Commit 6a473a6d authored by LeeJiancong's avatar LeeJiancong

'对接新增需求,对接需求发布-新增成功,完善新增需求发布列表'

parent 97156771
/*
* @Author: LeeJiancong
* @Date: 2020-07-30 17:23:48
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-30 17:24:49
*/
export default {
default: {
padding: '2px 5px',
background: 'rgba(244,245,247,1)',
borderRadius: '4px'
},
confirm: {
color: '#3F7ED2',
padding: '2px 5px',
background: 'rgba(240, 248, 255, 1)',
borderRadius: '4px'
},
success: {
color: '#00B37A',
padding: '2px 5px',
background: 'rgba(235,247,242,1)',
borderRadius: '4px'
},
warn: {
color: '#E63F3B',
padding: '2px 5px',
background: 'rgba(255,235,230,1)',
borderRadius: '4px'
}
}
\ No newline at end of file
import React, { Component,ReactNode } from 'react';
import {Badge} from 'antd'
export const interiorState = (text:any) => {
let component: ReactNode = null;
text === 1 ? component = <Badge status='default' text="待提交审核" />:
text === 2 ? component = <Badge status='processing' text="待审核" />:
text === 3 ? component = <Badge status='success' text="审核通过" />:
component = <Badge status='error' text="审核不通过" />
return component;
}
\ No newline at end of file
......@@ -34,7 +34,6 @@ import ReutrnEle from '@/components/ReturnEle'
import RroductModal from '../components/productModal'
import { PATTERN_MAPS } from '@/constants/regExp'
import {
GetProductCustomerGetCustomerCategoryTreeResponse,
GetManageAreaAllResponse
} from '@/services';
import { store } from '@/store'
......@@ -75,10 +74,10 @@ const Detail: React.FC<{}> = () => {
const [productSource, setproductSource] = useState([])//商品列表 新增
const [shipperAddressList, setshipperAddressList] = useState([])
const [CategoryTreeOne, setCategoryTreeOne] = useState([])
const [seletCategoryNameList, setseletCategoryNameList] = useState([])
const [provinceList, setProvinceList] = useState([])
const [showCategory, setShowCategory] = useState(null)
const [dialogVisible, setdialogVisible] = useState(false)
const [customerCategoryTree, setCustomerCategoryTree] = useState<GetProductCustomerGetCustomerCategoryTreeResponse>()
const [proviceOptions, setProviceOptions] = useState<GetManageAreaAllResponse>()
const [areaParams, setAreaParams] = useState<AreaParams>()
const [tabData, settabData] = useState<any>({})
......@@ -101,94 +100,97 @@ const Detail: React.FC<{}> = () => {
* @param {type}
* @return {type}
*/
const onCustomerCategoryChange = (value: any) => {
let seletCategoryId = value[1] || value[0]
const onCustomerCategoryChange = (value: any,options:any) => {
console.log(3112,value,options)
let seletCategoryId = value[value.length - 1 ]
setseletCategoryNameList(options)
console.log(seletCategoryId, 'seleellele')
// if (seletCategoryId) {
// PublicApi.getProductPlatformGetCategoryById({ id: seletCategoryId }).then(res => {
// if(res.code === 1000){
// let {data} = res
let data = [
{
id: '1',
name: '外观尺寸',
attributeList: [
{
id: '2',
type: 1,
name: '面料',
attributeValueList: [
{
id: 1,
value: '涤沦'
},
{
id: 2,
value: '面料'
}
]
},
{
id: '3',
type: 1,
name: '颜色',
attributeValueList: [
{
id: 1,
value: '红色'
},
{
id: 2,
value: '白色'
}
]
},
]
},
{
id: '5',
name: '工艺',
attributeList: [
{
id: '4',
type: 1,
name: '化学处理',
attributeValueList: [
{
id: 5,
value: '化学1'
},
{
id: 6,
value: '化学2'
}
]
},
{
id: '5',
type: 1,
name: '表皮处理',
attributeValueList: [
{
id: 1,
value: '表皮1'
},
{
id: 2,
value: '表皮2'
}
]
},
]
},
]
settabData(data)
PublicApi.getProductPlatformGetCategoryById({ id: seletCategoryId }).then(res => {
if(res.code === 1000){
let data = res.data
// let data = [
// {
// id: '1',
// name: '外观尺寸',
// attributeList: [
// {
// id: '2',
// type: 1,
// name: '面料',
// attributeValueList: [
// {
// id: 1,
// value: '涤沦'
// },
// {
// id: 2,
// value: '面料'
// }
// ]
// },
// {
// id: '3',
// type: 1,
// name: '颜色',
// attributeValueList: [
// {
// id: 1,
// value: '红色'
// },
// {
// id: 2,
// value: '白色'
// }
// ]
// },
// ]
// },
// {
// id: '5',
// name: '工艺',
// attributeList: [
// {
// id: '4',
// type: 1,
// name: '化学处理',
// attributeValueList: [
// {
// id: 5,
// value: '化学1'
// },
// {
// id: 6,
// value: '化学2'
// }
// ]
// },
// {
// id: '5',
// type: 1,
// name: '表皮处理',
// attributeValueList: [
// {
// id: 1,
// value: '表皮1'
// },
// {
// id: 2,
// value: '表皮2'
// }
// ]
// },
// ]
// },
// ]
settabData([data])//转成数组
let da = []
data.forEach((item: any) => {
if (item.attributeList) {
item.attributeList.forEach((v: any) => (
// data.forEach((item: any) => {
if (data.attributeList) {
data.attributeList.forEach((v: any) => (
da.push({
title: v.name,//表头
dataIndex: v.name,//字段值
......@@ -203,11 +205,11 @@ const Detail: React.FC<{}> = () => {
})
))
}
})
// })
setotherList([...da])
// }
// })
}
})
// }
// else
// setShowCategory(null)
......@@ -266,7 +268,7 @@ const Detail: React.FC<{}> = () => {
}
}
useEffect(() => {
PublicApi.getProductCustomerGetCustomerCategoryTree().then(res => {
PublicApi.getProductPlatformGetCategoryTree({rootNodeId:null}).then(res => {
if (res.code === 1000) {
let { data } = res
setCategoryTreeOne(data)
......@@ -354,15 +356,21 @@ const Detail: React.FC<{}> = () => {
const handleSubmitTabForm = () => {
tabForm.validateFields().then(values => {
console.log('valiue',values)
if(values.productCategory){
if(values.customerCategoryId && values.customerCategoryId.length > 0){
values['productCategory'] = {}
values.productCategory.id = values.productCategory
values.productCategory.id = values.customerCategoryId[0]
values.productCategory.key = values.customerCategoryId[0]
let NameList = seletCategoryNameList.map((v)=> {
return v.title
})
values.productCategory.name = NameList.join('-')
delete values.customerCategoryId
}
if(values.deliveryTime){
values.deliveryTime = moment(values.deliveryTime).format("YYYY-MM-DD")
values.deliveryTime = moment(values.deliveryTime).format("x")
}
if(values.quotationAsTime){
values.quotationAsTime = moment(values.quotationAsTime).format("YYYY-MM-DD HH:mm")
values.quotationAsTime = moment(values.quotationAsTime).format("x")
}
//省市
......@@ -376,7 +384,42 @@ const Detail: React.FC<{}> = () => {
}else{
values['defaultAddres']= 1
}
console.log('时间',values)
let productList = []
productSource.forEach((v) => {
let item:any = {}
item.brand = v.brand
item.model = v.model
item.purchaseNuit = v.purchaseNuit
item.purchaseQuantity = v.purchaseQuantity
let _otherList = []
Object.keys(v).forEach(child => {
otherList.forEach(j=> {
let otherItem:any = {}
if(child === j.title){
otherItem[child] = v[child]
_otherList.push(otherItem)
}
})
})
item.productAttributeJson = JSON.stringify([..._otherList])
productList.push(item)
console.log('item',item)
})
values['voucherTime'] = null
values['memberIds'] = []
values['demandDockings'] = []
values['requisitionFormProducts'] = [...productList]
console.log('productList',productList)
values['type'] = platType
console.log((JSON.stringify(values)))
PublicApi.postOrderRequisitionFormAdd(values).then(res => {
if(res.code === 1000){
history.goBack()
}
})
})
}
......@@ -477,7 +520,7 @@ const Detail: React.FC<{}> = () => {
<Cascader
options={CategoryTreeOne}
fieldNames={{ label: 'title', value: 'id', children: 'children' }}
onChange={onCustomerCategoryChange}
onChange={(value,selectedOptions) => onCustomerCategoryChange(value,selectedOptions)}
placeholder="请选择品类"
notFoundContent={<Spin size="small" />}
/>
......
import React, { ReactNode, useRef, useState } from 'react';
/*
* @Author: LeeJiancong
* @Date: 2020-08-24 11:39:11
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-08-31 19:49:09
*/
import React, { ReactNode, useRef, useState,useEffect } from 'react';
import { history } from 'umi';
import {
Button,
......@@ -7,7 +14,8 @@ import {
Row,
Col,
Dropdown,
Menu
Menu,
Popconfirm
} from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import {
......@@ -21,8 +29,11 @@ import {
} from 'god/dist/src/standard-table/TableController';
import EyePreview from '@/components/EyePreview';
import StatusSwitch from '@/components/StatusSwitch';
import {interiorState} from '../../common/tableStatusList'
import statuStyle from '../../common/colorTag'
import NiceForm from '@/components/NiceForm';
import {timeRange} from '@/utils/index'
import moment from 'moment'
import { createFormActions, FormEffectHooks } from '@formily/antd';
import {PageStatus} from '@/hooks/usePageStatus'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
......@@ -39,7 +50,12 @@ const fetchData = async (params: any) => {
const List:React.FC<{}> = () => {
const ref = useRef<any>({})
const [more, setmore] = useState(false)
const [selectedRowKeys, setselectedRowKeys] = useState<Array<string>>([])
const [selectRow, setSelectRow] = useState([])
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<number>>([])
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
const columns : ColumnType<any>[] = [
{
title:'需求单号',
......@@ -63,43 +79,112 @@ const List:React.FC<{}> = () => {
title:'交付日期',
key:'deliveryTime',
dataIndex:'deliveryTime',
align:'center'
align:'center',
render:(text:any)=> format(text)
},
{
title:'报价截至时间',
key:'quotationAsTime',
dataIndex:'quotationAsTime',
align:'center'
align:'center',
render:(text:any)=> format(text)
},
{
title:'单据时间',
key:'voucherTime',
dataIndex:'voucherTime',
align:'center'
align:'center',
render:(text:any)=> format(text)
},
{
title:'外部状态',
key:'externalState',
dataIndex:'externalState',
align:'center'
align:'center',
render: (text: any, reconds) => {
let component: ReactNode = null
if (text == 3) {
component = <><span style={statuStyle.warn}>审核不通过需求单</span></>
}else if (text == 1) {
component = <><span style={statuStyle.default}>待提交需求单</span></>
}
return component
}
},
{
title:'内部状态',
key:'interiorState',
dataIndex:'interiorState',
align:'center'
align:'center',
render:(text:any) => interiorState(text)
},
{
title:'操作',
key:'options',
dataIndex:'options',
align:'center',
render:(text:any,record:any) => <></>
render: (_: any, record: any) => {
return (
<>
{
(record.interiorState !== 3 &&
<Button type="link" onClick={() => toEdit(record.id)}>编辑</Button>
)
}
{
(record.externalState === 1 && record.interiorState === 1) &&
<>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={() => handleDelete([record.id])}>
<Button type='link'>
删除
</Button>
</Popconfirm>
<Popconfirm title="确定要提交吗?" okText="是" cancelText="否" onConfirm={() => handleSubmit(record.id)}>
<Button type='link'>提交</Button>
</Popconfirm>
</>
}
</>
)
}
},
]
useEffect(()=> {
},[])
const toEdit = (id:number | string) => {
history.push(`/memberCenter/tranactionAbility/enquirySubmit/addEnquiry?id=${id}`)
}
/**
* @description: 删除
* @param {type}
* @return {type}
*/
const handleDelete = (arr:number[]| string[]) => {
PublicApi.postOrderRequisitionFormDeleteAll({ ids: arr }).then(res => {
ref.current.reload()
})
}
//批量提交
const handleSubmitAll = (ids: number[]) => {
PublicApi.postOrderSubmitRequisitionFormAll({ ids: ids }).then(res => {
ref.current.reload()
})
}
//提交审核
const handleSubmit = (id) => {
PublicApi.postOrderNewRequisitionFormAudit({ id: id }).then(res => {
ref.current.reload()
})
}
const handleSumbit = (values:any) => {
if(values.voucherTime){
values.startVoucherTime = timeRange(values.voucherTime).st
......@@ -110,7 +195,7 @@ const List:React.FC<{}> = () => {
ref.current.reload(values)
}
const menu = (
<Menu onClick={e => handleBatchDel(e)}>
<Menu onClick={() => handleDelete(selectedRowKeys)}>
<Menu.Item key='1' icon={<DeleteOutlined/>}>
批量删除
</Menu.Item>
......@@ -121,13 +206,17 @@ const List:React.FC<{}> = () => {
}
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {},
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
},
}
const controllerBtns = <Row>
<Col span={24}>
<Space direction="horizontal" size={16}>
<Button type="primary" onClick={() => history.push('/memberCenter/tranactionAbility/enquirySubmit/addEnquiry')} icon={<PlusOutlined/>}>新建</Button>
<Button >批量提交审核</Button>
<Button onClick={() => handleSubmitAll(selectedRowKeys)}>批量提交审核</Button>
<Dropdown.Button
overlay={menu}
trigger={['click']}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment