Commit 979708ac714a0173feebcaccfcbb5a096ab0b03b
1 parent
46a71dbe
feat: update
Showing
1 changed file
with
50 additions
and
34 deletions
src/pages/Order/components/OrderDrawer.tsx
... | ... | @@ -37,6 +37,39 @@ import { |
37 | 37 | export default ({ onClose, data, subOrders, orderOptType }) => { |
38 | 38 | const [invoicingStatus, setInvoicingStatus] = useState(''); |
39 | 39 | const [salesCodeOptions, setSalesCodeOptions] = useState([]); |
40 | + const [form] = Form.useForm<{ | |
41 | + salesCode: ''; | |
42 | + customerName: ''; | |
43 | + customerContactNumber: ''; | |
44 | + institution: ''; | |
45 | + institutionContactName: ''; | |
46 | + customerShippingAddress: ''; | |
47 | + totalPayment: ''; | |
48 | + paymentChannel: ''; | |
49 | + paymentMethod: ''; | |
50 | + productBelongBusiness: ''; | |
51 | + invoicingStatus: ''; | |
52 | + invoiceIdentificationNumber: ''; | |
53 | + invoicingTime: ''; | |
54 | + bank: ''; | |
55 | + bankAccountNumber: ''; | |
56 | + deleteSubOrderLists: []; | |
57 | + notes: ''; | |
58 | + list: [ | |
59 | + { | |
60 | + productCode: ''; | |
61 | + productName: ''; | |
62 | + quantity: ''; | |
63 | + productPrice: ''; | |
64 | + parameters: ''; | |
65 | + subOrderPayment: ''; | |
66 | + unit: ''; | |
67 | + serialNumber: ''; | |
68 | + notes: ''; | |
69 | + }, | |
70 | + ]; | |
71 | + }>(); | |
72 | + | |
40 | 73 | let originSubOrders = cloneDeep(subOrders); |
41 | 74 | /** |
42 | 75 | * 获取当前的操作类型boolean值 |
... | ... | @@ -60,11 +93,26 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
60 | 93 | const fileList: any = []; |
61 | 94 | |
62 | 95 | const getSalesCodeOptions = async () => { |
63 | - const { data } = await postServiceOrderQuerySalesCode(); | |
64 | - let options = data?.map((item) => { | |
96 | + const res = await postServiceOrderQuerySalesCode(); | |
97 | + let options = res.data?.map((item) => { | |
65 | 98 | return { label: item.userName, value: item.userName }; |
66 | 99 | }); |
67 | 100 | setSalesCodeOptions(options); |
101 | + | |
102 | + if (optType('copy') || optType('edit')) { | |
103 | + let includeFlag = false; | |
104 | + //销售代码校验,如果是旧的销售代码,则提示并清空 | |
105 | + for (let option of options) { | |
106 | + if (option.value === data.salesCode) { | |
107 | + includeFlag = true; | |
108 | + } | |
109 | + } | |
110 | + console.log(includeFlag); | |
111 | + if (!includeFlag) { | |
112 | + form.resetFields(['salesCode']); | |
113 | + message.warning('检测到销售代码为旧的,已清空,请重新选择'); | |
114 | + } | |
115 | + } | |
68 | 116 | }; |
69 | 117 | |
70 | 118 | useEffect(() => { |
... | ... | @@ -117,38 +165,6 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
117 | 165 | if (subOrders !== undefined && subOrders.length > 0) { |
118 | 166 | data.list = subOrders; |
119 | 167 | } |
120 | - const [form] = Form.useForm<{ | |
121 | - salesCode: ''; | |
122 | - customerName: ''; | |
123 | - customerContactNumber: ''; | |
124 | - institution: ''; | |
125 | - institutionContactName: ''; | |
126 | - customerShippingAddress: ''; | |
127 | - totalPayment: ''; | |
128 | - paymentChannel: ''; | |
129 | - paymentMethod: ''; | |
130 | - productBelongBusiness: ''; | |
131 | - invoicingStatus: ''; | |
132 | - invoiceIdentificationNumber: ''; | |
133 | - invoicingTime: ''; | |
134 | - bank: ''; | |
135 | - bankAccountNumber: ''; | |
136 | - deleteSubOrderLists: []; | |
137 | - notes: ''; | |
138 | - list: [ | |
139 | - { | |
140 | - productCode: ''; | |
141 | - productName: ''; | |
142 | - quantity: ''; | |
143 | - productPrice: ''; | |
144 | - parameters: ''; | |
145 | - subOrderPayment: ''; | |
146 | - unit: ''; | |
147 | - serialNumber: ''; | |
148 | - notes: ''; | |
149 | - }, | |
150 | - ]; | |
151 | - }>(); | |
152 | 168 | |
153 | 169 | const actionRef = useRef< |
154 | 170 | FormListActionType<{ | ... | ... |