Commit 68a7b01c authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

新增需求发布新需求完成接口接入

parent c76f2f18
...@@ -43,6 +43,13 @@ export default [ ...@@ -43,6 +43,13 @@ export default [
}, },
// 待新增需求单-编辑 // 待新增需求单-编辑
{ {
path: '/memberCenter/tranactionAbility/enquirySubmit/addDemandOrder/edit',
name: 'editEnquiry',
component: '@/pages/transaction/enquirySubmit/addDemandOrder',
hideInMenu: true,
},
// 待新增需求单-编辑
{
path: '/memberCenter/tranactionAbility/enquirySubmit/toAddSubmitList/edit', path: '/memberCenter/tranactionAbility/enquirySubmit/toAddSubmitList/edit',
name: 'editEnquiry', name: 'editEnquiry',
component: '@/pages/transaction/enquirySubmit/toAddSubmit/detail', component: '@/pages/transaction/enquirySubmit/toAddSubmit/detail',
......
...@@ -4,6 +4,7 @@ import { ColumnType } from 'antd/lib/table/interface'; ...@@ -4,6 +4,7 @@ import { ColumnType } from 'antd/lib/table/interface';
import ModalAnchor from './Modal/modalAnchor'; import ModalAnchor from './Modal/modalAnchor';
import ModalGoods from './Modal/modalGoods'; import ModalGoods from './Modal/modalGoods';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
const layout: any = { const layout: any = {
...@@ -134,12 +135,27 @@ const AddGoods: React.FC<faceSetData> = (props) => { ...@@ -134,12 +135,27 @@ const AddGoods: React.FC<faceSetData> = (props) => {
} }
}, [tabledata]) }, [tabledata])
useEffect(() => {
/**编辑回显数据 */
if(Object.keys(set).length > 0) {
form.setFieldsValue({
type: set.type
})
PublicApi.getOrderRequisitionFormProductDetails({id: set.id}).then(res => {
if(res.code === 1000) {
setType(set.type)
settabledata([res])
}
})
}
}, [set])
return ( return (
<Form <Form
{...layout} {...layout}
form={form} form={form}
> >
<Form.Item label='添加方式' rules={[{ required: true, message: '请选择添加方式' }]}> <Form.Item label='添加方式' name='type' rules={[{ required: true, message: '请选择添加方式' }]}>
<Radio.Group onChange={changeRadio}> <Radio.Group onChange={changeRadio}>
<Radio value={1}>通过平台属性添加</Radio> <Radio value={1}>通过平台属性添加</Radio>
<Radio value={2}>选择货品添加</Radio> <Radio value={2}>选择货品添加</Radio>
......
...@@ -41,7 +41,7 @@ const BasicInfo: React.FC<faceSetData> = (props) => { ...@@ -41,7 +41,7 @@ const BasicInfo: React.FC<faceSetData> = (props) => {
}) })
} }
// 选择下拉得内容 // 选择下拉得内容
const handProvince = (val: any, idx: number, num: number) => { const handProvince = async (val: any, idx: number, num: number) => {
const result = [...requisitionFormAddress]; const result = [...requisitionFormAddress];
const cityCode: Array<any> = [] const cityCode: Array<any> = []
result.forEach((item: any) => { result.forEach((item: any) => {
...@@ -51,7 +51,7 @@ const BasicInfo: React.FC<faceSetData> = (props) => { ...@@ -51,7 +51,7 @@ const BasicInfo: React.FC<faceSetData> = (props) => {
}) })
setcode([...cityCode]); setcode([...cityCode]);
if (num === 1) { if (num === 1) {
province.forEach(item => { await province.forEach(item => {
if (item.code === val) { if (item.code === val) {
PublicApi.getManageAreaByPcodeAll({ pcode: val }).then((res: any) => { PublicApi.getManageAreaByPcodeAll({ pcode: val }).then((res: any) => {
if (res.code === 1000) { if (res.code === 1000) {
...@@ -63,7 +63,7 @@ const BasicInfo: React.FC<faceSetData> = (props) => { ...@@ -63,7 +63,7 @@ const BasicInfo: React.FC<faceSetData> = (props) => {
}) })
} }
}) })
} else { } else {
city.forEach(item => { city.forEach(item => {
item.citydata.forEach(items => { item.citydata.forEach(items => {
...@@ -139,6 +139,30 @@ const BasicInfo: React.FC<faceSetData> = (props) => { ...@@ -139,6 +139,30 @@ const BasicInfo: React.FC<faceSetData> = (props) => {
}, []) }, [])
useEffect(() => { useEffect(() => {
/**编辑回显数据 */
if (Object.keys(set).length > 0) {
setrequisitionFormAddress([...set.requisitionFormAddress])
set.requisitionFormAddress.forEach((item: any, index: number) => {
PublicApi.getManageAreaByPcodeAll({ pcode: item.provinceCode }).then((res: any) => {
if (res.code === 1000) {
city[index] = { citydata: res.data }
Promise.resolve().then(() => {
setTimeout(() => {
setcity([...city])
form.setFieldsValue({
details: set.details,
['province_' + index]: item.provinceCode,
['city_' + index]: item.cityCode,
});
}, 350);
});
}
})
})
}
}, [set])
useEffect(() => {
currentRef.current = { currentRef.current = {
get: () => new Promise((resolve: any) => { get: () => new Promise((resolve: any) => {
form.validateFields().then(res => { form.validateFields().then(res => {
...@@ -231,27 +255,27 @@ const BasicInfo: React.FC<faceSetData> = (props) => { ...@@ -231,27 +255,27 @@ const BasicInfo: React.FC<faceSetData> = (props) => {
<Form.Item <Form.Item
label='需求单号' label='需求单号'
> >
<span>SPTY12</span> <span>{set.requisitionFormNo && set.requisitionFormNo}</span>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='会员名称' label='会员名称'
> >
<span>温州龙昌手袋有限公司</span> <span>{set.memberName && set.memberName}</span>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='单据时间' label='单据时间'
> >
<span>2020-08-20 12:56:25</span> <span>{set.voucherTime && set.voucherTime}</span>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='外部状态' label='外部状态'
> >
<span>待提交需求单</span> <span>{set.externalState && set.externalState}</span>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='部状态' label='部状态'
> >
<span>待提交审核</span> <span>{set.interiorState && set.interiorState}</span>
</Form.Item> </Form.Item>
</Form> </Form>
) )
......
...@@ -148,9 +148,11 @@ const DemandDbutted: React.FC<faceSetData> = (props) => { ...@@ -148,9 +148,11 @@ const DemandDbutted: React.FC<faceSetData> = (props) => {
shopId === 3 && shopId === 3 &&
// 指定会员 // 指定会员
<Form.Item noStyle> <Form.Item noStyle>
<Button type='dashed' block style={{ marginBottom: '24px' }}><PlusOutlined />选择会员</Button> {/* <Button type='dashed' block style={{ marginBottom: '24px' }}><PlusOutlined />选择会员</Button> */}
<Table <StandardTable
rowSelection={rowSelection}
columns={memberColumns} columns={memberColumns}
// fetchTableData={(params) => fetchSystemMateData(params)}
/> />
</Form.Item> </Form.Item>
} }
......
import React, { useState } from 'react'; import React, { useState, useEffect } from 'react';
import styles from './index.less'; import styles from './index.less';
import { Radio } from 'antd'; import { Radio } from 'antd';
import PolymericTable from '@/components/PolymericTable'; import PolymericTable from '@/components/PolymericTable';
...@@ -18,6 +18,7 @@ const FlowRecord: React.FC<faceSetData> = (props) => { ...@@ -18,6 +18,7 @@ const FlowRecord: React.FC<faceSetData> = (props) => {
const outerColumns: EditableColumns[] = [{ const outerColumns: EditableColumns[] = [{
title: '序号', title: '序号',
dataIndex: 'inquiryListId', dataIndex: 'inquiryListId',
render: (texr: any, record: any, index: number) => <span>{index + 1}</span>
}, { }, {
title: '操作角色', title: '操作角色',
dataIndex: 'roleName', dataIndex: 'roleName',
...@@ -26,7 +27,7 @@ const FlowRecord: React.FC<faceSetData> = (props) => { ...@@ -26,7 +27,7 @@ const FlowRecord: React.FC<faceSetData> = (props) => {
dataIndex: 'state', dataIndex: 'state',
}, { }, {
title: '操作', title: '操作',
dataIndex: 'operation', dataIndex: 'operationalProcess',
}, { }, {
title: '操作时间', title: '操作时间',
dataIndex: 'operationTime', dataIndex: 'operationTime',
...@@ -38,6 +39,7 @@ const FlowRecord: React.FC<faceSetData> = (props) => { ...@@ -38,6 +39,7 @@ const FlowRecord: React.FC<faceSetData> = (props) => {
const insideColumns: EditableColumns[] = [{ const insideColumns: EditableColumns[] = [{
title: '序号', title: '序号',
dataIndex: 'inquiryListId', dataIndex: 'inquiryListId',
render: (texr: any, record: any, index: number) => <span>{index + 1}</span>
}, { }, {
title: '操作人', title: '操作人',
dataIndex: 'roleName', dataIndex: 'roleName',
...@@ -52,7 +54,7 @@ const FlowRecord: React.FC<faceSetData> = (props) => { ...@@ -52,7 +54,7 @@ const FlowRecord: React.FC<faceSetData> = (props) => {
dataIndex: 'state', dataIndex: 'state',
}, { }, {
title: '操作', title: '操作',
dataIndex: 'operation', dataIndex: 'operationalProcess',
}, { }, {
title: '操作时间', title: '操作时间',
dataIndex: 'operationTime', dataIndex: 'operationTime',
...@@ -64,6 +66,7 @@ const FlowRecord: React.FC<faceSetData> = (props) => { ...@@ -64,6 +66,7 @@ const FlowRecord: React.FC<faceSetData> = (props) => {
const onChange = (e: any) => { const onChange = (e: any) => {
setRadio(e.target.value) setRadio(e.target.value)
} }
return ( return (
<div> <div>
<Radio.Group defaultValue="outer" buttonStyle="solid" onChange={onChange}> <Radio.Group defaultValue="outer" buttonStyle="solid" onChange={onChange}>
...@@ -75,12 +78,14 @@ const FlowRecord: React.FC<faceSetData> = (props) => { ...@@ -75,12 +78,14 @@ const FlowRecord: React.FC<faceSetData> = (props) => {
columns={outerColumns} columns={outerColumns}
loading={false} loading={false}
pagination={null} pagination={null}
dataSource={Object.keys(set).length > 0 && set.externalRequisitionFormStateResponses}
/> />
: :
<PolymericTable <PolymericTable
columns={insideColumns} columns={insideColumns}
loading={false} loading={false}
pagination={null} pagination={null}
dataSource={Object.keys(set).length > 0 && set.interiorRequisitionFormStateResponses}
/> />
} }
</div> </div>
......
...@@ -64,6 +64,23 @@ const TradingConditions: React.FC<faceSetData> = (props) => { ...@@ -64,6 +64,23 @@ const TradingConditions: React.FC<faceSetData> = (props) => {
setselectAddress(option) setselectAddress(option)
} }
useEffect(() => {
if(Object.keys(set).length > 0) {
TradingConditionsForm.setFieldsValue({
deliveryTime: moment(set.deliveryTime),
addresId: set.addresId,
quotationAsTime: moment(set.quotationAsTime),
offer: set.offer,
paymentType: set.paymentType,
taxes: set.taxes,
logistics: set.logistics,
packRequire: set.packRequire,
otherRequire: set.otherRequire
})
setselectAddress({children: set.addres});
}
}, [set])
return ( return (
<Form <Form
{...layout} {...layout}
...@@ -85,9 +102,6 @@ const TradingConditions: React.FC<faceSetData> = (props) => { ...@@ -85,9 +102,6 @@ const TradingConditions: React.FC<faceSetData> = (props) => {
))} ))}
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item hidden label='交付地址' name='addres'>
<Input value={selectAddress.children} />
</Form.Item>
<Form.Item label='报价截止时间' name='quotationAsTime' rules={[{ required: true, message: '请选择报价截止时间' }]}> <Form.Item label='报价截止时间' name='quotationAsTime' rules={[{ required: true, message: '请选择报价截止时间' }]}>
<DatePicker <DatePicker
style={{ width: '100%' }} style={{ width: '100%' }}
......
import React, { useState, useRef } from 'react'; import React, { useState, useRef, useEffect } from 'react';
import { history } from 'umi'; import { history } from 'umi';
import ReutrnEle from '@/components/ReturnEle' import ReutrnEle from '@/components/ReturnEle'
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
...@@ -8,11 +8,12 @@ import TradingConditions from './components/tradingConditions' ...@@ -8,11 +8,12 @@ import TradingConditions from './components/tradingConditions'
import FlowRecord from './components/flowRecord'; import FlowRecord from './components/flowRecord';
import AddGoods from './components/addGoods'; import AddGoods from './components/addGoods';
import DemandDbutted from './components/demandDbutted'; import DemandDbutted from './components/demandDbutted';
import { setUpdata } from './data'; /**set数据给子组件 */ import { PublicApi } from '@/services/api';
const { TabPane } = Tabs; const { TabPane } = Tabs;
const AddDemandOrder: React.FC<{}> = () => { const AddDemandOrder: React.FC<{}> = () => {
const [fetchdata, setfetchdata] = useState<any>(setUpdata); const { id } = history.location.query;
const [fetchdata, setfetchdata] = useState<any>({});
const basic = useRef<any>(); const basic = useRef<any>();
const goods = useRef<any>(); const goods = useRef<any>();
const trading = useRef<any>(); const trading = useRef<any>();
...@@ -27,17 +28,58 @@ const AddDemandOrder: React.FC<{}> = () => { ...@@ -27,17 +28,58 @@ const AddDemandOrder: React.FC<{}> = () => {
const data = { const data = {
...basicRef.data, ...basicRef.data,
...tradingRef.data, ...tradingRef.data,
...goodsRef.data ...goodsRef.data,
type: 1,
shopIds: [1]
} }
console.log(data) if (basicRef.data.requisitionFormAddress.length > 0) {
} else { data.defaultAddres = 0
} else {
data.defaultAddres = 1
}
if(id) {
data.id = fetchdata.id;
PublicApi.postOrderRequisitionFormUpdate(data).then(res => {
if (res.code === 1000) {
history.goBack()
}
})
} else {
PublicApi.postOrderRequisitionFormAdd(data).then(res => {
if (res.code === 1000) {
history.goBack()
}
})
}
}
}
useEffect(() => {
if (id) {
new Promise(resolve => {
PublicApi.getOrderRequisitionFormDetails({ id, current: '1', pageSize: '10' }).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
}).then((res:any) => {
// let obj: any = {}
// for (let key in fetchdata) {
// for (let keys in res) {
// if (key === keys) {
// obj = {
// ...obj, ...{
// [keys]: res[keys]
// }
// }
// }
// }
// }
setfetchdata(res)
})
} }
} }, [id])
/**获取商品的属性 */
const getAttribute = (data:any) => {
console.log(data, 10086)
}
return ( return (
<PageHeaderWrapper <PageHeaderWrapper
onBack={() => history.goBack()} onBack={() => history.goBack()}
...@@ -57,7 +99,6 @@ const AddDemandOrder: React.FC<{}> = () => { ...@@ -57,7 +99,6 @@ const AddDemandOrder: React.FC<{}> = () => {
<TabPane forceRender tab='添加商品' key='2'> <TabPane forceRender tab='添加商品' key='2'>
<AddGoods <AddGoods
set={fetchdata} set={fetchdata}
get={getAttribute}
currentRef={goods} currentRef={goods}
/> />
</TabPane> </TabPane>
......
...@@ -158,7 +158,7 @@ const List: React.FC<{}> = () => { ...@@ -158,7 +158,7 @@ const List: React.FC<{}> = () => {
}, []) }, [])
const toEdit = (id: number | string) => { const toEdit = (id: number | string) => {
history.push(`/memberCenter/tranactionAbility/enquirySubmit/toAddSubmitList/edit?id=${id}`) history.push(`/memberCenter/tranactionAbility/enquirySubmit/addDemandOrder/edit?id=${id}`)
} }
/** /**
* @description: 删除 * @description: 删除
...@@ -223,7 +223,7 @@ const List: React.FC<{}> = () => { ...@@ -223,7 +223,7 @@ const List: React.FC<{}> = () => {
const controllerBtns = <Row> const controllerBtns = <Row>
<Col span={24}> <Col span={24}>
<Space direction="horizontal" size={16}> <Space direction="horizontal" size={16}>
<Button type="primary" onClick={() => history.push('/memberCenter/tranactionAbility/enquirySubmit/toAddSubmitList/add')} icon={<PlusOutlined />}>新建</Button> <Button type="primary" onClick={() => history.push('/memberCenter/tranactionAbility/enquirySubmit/addDemandOrder/add')} icon={<PlusOutlined />}>新建</Button>
<Button onClick={() => handleSubmitAll(selectedRowKeys)}>批量提交审核</Button> <Button onClick={() => handleSubmitAll(selectedRowKeys)}>批量提交审核</Button>
<Dropdown.Button <Dropdown.Button
overlay={menu} overlay={menu}
...@@ -238,28 +238,28 @@ const List: React.FC<{}> = () => { ...@@ -238,28 +238,28 @@ const List: React.FC<{}> = () => {
const [externalState, setExternalState] = useState<any>([]); const [externalState, setExternalState] = useState<any>([]);
const [interiorState, setInteriorState] = useState<any>([]); const [interiorState, setInteriorState] = useState<any>([]);
useEffect(() => { // useEffect(() => {
const external = new Promise(resolve => { // const external = new Promise(resolve => {
//查询需求单外部状态枚举列表 // //查询需求单外部状态枚举列表
PublicApi.getOrderRequisitionFormExternalStateEnum().then((res: any) => { // PublicApi.getOrderRequisitionFormExternalStateEnum().then((res: any) => {
if (res.code === 1000) { // if (res.code === 1000) {
resolve(res.data) // resolve(res.data)
} // }
}) // })
}) // })
const interior = new Promise(resolve => { // const interior = new Promise(resolve => {
// 查询需求单内部状态枚举列表 // // 查询需求单内部状态枚举列表
PublicApi.getOrderRequisitionFormInteriorStateEnum().then((res: any) => { // PublicApi.getOrderRequisitionFormInteriorStateEnum().then((res: any) => {
if (res.code === 1000) { // if (res.code === 1000) {
resolve(res.data) // resolve(res.data)
} // }
}) // })
}) // })
Promise.all([external, interior]).then(res => { // Promise.all([external, interior]).then(res => {
setExternalState(res[0]) // setExternalState(res[0])
setInteriorState(res[1]) // setInteriorState(res[1])
}) // })
}, []) // }, [])
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
......
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