Commit 5afa2257635ad0d86be1cb769c42e00e056df279
Merge remote-tracking branch 'origin/baobiao'
# Conflicts: # src/pages/Order/OrderList/OrderDrawer.tsx
Showing
6 changed files
with
374 additions
and
11447 deletions
order-erp.service-1.0-SNAPSHOT.jar deleted
100644 → 0
No preview for this file type
src/pages/Order/Order/components/OrderDrawer copy.tsx deleted
100644 → 0
1 | -import { RESPONSE_CODE } from '@/constants/enum'; | ||
2 | -import { | ||
3 | - postKingdeeRepCustomer, | ||
4 | - postKingdeeRepCustomerDetail, | ||
5 | - postKingdeeRepMaterial, | ||
6 | - postKingdeeRepMaterialUnit, | ||
7 | - postKingdeeRepMeasureUnit, | ||
8 | - postServiceOrderAddOrder, | ||
9 | - postServiceOrderQuerySalesCode, | ||
10 | - postServiceOrderUpdateOrder, | ||
11 | -} from '@/services'; | ||
12 | -import { | ||
13 | - FloatAdd, | ||
14 | - enumToSelect, | ||
15 | - getAliYunOSSFileNameFromUrl, | ||
16 | - getUserInfo, | ||
17 | -} from '@/utils'; | ||
18 | -import { getTeacherCustomFieldNumber } from '@/utils/kingdee'; | ||
19 | -import { | ||
20 | - DrawerForm, | ||
21 | - FormListActionType, | ||
22 | - ProCard, | ||
23 | - ProFormDateTimePicker, | ||
24 | - ProFormDigit, | ||
25 | - ProFormList, | ||
26 | - ProFormSelect, | ||
27 | - ProFormText, | ||
28 | - ProFormTextArea, | ||
29 | - ProFormUploadDragger, | ||
30 | -} from '@ant-design/pro-components'; | ||
31 | -import { Button, Form, message } from 'antd'; | ||
32 | -import { cloneDeep } from 'lodash'; | ||
33 | -import { useEffect, useRef, useState } from 'react'; | ||
34 | -import { | ||
35 | - INVOCING_STATUS_OPTIONS, | ||
36 | - INVOCING_STATUS_OPTIONS_OLD, | ||
37 | - PAYMENT_CHANNEL_OPTIONS, | ||
38 | - PAYMENT_METHOD_OPTIONS, | ||
39 | - PRODUCT_BELONG_DEPARTMENT_OPTIONS, | ||
40 | -} from '../../constant'; | ||
41 | -import KingdeeCustomerModal from './KingdeeCustomerModal'; | ||
42 | - | ||
43 | -export default ({ onClose, data, subOrders, orderOptType }) => { | ||
44 | - const [invoicingStatus, setInvoicingStatus] = useState(''); | ||
45 | - const [salesCodeOptions, setSalesCodeOptions] = useState([]); | ||
46 | - const [customer, setCustomer] = useState({}); | ||
47 | - const [kingdeeCstomerModalVisible, setKingdeeCstomerModalVisible] = | ||
48 | - useState(false); | ||
49 | - const [ | ||
50 | - productParametersDisabledFlagList, | ||
51 | - setProductParametersDisabledFlagList, | ||
52 | - ] = useState([]); | ||
53 | - // const [productInvStockOptionsList, setProductInvStockOptionsList] = useState( | ||
54 | - // [], | ||
55 | - // ); //商品的仓库选项 | ||
56 | - const [productUnitOptionsList, setProductUnitOptionsList] = useState([]); //商品的单位选项 | ||
57 | - const [productCustomerContactOptions, setProductCustomerContactOptions] = | ||
58 | - useState([]); //客户的收货人选项 | ||
59 | - const [form] = Form.useForm<{ | ||
60 | - salesCode: ''; | ||
61 | - customerName: ''; | ||
62 | - customerContactNumber: ''; | ||
63 | - institution: ''; | ||
64 | - institutionContactName: ''; | ||
65 | - customerShippingAddress: ''; | ||
66 | - totalPayment: ''; | ||
67 | - paymentChannel: ''; | ||
68 | - paymentMethod: ''; | ||
69 | - productBelongBusiness: ''; | ||
70 | - invoicingStatus: ''; | ||
71 | - invoiceIdentificationNumber: ''; | ||
72 | - invoicingTime: ''; | ||
73 | - bank: ''; | ||
74 | - bankAccountNumber: ''; | ||
75 | - deleteSubOrderLists: []; | ||
76 | - notes: ''; | ||
77 | - list: [ | ||
78 | - { | ||
79 | - productCode: ''; | ||
80 | - productName: ''; | ||
81 | - quantity: ''; | ||
82 | - productPrice: ''; | ||
83 | - parameters: ''; | ||
84 | - subOrderPayment: ''; | ||
85 | - unit: ''; | ||
86 | - serialNumber: ''; | ||
87 | - notes: ''; | ||
88 | - }, | ||
89 | - ]; | ||
90 | - }>(); | ||
91 | - | ||
92 | - let originSubOrders = cloneDeep(subOrders); | ||
93 | - /** | ||
94 | - * 获取当前的操作类型boolean值 | ||
95 | - * @param type 操作类型,如果与当前匹配返回true | ||
96 | - */ | ||
97 | - function optType(type: string) { | ||
98 | - return orderOptType === type; | ||
99 | - } | ||
100 | - | ||
101 | - /** | ||
102 | - * | ||
103 | - * @returns 获取开票选项 | ||
104 | - */ | ||
105 | - function getInvoicingSelect() { | ||
106 | - if (optType('edit')) { | ||
107 | - return enumToSelect(INVOCING_STATUS_OPTIONS_OLD); | ||
108 | - } | ||
109 | - return enumToSelect(INVOCING_STATUS_OPTIONS); | ||
110 | - } | ||
111 | - | ||
112 | - const fileList: any = []; | ||
113 | - | ||
114 | - const getSalesCodeOptions = async () => { | ||
115 | - const res = await postServiceOrderQuerySalesCode(); | ||
116 | - let options = res.data?.map((item) => { | ||
117 | - return { | ||
118 | - label: item.userName, | ||
119 | - value: item.userName, | ||
120 | - number: item.number, | ||
121 | - }; | ||
122 | - }); | ||
123 | - setSalesCodeOptions(options); | ||
124 | - | ||
125 | - if (optType('copy') || optType('edit')) { | ||
126 | - let includeFlag = false; | ||
127 | - //销售代码校验,如果是旧的销售代码,则提示并清空 | ||
128 | - for (let option of options) { | ||
129 | - if (option.value === data.salesCode) { | ||
130 | - includeFlag = true; | ||
131 | - } | ||
132 | - } | ||
133 | - if (!includeFlag) { | ||
134 | - form.resetFields(['salesCode']); | ||
135 | - message.warning('检测到销售代码为旧的,已清空,请重新选择'); | ||
136 | - } | ||
137 | - } | ||
138 | - }; | ||
139 | - | ||
140 | - //复制的时候,如果是不需要开票,要把开票信息清空 | ||
141 | - if (optType('copy') && data.invoicingStatus === 'UN_INVOICE') { | ||
142 | - data.invoiceIdentificationNumber = undefined; | ||
143 | - } | ||
144 | - | ||
145 | - if (subOrders !== undefined && subOrders.length > 0) { | ||
146 | - data.list = subOrders; | ||
147 | - } | ||
148 | - | ||
149 | - const actionRef = useRef< | ||
150 | - FormListActionType<{ | ||
151 | - name: string; | ||
152 | - }> | ||
153 | - >(); | ||
154 | - | ||
155 | - useEffect(() => { | ||
156 | - form.setFieldsValue({ ...data }); | ||
157 | - //如果是新建,需要清空list | ||
158 | - if (optType('add')) { | ||
159 | - form.resetFields(['list']); | ||
160 | - } | ||
161 | - }, [data]); | ||
162 | - | ||
163 | - /** | ||
164 | - * 选择客户后自动为收货人Select添加选项,填充课题组和单位信息 | ||
165 | - * @param option 客户选项 | ||
166 | - */ | ||
167 | - async function autoFillCustomerContactSelectOptions(customerId: any) { | ||
168 | - //查询单位详细信息 | ||
169 | - let res = await postKingdeeRepCustomerDetail({ | ||
170 | - data: { | ||
171 | - id: customerId, | ||
172 | - }, | ||
173 | - }); | ||
174 | - | ||
175 | - //erp客户名称 | ||
176 | - form.setFieldValue('erpCustomerName', res?.name); | ||
177 | - | ||
178 | - //重新设置当前option | ||
179 | - form.setFieldValue('erpCustomerId', { | ||
180 | - label: res?.name, | ||
181 | - value: res?.id, | ||
182 | - id: res?.id, | ||
183 | - }); | ||
184 | - | ||
185 | - //查询客户自定义字段,课题组 | ||
186 | - let entity_number = await getTeacherCustomFieldNumber(); | ||
187 | - | ||
188 | - //在单位详细信息中拿到自定义字段的值 | ||
189 | - let customField = res?.custom_field; | ||
190 | - if (customField) { | ||
191 | - let teacherName = customField[entity_number]; | ||
192 | - //填充到课题组老师表单字段中 | ||
193 | - form.setFieldValue('institutionContactName', teacherName); | ||
194 | - } | ||
195 | - | ||
196 | - //单位名称,从客户名称中获取,客户名称规则<单位名称>-<联系人名称和电话> | ||
197 | - let namePortions = res?.name?.split('-'); | ||
198 | - if (namePortions && namePortions.length >= 2) { | ||
199 | - form.setFieldValue('institution', namePortions[0]); | ||
200 | - } | ||
201 | - | ||
202 | - //如果原来的收货信息没有包含在这次查询出来的收货人选项中,那么清除原来的收货人信息 | ||
203 | - let existFlag = false; | ||
204 | - | ||
205 | - //填充收货人选项 | ||
206 | - let newProductCustomerContactOptions = res?.bomentity?.map((item) => { | ||
207 | - let address = | ||
208 | - item.contact_person + ',' + item.mobile + ',' + item.contact_address; | ||
209 | - if (address === data.contactAddress) { | ||
210 | - existFlag = true; | ||
211 | - } | ||
212 | - return { ...item, label: address, value: address }; | ||
213 | - }); | ||
214 | - | ||
215 | - setProductCustomerContactOptions(newProductCustomerContactOptions); | ||
216 | - | ||
217 | - if (!existFlag) { | ||
218 | - //清空原来的收货人信息 | ||
219 | - form.setFieldValue('customerShippingAddress', undefined); | ||
220 | - form.setFieldValue('customerContactNumber', undefined); | ||
221 | - form.setFieldValue('customerName', undefined); | ||
222 | - form.setFieldValue('erpCustomerAddress', undefined); | ||
223 | - } | ||
224 | - } | ||
225 | - | ||
226 | - /** | ||
227 | - * 回显金蝶信息 | ||
228 | - */ | ||
229 | - async function showKindeeInfo() { | ||
230 | - //客户信息 | ||
231 | - if (data.customerId) { | ||
232 | - //客户回显 | ||
233 | - autoFillCustomerContactSelectOptions(data.customerId); | ||
234 | - } | ||
235 | - | ||
236 | - //商品单位回显 | ||
237 | - let list = data?.subOrderInformationLists; | ||
238 | - if (list) { | ||
239 | - let newProductUnitOptionsList = [...productUnitOptionsList]; | ||
240 | - for (let i = 0; i < list.length; i++) { | ||
241 | - newProductUnitOptionsList[i] = [ | ||
242 | - { label: list[i].unit, value: list[i].unitId }, | ||
243 | - ]; | ||
244 | - } | ||
245 | - setProductUnitOptionsList(newProductUnitOptionsList); | ||
246 | - } | ||
247 | - } | ||
248 | - | ||
249 | - /** | ||
250 | - * | ||
251 | - * @param option 商品名称所对应的商品数据 | ||
252 | - * @param currentRowData list中当前行的数据 | ||
253 | - */ | ||
254 | - async function autoFillProductInfo( | ||
255 | - option: any, | ||
256 | - currentRowData: any, | ||
257 | - index: any, | ||
258 | - ) { | ||
259 | - let newProductParametersDisabledFlagList = [ | ||
260 | - ...productParametersDisabledFlagList, | ||
261 | - ]; | ||
262 | - let newProductUnitOptionsList = [...productUnitOptionsList]; | ||
263 | - newProductUnitOptionsList[index] = []; | ||
264 | - | ||
265 | - //是新增商品 | ||
266 | - if (option.type === 'add') { | ||
267 | - //商品参数开放权限可以编辑 | ||
268 | - newProductParametersDisabledFlagList[index] = false; | ||
269 | - | ||
270 | - //清空商品信息 | ||
271 | - let copyList = form.getFieldValue('list'); | ||
272 | - let currentData = copyList[index]; | ||
273 | - currentData.productCode = undefined; | ||
274 | - currentData.parameters = undefined; | ||
275 | - currentData.unit = undefined; | ||
276 | - currentData.subOrderPayment = undefined; | ||
277 | - currentData.quantity = undefined; | ||
278 | - currentData.notes = undefined; | ||
279 | - currentData.productPrice = undefined; | ||
280 | - form.setFieldValue('list', copyList); | ||
281 | - | ||
282 | - //查询计量单价列表 | ||
283 | - let res = await postKingdeeRepMeasureUnit({ data: {} }); | ||
284 | - if (res && res?.rows) { | ||
285 | - for (let row of res?.rows) { | ||
286 | - newProductUnitOptionsList[index].push({ | ||
287 | - label: row.name, | ||
288 | - value: row.id, | ||
289 | - }); | ||
290 | - } | ||
291 | - } | ||
292 | - } else { | ||
293 | - //选择的是已有的商品,进行内容自动填充 | ||
294 | - let copyList = form.getFieldValue('list'); | ||
295 | - let currentData = copyList[index]; | ||
296 | - currentData.productCode = option?.number; | ||
297 | - currentData.parameters = option?.model; | ||
298 | - currentData.unit = option?.base_unit_name; | ||
299 | - | ||
300 | - //商品id | ||
301 | - currentData.materialId = option?.id; | ||
302 | - | ||
303 | - //单位 | ||
304 | - currentData.unit = option.base_unit_name; | ||
305 | - currentData.unitId = option.base_unit_id; | ||
306 | - | ||
307 | - form.setFieldValue('list', copyList); | ||
308 | - | ||
309 | - //商品所在的仓库选项填充 | ||
310 | - // let res = await postKingdeeRepMaterialStock({ | ||
311 | - // data: { | ||
312 | - // material_id: option.id, | ||
313 | - // }, | ||
314 | - // }); | ||
315 | - // let newProductInvStockOptionsList = [...productInvStockOptionsList]; | ||
316 | - // newProductInvStockOptionsList[index] = res?.rows?.map((item) => { | ||
317 | - // return { label: item.inv_stock, value: item.inv_stock_id }; | ||
318 | - // }); | ||
319 | - // setProductInvStockOptionsList(newProductInvStockOptionsList); | ||
320 | - | ||
321 | - //商品单位填充,查询商品单位列表 | ||
322 | - let res = await postKingdeeRepMaterialUnit({ | ||
323 | - data: { material_id: option.id }, | ||
324 | - }); | ||
325 | - if (res && res.rows) { | ||
326 | - for (let row of res.rows) { | ||
327 | - newProductUnitOptionsList[index].push({ | ||
328 | - label: row.unit_name, | ||
329 | - value: row.unit_id, | ||
330 | - }); | ||
331 | - } | ||
332 | - } | ||
333 | - //商品参数不允许编辑 | ||
334 | - newProductParametersDisabledFlagList[index] = true; | ||
335 | - } | ||
336 | - | ||
337 | - setProductParametersDisabledFlagList(newProductParametersDisabledFlagList); | ||
338 | - setProductUnitOptionsList(newProductUnitOptionsList); | ||
339 | - } | ||
340 | - | ||
341 | - /** | ||
342 | - * 选择收货人后自动填充信息 | ||
343 | - * @param option 收货人信息 | ||
344 | - */ | ||
345 | - async function autoFillCustomerInfo(option: any) { | ||
346 | - form.setFieldValue('customerShippingAddress', option.contact_address); | ||
347 | - form.setFieldValue('customerContactNumber', option.mobile); | ||
348 | - form.setFieldValue('customerName', option.contact_person); | ||
349 | - | ||
350 | - //erp收货地址:需要与客户联系人中的地址一样:姓名,手机号,地址 | ||
351 | - form.setFieldValue('contactAddress', option.value); | ||
352 | - } | ||
353 | - | ||
354 | - /** | ||
355 | - * 填充销售代表的信息 | ||
356 | - * @param option | ||
357 | - */ | ||
358 | - function autoFillSalesInfo(option: any) { | ||
359 | - console.log(option); | ||
360 | - //销售代表对应职员编码填充 | ||
361 | - form.setFieldValue('empNumber', option.number); | ||
362 | - } | ||
363 | - | ||
364 | - /** | ||
365 | - * 选择商品单位后自动填充 | ||
366 | - * @param option | ||
367 | - * @param index | ||
368 | - */ | ||
369 | - function autoFillUnit(option: any, index: any) { | ||
370 | - let copyList = form.getFieldValue('list'); | ||
371 | - let currentData = copyList[index]; | ||
372 | - currentData.unit = option?.label; | ||
373 | - form.setFieldValue('list', copyList); | ||
374 | - } | ||
375 | - | ||
376 | - /** | ||
377 | - * 计算子订单金额 | ||
378 | - * @param listMeta 当前商品信息 | ||
379 | - */ | ||
380 | - function computeSubOrderPayment(listMeta: any) { | ||
381 | - let quantity = listMeta?.record?.quantity; | ||
382 | - let productPrice = listMeta?.record?.productPrice; | ||
383 | - quantity = quantity === '' || quantity === undefined ? 0 : quantity; | ||
384 | - productPrice = | ||
385 | - productPrice === '' || productPrice === undefined ? 0 : productPrice; | ||
386 | - | ||
387 | - listMeta.subOrderPayment = quantity * productPrice; | ||
388 | - let list = form.getFieldValue('list'); | ||
389 | - list[listMeta?.index].subOrderPayment = quantity * productPrice; | ||
390 | - form.setFieldValue('list', list); | ||
391 | - } | ||
392 | - | ||
393 | - /** | ||
394 | - * 计算支付总额 | ||
395 | - */ | ||
396 | - function computeTotalPayment() { | ||
397 | - let list = form.getFieldValue('list'); | ||
398 | - let totalPayment = 0; | ||
399 | - list?.forEach((subOrder: any) => { | ||
400 | - let subOrderPayment = subOrder?.subOrderPayment; | ||
401 | - if (subOrderPayment !== '' || subOrderPayment !== undefined) { | ||
402 | - totalPayment = FloatAdd(totalPayment, subOrderPayment); | ||
403 | - } | ||
404 | - }); | ||
405 | - form.setFieldValue('totalPayment', totalPayment); | ||
406 | - } | ||
407 | - | ||
408 | - useEffect(() => { | ||
409 | - getSalesCodeOptions(); | ||
410 | - showKindeeInfo(); | ||
411 | - }, []); | ||
412 | - | ||
413 | - useEffect(() => { | ||
414 | - // 在组件挂载或数据变化时,更新组件状态 | ||
415 | - if (data) { | ||
416 | - setInvoicingStatus(data.invoicingStatus); | ||
417 | - } | ||
418 | - }, [data]); | ||
419 | - | ||
420 | - // let mainInfoDisbled = optType('edit'); | ||
421 | - if (optType('edit') || optType('copy')) { | ||
422 | - //如果是复制,需要开票,不回显是否需要开票字段 | ||
423 | - if (optType('copy')) { | ||
424 | - if (data.invoicingStatus === 'INVOICED') { | ||
425 | - data.invoicingStatus = undefined; | ||
426 | - } | ||
427 | - } | ||
428 | - //订单修改和新增的子订单列表命名是list | ||
429 | - data.list = data.subOrderInformationLists; | ||
430 | - //主订单事业部默认显示子订单第一条的事业部 | ||
431 | - data.productBelongBusiness = data.list[0].productBelongBusiness; | ||
432 | - data.paymentMethod = data.list[0].paymentMethod; | ||
433 | - data.paymentChannel = data.list[0].paymentChannel; | ||
434 | - data.invoicingStatus = data.list[0].invoicingStatus; | ||
435 | - | ||
436 | - data.list = data.list?.map((item) => { | ||
437 | - item.filePaths = item.listAnnex?.map((path) => { | ||
438 | - let i = 0; | ||
439 | - return { | ||
440 | - uid: i++, | ||
441 | - name: getAliYunOSSFileNameFromUrl(path), | ||
442 | - status: 'uploaded', | ||
443 | - url: path, | ||
444 | - response: { data: [path] }, | ||
445 | - }; | ||
446 | - }); | ||
447 | - return item; | ||
448 | - }); | ||
449 | - } | ||
450 | - | ||
451 | - return ( | ||
452 | - <> | ||
453 | - <DrawerForm<{ | ||
454 | - deleteSubOrderLists: any; | ||
455 | - name: string; | ||
456 | - company: string; | ||
457 | - }> | ||
458 | - open | ||
459 | - width="35%" | ||
460 | - title={optType('add') || optType('copy') ? '新建订单' : '修改订单'} | ||
461 | - resize={{ | ||
462 | - onResize() { | ||
463 | - console.log('resize!'); | ||
464 | - }, | ||
465 | - maxWidth: window.innerWidth * 0.8, | ||
466 | - minWidth: 400, | ||
467 | - }} | ||
468 | - // layout="horizontal" | ||
469 | - // labelCol={{ span: 8 }} | ||
470 | - form={form} | ||
471 | - autoFocusFirstInput | ||
472 | - drawerProps={{ | ||
473 | - destroyOnClose: true, | ||
474 | - maskClosable: false, | ||
475 | - }} | ||
476 | - submitTimeout={2000} | ||
477 | - onFinish={async (values) => { | ||
478 | - let res = {}; | ||
479 | - //附件处理 | ||
480 | - let list = values.list; | ||
481 | - // console.log(list); | ||
482 | - list = list.map((item) => { | ||
483 | - item.filePaths = item.filePaths?.map((file) => { | ||
484 | - console.log(file); | ||
485 | - return { url: file.response.data[0] }; | ||
486 | - }); | ||
487 | - return item; | ||
488 | - }); | ||
489 | - | ||
490 | - values.list = list; | ||
491 | - values.institution = values.institution?.trim(); | ||
492 | - values.institutionContactName = values.institutionContactName?.trim(); | ||
493 | - | ||
494 | - if (typeof values.erpCustomerId !== 'string') { | ||
495 | - values.erpCustomerId = values.erpCustomerId?.id; | ||
496 | - } | ||
497 | - | ||
498 | - if (optType('add') || optType('copy')) { | ||
499 | - res = await postServiceOrderAddOrder({ data: values }); | ||
500 | - } else { | ||
501 | - //计算已删除的子订单id | ||
502 | - const originIds = originSubOrders.map((item) => { | ||
503 | - return item.id; | ||
504 | - }); | ||
505 | - const curIds = form.getFieldValue('list')?.map((item) => { | ||
506 | - return item.id; | ||
507 | - }); | ||
508 | - let diff = originIds.filter((item) => !curIds.includes(item)); | ||
509 | - values.deleteSubOrderLists = diff; | ||
510 | - res = await postServiceOrderUpdateOrder({ data: values }); | ||
511 | - } | ||
512 | - | ||
513 | - if (res.result === RESPONSE_CODE.SUCCESS) { | ||
514 | - message.success(res.message); | ||
515 | - // 不返回不会关闭弹框 | ||
516 | - onClose(true); | ||
517 | - return true; | ||
518 | - } | ||
519 | - }} | ||
520 | - onOpenChange={(val) => { | ||
521 | - return !val && onClose(); | ||
522 | - }} | ||
523 | - > | ||
524 | - <h2>订单基本信息</h2> | ||
525 | - <ProFormText | ||
526 | - key="id" | ||
527 | - name="id" | ||
528 | - width="lg" | ||
529 | - disabled | ||
530 | - label="id" | ||
531 | - placeholder="id" | ||
532 | - hidden | ||
533 | - /> | ||
534 | - | ||
535 | - <ProFormText | ||
536 | - key="empNumber" | ||
537 | - name="empNumber" | ||
538 | - width="lg" | ||
539 | - label="销售职员编码" | ||
540 | - placeholder="销售职员编码" | ||
541 | - hidden | ||
542 | - /> | ||
543 | - | ||
544 | - <ProFormSelect | ||
545 | - name="salesCode" | ||
546 | - key="salesCode" | ||
547 | - width="lg" | ||
548 | - showSearch | ||
549 | - label="销售代表" | ||
550 | - placeholder="请输入销售代表" | ||
551 | - rules={[{ required: true, message: '销售代表必填' }]} | ||
552 | - options={salesCodeOptions} | ||
553 | - onChange={(_, option) => { | ||
554 | - autoFillSalesInfo(option); | ||
555 | - }} | ||
556 | - // disabled={mainInfoDisbled} | ||
557 | - /> | ||
558 | - | ||
559 | - <ProFormText | ||
560 | - key="erpCustomerName" | ||
561 | - name="erpCustomerName" | ||
562 | - hidden | ||
563 | - ></ProFormText> | ||
564 | - | ||
565 | - <ProFormText | ||
566 | - key="contactAddress" | ||
567 | - name="contactAddress" | ||
568 | - hidden | ||
569 | - ></ProFormText> | ||
570 | - | ||
571 | - <ProFormSelect | ||
572 | - name="erpCustomerId" | ||
573 | - key="erpCustomerId" | ||
574 | - width="lg" | ||
575 | - showSearch | ||
576 | - label={ | ||
577 | - <> | ||
578 | - <span>客户</span> | ||
579 | - <span | ||
580 | - className="pl-2 text-xs text-[#1677ff] cursor-pointer" | ||
581 | - onClick={() => { | ||
582 | - let customerId = form.getFieldValue('erpCustomerId'); | ||
583 | - if (typeof customerId === 'string') { | ||
584 | - setCustomer({ ...customer, id: customerId }); | ||
585 | - } else { | ||
586 | - setCustomer({ ...customer, id: customerId.id }); | ||
587 | - } | ||
588 | - setKingdeeCstomerModalVisible(true); | ||
589 | - }} | ||
590 | - > | ||
591 | - 编辑客户信息 | ||
592 | - </span> | ||
593 | - </> | ||
594 | - } | ||
595 | - placeholder="请选择客户" | ||
596 | - rules={[{ required: true, message: '客户必填' }]} | ||
597 | - onChange={(_, option) => { | ||
598 | - //新增客户 | ||
599 | - if (option.type === 'add') { | ||
600 | - setCustomer({ name: option.name }); | ||
601 | - setKingdeeCstomerModalVisible(true); | ||
602 | - return; | ||
603 | - } | ||
604 | - autoFillCustomerContactSelectOptions(option.id); | ||
605 | - }} | ||
606 | - initialValue={{ | ||
607 | - label: data?.erpCustomerName, | ||
608 | - value: data?.customerId, | ||
609 | - id: data?.customerId, | ||
610 | - }} | ||
611 | - fieldProps={{ | ||
612 | - optionItemRender(item) { | ||
613 | - if (item.type === 'add') { | ||
614 | - return ( | ||
615 | - <div title={item.name + '(新增客户)'}> | ||
616 | - <span style={{ color: '#333333' }}>{item.name}</span> | ||
617 | - {' | '} | ||
618 | - <span style={{ color: 'orange' }}>自定义</span> | ||
619 | - </div> | ||
620 | - ); | ||
621 | - } | ||
622 | - return ( | ||
623 | - <div | ||
624 | - title={ | ||
625 | - item.name + | ||
626 | - ' | ' + | ||
627 | - item.customerContactNumber + | ||
628 | - ' | ' + | ||
629 | - (item.customerShippingAddress === undefined | ||
630 | - ? '无地址' | ||
631 | - : item.customerShippingAddress) + | ||
632 | - ' | ' + | ||
633 | - item.institutionContactName + | ||
634 | - ' | ' + | ||
635 | - item.institution | ||
636 | - } | ||
637 | - > | ||
638 | - <span style={{ color: '#333333' }}>{item.name}</span> | ||
639 | - </div> | ||
640 | - ); | ||
641 | - }, | ||
642 | - }} | ||
643 | - debounceTime={1000} | ||
644 | - request={async (value, {}) => { | ||
645 | - const keywords = value.keyWords; | ||
646 | - const res = await postKingdeeRepCustomer({ | ||
647 | - data: { search: keywords }, | ||
648 | - }); | ||
649 | - console.log(res); | ||
650 | - | ||
651 | - let options = res?.rows?.map((c: any) => { | ||
652 | - return { | ||
653 | - ...c, | ||
654 | - label: c.name, | ||
655 | - value: c.id, | ||
656 | - key: c.id, | ||
657 | - }; | ||
658 | - }); | ||
659 | - | ||
660 | - //第一个商品默认为要新增客户 | ||
661 | - if (keywords.trim() !== '') { | ||
662 | - options.unshift({ | ||
663 | - name: keywords, | ||
664 | - type: 'add', | ||
665 | - label: keywords, | ||
666 | - value: 3.1415926, | ||
667 | - key: keywords, | ||
668 | - }); | ||
669 | - } | ||
670 | - return options; | ||
671 | - }} | ||
672 | - /> | ||
673 | - <ProFormSelect | ||
674 | - key="customerName" | ||
675 | - label="收货人" | ||
676 | - width="lg" | ||
677 | - showSearch | ||
678 | - name="customerName" | ||
679 | - placeholder="请选择收货人" | ||
680 | - rules={[{ required: true, message: '收货人必填' }]} | ||
681 | - onChange={(_, option) => { | ||
682 | - autoFillCustomerInfo(option); | ||
683 | - }} | ||
684 | - initialValue={data.contactAddress} | ||
685 | - options={productCustomerContactOptions} | ||
686 | - /> | ||
687 | - <ProFormText | ||
688 | - width="lg" | ||
689 | - key="customerContactNumber" | ||
690 | - name="customerContactNumber" | ||
691 | - label="联系方式" | ||
692 | - placeholder="请输入联系方式" | ||
693 | - rules={[{ required: true, message: '联系方式必填' }]} | ||
694 | - disabled | ||
695 | - /> | ||
696 | - <ProFormText | ||
697 | - width="lg" | ||
698 | - key="institution" | ||
699 | - name="institution" | ||
700 | - label="单位" | ||
701 | - placeholder="请输入单位" | ||
702 | - rules={[{ required: true, message: '单位必填' }]} | ||
703 | - disabled | ||
704 | - /> | ||
705 | - <ProFormText | ||
706 | - width="lg" | ||
707 | - key="institutionContactName" | ||
708 | - name="institutionContactName" | ||
709 | - label="课题组" | ||
710 | - placeholder="请输入课题组" | ||
711 | - rules={[{ required: true, message: '课题组必填' }]} | ||
712 | - disabled | ||
713 | - /> | ||
714 | - <ProFormTextArea | ||
715 | - width="lg" | ||
716 | - key="customerShippingAddress" | ||
717 | - name="customerShippingAddress" | ||
718 | - label="收货地址" | ||
719 | - placeholder="请输入收货地址" | ||
720 | - rules={[{ required: true, message: '收货地址必填' }]} | ||
721 | - disabled | ||
722 | - /> | ||
723 | - <div id="total-payment"> | ||
724 | - <ProFormDigit | ||
725 | - name="totalPayment" | ||
726 | - width="lg" | ||
727 | - key="totalPayment" | ||
728 | - label="支付总额(¥)" | ||
729 | - rules={[{ required: true, message: '支付总额必填' }]} | ||
730 | - tooltip="点击计算,合计所有子订单金额" | ||
731 | - fieldProps={{ | ||
732 | - addonAfter: ( | ||
733 | - <Button | ||
734 | - className="rounded-l-none" | ||
735 | - type="primary" | ||
736 | - onClick={computeTotalPayment} | ||
737 | - > | ||
738 | - 计算 | ||
739 | - </Button> | ||
740 | - ), | ||
741 | - }} | ||
742 | - // disabled={mainInfoDisbled} | ||
743 | - /> | ||
744 | - </div> | ||
745 | - | ||
746 | - <ProFormSelect | ||
747 | - placeholder="请输入支付渠道" | ||
748 | - name="paymentChannel" | ||
749 | - width="lg" | ||
750 | - key="paymentChannel" | ||
751 | - label="支付渠道" | ||
752 | - options={enumToSelect(PAYMENT_CHANNEL_OPTIONS)} | ||
753 | - rules={[{ required: true, message: '支付渠道必填' }]} | ||
754 | - // disabled={mainInfoDisbled} | ||
755 | - /> | ||
756 | - <ProFormSelect | ||
757 | - placeholder="请输入支付方式" | ||
758 | - name="paymentMethod" | ||
759 | - width="lg" | ||
760 | - key="paymentMethod" | ||
761 | - label="支付方式" | ||
762 | - options={enumToSelect(PAYMENT_METHOD_OPTIONS)} | ||
763 | - rules={[{ required: true, message: '支付方式必填' }]} | ||
764 | - // disabled={mainInfoDisbled} | ||
765 | - /> | ||
766 | - <ProFormSelect | ||
767 | - placeholder="选择是否需要开票" | ||
768 | - name="invoicingStatus" | ||
769 | - width="lg" | ||
770 | - key="invoicingStatus" | ||
771 | - label="是否需要开票" | ||
772 | - options={getInvoicingSelect()} | ||
773 | - // disabled={mainInfoDisbled} | ||
774 | - onChange={(_, option) => { | ||
775 | - setInvoicingStatus(option.value); | ||
776 | - if (option.value === 'UN_INVOICE') { | ||
777 | - form.setFieldValue('invoiceIdentificationNumber', undefined); | ||
778 | - form.setFieldValue('bank', undefined); | ||
779 | - form.setFieldValue('bankAccountNumber', undefined); | ||
780 | - } | ||
781 | - }} | ||
782 | - rules={[{ required: true, message: '是否需要开票必填' }]} | ||
783 | - /> | ||
784 | - <ProFormText | ||
785 | - width="lg" | ||
786 | - name="invoiceIdentificationNumber" | ||
787 | - label="开票信息" | ||
788 | - key="invoiceIdentificationNumber" | ||
789 | - // disabled={mainInfoDisbled} | ||
790 | - hidden={invoicingStatus === 'UN_INVOICE'} | ||
791 | - placeholder="请输入开票信息" | ||
792 | - rules={[ | ||
793 | - { | ||
794 | - required: invoicingStatus === 'UN_INVOICE' ? false : true, | ||
795 | - message: '开票信息必填', | ||
796 | - }, | ||
797 | - ]} | ||
798 | - /> | ||
799 | - | ||
800 | - {getUserInfo().roleSmallVO?.code === 'admin' ? ( | ||
801 | - <ProFormDateTimePicker | ||
802 | - width="lg" | ||
803 | - key="invoicingTime" | ||
804 | - name="invoicingTime" | ||
805 | - // disabled={mainInfoDisbled} | ||
806 | - hidden={invoicingStatus === 'UN_INVOICE'} | ||
807 | - label="开票时间" | ||
808 | - placeholder="请输入开票时间" | ||
809 | - /> | ||
810 | - ) : ( | ||
811 | - '' | ||
812 | - )} | ||
813 | - <ProFormText | ||
814 | - width="lg" | ||
815 | - name="bank" | ||
816 | - key="bank" | ||
817 | - label="开户银行" | ||
818 | - // disabled={mainInfoDisbled} | ||
819 | - hidden={invoicingStatus === 'UN_INVOICE'} | ||
820 | - placeholder="请输入开户银行" | ||
821 | - /> | ||
822 | - <ProFormText | ||
823 | - width="lg" | ||
824 | - key="bankAccountNumber" | ||
825 | - name="bankAccountNumber" | ||
826 | - hidden={invoicingStatus === 'UN_INVOICE'} | ||
827 | - label="银行账号" | ||
828 | - // disabled={mainInfoDisbled} | ||
829 | - placeholder="请输入银行账号" | ||
830 | - /> | ||
831 | - <ProFormTextArea | ||
832 | - width="lg" | ||
833 | - name="notes" | ||
834 | - label="备注" | ||
835 | - key="notes" | ||
836 | - // disabled={mainInfoDisbled} | ||
837 | - placeholder="请输入备注" | ||
838 | - rules={[ | ||
839 | - { | ||
840 | - max: 120, // 最大长度为120个字符 | ||
841 | - message: '备注不能超过120个字符', | ||
842 | - }, | ||
843 | - ]} | ||
844 | - /> | ||
845 | - | ||
846 | - <h2>商品信息</h2> | ||
847 | - <ProFormList | ||
848 | - creatorButtonProps={{ disabled: false }} | ||
849 | - name="list" | ||
850 | - label="" | ||
851 | - copyIconProps={false} //复制按钮不显示 | ||
852 | - initialValue={[ | ||
853 | - { | ||
854 | - productCode: '', | ||
855 | - productName: '', | ||
856 | - quantity: '', | ||
857 | - productPrice: '', | ||
858 | - parameters: '', | ||
859 | - subOrderPayment: '', | ||
860 | - }, | ||
861 | - ]} | ||
862 | - actionGuard={{ | ||
863 | - beforeRemoveRow: async (index) => { | ||
864 | - return new Promise((resolve) => { | ||
865 | - if (index === 0) { | ||
866 | - message.error('第一行数据不能删除'); | ||
867 | - resolve(false); | ||
868 | - return; | ||
869 | - } | ||
870 | - resolve(true); | ||
871 | - }); | ||
872 | - }, | ||
873 | - }} | ||
874 | - itemRender={(doms, listMeta) => { | ||
875 | - if (optType('edit')) { | ||
876 | - let i = 0; | ||
877 | - let defaultFileList = listMeta.record?.listAnnex?.map((annex) => { | ||
878 | - return { | ||
879 | - uid: i++, | ||
880 | - name: annex, | ||
881 | - status: 'uploaded', | ||
882 | - url: annex, | ||
883 | - response: { data: [annex] }, | ||
884 | - }; | ||
885 | - }); | ||
886 | - fileList[listMeta.index] = defaultFileList; | ||
887 | - } | ||
888 | - let itemFileList = fileList[listMeta.index]; | ||
889 | - return ( | ||
890 | - <ProCard | ||
891 | - bordered | ||
892 | - extra={doms.action} | ||
893 | - title={'商品' + (listMeta.index + 1)} | ||
894 | - style={{ | ||
895 | - marginBlockEnd: 8, | ||
896 | - }} | ||
897 | - > | ||
898 | - {[ | ||
899 | - <ProFormText | ||
900 | - key={'material' + listMeta.index} | ||
901 | - name="materialId" | ||
902 | - hidden | ||
903 | - ></ProFormText>, | ||
904 | - <ProFormSelect | ||
905 | - key="key" | ||
906 | - label="商品名称" | ||
907 | - width="lg" | ||
908 | - showSearch | ||
909 | - name="productName" | ||
910 | - // options={options} | ||
911 | - placeholder="请搜索商品" | ||
912 | - rules={[{ required: true, message: '商品名称必填' }]} | ||
913 | - onChange={(_, option) => { | ||
914 | - autoFillProductInfo(option, listMeta, listMeta.index); | ||
915 | - }} | ||
916 | - initialValue={{ | ||
917 | - label: listMeta?.record?.productName, | ||
918 | - value: listMeta?.record?.materialId, | ||
919 | - }} | ||
920 | - fieldProps={{ | ||
921 | - optionItemRender(item) { | ||
922 | - if (item.type === 'add') { | ||
923 | - return ( | ||
924 | - <div title={item.name + '(新增商品信息)'}> | ||
925 | - <span style={{ color: '#333333' }}> | ||
926 | - {item.label} | ||
927 | - </span> | ||
928 | - {' | '} | ||
929 | - <span style={{ color: 'orange' }}>新增商品</span> | ||
930 | - </div> | ||
931 | - ); | ||
932 | - } | ||
933 | - return ( | ||
934 | - <div | ||
935 | - title={ | ||
936 | - item.label + | ||
937 | - ' | ' + | ||
938 | - (item.model === undefined | ||
939 | - ? '无参数' | ||
940 | - : item.model) + | ||
941 | - ' | ' + | ||
942 | - item.base_unit_name | ||
943 | - } | ||
944 | - > | ||
945 | - <span style={{ color: '#333333' }}> | ||
946 | - {item.label} | ||
947 | - </span> | ||
948 | - {' | '} | ||
949 | - <span style={{ color: '#339999' }}> | ||
950 | - {item.model === undefined ? '无参数' : item.model} | ||
951 | - </span> | ||
952 | - {' | '} | ||
953 | - <span style={{ color: '#666666' }}> | ||
954 | - {item.base_unit_name === undefined | ||
955 | - ? '无单位' | ||
956 | - : item.base_unit_name} | ||
957 | - </span> | ||
958 | - </div> | ||
959 | - ); | ||
960 | - }, | ||
961 | - }} | ||
962 | - debounceTime={1000} | ||
963 | - request={async (value) => { | ||
964 | - const keywords = value.keyWords; | ||
965 | - const res = await postKingdeeRepMaterial({ | ||
966 | - data: { search: keywords }, | ||
967 | - }); | ||
968 | - let options = res?.rows?.map((p: any) => { | ||
969 | - return { | ||
970 | - ...p, | ||
971 | - label: p.name, | ||
972 | - value: p.id + '|' + p.name, | ||
973 | - key: p.id, | ||
974 | - }; | ||
975 | - }); | ||
976 | - | ||
977 | - //第一个商品默认为要新增的商品 | ||
978 | - if (keywords.trim() !== '') { | ||
979 | - options.unshift({ | ||
980 | - productName: keywords, | ||
981 | - type: 'add', | ||
982 | - label: keywords, | ||
983 | - value: 13 + '|' + keywords, | ||
984 | - key: keywords, | ||
985 | - }); | ||
986 | - } | ||
987 | - return options; | ||
988 | - }} | ||
989 | - />, | ||
990 | - <ProFormText | ||
991 | - key={'productCode' + listMeta.index} | ||
992 | - width="lg" | ||
993 | - name="productCode" | ||
994 | - disabled | ||
995 | - label={ | ||
996 | - <> | ||
997 | - <span>商品编码</span> | ||
998 | - <span className="pl-2 text-xs text-gray-400"> | ||
999 | - 新增商品时,商品编码由系统自动生成 | ||
1000 | - </span> | ||
1001 | - </> | ||
1002 | - } | ||
1003 | - placeholder="商品编码" | ||
1004 | - />, | ||
1005 | - // <ProFormSelect | ||
1006 | - // key="inv_stock" | ||
1007 | - // placeholder="请选择仓库" | ||
1008 | - // name="invStockId" | ||
1009 | - // width="lg" | ||
1010 | - // label="仓库" | ||
1011 | - // options={productInvStockOptionsList[listMeta.index]} | ||
1012 | - // />, | ||
1013 | - <ProFormText | ||
1014 | - key={'parameters' + listMeta.index} | ||
1015 | - width="lg" | ||
1016 | - name="parameters" | ||
1017 | - label="商品参数" | ||
1018 | - placeholder="请输入商品参数" | ||
1019 | - rules={[{ required: true, message: '商品参数必填' }]} | ||
1020 | - disabled={ | ||
1021 | - productParametersDisabledFlagList[listMeta.index] !== | ||
1022 | - false | ||
1023 | - } | ||
1024 | - />, | ||
1025 | - <ProFormDigit | ||
1026 | - key={'quantity' + listMeta.index} | ||
1027 | - width="lg" | ||
1028 | - name="quantity" | ||
1029 | - label="商品数量" | ||
1030 | - fieldProps={{ | ||
1031 | - onChange: (value) => { | ||
1032 | - listMeta.record.quantity = value; | ||
1033 | - computeSubOrderPayment(listMeta); | ||
1034 | - }, | ||
1035 | - }} | ||
1036 | - placeholder="请输入商品数量" | ||
1037 | - rules={[{ required: true, message: '商品数量必填' }]} | ||
1038 | - />, | ||
1039 | - | ||
1040 | - <ProFormDigit | ||
1041 | - key={'productPrice' + listMeta.index} | ||
1042 | - width="lg" | ||
1043 | - name="productPrice" | ||
1044 | - label="商品单价" | ||
1045 | - fieldProps={{ | ||
1046 | - onChange: (value) => { | ||
1047 | - listMeta.record.productPrice = value; | ||
1048 | - computeSubOrderPayment(listMeta); | ||
1049 | - }, | ||
1050 | - }} | ||
1051 | - placeholder="请输入商品单价" | ||
1052 | - rules={[{ required: true, message: '商品单价必填' }]} | ||
1053 | - />, | ||
1054 | - | ||
1055 | - <ProFormSelect | ||
1056 | - key="unitId" | ||
1057 | - placeholder="请选择单位" | ||
1058 | - name="unitId" | ||
1059 | - width="lg" | ||
1060 | - label="单位" | ||
1061 | - showSearch | ||
1062 | - onChange={(_, option) => { | ||
1063 | - autoFillUnit(option, listMeta.index); | ||
1064 | - }} | ||
1065 | - options={productUnitOptionsList[listMeta.index]} | ||
1066 | - rules={[{ required: true, message: '商品单位必填' }]} | ||
1067 | - />, | ||
1068 | - <ProFormText | ||
1069 | - key={'unit' + listMeta.index} | ||
1070 | - width="lg" | ||
1071 | - name="unit" | ||
1072 | - label="商品单位" | ||
1073 | - placeholder="请输入商品单位" | ||
1074 | - rules={[{ required: true, message: '商品单位必填' }]} | ||
1075 | - hidden | ||
1076 | - />, | ||
1077 | - | ||
1078 | - <ProFormDigit | ||
1079 | - width="lg" | ||
1080 | - key={'subOrderPayment' + listMeta.index} | ||
1081 | - name="subOrderPayment" | ||
1082 | - label="子订单金额" | ||
1083 | - placeholder="请输入子订单金额" | ||
1084 | - tooltip="商品数量和单价变化后会自动计算子订单金额" | ||
1085 | - rules={[{ required: true, message: '子订单金额必填' }]} | ||
1086 | - />, | ||
1087 | - <ProFormSelect | ||
1088 | - key={'productBelongBusiness' + listMeta.index} | ||
1089 | - placeholder="请输入所属事业部" | ||
1090 | - name="productBelongBusiness" | ||
1091 | - width="lg" | ||
1092 | - label="所属事业部" | ||
1093 | - options={enumToSelect(PRODUCT_BELONG_DEPARTMENT_OPTIONS)} | ||
1094 | - initialValue={'EXPERIMENTAL_CONSUMABLES'} | ||
1095 | - rules={[{ required: true, message: '所属事业部必填' }]} | ||
1096 | - // disabled={mainInfoDisbled} | ||
1097 | - />, | ||
1098 | - <ProFormTextArea | ||
1099 | - key={'notes' + listMeta.index} | ||
1100 | - width="lg" | ||
1101 | - name="notes" | ||
1102 | - label={ | ||
1103 | - <div> | ||
1104 | - <span>备注</span> | ||
1105 | - <span className="pl-2 text-xs text-gray-400"> | ||
1106 | - 备注将体现在出货单上,请将需要仓管看见的信息写在备注上,例如需要开收据等信息。 | ||
1107 | - </span> | ||
1108 | - </div> | ||
1109 | - } | ||
1110 | - placeholder="请输入备注" | ||
1111 | - rules={[ | ||
1112 | - { | ||
1113 | - max: 120, // 最大长度为120个字符 | ||
1114 | - message: '备注不能超过120个字符', | ||
1115 | - }, | ||
1116 | - ]} | ||
1117 | - />, | ||
1118 | - <> | ||
1119 | - <ProFormUploadDragger | ||
1120 | - key={'filePaths' + listMeta.index} | ||
1121 | - label="附件" | ||
1122 | - name="filePaths" | ||
1123 | - action="/api/service/order/fileProcess" | ||
1124 | - fieldProps={{ | ||
1125 | - headers: { | ||
1126 | - Authorization: localStorage.getItem('token'), | ||
1127 | - }, | ||
1128 | - itemFileList, | ||
1129 | - }} | ||
1130 | - /> | ||
1131 | - </>, | ||
1132 | - ]} | ||
1133 | - </ProCard> | ||
1134 | - ); | ||
1135 | - }} | ||
1136 | - actionRef={actionRef} | ||
1137 | - ></ProFormList> | ||
1138 | - </DrawerForm> | ||
1139 | - | ||
1140 | - {kingdeeCstomerModalVisible && ( | ||
1141 | - <KingdeeCustomerModal | ||
1142 | - setVisible={setKingdeeCstomerModalVisible} | ||
1143 | - data={customer} | ||
1144 | - onClose={(customerId: any) => { | ||
1145 | - setKingdeeCstomerModalVisible(false); | ||
1146 | - //回显已经新建好的客户 | ||
1147 | - autoFillCustomerContactSelectOptions(customerId); | ||
1148 | - }} | ||
1149 | - /> | ||
1150 | - )} | ||
1151 | - </> | ||
1152 | - ); | ||
1153 | -}; |
src/pages/Order/Order/index copy.tsx deleted
100644 → 0
1 | -import ButtonConfirm from '@/components/ButtomConfirm'; | ||
2 | -import { RESPONSE_CODE } from '@/constants/enum'; | ||
3 | -import ImportExpressBillModal from '@/pages/Order/Order/components/ImportExpressBillModal'; | ||
4 | -import InvoicingDrawerForm from '@/pages/Order/Order/components/InvoicingDrawerForm'; | ||
5 | -import ReissueModal from '@/pages/Order/Order/components/ReissueModal'; | ||
6 | -import ReissueModal_old from '@/pages/Order/Order/components/ReissueModal_old'; | ||
7 | -import { | ||
8 | - postKingdeeRepSalBillOutbound, | ||
9 | - postKingdeeRepSalOrderSave, | ||
10 | - postServiceConstCanApplyAfterInvoicingStatus, | ||
11 | - postServiceInvoiceCancelApply, | ||
12 | - postServiceOrderCancelSend, | ||
13 | - postServiceOrderConfirmInvoice, | ||
14 | - postServiceOrderGetCurrentOptNode, | ||
15 | - postServiceOrderNoNeedSend, | ||
16 | - postServiceOrderOrderCancel, | ||
17 | - postServiceOrderProcureOrder, | ||
18 | - postServiceOrderProcurePrint, | ||
19 | - postServiceOrderProvideProcurementRoles, | ||
20 | - postServiceOrderQueryServiceOrder, | ||
21 | - postServiceOrderSaleCancelInvoicing, | ||
22 | - postServiceOrderSalesConfirm, | ||
23 | - postServiceOrderWarningOrderStatistics, | ||
24 | -} from '@/services'; | ||
25 | -import { downloadFile } from '@/services/order'; | ||
26 | -import { | ||
27 | - FloatAdd, | ||
28 | - copyToClipboard, | ||
29 | - enumToProTableEnumValue, | ||
30 | - enumValueToLabel, | ||
31 | - formatDateTime, | ||
32 | - formatdate, | ||
33 | - getAliYunOSSFileNameFromUrl, | ||
34 | - isImageName, | ||
35 | -} from '@/utils'; | ||
36 | -import { | ||
37 | - getReceivingCompanyOptions, | ||
38 | - isAdmin, | ||
39 | - isExaminer, | ||
40 | - isFinance, | ||
41 | - isProcure, | ||
42 | - isSales, | ||
43 | - isSupplier, | ||
44 | - isWarehousekeeper, | ||
45 | -} from '@/utils/order'; | ||
46 | -import { getUserInfo } from '@/utils/user'; | ||
47 | -import { | ||
48 | - ClockCircleTwoTone, | ||
49 | - ContainerTwoTone, | ||
50 | - CopyOutlined, | ||
51 | - CopyTwoTone, | ||
52 | - DownOutlined, | ||
53 | - EditTwoTone, | ||
54 | - QuestionCircleOutlined, | ||
55 | -} from '@ant-design/icons'; | ||
56 | -import { | ||
57 | - ActionType, | ||
58 | - ProColumns, | ||
59 | - ProFormInstance, | ||
60 | - ProTable, | ||
61 | -} from '@ant-design/pro-components'; | ||
62 | -import { useModel } from '@umijs/max'; | ||
63 | -import { | ||
64 | - Button, | ||
65 | - Card, | ||
66 | - Checkbox, | ||
67 | - Col, | ||
68 | - Divider, | ||
69 | - Dropdown, | ||
70 | - Flex, | ||
71 | - FloatButton, | ||
72 | - Image, | ||
73 | - MenuProps, | ||
74 | - Modal, | ||
75 | - Popconfirm, | ||
76 | - Radio, | ||
77 | - Row, | ||
78 | - Space, | ||
79 | - Spin, | ||
80 | - Tag, | ||
81 | - Tooltip, | ||
82 | - message, | ||
83 | -} from 'antd'; | ||
84 | -import Base64 from 'base-64'; | ||
85 | -import { cloneDeep } from 'lodash'; | ||
86 | -import React, { Key, useEffect, useMemo, useRef, useState } from 'react'; | ||
87 | -import OrderPrintModal from '../../OrderPrint/OrderPrintModal'; | ||
88 | -import { | ||
89 | - AFTER_INVOICING_STATUS, | ||
90 | - CHECK_TYPE, | ||
91 | - LOGISTICS_STATUS_OPTIONS, | ||
92 | - MAIN_ORDER_COLUMNS, | ||
93 | - MODIFIED_AUDIT_STATUS_OPTIONS, | ||
94 | - ORDER_STATUS_OPTIONS, | ||
95 | - PAYEE_OPTIONS, | ||
96 | - PAYMENT_CHANNEL_OPTIONS, | ||
97 | - PAYMENT_RECEIPTS_STATUS_OPTIONS, | ||
98 | - POST_AUDIT_OPTIONS, | ||
99 | - PROCURE_ORDER_STATUS, | ||
100 | - PROCURE_PRIMARY_ORDER_STATUS_OPTIONS, | ||
101 | - PRODUCT_BELONG_DEPARTMENT_OPTIONS, | ||
102 | - SHIPPING_WAREHOUSE_OPTIONS, | ||
103 | - TAGS_COLOR, | ||
104 | - getInvoicingType, | ||
105 | - getNeedInvoicing, | ||
106 | -} from '../constant'; | ||
107 | -import AfterSalesDrawer from './components/AfterSalesDrawer'; | ||
108 | -import ApplyForInvoicingModal from './components/ApplyForInvoicingModal'; | ||
109 | -import AttachmentModal from './components/AttachmentModal'; | ||
110 | -import CheckModal from './components/CheckModal'; | ||
111 | -import ConfirmReceiptModal from './components/ConfirmReceiptModal'; | ||
112 | -import DeliverInfoDrawer from './components/DeliverInfoDrawer'; | ||
113 | -import DeliverModal from './components/DeliverModal'; | ||
114 | -import FeedbackRegistrationModal from './components/FeedbackRegistrationModal'; | ||
115 | -import FinancialDrawer from './components/FinancialDrawer'; | ||
116 | -import FinancialEditDrawer from './components/FinancialEditDrawer'; | ||
117 | -import FinancialMergeDrawer from './components/FinancialMergeDrawer'; | ||
118 | -import FinancialReceiptsModal from './components/FinancialReceiptsModal'; | ||
119 | -import HistoryModal from './components/HistoryModal'; | ||
120 | -import ImagesViewerModal from './components/ImagesViewerModal'; | ||
121 | -import ImportModal from './components/ImportModal'; | ||
122 | -import ModifiedDiffModal from './components/ModifiedDiffModal'; | ||
123 | -import OrderDrawer from './components/OrderDrawer'; | ||
124 | -import OrderNotesEditModal from './components/OrderNotesEditModal'; | ||
125 | -import ProcureCheckModal from './components/ProcureCheckModal'; | ||
126 | -import ProcureConvertModal from './components/ProcureConvertModal'; | ||
127 | -import ProductionTimeModal from './components/ProductionTimeModal'; | ||
128 | -import ShippingWarehouseChangeModal from './components/ShippingWarehouseChangeModal'; | ||
129 | -import UploadPayBillModal from './components/UploadPayBillModal'; | ||
130 | -import './index.less'; | ||
131 | -import { OrderListItemType, OrderType } from './type.d'; | ||
132 | -// import { useNavigate } from 'react-router-dom'; | ||
133 | -import { history } from '@umijs/max'; | ||
134 | -// import { format } from 'fecha'; | ||
135 | - | ||
136 | -const OrderPage = () => { | ||
137 | - const [orderDrawerVisible, setOrderDrawerVisible] = useState<boolean>(false); | ||
138 | - const [checkVisible, setCheckVisible] = useState<boolean>(false); | ||
139 | - const [orderPrintVisible, setOrderPrintVisible] = useState<boolean>(false); | ||
140 | - const [allMainChecked, setAllMainChecked] = useState(false); | ||
141 | - const [imagesViewerModalVisible, setImagesViewerModalVisible] = | ||
142 | - useState<boolean>(false); | ||
143 | - const [data, setData] = useState([]); //列表数据 | ||
144 | - const [notesEditVisible, setNotesEditVisible] = useState<boolean>(false); | ||
145 | - const [financialMergeDrawerVisible, setFinancialMergeDrawerVisible] = | ||
146 | - useState<boolean>(false); | ||
147 | - const [attachmentModalVisible, setAttachmentModalVisible] = | ||
148 | - useState<boolean>(false); | ||
149 | - const [uploadPayBillModalVisible, setUploadPayBillModalVisible] = | ||
150 | - useState<boolean>(false); | ||
151 | - const [ | ||
152 | - feedbackRegistrationModalVisible, | ||
153 | - setFeedbackRegistrationModalVisible, | ||
154 | - ] = useState<boolean>(false); | ||
155 | - const [modifiedDiffModalVisible, setModifiedDiffModalVisible] = | ||
156 | - useState<boolean>(false); | ||
157 | - const [financialReceiptsModalVisible, setFinancialReceiptsModalVisible] = | ||
158 | - useState(false); | ||
159 | - const [financialVisible, setFinancialVisible] = useState<boolean>(false); | ||
160 | - const [financialEditVisible, setFinancialEditVisible] = | ||
161 | - useState<boolean>(false); | ||
162 | - const [afterSalesDrawerVisible, setAfterSalesDrawerVisible] = | ||
163 | - useState<boolean>(false); | ||
164 | - const [historyModalVisible, setHistoryModalVisible] = | ||
165 | - useState<boolean>(false); | ||
166 | - const [isRePrintOrder, setIsRePrintOrder] = useState<boolean>(false); | ||
167 | - const [isSendProduct, setIsSendProduct] = useState<boolean>(false); | ||
168 | - const [isMainOrder, setIsMainOrder] = useState<boolean>(false); | ||
169 | - const [importModalVisible, setImportModalVisible] = useState<boolean>(false); | ||
170 | - const [reissueVisible, setReissueVisible] = useState<boolean>(false); | ||
171 | - const [reissueVisibleOld, setReissueVisibleOld] = useState<boolean>(false); | ||
172 | - const [applyForInvoicingVisible, setApplyForInvoicingVisible] = | ||
173 | - useState<boolean>(false); | ||
174 | - const [procureCheckModalVisible, setProcureCheckModalVisible] = | ||
175 | - useState<boolean>(false); | ||
176 | - const [procureConvertModalVisible, setProcureConvertModalVisible] = | ||
177 | - useState<boolean>(false); | ||
178 | - const [invoicingDrawerFormVisible, setInvoicingDrawerFormVisible] = | ||
179 | - useState<boolean>(false); | ||
180 | - const [confirmReceiptVisible, setConfirmReceiptVisible] = | ||
181 | - useState<boolean>(false); | ||
182 | - const [productionTimeModalVisible, setProductionTimeModalVisible] = | ||
183 | - useState<boolean>(false); | ||
184 | - const [deliverVisible, setDeliverVisible] = useState<boolean>(false); | ||
185 | - const [deliverInfoDrawerVisible, setDeliverInfoDrawerVisible] = | ||
186 | - useState<boolean>(false); | ||
187 | - const [orderOptType, setOrderOptType] = useState<string>(''); | ||
188 | - const [isEdit, setIsEdit] = useState<boolean>(false); | ||
189 | - const [expandedRowKeys] = useState<Key[]>([]); | ||
190 | - const [notesType, setNotesType] = useState(1); | ||
191 | - const [notes, setNotes] = useState(1); | ||
192 | - const [rolePath, setRolePath] = useState([]); //当前角色权限(新增跟打印按钮) | ||
193 | - const userInfo = getUserInfo(); | ||
194 | - // const [tableHeight, setTableHeight] = useState(200); | ||
195 | - const [selectedRows, setSelectedRows] = useState([]); | ||
196 | - const [mainOrderIdSubOrderIdRelationsMap] = useState(new Map()); //主订单id与子订单id的对照关系,用于主订单子订单的勾选校验,子订单全选中对应的主订单自动勾选上 | ||
197 | - const [selectedMainOrderKeys, setSelectedMainOrderKeys] = useState<any[]>([]); | ||
198 | - const [selectedSubOrderKeys, setSelectedSubOrderKeys] = useState<any[]>([]); | ||
199 | - const [pageSize, setPageSize] = useState(10); | ||
200 | - const [currentPage, setCurrentPage] = useState(1); | ||
201 | - const [orderCheckType, setOrderCheckType] = useState(''); | ||
202 | - const [imagesViewerOptType, setImagesViewerOptType] = useState(''); | ||
203 | - const [filterCondifion, setFilterCondition] = useState(0); | ||
204 | - const [mainOrderSelectedMap] = useState(new Map()); //选中的主订单Map key:主订单id value:主订单数据 | ||
205 | - const [subOrderSelectedMap, setSubOrderSelectedMap] = useState(new Map()); //选中的子订单Map key:主订单id value:选中的子订单数据集合 | ||
206 | - const [currentOptMainId, setCurrentMainId] = useState<any>(undefined); //当前操作对象的主订单id | ||
207 | - const [curretnOptSubId, setCurretnOptSubId] = useState<any>(undefined); //当前操作对象的子订单id | ||
208 | - const [subOrderCount, setSubOrderCount] = useState(0); | ||
209 | - const [sorted, setSorted] = useState(false); | ||
210 | - const mainTableRef = useRef<ActionType>(); | ||
211 | - const mainTableFormRef = useRef<ProFormInstance>(); | ||
212 | - let [searchParams, setSearchParam] = useState(Object); //表格的查询条件存储 | ||
213 | - const [messageApi, contextHolder] = message.useMessage(); | ||
214 | - const [ | ||
215 | - shippingWarehouseChangeModalVisible, | ||
216 | - setShippingWarehouseChangeModalVisible, | ||
217 | - ] = useState(false); | ||
218 | - const [canApplyAfterInvoicingStatus, setCanApplyAfterInvoicingStatus] = | ||
219 | - useState([]); | ||
220 | - const [ids, setIds] = useState([]); | ||
221 | - const [recordOptNode, setRecordOptNode] = useState(null); | ||
222 | - const roleCode = userInfo?.roleSmallVO?.code; | ||
223 | - const roles = userInfo?.roles; | ||
224 | - const canMergeInvoicing = useMemo(() => { | ||
225 | - if (subOrderSelectedMap.size === 0) { | ||
226 | - return false; | ||
227 | - } | ||
228 | - // 检查 value.items 中的每个元素 | ||
229 | - console.log( | ||
230 | - 'map' + JSON.stringify([...subOrderSelectedMap.values()].flat()), | ||
231 | - ); | ||
232 | - return [...subOrderSelectedMap.values()] | ||
233 | - .flat() | ||
234 | - .every((subItem) => subItem.paths?.includes('applyInvoicing_old')); | ||
235 | - }, [selectedSubOrderKeys]); | ||
236 | - | ||
237 | - console.log(JSON.stringify(userInfo)); | ||
238 | - const triggerRecordOptNode = async (id) => { | ||
239 | - const res = await postServiceOrderGetCurrentOptNode({ | ||
240 | - query: { | ||
241 | - id, | ||
242 | - }, | ||
243 | - }); | ||
244 | - setRecordOptNode(res.data); | ||
245 | - }; | ||
246 | - | ||
247 | - const exportLoading = () => { | ||
248 | - messageApi.open({ | ||
249 | - type: 'loading', | ||
250 | - content: '正在导出文件...', | ||
251 | - duration: 0, | ||
252 | - }); | ||
253 | - }; | ||
254 | - | ||
255 | - const exportLoadingDestory = () => { | ||
256 | - messageApi.destroy(); | ||
257 | - }; | ||
258 | - | ||
259 | - const refreshTable = () => { | ||
260 | - mainTableRef.current?.reload(); | ||
261 | - //刷新表格数据的时候,取消选中行 | ||
262 | - setSelectedRows([]); | ||
263 | - setSelectedSubOrderKeys([]); | ||
264 | - }; | ||
265 | - | ||
266 | - /*useEffect(() => { | ||
267 | - let initAfterInvoicingStatus = async () => { | ||
268 | - const afteInvoicingStatus = await getAfterInvoicingStatus(); | ||
269 | - setAfterInvoicingStatus(afteInvoicingStatus); | ||
270 | - }; | ||
271 | - initAfterInvoicingStatus(); | ||
272 | - }, []);*/ | ||
273 | - | ||
274 | - useEffect(() => { | ||
275 | - // 使用URLSearchParams来解析查询参数 | ||
276 | - const params = new URLSearchParams(location.search); | ||
277 | - const id = params.get('id'); | ||
278 | - const subOrderId = params.get('subOrderId'); | ||
279 | - if (id) { | ||
280 | - mainTableFormRef.current?.setFieldValue('id', id); | ||
281 | - } | ||
282 | - if (subOrderId) { | ||
283 | - mainTableFormRef.current?.setFieldValue('subOrderId', subOrderId); | ||
284 | - } | ||
285 | - }, []); | ||
286 | - | ||
287 | - useEffect(() => { | ||
288 | - const initEnum = async () => { | ||
289 | - let invoiceTypeRet = await postServiceConstCanApplyAfterInvoicingStatus(); | ||
290 | - if (invoiceTypeRet.result === RESPONSE_CODE.SUCCESS) { | ||
291 | - setCanApplyAfterInvoicingStatus(invoiceTypeRet.data); | ||
292 | - } | ||
293 | - }; | ||
294 | - initEnum(); | ||
295 | - }, []); | ||
296 | - | ||
297 | - /** | ||
298 | - * 复制订单到剪贴板 | ||
299 | - * @param record | ||
300 | - */ | ||
301 | - function copyOrderToClipboard(record: any) { | ||
302 | - let text = ''; | ||
303 | - text += record?.id; | ||
304 | - text += ',' + record?.salesCode; | ||
305 | - text += ',' + record?.customerName; | ||
306 | - | ||
307 | - text += ',' + record?.customerContactNumber; | ||
308 | - | ||
309 | - text += ',' + record?.customerShippingAddress; | ||
310 | - | ||
311 | - if (!isSupplier()) { | ||
312 | - text += ',' + record?.institutionContactName; | ||
313 | - text += ',' + record?.institution; | ||
314 | - } | ||
315 | - record?.subOrderInformationLists?.forEach((item) => { | ||
316 | - text += '\n'; | ||
317 | - text += item?.productName; | ||
318 | - text += ' ' + item?.parameters; | ||
319 | - text += ' ' + item?.quantity; | ||
320 | - text += ' ' + item?.unit; | ||
321 | - if (!isSupplier()) { | ||
322 | - text += ' ¥' + item?.subOrderPayment; | ||
323 | - } | ||
324 | - text += ' ' + item?.id; | ||
325 | - }); | ||
326 | - if (copyToClipboard(text)) { | ||
327 | - message.info('已复制到剪贴板'); | ||
328 | - } else { | ||
329 | - message.info('无法复制到剪贴板'); | ||
330 | - } | ||
331 | - } | ||
332 | - | ||
333 | - const MyToolTip = ({ title, content }) => { | ||
334 | - return ( | ||
335 | - <Tooltip | ||
336 | - color="#FFFFFF" | ||
337 | - placement="bottom" | ||
338 | - title={<div className="px-5 py-4 text-black">{title}</div>} | ||
339 | - > | ||
340 | - {content} | ||
341 | - </Tooltip> | ||
342 | - ); | ||
343 | - }; | ||
344 | - | ||
345 | - /** | ||
346 | - * 检查是否可以打印 | ||
347 | - * @param paths 按钮集合 | ||
348 | - * @returns | ||
349 | - */ | ||
350 | - function checkePrintable(paths: any) { | ||
351 | - if ( | ||
352 | - !paths?.includes('printOrder') && | ||
353 | - !paths?.includes('supplierPrint') && | ||
354 | - !paths?.includes('procurePrint') && | ||
355 | - !paths?.includes('rePrintOrder') | ||
356 | - ) { | ||
357 | - return false; | ||
358 | - } | ||
359 | - | ||
360 | - return true; | ||
361 | - } | ||
362 | - | ||
363 | - /** | ||
364 | - * 财务是否选中排序 | ||
365 | - * @param e | ||
366 | - */ | ||
367 | - function financeSorted(e: any) { | ||
368 | - let checked = e?.target.checked; | ||
369 | - setSorted(checked); | ||
370 | - refreshTable(); | ||
371 | - } | ||
372 | - | ||
373 | - /** | ||
374 | - * 重置当前的操作对象 | ||
375 | - */ | ||
376 | - function clearOptObject() { | ||
377 | - setCurrentMainId(undefined); | ||
378 | - setCurretnOptSubId(undefined); | ||
379 | - setIsMainOrder(false); | ||
380 | - } | ||
381 | - | ||
382 | - /** | ||
383 | - * 初始化当前的操作对象 | ||
384 | - * @param subId | ||
385 | - * @param mainId | ||
386 | - */ | ||
387 | - function createOptObject(subId: any, mainId: any) { | ||
388 | - setCurrentMainId(mainId); | ||
389 | - setCurretnOptSubId(subId); | ||
390 | - } | ||
391 | - | ||
392 | - /** | ||
393 | - * 检查当前操作是否异常 | ||
394 | - */ | ||
395 | - // function checkOptValid() { | ||
396 | - // if ((currentOptMainId === undefined || currentOptMainId === null) && (curretnOptSubId === undefined || curretnOptSubId === null)) { | ||
397 | - // message.error("页面错误:当前操作对象为空,请联系系统管理员"); | ||
398 | - // return false; | ||
399 | - // } | ||
400 | - | ||
401 | - // //检查数据是否存在 | ||
402 | - // //主订单数据 | ||
403 | - // if (!Array.from(mainOrderIdSubOrderIdRelationsMap.keys()).includes(currentOptMainId)) { | ||
404 | - // message.error("页面错误:当前操作主订单对象为空,请联系系统管理员"); | ||
405 | - // } | ||
406 | - | ||
407 | - // //子订单 | ||
408 | - // let allSubIds = []; | ||
409 | - // for (const idList of mainOrderIdSubOrderIdRelationsMap.values()) { | ||
410 | - // allSubIds.push(...idList); | ||
411 | - // } | ||
412 | - // if (!allSubIds.includes(curretnOptSubId)) { | ||
413 | - // message.error("页面错误:当前操作子订单对象为空,请联系系统管理员"); | ||
414 | - // return false | ||
415 | - // } | ||
416 | - | ||
417 | - // return true; | ||
418 | - // } | ||
419 | - | ||
420 | - /** | ||
421 | - * 获取当前选中子订单的其中一个主订单 | ||
422 | - */ | ||
423 | - function getFirstMainOrder() { | ||
424 | - let mainId = [...subOrderSelectedMap.values()].flat()[0].mainOrderId; | ||
425 | - for (let item of data) { | ||
426 | - if (item.id === mainId) { | ||
427 | - return item; | ||
428 | - } | ||
429 | - } | ||
430 | - | ||
431 | - return null; | ||
432 | - } | ||
433 | - | ||
434 | - /** | ||
435 | - * 返回当前操作的主订单数据 | ||
436 | - */ | ||
437 | - function buildMainOrder() { | ||
438 | - if (currentOptMainId === undefined || currentOptMainId === null) { | ||
439 | - message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员'); | ||
440 | - return; | ||
441 | - } | ||
442 | - | ||
443 | - let mainOrderClone = null; | ||
444 | - let matchedData = data.filter((item) => { | ||
445 | - return item.id === currentOptMainId; | ||
446 | - }); | ||
447 | - if (matchedData.length > 0) { | ||
448 | - mainOrderClone = cloneDeep(matchedData[0]); | ||
449 | - } | ||
450 | - | ||
451 | - if (mainOrderClone === null) { | ||
452 | - message.error('页面错误:当前操作的主订单数据不存在,请联系系统管理员'); | ||
453 | - } | ||
454 | - | ||
455 | - return mainOrderClone; | ||
456 | - } | ||
457 | - | ||
458 | - /** | ||
459 | - * 返回当前操作的子订单集合 | ||
460 | - */ | ||
461 | - function buildSubOrders() { | ||
462 | - if (currentOptMainId === undefined || currentOptMainId === null) { | ||
463 | - message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员'); | ||
464 | - return; | ||
465 | - } | ||
466 | - | ||
467 | - let cloneSubOrders = []; | ||
468 | - | ||
469 | - //如果没有传当前操作的子订单id,说明是操作主订单 | ||
470 | - if (curretnOptSubId === undefined || curretnOptSubId === null) { | ||
471 | - //如果有选中子订单,那么取选中的子订单为操作对象,否则取当前主订单的全部子订单为操作对象 | ||
472 | - let currentOptSubOrders = subOrderSelectedMap.get(currentOptMainId); | ||
473 | - if ( | ||
474 | - currentOptSubOrders === null || | ||
475 | - currentOptSubOrders === undefined || | ||
476 | - currentOptSubOrders.length === 0 | ||
477 | - ) { | ||
478 | - for (let item of data) { | ||
479 | - if (item.id === currentOptMainId) { | ||
480 | - for (let subOrder of item?.subOrderInformationLists) { | ||
481 | - cloneSubOrders.push(cloneDeep(subOrder)); | ||
482 | - } | ||
483 | - } | ||
484 | - } | ||
485 | - } else { | ||
486 | - cloneSubOrders = currentOptSubOrders.map((item) => { | ||
487 | - return cloneDeep(item); | ||
488 | - }); | ||
489 | - } | ||
490 | - } else { | ||
491 | - //操作的是子订单 | ||
492 | - for (let item of data) { | ||
493 | - if (item.id === currentOptMainId) { | ||
494 | - for (let subOrder of item?.subOrderInformationLists) { | ||
495 | - if (subOrder.id === curretnOptSubId) { | ||
496 | - cloneSubOrders.push(cloneDeep(subOrder)); | ||
497 | - break; | ||
498 | - } | ||
499 | - } | ||
500 | - } | ||
501 | - } | ||
502 | - } | ||
503 | - | ||
504 | - if (cloneSubOrders.length === 0) { | ||
505 | - message.error('页面错误:当前操作的订单数据不存在,请联系系统管理员'); | ||
506 | - return; | ||
507 | - } | ||
508 | - | ||
509 | - return cloneSubOrders; | ||
510 | - } | ||
511 | - | ||
512 | - /** | ||
513 | - * 获取当前操作申请开票的订单总金额 | ||
514 | - */ | ||
515 | - function getApplyInvoicingTotalPayment() { | ||
516 | - let subOrders = isMainOrder | ||
517 | - ? [...subOrderSelectedMap.values()].flat() | ||
518 | - : buildSubOrders(); | ||
519 | - | ||
520 | - let totalPayment = 0; | ||
521 | - if (subOrders && subOrders.length > 0) { | ||
522 | - let mainIds = subOrders?.map((item: any) => { | ||
523 | - return item.mainOrderId; | ||
524 | - }); | ||
525 | - | ||
526 | - let uniqueMainIds = [...new Set(mainIds)]; | ||
527 | - | ||
528 | - let dataMap = data.reduce((map, obj: any) => { | ||
529 | - map.set(obj.id, obj); | ||
530 | - return map; | ||
531 | - }, new Map()); | ||
532 | - | ||
533 | - uniqueMainIds.forEach((id: any) => { | ||
534 | - let o = dataMap.get(id); | ||
535 | - if (o) { | ||
536 | - totalPayment = FloatAdd(totalPayment, o.totalPayment); | ||
537 | - } | ||
538 | - }); | ||
539 | - } | ||
540 | - return totalPayment; | ||
541 | - } | ||
542 | - | ||
543 | - /** | ||
544 | - * 根据主订单id,将该主订单下的所有子订单取消选中 | ||
545 | - */ | ||
546 | - const removeSelectedSubOrderKeysByMainOrderId = (id: any) => { | ||
547 | - let currentMainOrderAllSubOrderIds = | ||
548 | - mainOrderIdSubOrderIdRelationsMap.get(id); | ||
549 | - if (currentMainOrderAllSubOrderIds) { | ||
550 | - let newSelectedSubOrderKeys = selectedSubOrderKeys.filter((item) => { | ||
551 | - return !currentMainOrderAllSubOrderIds.includes(item); | ||
552 | - }); | ||
553 | - setSelectedSubOrderKeys(newSelectedSubOrderKeys); | ||
554 | - } | ||
555 | - }; | ||
556 | - | ||
557 | - /** | ||
558 | - * 根据主订单id取消选中主订单 | ||
559 | - * @param id | ||
560 | - */ | ||
561 | - const removeSelecetMainOrderKeyByMainOrderId = (id: any) => { | ||
562 | - if (selectedMainOrderKeys.includes(id)) { | ||
563 | - let newSelectedMainOrderKeys = selectedMainOrderKeys.filter((item) => { | ||
564 | - return item !== id; | ||
565 | - }); | ||
566 | - setSelectedMainOrderKeys(newSelectedMainOrderKeys); | ||
567 | - } | ||
568 | - }; | ||
569 | - | ||
570 | - const onCheckboxChange = (record: never) => { | ||
571 | - let newSelectedMainOrderKeys = []; | ||
572 | - if (selectedMainOrderKeys.includes(record.id)) { | ||
573 | - newSelectedMainOrderKeys = selectedMainOrderKeys.filter( | ||
574 | - (key) => key !== record.id, | ||
575 | - ); | ||
576 | - removeSelectedSubOrderKeysByMainOrderId(record.id); | ||
577 | - setSelectedRows([]); | ||
578 | - | ||
579 | - //删除选中主订单的信息 | ||
580 | - mainOrderSelectedMap.delete(record.id); | ||
581 | - //删除选中主订单附属子订单的信息 | ||
582 | - subOrderSelectedMap.delete(record.id); | ||
583 | - //总选中按钮取消选中 | ||
584 | - setAllMainChecked(false); | ||
585 | - } else { | ||
586 | - newSelectedMainOrderKeys = [...selectedMainOrderKeys, record.id]; | ||
587 | - //子订单全部自动选中 | ||
588 | - let subIds = record.subOrderInformationLists?.map((item) => { | ||
589 | - return item.id; | ||
590 | - }); | ||
591 | - let newSelectedSubOrderKeys = [...selectedSubOrderKeys]; | ||
592 | - for (let subId of subIds) { | ||
593 | - if (!selectedSubOrderKeys.includes(subId)) { | ||
594 | - newSelectedSubOrderKeys.push(subId); | ||
595 | - } | ||
596 | - } | ||
597 | - setSelectedSubOrderKeys(newSelectedSubOrderKeys); | ||
598 | - | ||
599 | - setSelectedRows(record.subOrderInformationLists); | ||
600 | - | ||
601 | - //选中主订单 | ||
602 | - mainOrderSelectedMap.set(record.id, record); | ||
603 | - //选中子订单 | ||
604 | - subOrderSelectedMap.set(record.id, record.subOrderInformationLists); | ||
605 | - setSubOrderSelectedMap(new Map(subOrderSelectedMap)); | ||
606 | - | ||
607 | - //如果所有主订单都勾选上了,那么勾选上总选中按钮 | ||
608 | - if ( | ||
609 | - mainOrderSelectedMap?.size === mainOrderIdSubOrderIdRelationsMap.size | ||
610 | - ) { | ||
611 | - setAllMainChecked(true); | ||
612 | - } | ||
613 | - } | ||
614 | - setSelectedMainOrderKeys(newSelectedMainOrderKeys); | ||
615 | - }; | ||
616 | - // const handleTableExpand = (mainOrderIds: any) => { | ||
617 | - // setExpandedRowKeys(mainOrderIds); | ||
618 | - // }; | ||
619 | - | ||
620 | - const allMainCheckBoxChange = () => { | ||
621 | - let checked = !allMainChecked; | ||
622 | - setAllMainChecked(checked); | ||
623 | - | ||
624 | - if (checked) { | ||
625 | - let mainOrderIds = data?.map((item) => { | ||
626 | - mainOrderSelectedMap.set(item.id, item); | ||
627 | - return item.id; | ||
628 | - }); | ||
629 | - | ||
630 | - let subOrderIds = []; | ||
631 | - for (let subIdList of mainOrderIdSubOrderIdRelationsMap.values()) { | ||
632 | - subOrderIds.push(...subIdList); | ||
633 | - } | ||
634 | - | ||
635 | - if (data) { | ||
636 | - for (let item of data) { | ||
637 | - mainOrderSelectedMap.set(item.id, item); | ||
638 | - | ||
639 | - subOrderSelectedMap.set(item.id, item.subOrderInformationLists); | ||
640 | - } | ||
641 | - } | ||
642 | - | ||
643 | - setSelectedMainOrderKeys(mainOrderIds); | ||
644 | - setSelectedSubOrderKeys(subOrderIds); | ||
645 | - } else { | ||
646 | - setSelectedMainOrderKeys([]); | ||
647 | - setSelectedSubOrderKeys([]); | ||
648 | - mainOrderSelectedMap.clear(); | ||
649 | - subOrderSelectedMap.clear(); | ||
650 | - } | ||
651 | - }; | ||
652 | - | ||
653 | - //表头渲染 | ||
654 | - const OrderTableHeader = () => { | ||
655 | - return ( | ||
656 | - <Flex className="w-full"> | ||
657 | - <Flex className="w-[1%] ml-[7px]"> | ||
658 | - <Checkbox | ||
659 | - onChange={allMainCheckBoxChange} | ||
660 | - checked={allMainChecked} | ||
661 | - ></Checkbox> | ||
662 | - </Flex> | ||
663 | - <Flex className="w-[30%] ml-[1%]"> | ||
664 | - <span className="font-medium">商品信息</span> | ||
665 | - </Flex> | ||
666 | - <Flex className="w-[13%]"> | ||
667 | - <span className="font-medium">交易金额</span> | ||
668 | - </Flex> | ||
669 | - | ||
670 | - {!isSupplier() ? ( | ||
671 | - <> | ||
672 | - <Flex className="w-[10%]"> | ||
673 | - <span className="font-medium">支付</span> | ||
674 | - </Flex> | ||
675 | - <Flex className="w-[12%]"> | ||
676 | - <span className="font-medium">其他</span> | ||
677 | - </Flex> | ||
678 | - </> | ||
679 | - ) : ( | ||
680 | - '' | ||
681 | - )} | ||
682 | - | ||
683 | - <Flex className="w-[10%]"> | ||
684 | - <span className="font-medium">交易状态</span> | ||
685 | - </Flex> | ||
686 | - <Flex className="w-[17%]"> | ||
687 | - <span className="font-medium">操作</span> | ||
688 | - </Flex> | ||
689 | - </Flex> | ||
690 | - ); | ||
691 | - }; | ||
692 | - //子订单内容渲染 | ||
693 | - const SubOderRander = ({ record, optRecord }) => { | ||
694 | - /** | ||
695 | - * 获取订单状态标签 | ||
696 | - * @param optRecord | ||
697 | - */ | ||
698 | - function getOrderStatusTag(optRecord: any): import('react').ReactNode { | ||
699 | - const orderStatus = optRecord.orderStatus; | ||
700 | - const paymentMethod = optRecord.paymentMethod; | ||
701 | - let orderStatusTagText = enumValueToLabel( | ||
702 | - optRecord.orderStatus, | ||
703 | - ORDER_STATUS_OPTIONS, | ||
704 | - ); | ||
705 | - | ||
706 | - if (orderStatus === 'WAIT_CONFIRM_DELIVER_AFTER_INVOICE') { | ||
707 | - if (optRecord.afterInvoicingStatus !== 'COMPLETE_INVOICING') { | ||
708 | - orderStatusTagText = '待开票'; | ||
709 | - } else { | ||
710 | - orderStatusTagText = '待确认发货'; | ||
711 | - } | ||
712 | - } | ||
713 | - | ||
714 | - //如果是未审核或者领导已审核,付款状态为预付款则需要财务审核【财务待审核】,否则仓库审核【】 | ||
715 | - if ( | ||
716 | - orderStatus === 'UNAUDITED' || | ||
717 | - orderStatus === 'LEADER_AUDITED' || | ||
718 | - orderStatus === 'PROCURE_REJECT' | ||
719 | - ) { | ||
720 | - if (paymentMethod === 'PAYMENT_IN_ADVANCE') { | ||
721 | - orderStatusTagText = '财务待审核'; | ||
722 | - } else { | ||
723 | - orderStatusTagText = '仓库待审核'; | ||
724 | - } | ||
725 | - } | ||
726 | - | ||
727 | - //如果是财务已审核,显示为【仓库待审核】 | ||
728 | - if (orderStatus === 'FINANCE_PROCESS') { | ||
729 | - orderStatusTagText = '仓库待审核'; | ||
730 | - } | ||
731 | - | ||
732 | - if (orderStatus === 'AUDIT_FAILED') { | ||
733 | - return ( | ||
734 | - <MyToolTip | ||
735 | - key="key" | ||
736 | - title={optRecord.checkNotes + ' ' + optRecord.postAuditNotes} | ||
737 | - content={ | ||
738 | - <> | ||
739 | - <Tag | ||
740 | - color={TAGS_COLOR.get(optRecord.orderStatus)} | ||
741 | - style={{ marginRight: '4px' }} | ||
742 | - > | ||
743 | - {orderStatusTagText} | ||
744 | - </Tag> | ||
745 | - <QuestionCircleOutlined style={{ color: '#C1C1C1' }} /> | ||
746 | - </> | ||
747 | - } | ||
748 | - /> | ||
749 | - ); | ||
750 | - } | ||
751 | - | ||
752 | - if ( | ||
753 | - orderStatus === 'AFTER_SALES_COMPLETION' || | ||
754 | - orderStatus === 'IN_AFTER_SALES' | ||
755 | - ) { | ||
756 | - return ( | ||
757 | - <Tag | ||
758 | - color={TAGS_COLOR.get(optRecord.orderStatus)} | ||
759 | - style={{ marginRight: '4px' }} | ||
760 | - > | ||
761 | - {orderStatusTagText} | ||
762 | - </Tag> | ||
763 | - ); | ||
764 | - } | ||
765 | - | ||
766 | - if (orderStatus === 'PROCURE_CONVERT_WAREHOUSE_KEEPER') { | ||
767 | - return ( | ||
768 | - <MyToolTip | ||
769 | - key="key" | ||
770 | - title={optRecord.checkNotes} | ||
771 | - content={ | ||
772 | - <> | ||
773 | - <Tag | ||
774 | - color={TAGS_COLOR.get(optRecord.orderStatus)} | ||
775 | - style={{ marginRight: '4px' }} | ||
776 | - > | ||
777 | - {orderStatusTagText} | ||
778 | - </Tag> | ||
779 | - <QuestionCircleOutlined style={{ color: '#C1C1C1' }} /> | ||
780 | - </> | ||
781 | - } | ||
782 | - /> | ||
783 | - ); | ||
784 | - } | ||
785 | - | ||
786 | - return ( | ||
787 | - <Tag key="key" color={TAGS_COLOR.get(optRecord.orderStatus)}> | ||
788 | - {orderStatusTagText} | ||
789 | - </Tag> | ||
790 | - ); | ||
791 | - } | ||
792 | - | ||
793 | - /** | ||
794 | - * 获取后置审核状态标签 | ||
795 | - * @param optRecord | ||
796 | - */ | ||
797 | - function getPostAuditStatusTag(optRecord: any): import('react').ReactNode { | ||
798 | - return ( | ||
799 | - <Tag key="key" color={TAGS_COLOR.get(optRecord.postAuditStatus)}> | ||
800 | - {enumValueToLabel(optRecord.postAuditStatus, POST_AUDIT_OPTIONS)} | ||
801 | - </Tag> | ||
802 | - ); | ||
803 | - } | ||
804 | - | ||
805 | - //申请开票附件处理 | ||
806 | - const getAfterAnnexList = () => { | ||
807 | - // let links = []; | ||
808 | - let afterAnnexList = optRecord.afterAnnexList; | ||
809 | - let i = 1; | ||
810 | - let images = []; | ||
811 | - let otherAnnex = []; | ||
812 | - if (afterAnnexList?.length > 0) { | ||
813 | - for (let url of afterAnnexList) { | ||
814 | - let name = getAliYunOSSFileNameFromUrl(url); | ||
815 | - if (isImageName(name)) { | ||
816 | - images.push({ name: name, url: url }); | ||
817 | - } else { | ||
818 | - otherAnnex.push({ name: '附件' + i++, url: url }); | ||
819 | - } | ||
820 | - } | ||
821 | - } | ||
822 | - | ||
823 | - return ( | ||
824 | - <div className="pl-1"> | ||
825 | - <Image.PreviewGroup | ||
826 | - className="mr-10" | ||
827 | - preview={{ | ||
828 | - onChange: (current, prev) => | ||
829 | - console.log(`current index: ${current}, prev index: ${prev}`), | ||
830 | - }} | ||
831 | - > | ||
832 | - {images.map((item, index) => ( | ||
833 | - <React.Fragment key={index}> | ||
834 | - {index > 0 ? <Divider type="vertical" /> : ''} | ||
835 | - <Image | ||
836 | - className="max-h-[50px] max-w-[70px]" | ||
837 | - src={item.url} | ||
838 | - title={item.name} | ||
839 | - />{' '} | ||
840 | - </React.Fragment> | ||
841 | - ))} | ||
842 | - </Image.PreviewGroup> | ||
843 | - {otherAnnex.map((item, index) => { | ||
844 | - return ( | ||
845 | - <Popconfirm | ||
846 | - title="下载或预览" | ||
847 | - key={index} | ||
848 | - onConfirm={() => { | ||
849 | - window.open( | ||
850 | - '/previewApi/onlinePreview?url=' + | ||
851 | - encodeURIComponent(Base64.encode(item.url)), | ||
852 | - ); | ||
853 | - }} | ||
854 | - onCancel={() => { | ||
855 | - window.open(item.url); | ||
856 | - }} | ||
857 | - okText="预览" | ||
858 | - cancelText="下载" | ||
859 | - > | ||
860 | - <Button className="px-1" key={index} type="link"> | ||
861 | - {item.name} | ||
862 | - </Button> | ||
863 | - </Popconfirm> | ||
864 | - ); | ||
865 | - })} | ||
866 | - </div> | ||
867 | - ); | ||
868 | - }; | ||
869 | - | ||
870 | - //财务审核附件处理 | ||
871 | - const getInvoicingCheckAnnexList = () => { | ||
872 | - let invoicingCheckAnnexList = optRecord.invoicingCheckAnnexList; | ||
873 | - return ( | ||
874 | - <div> | ||
875 | - <Image.PreviewGroup | ||
876 | - className="mr-10" | ||
877 | - preview={{ | ||
878 | - onChange: (current, prev) => | ||
879 | - console.log(`current index: ${current}, prev index: ${prev}`), | ||
880 | - }} | ||
881 | - > | ||
882 | - {invoicingCheckAnnexList.map((url, index) => ( | ||
883 | - <React.Fragment key={index}> | ||
884 | - <Image className="max-h-[50px] max-w-[70px]" src={url} />{' '} | ||
885 | - <Divider type="vertical" /> | ||
886 | - </React.Fragment> | ||
887 | - ))} | ||
888 | - </Image.PreviewGroup> | ||
889 | - </div> | ||
890 | - ); | ||
891 | - }; | ||
892 | - | ||
893 | - return ( | ||
894 | - <> | ||
895 | - <Flex className="w-full border-b-indigo-500"> | ||
896 | - <Flex vertical className="w-[31%]" gap="small"> | ||
897 | - {/* 商品名称 */} | ||
898 | - <div> | ||
899 | - <div | ||
900 | - className="overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer" | ||
901 | - onClick={() => { | ||
902 | - copyToClipboard(optRecord.productName); | ||
903 | - message.info('商品名称复制成功:' + optRecord.productName); | ||
904 | - }} | ||
905 | - title={optRecord.productName} | ||
906 | - > | ||
907 | - <span className="font-medium text-black "> | ||
908 | - {optRecord.productName} | ||
909 | - </span> | ||
910 | - </div> | ||
911 | - <div className="text-xs text-[#8C8C8C]"> | ||
912 | - <span | ||
913 | - className="cursor-pointer" | ||
914 | - onClick={() => { | ||
915 | - copyToClipboard(optRecord.id); | ||
916 | - message.info('子订单编号复制成功:' + optRecord.id); | ||
917 | - }} | ||
918 | - > | ||
919 | - {optRecord.id} | ||
920 | - </span> | ||
921 | - {(roleCode === 'salesRepresentative' || | ||
922 | - roleCode === 'salesManager') && | ||
923 | - !optRecord.isCurrentUserOrder ? ( | ||
924 | - <span className="text-[#f44e4e]">(非本账号订单)</span> | ||
925 | - ) : ( | ||
926 | - '' | ||
927 | - )} | ||
928 | - {optRecord.modifiedOptFlag !== null ? ( | ||
929 | - <span className="text-[#f44e4e] cursor-pointer"> | ||
930 | - {optRecord.modifiedOptFlag === 'MODIFY' ? '(修改中)' : ''} | ||
931 | - {optRecord.modifiedOptFlag === 'DELETE' ? '(删除中)' : ''} | ||
932 | - {optRecord.modifiedOptFlag === 'INSERT' ? '(新增中)' : ''} | ||
933 | - </span> | ||
934 | - ) : ( | ||
935 | - '' | ||
936 | - )} | ||
937 | - {optRecord.uid && ( | ||
938 | - <span className="text-[#f44e4e] cursor-pointer"> | ||
939 | - (商城订单) | ||
940 | - </span> | ||
941 | - )} | ||
942 | - | ||
943 | - {optRecord.modified ? ( | ||
944 | - <Tooltip title="点击查看详情"> | ||
945 | - <span | ||
946 | - className="text-[#f44e4e] cursor-pointer" | ||
947 | - onClick={async () => { | ||
948 | - createOptObject(optRecord.id, record.id); | ||
949 | - setModifiedDiffModalVisible(true); | ||
950 | - }} | ||
951 | - > | ||
952 | - (内容有变化) | ||
953 | - </span> | ||
954 | - </Tooltip> | ||
955 | - ) : ( | ||
956 | - '' | ||
957 | - )} | ||
958 | - {!optRecord.logicDelete ? ( | ||
959 | - <span className="text-[#f44e4e]">(已作废)</span> | ||
960 | - ) : ( | ||
961 | - '' | ||
962 | - )} | ||
963 | - </div> | ||
964 | - </div> | ||
965 | - | ||
966 | - <div | ||
967 | - className="overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer" | ||
968 | - title={optRecord.parameters} | ||
969 | - onClick={() => { | ||
970 | - copyToClipboard(optRecord.parameters); | ||
971 | - message.info('商品名称复制成功:' + optRecord.parameters); | ||
972 | - }} | ||
973 | - > | ||
974 | - <span className="text-[#8C8C8C]"> | ||
975 | - 参数:{optRecord.parameters} | ||
976 | - </span> | ||
977 | - </div> | ||
978 | - </Flex> | ||
979 | - <Flex className="w-[13%]" vertical gap="small"> | ||
980 | - {!isSupplier() ? ( | ||
981 | - <> | ||
982 | - <div | ||
983 | - className="overflow-hidden whitespace-no-wrap overflow-ellipsis" | ||
984 | - title={optRecord.productPrice} | ||
985 | - > | ||
986 | - <span className="text-[#8C8C8C]">单价:</span> | ||
987 | - <span className="text-slate-700"> | ||
988 | - ¥{optRecord.productPrice} | ||
989 | - </span> | ||
990 | - </div> | ||
991 | - </> | ||
992 | - ) : ( | ||
993 | - '' | ||
994 | - )} | ||
995 | - | ||
996 | - <div | ||
997 | - className="overflow-hidden whitespace-no-wrap overflow-ellipsis" | ||
998 | - title={optRecord.quantity} | ||
999 | - > | ||
1000 | - <span className="text-[#8C8C8C]">数量:</span> | ||
1001 | - <span className="text-slate-700"> | ||
1002 | - x{optRecord.quantity + ' '} | ||
1003 | - </span> | ||
1004 | - <span className="text-[#8C8C8C]">{optRecord.unit}</span> | ||
1005 | - </div> | ||
1006 | - | ||
1007 | - {!isSupplier() ? ( | ||
1008 | - <div | ||
1009 | - className="overflow-hidden whitespace-no-wrap overflow-ellipsis" | ||
1010 | - title={optRecord.subOrderPayment} | ||
1011 | - > | ||
1012 | - <span className="text-[#8C8C8C]">合计:</span> | ||
1013 | - <span className="text-slate-700"> | ||
1014 | - ¥{optRecord.subOrderPayment} | ||
1015 | - </span> | ||
1016 | - </div> | ||
1017 | - ) : ( | ||
1018 | - '' | ||
1019 | - )} | ||
1020 | - </Flex> | ||
1021 | - | ||
1022 | - <Flex className="w-[10%]" vertical gap="small"> | ||
1023 | - {!isSupplier() ? ( | ||
1024 | - <> | ||
1025 | - {/* 支付方式 */} | ||
1026 | - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
1027 | - <span className="text-slate-700"> | ||
1028 | - {optRecord.paymentMethodText} | ||
1029 | - </span> | ||
1030 | - </div> | ||
1031 | - {/* 支付渠道 */} | ||
1032 | - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
1033 | - <span className="text-slate-700"> | ||
1034 | - {enumValueToLabel( | ||
1035 | - optRecord.paymentChannel, | ||
1036 | - PAYMENT_CHANNEL_OPTIONS, | ||
1037 | - )} | ||
1038 | - </span> | ||
1039 | - </div> | ||
1040 | - {/* 回款审核状态 */} | ||
1041 | - {optRecord.paymentReceiptStatus !== null ? ( | ||
1042 | - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
1043 | - <Tag | ||
1044 | - className="hover:cursor-pointer" | ||
1045 | - onMouseEnter={(e: any) => { | ||
1046 | - e.target.innerText = '点击查看回款凭证'; | ||
1047 | - }} | ||
1048 | - onMouseLeave={(e: any) => { | ||
1049 | - e.target.innerText = enumValueToLabel( | ||
1050 | - optRecord.paymentReceiptStatus, | ||
1051 | - PAYMENT_RECEIPTS_STATUS_OPTIONS, | ||
1052 | - ); | ||
1053 | - }} | ||
1054 | - onClick={() => { | ||
1055 | - createOptObject(optRecord.id, record.id); | ||
1056 | - setImagesViewerOptType('paymentReceipt'); | ||
1057 | - setImagesViewerModalVisible(true); | ||
1058 | - }} | ||
1059 | - key="key" | ||
1060 | - color={TAGS_COLOR.get(optRecord.paymentReceiptStatus)} | ||
1061 | - > | ||
1062 | - {enumValueToLabel( | ||
1063 | - optRecord.paymentReceiptStatus, | ||
1064 | - PAYMENT_RECEIPTS_STATUS_OPTIONS, | ||
1065 | - )} | ||
1066 | - </Tag> | ||
1067 | - </div> | ||
1068 | - ) : ( | ||
1069 | - '' | ||
1070 | - )} | ||
1071 | - </> | ||
1072 | - ) : ( | ||
1073 | - '' | ||
1074 | - )} | ||
1075 | - </Flex> | ||
1076 | - <Flex className="w-[13%]" vertical gap="small"> | ||
1077 | - {!isSupplier() ? ( | ||
1078 | - <> | ||
1079 | - {/* 所属部门 */} | ||
1080 | - <div | ||
1081 | - className="overflow-hidden whitespace-no-wrap overflow-ellipsis" | ||
1082 | - title={enumValueToLabel( | ||
1083 | - optRecord.productBelongBusiness, | ||
1084 | - PRODUCT_BELONG_DEPARTMENT_OPTIONS, | ||
1085 | - )} | ||
1086 | - > | ||
1087 | - <span className="text-slate-700"> | ||
1088 | - {enumValueToLabel( | ||
1089 | - optRecord.productBelongBusiness, | ||
1090 | - PRODUCT_BELONG_DEPARTMENT_OPTIONS, | ||
1091 | - )} | ||
1092 | - </span> | ||
1093 | - </div> | ||
1094 | - | ||
1095 | - {/* 开票类型 */} | ||
1096 | - {optRecord.invoicingStatus !== null ? ( | ||
1097 | - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
1098 | - <span className="text-slate-700"> | ||
1099 | - {getInvoicingType(optRecord)} | ||
1100 | - </span> | ||
1101 | - </div> | ||
1102 | - ) : ( | ||
1103 | - '' | ||
1104 | - )} | ||
1105 | - | ||
1106 | - {/* 开票状态 */} | ||
1107 | - {optRecord.afterInvoicingStatus !== null ? ( | ||
1108 | - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
1109 | - <Tooltip | ||
1110 | - title={ | ||
1111 | - optRecord.invoicingUrgentCause !== null && | ||
1112 | - optRecord.afterInvoicingStatus === | ||
1113 | - 'URGENT_INVOICE_AUDITING' | ||
1114 | - ? optRecord.invoicingUrgentCause | ||
1115 | - : enumValueToLabel( | ||
1116 | - optRecord.afterInvoicingStatus, | ||
1117 | - AFTER_INVOICING_STATUS, | ||
1118 | - ) | ||
1119 | - } | ||
1120 | - > | ||
1121 | - <Tag | ||
1122 | - color={TAGS_COLOR.get(optRecord.afterInvoicingStatus)} | ||
1123 | - > | ||
1124 | - {enumValueToLabel( | ||
1125 | - optRecord.afterInvoicingStatus, | ||
1126 | - AFTER_INVOICING_STATUS, | ||
1127 | - )} | ||
1128 | - </Tag> | ||
1129 | - </Tooltip> | ||
1130 | - </div> | ||
1131 | - ) : ( | ||
1132 | - '' | ||
1133 | - )} | ||
1134 | - | ||
1135 | - {/* 是否加急图标显示 */} | ||
1136 | - {optRecord.isUrgent ? ( | ||
1137 | - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
1138 | - <Tooltip | ||
1139 | - title={'期望开票时间:' + formatdate(optRecord.deadline)} | ||
1140 | - > | ||
1141 | - <Tag color="red">加急开票</Tag> | ||
1142 | - </Tooltip> | ||
1143 | - </div> | ||
1144 | - ) : ( | ||
1145 | - '' | ||
1146 | - )} | ||
1147 | - | ||
1148 | - {(roleCode === 'warehouseKeeper' || roleCode === 'admin') && | ||
1149 | - optRecord.shippingWarehouse !== null ? ( | ||
1150 | - <div | ||
1151 | - className="overflow-hidden whitespace-no-wrap overflow-ellipsis" | ||
1152 | - title={enumValueToLabel( | ||
1153 | - optRecord.shippingWarehouse, | ||
1154 | - SHIPPING_WAREHOUSE_OPTIONS, | ||
1155 | - )} | ||
1156 | - > | ||
1157 | - <span className="text-slate-700"> | ||
1158 | - {enumValueToLabel( | ||
1159 | - optRecord.shippingWarehouse, | ||
1160 | - SHIPPING_WAREHOUSE_OPTIONS, | ||
1161 | - )} | ||
1162 | - </span> | ||
1163 | - </div> | ||
1164 | - ) : ( | ||
1165 | - '' | ||
1166 | - )} | ||
1167 | - | ||
1168 | - {/* 生产时间 */} | ||
1169 | - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
1170 | - {optRecord.productionStartTime !== null || | ||
1171 | - optRecord.productionEndTime !== null ? ( | ||
1172 | - <MyToolTip | ||
1173 | - title={ | ||
1174 | - formatdate(optRecord.productionStartTime) + | ||
1175 | - ' 至 ' + | ||
1176 | - formatdate(optRecord.productionEndTime) | ||
1177 | - } | ||
1178 | - content={ | ||
1179 | - <Button type="link" size="small" style={{ padding: 0 }}> | ||
1180 | - 生产时间 | ||
1181 | - </Button> | ||
1182 | - } | ||
1183 | - /> | ||
1184 | - ) : ( | ||
1185 | - '' | ||
1186 | - )} | ||
1187 | - </div> | ||
1188 | - </> | ||
1189 | - ) : ( | ||
1190 | - '' | ||
1191 | - )} | ||
1192 | - </Flex> | ||
1193 | - | ||
1194 | - <Flex className="w-[10%]" vertical gap="small"> | ||
1195 | - {/* 开票状态 */} | ||
1196 | - {!isSupplier() ? ( | ||
1197 | - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
1198 | - <Tag | ||
1199 | - color={ | ||
1200 | - optRecord.invoicingTime === null || | ||
1201 | - optRecord.invoicingTime === undefined | ||
1202 | - ? TAGS_COLOR.get(optRecord.invoicingStatus) | ||
1203 | - : 'success' | ||
1204 | - } | ||
1205 | - > | ||
1206 | - {getNeedInvoicing(optRecord)} | ||
1207 | - </Tag> | ||
1208 | - </div> | ||
1209 | - ) : ( | ||
1210 | - '' | ||
1211 | - )} | ||
1212 | - | ||
1213 | - {/* 订单状态 */} | ||
1214 | - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
1215 | - {getOrderStatusTag(optRecord)} | ||
1216 | - </div> | ||
1217 | - | ||
1218 | - {/* 确认发票状态 */} | ||
1219 | - {optRecord.invoiceConfirmStatusText !== null && ( | ||
1220 | - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
1221 | - <Tag color={'success'} style={{ marginRight: '4px' }}> | ||
1222 | - {optRecord.invoiceConfirmStatusText} | ||
1223 | - </Tag> | ||
1224 | - </div> | ||
1225 | - )} | ||
1226 | - | ||
1227 | - {/* 后置审核状态 */} | ||
1228 | - {optRecord.postAuditStatus !== null ? ( | ||
1229 | - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
1230 | - {getPostAuditStatusTag(optRecord)} | ||
1231 | - </div> | ||
1232 | - ) : ( | ||
1233 | - '' | ||
1234 | - )} | ||
1235 | - | ||
1236 | - {/**采购是否已下单状态 */} | ||
1237 | - {optRecord.procureOrderStatus !== null && | ||
1238 | - optRecord.procureOrderStatus !== undefined ? ( | ||
1239 | - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
1240 | - <Tag color="success"> | ||
1241 | - {enumValueToLabel( | ||
1242 | - optRecord.procureOrderStatus, | ||
1243 | - PROCURE_ORDER_STATUS, | ||
1244 | - )} | ||
1245 | - </Tag> | ||
1246 | - </div> | ||
1247 | - ) : ( | ||
1248 | - '' | ||
1249 | - )} | ||
1250 | - | ||
1251 | - {/* 物流信息 */} | ||
1252 | - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
1253 | - {optRecord.orderStatus === 'CONFIRM_RECEIPT' || | ||
1254 | - optRecord.orderStatus === 'AFTER_SALES_COMPLETION' || | ||
1255 | - optRecord.orderStatus === 'IN_AFTER_SALES' || | ||
1256 | - optRecord.orderStatus === 'SHIPPED' ? ( | ||
1257 | - <MyToolTip | ||
1258 | - title={ | ||
1259 | - optRecord.serialNumber === undefined | ||
1260 | - ? '暂无物流信息' | ||
1261 | - : enumValueToLabel( | ||
1262 | - optRecord.logisticsMethod, | ||
1263 | - LOGISTICS_STATUS_OPTIONS, | ||
1264 | - ) + | ||
1265 | - ' ' + | ||
1266 | - optRecord.serialNumber + | ||
1267 | - ' ' + | ||
1268 | - optRecord.logisticsNotes | ||
1269 | - } | ||
1270 | - content={ | ||
1271 | - <Button type="link" size="small" style={{ padding: 0 }}> | ||
1272 | - 物流信息 | ||
1273 | - </Button> | ||
1274 | - } | ||
1275 | - /> | ||
1276 | - ) : ( | ||
1277 | - '' | ||
1278 | - )} | ||
1279 | - | ||
1280 | - {/* 修改审核状态 */} | ||
1281 | - {optRecord.modifiedAuditStatus !== null && | ||
1282 | - optRecord.modifiedAuditStatus !== 'AUDIT_FAILURE' ? ( | ||
1283 | - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
1284 | - <Tooltip | ||
1285 | - title={recordOptNode ? recordOptNode : <Spin />} | ||
1286 | - onOpenChange={(open) => { | ||
1287 | - console.log('open:' + open); | ||
1288 | - console.log('id:' + optRecord.id); | ||
1289 | - if (open) { | ||
1290 | - triggerRecordOptNode(optRecord.id); | ||
1291 | - } else { | ||
1292 | - setRecordOptNode(null); | ||
1293 | - } | ||
1294 | - }} | ||
1295 | - > | ||
1296 | - <Tag color={TAGS_COLOR.get(optRecord.modifiedAuditStatus)}> | ||
1297 | - {enumValueToLabel( | ||
1298 | - optRecord.modifiedAuditStatus, | ||
1299 | - MODIFIED_AUDIT_STATUS_OPTIONS, | ||
1300 | - )} | ||
1301 | - </Tag> | ||
1302 | - </Tooltip> | ||
1303 | - </div> | ||
1304 | - ) : ( | ||
1305 | - '' | ||
1306 | - )} | ||
1307 | - | ||
1308 | - {optRecord.modifiedAuditStatus === 'AUDIT_FAILURE' ? ( | ||
1309 | - <MyToolTip | ||
1310 | - key="key" | ||
1311 | - title={optRecord.modifiedAuditNotes} | ||
1312 | - content={ | ||
1313 | - <> | ||
1314 | - <Tag | ||
1315 | - color={TAGS_COLOR.get(optRecord.modifiedAuditNotes)} | ||
1316 | - style={{ marginRight: '4px' }} | ||
1317 | - > | ||
1318 | - {enumValueToLabel( | ||
1319 | - optRecord.modifiedAuditStatus, | ||
1320 | - MODIFIED_AUDIT_STATUS_OPTIONS, | ||
1321 | - )} | ||
1322 | - </Tag> | ||
1323 | - <QuestionCircleOutlined style={{ color: '#C1C1C1' }} /> | ||
1324 | - </> | ||
1325 | - } | ||
1326 | - /> | ||
1327 | - ) : ( | ||
1328 | - '' | ||
1329 | - )} | ||
1330 | - </div> | ||
1331 | - </Flex> | ||
1332 | - <Flex className="w-[18%]" wrap="wrap" gap="small"> | ||
1333 | - {optRecord.paths?.includes('postAudit') ? ( | ||
1334 | - <Button | ||
1335 | - className="p-0" | ||
1336 | - type="link" | ||
1337 | - onClick={() => { | ||
1338 | - createOptObject(optRecord.id, record.id); | ||
1339 | - setCheckVisible(true); | ||
1340 | - setOrderCheckType(CHECK_TYPE.WAITING_FOR_POST_AUDIT); | ||
1341 | - }} | ||
1342 | - > | ||
1343 | - 后置审核 | ||
1344 | - </Button> | ||
1345 | - ) : ( | ||
1346 | - '' | ||
1347 | - )} | ||
1348 | - {/* 加急审核 */} | ||
1349 | - {optRecord.paths?.includes('URGENT_INVOICE_AUDITING') ? ( | ||
1350 | - <Button | ||
1351 | - className="p-0" | ||
1352 | - type="link" | ||
1353 | - onClick={() => { | ||
1354 | - console.log('here'); | ||
1355 | - setCurrentMainId(record.id); | ||
1356 | - setCurretnOptSubId(optRecord.id); | ||
1357 | - setCheckVisible(true); | ||
1358 | - setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING); | ||
1359 | - }} | ||
1360 | - > | ||
1361 | - 加急审核(新) | ||
1362 | - </Button> | ||
1363 | - ) : ( | ||
1364 | - '' | ||
1365 | - )} | ||
1366 | - {optRecord.paths?.includes('URGENT_INVOICE_AUDITING_old') ? ( | ||
1367 | - <Button | ||
1368 | - className="p-0" | ||
1369 | - type="link" | ||
1370 | - onClick={() => { | ||
1371 | - console.log('here'); | ||
1372 | - setCurrentMainId(record.id); | ||
1373 | - setCurretnOptSubId(optRecord.id); | ||
1374 | - setCheckVisible(true); | ||
1375 | - setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD); | ||
1376 | - }} | ||
1377 | - > | ||
1378 | - 加急审核(旧) | ||
1379 | - </Button> | ||
1380 | - ) : ( | ||
1381 | - '' | ||
1382 | - )} | ||
1383 | - {optRecord.paths?.includes('salesConfirm') && ( | ||
1384 | - <ButtonConfirm | ||
1385 | - className="p-0" | ||
1386 | - title="是否确认此商城订单信息无误?确认无误之后订单将进入审核流程。" | ||
1387 | - text="订单确认" | ||
1388 | - onConfirm={async () => { | ||
1389 | - let res = await postServiceOrderSalesConfirm({ | ||
1390 | - data: { | ||
1391 | - subOrderIds: [optRecord.id], | ||
1392 | - }, | ||
1393 | - }); | ||
1394 | - | ||
1395 | - if (res && res.result === RESPONSE_CODE.SUCCESS) { | ||
1396 | - message.success(res.message); | ||
1397 | - refreshTable(); | ||
1398 | - } | ||
1399 | - }} | ||
1400 | - /> | ||
1401 | - )} | ||
1402 | - {optRecord.paths?.includes('uploadPaymentReceiptBill') ? ( | ||
1403 | - <Button | ||
1404 | - className="p-0" | ||
1405 | - type="link" | ||
1406 | - onClick={() => { | ||
1407 | - createOptObject(optRecord.id, record.id); | ||
1408 | - setUploadPayBillModalVisible(true); | ||
1409 | - }} | ||
1410 | - > | ||
1411 | - 回款 | ||
1412 | - </Button> | ||
1413 | - ) : ( | ||
1414 | - '' | ||
1415 | - )} | ||
1416 | - {optRecord.paths?.includes('reissue_old') ? ( | ||
1417 | - /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'|| | ||
1418 | - optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/ | ||
1419 | - <Button | ||
1420 | - className="p-0" | ||
1421 | - type="link" | ||
1422 | - onClick={() => { | ||
1423 | - setCurrentMainId(record.id); | ||
1424 | - setReissueVisibleOld(true); | ||
1425 | - }} | ||
1426 | - > | ||
1427 | - 重新开票(旧) | ||
1428 | - </Button> | ||
1429 | - ) : ( | ||
1430 | - '' | ||
1431 | - )} | ||
1432 | - {optRecord.paths?.includes('reissue') ? ( | ||
1433 | - /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'|| | ||
1434 | - optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/ | ||
1435 | - <Button | ||
1436 | - className="p-0" | ||
1437 | - type="link" | ||
1438 | - onClick={() => { | ||
1439 | - setCurrentMainId(record.id); | ||
1440 | - setCurretnOptSubId(optRecord.id); | ||
1441 | - setReissueVisible(true); | ||
1442 | - }} | ||
1443 | - > | ||
1444 | - 重新开票(新) | ||
1445 | - </Button> | ||
1446 | - ) : ( | ||
1447 | - '' | ||
1448 | - )} | ||
1449 | - | ||
1450 | - {optRecord.paths?.includes('confirmReissue_old') ? ( | ||
1451 | - <Button | ||
1452 | - className="p-0" | ||
1453 | - type="link" | ||
1454 | - onClick={() => { | ||
1455 | - setCurrentMainId(record.id); | ||
1456 | - setCurretnOptSubId(optRecord.id); | ||
1457 | - setCheckVisible(true); | ||
1458 | - setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE_OLD); | ||
1459 | - }} | ||
1460 | - > | ||
1461 | - 重新开票审核(旧) | ||
1462 | - </Button> | ||
1463 | - ) : ( | ||
1464 | - '' | ||
1465 | - )} | ||
1466 | - {optRecord.paths?.includes('confirmReissue') ? ( | ||
1467 | - <Button | ||
1468 | - className="p-0" | ||
1469 | - type="link" | ||
1470 | - onClick={() => { | ||
1471 | - setCurrentMainId(record.id); | ||
1472 | - setCurretnOptSubId(optRecord.id); | ||
1473 | - setCheckVisible(true); | ||
1474 | - setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE); | ||
1475 | - }} | ||
1476 | - > | ||
1477 | - 重新开票审核(新) | ||
1478 | - </Button> | ||
1479 | - ) : ( | ||
1480 | - '' | ||
1481 | - )} | ||
1482 | - | ||
1483 | - {optRecord.paths?.includes('leaderAudit') ? ( | ||
1484 | - <Button | ||
1485 | - className="p-0" | ||
1486 | - type="link" | ||
1487 | - onClick={() => { | ||
1488 | - setCurrentMainId(record.id); | ||
1489 | - setCurretnOptSubId(optRecord.id); | ||
1490 | - setCheckVisible(true); | ||
1491 | - setOrderCheckType(CHECK_TYPE.LEADER_AUDIT); | ||
1492 | - }} | ||
1493 | - > | ||
1494 | - 审核 | ||
1495 | - </Button> | ||
1496 | - ) : ( | ||
1497 | - '' | ||
1498 | - )} | ||
1499 | - | ||
1500 | - {optRecord.paths?.includes('creditAudit') ? ( | ||
1501 | - <Button | ||
1502 | - className="p-0" | ||
1503 | - type="link" | ||
1504 | - onClick={() => { | ||
1505 | - setCurrentMainId(record.id); | ||
1506 | - setCurretnOptSubId(optRecord.id); | ||
1507 | - setCheckVisible(true); | ||
1508 | - setOrderCheckType(CHECK_TYPE.CREDIT_AUDIT); | ||
1509 | - }} | ||
1510 | - > | ||
1511 | - 赊账审核 | ||
1512 | - </Button> | ||
1513 | - ) : ( | ||
1514 | - '' | ||
1515 | - )} | ||
1516 | - | ||
1517 | - {optRecord.paths?.includes('auditPaymentReceipt') ? ( | ||
1518 | - <Button | ||
1519 | - className="p-0" | ||
1520 | - type="link" | ||
1521 | - onClick={() => { | ||
1522 | - createOptObject(optRecord.id, record.id); | ||
1523 | - setCheckVisible(true); | ||
1524 | - setOrderCheckType(CHECK_TYPE.PAYMENT_RECEIPTS_AUDIT); | ||
1525 | - }} | ||
1526 | - > | ||
1527 | - 回款审核 | ||
1528 | - </Button> | ||
1529 | - ) : ( | ||
1530 | - '' | ||
1531 | - )} | ||
1532 | - | ||
1533 | - {optRecord.paths?.includes('modifiedAuditRequest') ? ( | ||
1534 | - <Button | ||
1535 | - className="p-0" | ||
1536 | - type="link" | ||
1537 | - onClick={() => { | ||
1538 | - createOptObject(optRecord.id, record.id); | ||
1539 | - setCheckVisible(true); | ||
1540 | - setOrderCheckType(CHECK_TYPE.NODE_OPERATING_AUDIT); | ||
1541 | - }} | ||
1542 | - > | ||
1543 | - 节点修改审核 | ||
1544 | - </Button> | ||
1545 | - ) : ( | ||
1546 | - '' | ||
1547 | - )} | ||
1548 | - | ||
1549 | - {optRecord.paths?.includes('applyModify') ? ( | ||
1550 | - <Button | ||
1551 | - className="p-0" | ||
1552 | - type="link" | ||
1553 | - onClick={() => { | ||
1554 | - createOptObject(optRecord.id, record.id); | ||
1555 | - setOrderDrawerVisible(true); | ||
1556 | - setOrderOptType('order-change-normal'); | ||
1557 | - }} | ||
1558 | - > | ||
1559 | - 申请修改 | ||
1560 | - </Button> | ||
1561 | - ) : ( | ||
1562 | - '' | ||
1563 | - )} | ||
1564 | - | ||
1565 | - {optRecord.paths?.includes('modifiedLeaderAuditRequest') ? ( | ||
1566 | - <Button | ||
1567 | - className="p-0" | ||
1568 | - type="link" | ||
1569 | - onClick={() => { | ||
1570 | - createOptObject(optRecord.id, record.id); | ||
1571 | - setCheckVisible(true); | ||
1572 | - setOrderCheckType(CHECK_TYPE.MODIFY_LEADER_AUDIT); | ||
1573 | - }} | ||
1574 | - > | ||
1575 | - 领导修改审核 | ||
1576 | - </Button> | ||
1577 | - ) : ( | ||
1578 | - '' | ||
1579 | - )} | ||
1580 | - | ||
1581 | - {optRecord.paths?.includes('shippingWarehouseChangeRequest') ? ( | ||
1582 | - <Button | ||
1583 | - className="p-0" | ||
1584 | - type="link" | ||
1585 | - onClick={() => { | ||
1586 | - setIds([optRecord.id]); | ||
1587 | - createOptObject(optRecord.id, record.id); | ||
1588 | - setShippingWarehouseChangeModalVisible(true); | ||
1589 | - }} | ||
1590 | - > | ||
1591 | - 修改仓库 | ||
1592 | - </Button> | ||
1593 | - ) : ( | ||
1594 | - '' | ||
1595 | - )} | ||
1596 | - | ||
1597 | - {optRecord.paths?.includes('saleCancelInvoicing_old') ? ( | ||
1598 | - <ButtonConfirm | ||
1599 | - className="p-0" | ||
1600 | - title="确认取消申请开票?" | ||
1601 | - text="取消申请(旧)" | ||
1602 | - onConfirm={async () => { | ||
1603 | - let res = await postServiceOrderSaleCancelInvoicing({ | ||
1604 | - data: { | ||
1605 | - subOrderIds: [optRecord.id], | ||
1606 | - }, | ||
1607 | - }); | ||
1608 | - | ||
1609 | - if (res && res.result === RESPONSE_CODE.SUCCESS) { | ||
1610 | - message.success(res.message); | ||
1611 | - refreshTable(); | ||
1612 | - } | ||
1613 | - }} | ||
1614 | - /> | ||
1615 | - ) : ( | ||
1616 | - '' | ||
1617 | - )} | ||
1618 | - {optRecord.paths?.includes('saleCancelInvoicing') ? ( | ||
1619 | - <ButtonConfirm | ||
1620 | - className="p-0" | ||
1621 | - title="确认取消申请开票?" | ||
1622 | - text="取消申请(新)" | ||
1623 | - onConfirm={async () => { | ||
1624 | - let res = await postServiceInvoiceCancelApply({ | ||
1625 | - data: { | ||
1626 | - subOrderIds: [optRecord.id], | ||
1627 | - }, | ||
1628 | - }); | ||
1629 | - | ||
1630 | - if (res && res.result === RESPONSE_CODE.SUCCESS) { | ||
1631 | - message.success(res.message); | ||
1632 | - refreshTable(); | ||
1633 | - } | ||
1634 | - }} | ||
1635 | - /> | ||
1636 | - ) : ( | ||
1637 | - '' | ||
1638 | - )} | ||
1639 | - {optRecord.paths?.includes('noNeedInvoicingEdit') ? ( | ||
1640 | - <Button | ||
1641 | - className="p-0" | ||
1642 | - type="link" | ||
1643 | - onClick={() => { | ||
1644 | - createOptObject(optRecord.id, record.id); | ||
1645 | - setFinancialEditVisible(true); | ||
1646 | - setIsMainOrder(false); | ||
1647 | - }} | ||
1648 | - > | ||
1649 | - 编辑时间 | ||
1650 | - </Button> | ||
1651 | - ) : ( | ||
1652 | - '' | ||
1653 | - )} | ||
1654 | - {optRecord.paths?.includes('sendProduct') ? ( | ||
1655 | - <Button | ||
1656 | - className="p-0" | ||
1657 | - type="link" | ||
1658 | - onClick={() => { | ||
1659 | - createOptObject(optRecord.id, record.id); | ||
1660 | - setDeliverVisible(true); | ||
1661 | - setIsSendProduct(true); | ||
1662 | - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | ||
1663 | - }} | ||
1664 | - > | ||
1665 | - 仓库发货 | ||
1666 | - </Button> | ||
1667 | - ) : ( | ||
1668 | - '' | ||
1669 | - )} | ||
1670 | - | ||
1671 | - {optRecord.paths?.includes('supplierSendOrder') ? ( | ||
1672 | - <Button | ||
1673 | - className="p-0" | ||
1674 | - type="link" | ||
1675 | - onClick={() => { | ||
1676 | - optRecord.mainOrderId = record.id; | ||
1677 | - setSelectedRows([cloneDeep(optRecord)]); //克隆一份数据,避免后续修改污染 | ||
1678 | - setDeliverVisible(true); | ||
1679 | - setIsSendProduct(true); | ||
1680 | - setOrderCheckType(CHECK_TYPE.SUPPLIER); | ||
1681 | - }} | ||
1682 | - > | ||
1683 | - 供应商发货 | ||
1684 | - </Button> | ||
1685 | - ) : ( | ||
1686 | - '' | ||
1687 | - )} | ||
1688 | - | ||
1689 | - {optRecord.paths?.includes('procureSend') ? ( | ||
1690 | - <Button | ||
1691 | - className="p-0" | ||
1692 | - type="link" | ||
1693 | - onClick={() => { | ||
1694 | - createOptObject(optRecord.id, record.id); | ||
1695 | - setDeliverVisible(true); | ||
1696 | - setIsSendProduct(true); | ||
1697 | - setOrderCheckType(CHECK_TYPE.PROCURE); | ||
1698 | - }} | ||
1699 | - > | ||
1700 | - {isSupplier() ? '发货' : '采购发货'} | ||
1701 | - </Button> | ||
1702 | - ) : ( | ||
1703 | - '' | ||
1704 | - )} | ||
1705 | - | ||
1706 | - {optRecord.paths?.includes('editProductionTime') ? ( | ||
1707 | - <Button | ||
1708 | - className="p-0" | ||
1709 | - type="link" | ||
1710 | - onClick={() => { | ||
1711 | - createOptObject(optRecord.id, record.id); | ||
1712 | - setProductionTimeModalVisible(true); | ||
1713 | - }} | ||
1714 | - > | ||
1715 | - 生产时间 | ||
1716 | - </Button> | ||
1717 | - ) : ( | ||
1718 | - '' | ||
1719 | - )} | ||
1720 | - | ||
1721 | - {optRecord.paths?.includes('queryAnnex') && | ||
1722 | - optRecord.listAnnex?.length > 0 ? ( | ||
1723 | - <Button | ||
1724 | - className="p-0" | ||
1725 | - type="link" | ||
1726 | - onClick={() => { | ||
1727 | - optRecord.mainOrderId = record.id; | ||
1728 | - createOptObject(optRecord.id, record.id); | ||
1729 | - setAttachmentModalVisible(true); | ||
1730 | - }} | ||
1731 | - > | ||
1732 | - 附件 | ||
1733 | - </Button> | ||
1734 | - ) : ( | ||
1735 | - '' | ||
1736 | - )} | ||
1737 | - | ||
1738 | - {optRecord.paths?.includes('modifySendInformation') ? ( | ||
1739 | - <Button | ||
1740 | - className="p-0" | ||
1741 | - type="link" | ||
1742 | - onClick={() => { | ||
1743 | - createOptObject(optRecord.id, record.id); | ||
1744 | - setDeliverVisible(true); | ||
1745 | - setIsSendProduct(false); | ||
1746 | - }} | ||
1747 | - > | ||
1748 | - 修改发货信息 | ||
1749 | - </Button> | ||
1750 | - ) : ( | ||
1751 | - '' | ||
1752 | - )} | ||
1753 | - | ||
1754 | - {optRecord.paths?.includes('printOrder') ? ( | ||
1755 | - <Button | ||
1756 | - className="p-0" | ||
1757 | - type="link" | ||
1758 | - onClick={async () => { | ||
1759 | - createOptObject(optRecord.id, record.id); | ||
1760 | - setOrderPrintVisible(true); | ||
1761 | - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | ||
1762 | - }} | ||
1763 | - > | ||
1764 | - 仓库打印 | ||
1765 | - </Button> | ||
1766 | - ) : ( | ||
1767 | - '' | ||
1768 | - )} | ||
1769 | - | ||
1770 | - {optRecord.paths?.includes('supplierPrint') ? ( | ||
1771 | - <Button | ||
1772 | - className="p-0" | ||
1773 | - type="link" | ||
1774 | - onClick={async () => { | ||
1775 | - createOptObject(optRecord.id, record.id); | ||
1776 | - setOrderPrintVisible(true); | ||
1777 | - setOrderCheckType(CHECK_TYPE.SUPPLIER); | ||
1778 | - }} | ||
1779 | - > | ||
1780 | - 供应商打印 | ||
1781 | - </Button> | ||
1782 | - ) : ( | ||
1783 | - '' | ||
1784 | - )} | ||
1785 | - | ||
1786 | - {optRecord.paths?.includes('procurePrint') ? ( | ||
1787 | - <ButtonConfirm | ||
1788 | - className="p-0" | ||
1789 | - title="确认打印?" | ||
1790 | - text="采购打印" | ||
1791 | - onConfirm={async () => { | ||
1792 | - let res = await postServiceOrderProcurePrint({ | ||
1793 | - data: { | ||
1794 | - ids: [optRecord.id], | ||
1795 | - }, | ||
1796 | - }); | ||
1797 | - | ||
1798 | - if (res.result === RESPONSE_CODE.SUCCESS) { | ||
1799 | - message.success(res.message); | ||
1800 | - refreshTable(); | ||
1801 | - } | ||
1802 | - }} | ||
1803 | - /> | ||
1804 | - ) : ( | ||
1805 | - // <Button | ||
1806 | - // className="p-0" | ||
1807 | - // type="link" | ||
1808 | - // onClick={async () => { | ||
1809 | - // setOrderPrintVisible(true); | ||
1810 | - // setSelectedRows([optRecord]); | ||
1811 | - // setOrderRow(record); | ||
1812 | - // setOrderCheckType(CHECK_TYPE.PROCURE); | ||
1813 | - // }} | ||
1814 | - // > | ||
1815 | - // 采购打印 | ||
1816 | - // </Button> | ||
1817 | - '' | ||
1818 | - )} | ||
1819 | - | ||
1820 | - {optRecord.paths?.includes('editOrder') && false ? ( | ||
1821 | - <Button | ||
1822 | - className="p-0" | ||
1823 | - type="link" | ||
1824 | - onClick={() => { | ||
1825 | - createOptObject(optRecord.id, record.id); | ||
1826 | - setFinancialVisible(true); | ||
1827 | - setIsEdit(true); | ||
1828 | - }} | ||
1829 | - > | ||
1830 | - 编辑 | ||
1831 | - </Button> | ||
1832 | - ) : ( | ||
1833 | - '' | ||
1834 | - )} | ||
1835 | - | ||
1836 | - {optRecord.paths?.includes('invoicing') ? ( | ||
1837 | - <Button | ||
1838 | - className="p-0" | ||
1839 | - type="link" | ||
1840 | - onClick={() => { | ||
1841 | - createOptObject(optRecord.id, record.id); | ||
1842 | - setFinancialVisible(true); | ||
1843 | - setIsEdit(false); | ||
1844 | - setIsMainOrder(false); | ||
1845 | - }} | ||
1846 | - > | ||
1847 | - 开票 | ||
1848 | - </Button> | ||
1849 | - ) : ( | ||
1850 | - '' | ||
1851 | - )} | ||
1852 | - | ||
1853 | - {optRecord.paths?.includes('applyInvoicing') ? ( | ||
1854 | - <Button | ||
1855 | - className="p-0" | ||
1856 | - type="link" | ||
1857 | - onClick={() => { | ||
1858 | - setInvoicingDrawerFormVisible(true); | ||
1859 | - createOptObject(optRecord.id, record.id); | ||
1860 | - setIsEdit(false); | ||
1861 | - setIsMainOrder(false); | ||
1862 | - }} | ||
1863 | - > | ||
1864 | - 申请开票(新) | ||
1865 | - </Button> | ||
1866 | - ) : ( | ||
1867 | - '' | ||
1868 | - )} | ||
1869 | - | ||
1870 | - {optRecord.paths?.includes('applyInvoicing_old') ? ( | ||
1871 | - <Button | ||
1872 | - className="p-0" | ||
1873 | - type="link" | ||
1874 | - onClick={() => { | ||
1875 | - setApplyForInvoicingVisible(true); | ||
1876 | - createOptObject(optRecord.id, record.id); | ||
1877 | - setIsEdit(false); | ||
1878 | - setIsMainOrder(false); | ||
1879 | - }} | ||
1880 | - > | ||
1881 | - 申请开票(旧) | ||
1882 | - </Button> | ||
1883 | - ) : ( | ||
1884 | - '' | ||
1885 | - )} | ||
1886 | - | ||
1887 | - {optRecord.paths?.includes('checkOrder') ? ( | ||
1888 | - <Button | ||
1889 | - className="p-0" | ||
1890 | - type="link" | ||
1891 | - onClick={() => { | ||
1892 | - setCurrentMainId(record.id); | ||
1893 | - setCurretnOptSubId(optRecord.id); | ||
1894 | - setCheckVisible(true); | ||
1895 | - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | ||
1896 | - }} | ||
1897 | - > | ||
1898 | - 审核 | ||
1899 | - </Button> | ||
1900 | - ) : ( | ||
1901 | - '' | ||
1902 | - )} | ||
1903 | - | ||
1904 | - {optRecord.paths?.includes('afterSalesCheck') ? ( | ||
1905 | - <Button | ||
1906 | - className="p-0" | ||
1907 | - type="link" | ||
1908 | - onClick={() => { | ||
1909 | - createOptObject(optRecord.id, record.id); | ||
1910 | - setCheckVisible(true); | ||
1911 | - setOrderCheckType(CHECK_TYPE.AFTER_SALES); | ||
1912 | - }} | ||
1913 | - > | ||
1914 | - 售后审核 | ||
1915 | - </Button> | ||
1916 | - ) : ( | ||
1917 | - '' | ||
1918 | - )} | ||
1919 | - | ||
1920 | - {optRecord.paths?.includes('financeCheckOrder') ? ( | ||
1921 | - <Button | ||
1922 | - className="p-0" | ||
1923 | - type="link" | ||
1924 | - onClick={() => { | ||
1925 | - createOptObject(optRecord.id, record.id); | ||
1926 | - setCheckVisible(true); | ||
1927 | - setOrderCheckType(CHECK_TYPE.FINALCIAL); | ||
1928 | - }} | ||
1929 | - > | ||
1930 | - 财务审核 | ||
1931 | - </Button> | ||
1932 | - ) : ( | ||
1933 | - '' | ||
1934 | - )} | ||
1935 | - | ||
1936 | - {optRecord.paths?.includes('procureCheckOrder') ? ( | ||
1937 | - <Button | ||
1938 | - className="p-0" | ||
1939 | - type="link" | ||
1940 | - onClick={() => { | ||
1941 | - createOptObject(optRecord.id, record.id); | ||
1942 | - setOrderCheckType(CHECK_TYPE.PROCURE); | ||
1943 | - setProcureCheckModalVisible(true); | ||
1944 | - }} | ||
1945 | - > | ||
1946 | - 采购审核 | ||
1947 | - </Button> | ||
1948 | - ) : ( | ||
1949 | - '' | ||
1950 | - )} | ||
1951 | - | ||
1952 | - {optRecord.paths?.includes('procureConvertProcure') ? ( | ||
1953 | - <Button | ||
1954 | - className="p-0" | ||
1955 | - type="link" | ||
1956 | - onClick={() => { | ||
1957 | - createOptObject(optRecord.id, record.id); | ||
1958 | - setOrderCheckType(CHECK_TYPE.PROCURE); | ||
1959 | - setProcureConvertModalVisible(true); | ||
1960 | - }} | ||
1961 | - > | ||
1962 | - 转发 | ||
1963 | - </Button> | ||
1964 | - ) : ( | ||
1965 | - '' | ||
1966 | - )} | ||
1967 | - | ||
1968 | - {optRecord.paths?.includes('rePrintOrder') ? ( | ||
1969 | - <Button | ||
1970 | - className="p-0" | ||
1971 | - type="link" | ||
1972 | - onClick={() => { | ||
1973 | - createOptObject(optRecord.id, record.id); | ||
1974 | - setOrderPrintVisible(true); | ||
1975 | - setIsRePrintOrder(true); | ||
1976 | - }} | ||
1977 | - > | ||
1978 | - 重新打印 | ||
1979 | - </Button> | ||
1980 | - ) : ( | ||
1981 | - '' | ||
1982 | - )} | ||
1983 | - | ||
1984 | - {optRecord.paths?.includes('confirmReceipt') ? ( | ||
1985 | - <Button | ||
1986 | - className="p-0" | ||
1987 | - type="link" | ||
1988 | - onClick={() => { | ||
1989 | - createOptObject(optRecord.id, record.id); | ||
1990 | - setConfirmReceiptVisible(true); | ||
1991 | - }} | ||
1992 | - > | ||
1993 | - 确认收货 | ||
1994 | - </Button> | ||
1995 | - ) : ( | ||
1996 | - '' | ||
1997 | - )} | ||
1998 | - | ||
1999 | - {optRecord.paths?.includes('applyAfterSales') ? ( | ||
2000 | - <Button | ||
2001 | - className="p-0" | ||
2002 | - type="link" | ||
2003 | - onClick={() => { | ||
2004 | - createOptObject(optRecord.id, record.id); | ||
2005 | - setOrderDrawerVisible(true); | ||
2006 | - setOrderOptType('after-sales'); | ||
2007 | - }} | ||
2008 | - > | ||
2009 | - 申请售后 | ||
2010 | - </Button> | ||
2011 | - ) : ( | ||
2012 | - '' | ||
2013 | - )} | ||
2014 | - | ||
2015 | - {optRecord.paths?.includes('procureOrder') ? ( | ||
2016 | - <ButtonConfirm | ||
2017 | - className="p-0" | ||
2018 | - title="是否已下单?" | ||
2019 | - text="下单" | ||
2020 | - onConfirm={async () => { | ||
2021 | - let res = await postServiceOrderProcureOrder({ | ||
2022 | - data: { subIds: [optRecord.id] }, | ||
2023 | - }); | ||
2024 | - if (res.result === RESPONSE_CODE.SUCCESS) { | ||
2025 | - message.success(res.message); | ||
2026 | - refreshTable(); | ||
2027 | - return true; | ||
2028 | - } | ||
2029 | - }} | ||
2030 | - /> | ||
2031 | - ) : ( | ||
2032 | - '' | ||
2033 | - )} | ||
2034 | - | ||
2035 | - {optRecord.paths?.includes('cancelSend') ? ( | ||
2036 | - <ButtonConfirm | ||
2037 | - className="p-0" | ||
2038 | - title="是否取消发货" | ||
2039 | - text="取消发货" | ||
2040 | - onConfirm={async () => { | ||
2041 | - let res = await postServiceOrderCancelSend({ | ||
2042 | - data: { subIds: [optRecord.id] }, | ||
2043 | - }); | ||
2044 | - if (res.result === RESPONSE_CODE.SUCCESS) { | ||
2045 | - message.success(res.message); | ||
2046 | - refreshTable(); | ||
2047 | - return true; | ||
2048 | - } | ||
2049 | - }} | ||
2050 | - /> | ||
2051 | - ) : ( | ||
2052 | - '' | ||
2053 | - )} | ||
2054 | - | ||
2055 | - {optRecord.paths?.includes('noNeedSend') ? ( | ||
2056 | - <ButtonConfirm | ||
2057 | - className="p-0" | ||
2058 | - title="此订单是否无需发货?" | ||
2059 | - text="无需发货" | ||
2060 | - onConfirm={async () => { | ||
2061 | - let res = await postServiceOrderNoNeedSend({ | ||
2062 | - data: { ids: [optRecord.id] }, | ||
2063 | - }); | ||
2064 | - if (res.result === RESPONSE_CODE.SUCCESS) { | ||
2065 | - message.success(res.message); | ||
2066 | - refreshTable(); | ||
2067 | - return true; | ||
2068 | - } | ||
2069 | - }} | ||
2070 | - /> | ||
2071 | - ) : ( | ||
2072 | - '' | ||
2073 | - )} | ||
2074 | - | ||
2075 | - {optRecord.paths?.includes('viewImages') ? ( | ||
2076 | - <Button | ||
2077 | - className="p-0" | ||
2078 | - type="link" | ||
2079 | - onClick={() => { | ||
2080 | - createOptObject(optRecord.id, record.id); | ||
2081 | - setImagesViewerOptType('shippingReceipt'); | ||
2082 | - setImagesViewerModalVisible(true); | ||
2083 | - }} | ||
2084 | - > | ||
2085 | - 查看收货凭证 | ||
2086 | - </Button> | ||
2087 | - ) : ( | ||
2088 | - '' | ||
2089 | - )} | ||
2090 | - | ||
2091 | - {optRecord.paths?.includes('confirmDeliver') ? ( | ||
2092 | - <Button | ||
2093 | - className="p-0" | ||
2094 | - type="link" | ||
2095 | - onClick={() => { | ||
2096 | - createOptObject(optRecord.id, record.id); | ||
2097 | - setOrderCheckType(CHECK_TYPE.CONFIRM_DELIVER); | ||
2098 | - setCheckVisible(true); | ||
2099 | - }} | ||
2100 | - > | ||
2101 | - 确认发货 | ||
2102 | - </Button> | ||
2103 | - ) : ( | ||
2104 | - '' | ||
2105 | - )} | ||
2106 | - {optRecord.paths?.includes('feedbackRegistration') ? ( | ||
2107 | - <Button | ||
2108 | - className="p-0" | ||
2109 | - type="link" | ||
2110 | - onClick={() => { | ||
2111 | - createOptObject(optRecord.id, record.id); | ||
2112 | - setFeedbackRegistrationModalVisible(true); | ||
2113 | - }} | ||
2114 | - > | ||
2115 | - 回访登记 | ||
2116 | - </Button> | ||
2117 | - ) : ( | ||
2118 | - '' | ||
2119 | - )} | ||
2120 | - | ||
2121 | - {optRecord.paths?.includes('confirmInvoice') ? ( | ||
2122 | - <ButtonConfirm | ||
2123 | - className="p-0" | ||
2124 | - title="已和客户确认发票??" | ||
2125 | - text="确认发票" | ||
2126 | - onConfirm={async () => { | ||
2127 | - let body = [optRecord.id]; | ||
2128 | - const data = await postServiceOrderConfirmInvoice({ | ||
2129 | - data: body, | ||
2130 | - }); | ||
2131 | - if (data.result === RESPONSE_CODE.SUCCESS) { | ||
2132 | - message.success(data.message); | ||
2133 | - refreshTable(); | ||
2134 | - } | ||
2135 | - }} | ||
2136 | - /> | ||
2137 | - ) : ( | ||
2138 | - '' | ||
2139 | - )} | ||
2140 | - {optRecord.paths?.includes('orderCancel') ? ( | ||
2141 | - <ButtonConfirm | ||
2142 | - className="p-0" | ||
2143 | - title="确认作废?" | ||
2144 | - text="作废" | ||
2145 | - onConfirm={async () => { | ||
2146 | - let body = { ids: [optRecord.id], checkIsMainOrderId: false }; | ||
2147 | - const data = await postServiceOrderOrderCancel({ | ||
2148 | - data: body, | ||
2149 | - }); | ||
2150 | - if (data.result === RESPONSE_CODE.SUCCESS) { | ||
2151 | - message.success(data.message); | ||
2152 | - refreshTable(); | ||
2153 | - } | ||
2154 | - }} | ||
2155 | - /> | ||
2156 | - ) : ( | ||
2157 | - '' | ||
2158 | - )} | ||
2159 | - </Flex> | ||
2160 | - </Flex> | ||
2161 | - | ||
2162 | - <Flex title={optRecord.notes}> | ||
2163 | - <div | ||
2164 | - className="max-w-[1100px] overflow-hidden whitespace-normal overflow-ellipsis hover:cursor-pointer" | ||
2165 | - onClick={() => { | ||
2166 | - copyToClipboard(optRecord.notes); | ||
2167 | - message.info('备注复制成功:' + optRecord.notes); | ||
2168 | - }} | ||
2169 | - > | ||
2170 | - <span className="text-[#8C8C8C]"> | ||
2171 | - 备注: | ||
2172 | - {optRecord.notes === null ? '暂无备注' : optRecord.notes} | ||
2173 | - </span> | ||
2174 | - </div> | ||
2175 | - {!isSupplier() && (isSales() || isWarehousekeeper() || isAdmin()) && ( | ||
2176 | - <EditTwoTone | ||
2177 | - className="pl-1 pr-1 hover:curcor-pointer" | ||
2178 | - onClick={() => { | ||
2179 | - setNotesEditVisible(true); | ||
2180 | - setSelectedRows([optRecord.id]); | ||
2181 | - setNotes(optRecord.notes); | ||
2182 | - setNotesType(1); | ||
2183 | - }} | ||
2184 | - /> | ||
2185 | - )} | ||
2186 | - </Flex> | ||
2187 | - | ||
2188 | - {(isProcure() || isWarehousekeeper() || isSales() || isAdmin()) && | ||
2189 | - !isSupplier() ? ( | ||
2190 | - <div className="pt-2"> | ||
2191 | - <Flex title={optRecord.supplierName}> | ||
2192 | - <div> | ||
2193 | - <span className="text-[#8C8C8C]"> | ||
2194 | - 所属采购: | ||
2195 | - {optRecord.supplierName === null | ||
2196 | - ? '暂无' | ||
2197 | - : optRecord.supplierName} | ||
2198 | - </span> | ||
2199 | - </div> | ||
2200 | - | ||
2201 | - <Divider type="vertical" /> | ||
2202 | - | ||
2203 | - <div className="overflow-hidden whitespace-normal overflow-ellipsis hover:cursor-pointer"> | ||
2204 | - <span className="text-[#8C8C8C]"> | ||
2205 | - 采购备注: | ||
2206 | - {optRecord.procureNotes === null | ||
2207 | - ? '暂无备注' | ||
2208 | - : optRecord.procureNotes} | ||
2209 | - </span> | ||
2210 | - </div> | ||
2211 | - {/* 编辑备注按钮 */} | ||
2212 | - {(isProcure() || isAdmin()) && ( | ||
2213 | - <EditTwoTone | ||
2214 | - className="pl-1 pr-1 hover:curcor-pointer" | ||
2215 | - onClick={() => { | ||
2216 | - setSelectedRows([optRecord.id]); | ||
2217 | - setNotes(optRecord.procureNotes); | ||
2218 | - setNotesEditVisible(true); | ||
2219 | - setNotesType(2); | ||
2220 | - }} | ||
2221 | - /> | ||
2222 | - )} | ||
2223 | - </Flex> | ||
2224 | - | ||
2225 | - {(isAdmin() || isProcure()) && ( | ||
2226 | - <Flex title={optRecord.supplierNotes}> | ||
2227 | - <div className="max-w-[90%] whitespace-no-wrap overflow-hidden overflow-ellipsis"> | ||
2228 | - <span className="text-[#8C8C8C]"> | ||
2229 | - 供应商备注: | ||
2230 | - {optRecord.supplierNotes === null | ||
2231 | - ? '暂无备注' | ||
2232 | - : optRecord.supplierNotes} | ||
2233 | - </span> | ||
2234 | - </div> | ||
2235 | - {/* 编辑备注按钮 */} | ||
2236 | - <EditTwoTone | ||
2237 | - className="pl-1 hover:curcor-pointer" | ||
2238 | - onClick={() => { | ||
2239 | - setSelectedRows([optRecord.id]); | ||
2240 | - setNotes(optRecord.supplierNotes); | ||
2241 | - setNotesEditVisible(true); | ||
2242 | - setNotesType(3); | ||
2243 | - }} | ||
2244 | - /> | ||
2245 | - </Flex> | ||
2246 | - )} | ||
2247 | - </div> | ||
2248 | - ) : ( | ||
2249 | - '' | ||
2250 | - )} | ||
2251 | - | ||
2252 | - {isAdmin() || isSales() || isFinance() ? ( | ||
2253 | - <Flex title={optRecord.notes} className="pt-2"> | ||
2254 | - <div className="flex items-center"> | ||
2255 | - <div className="flex items-center max-w-[500px]"> | ||
2256 | - <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
2257 | - <Tooltip | ||
2258 | - title={optRecord.applyInvoicingNotes} | ||
2259 | - placement="topLeft" | ||
2260 | - > | ||
2261 | - <span className="text-[#8C8C8C]"> | ||
2262 | - 申请开票备注: | ||
2263 | - {optRecord.applyInvoicingNotes === undefined || | ||
2264 | - optRecord.applyInvoicingNotes === null | ||
2265 | - ? '暂无备注' | ||
2266 | - : optRecord.applyInvoicingNotes} | ||
2267 | - </span> | ||
2268 | - </Tooltip> | ||
2269 | - </div> | ||
2270 | - | ||
2271 | - {getAfterAnnexList()} | ||
2272 | - | ||
2273 | - <Tooltip title="编辑"> | ||
2274 | - <EditTwoTone | ||
2275 | - className="pl-1 hover:curcor-pointer" | ||
2276 | - onClick={() => { | ||
2277 | - setNotesEditVisible(true); | ||
2278 | - setSelectedRows([optRecord.id]); | ||
2279 | - setNotes(optRecord.applyInvoicingNotes); | ||
2280 | - setNotesType(4); | ||
2281 | - }} | ||
2282 | - /> | ||
2283 | - </Tooltip> | ||
2284 | - </div> | ||
2285 | - <Divider type="vertical" className="mx-5" /> | ||
2286 | - <div className="flex items-center max-w-[500px]"> | ||
2287 | - <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
2288 | - <Tooltip title={optRecord.checkNotes} placement="topLeft"> | ||
2289 | - <span className="text-[#8C8C8C] mr-3"> | ||
2290 | - 财务审核备注: | ||
2291 | - {optRecord.checkNotes === undefined || | ||
2292 | - optRecord.checkNotes === null | ||
2293 | - ? '暂无备注' | ||
2294 | - : optRecord.checkNotes} | ||
2295 | - </span> | ||
2296 | - </Tooltip> | ||
2297 | - </div> | ||
2298 | - | ||
2299 | - {getInvoicingCheckAnnexList()} | ||
2300 | - </div> | ||
2301 | - </div> | ||
2302 | - </Flex> | ||
2303 | - ) : ( | ||
2304 | - '' | ||
2305 | - )} | ||
2306 | - | ||
2307 | - {isAdmin() || isSales() || isFinance() ? ( | ||
2308 | - <Flex title={optRecord.notes} className="pt-2"> | ||
2309 | - <div className="flex items-center"> | ||
2310 | - <div className="flex items-center max-w-[500px]"> | ||
2311 | - <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
2312 | - <Tooltip title={optRecord.reissueNotes} placement="topLeft"> | ||
2313 | - <span className="text-[#8C8C8C]"> | ||
2314 | - 重新开票备注: | ||
2315 | - {optRecord.reissueNotes === undefined || | ||
2316 | - optRecord.reissueNotes === null | ||
2317 | - ? '暂无备注' | ||
2318 | - : optRecord.reissueNotes} | ||
2319 | - </span> | ||
2320 | - </Tooltip> | ||
2321 | - </div> | ||
2322 | - | ||
2323 | - <Tooltip title="编辑"> | ||
2324 | - <EditTwoTone | ||
2325 | - className="pl-1 hover:curcor-pointer" | ||
2326 | - onClick={() => { | ||
2327 | - setNotesEditVisible(true); | ||
2328 | - setSelectedRows([optRecord.id]); | ||
2329 | - setNotes(optRecord.reissueNotes); | ||
2330 | - setNotesType(5); | ||
2331 | - }} | ||
2332 | - /> | ||
2333 | - </Tooltip> | ||
2334 | - </div> | ||
2335 | - <Divider type="vertical" className="mx-5" /> | ||
2336 | - </div> | ||
2337 | - </Flex> | ||
2338 | - ) : ( | ||
2339 | - '' | ||
2340 | - )} | ||
2341 | - | ||
2342 | - {isAdmin() || isSales() ? ( | ||
2343 | - <Flex title={optRecord.notes} className="pt-2"> | ||
2344 | - <div className="flex items-center"> | ||
2345 | - <div className="flex items-center max-w-[500px]"> | ||
2346 | - <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis"> | ||
2347 | - <Tooltip | ||
2348 | - title={optRecord.feedbackRegistrationContent} | ||
2349 | - placement="topLeft" | ||
2350 | - > | ||
2351 | - <span className="text-[#8C8C8C] mr-3"> | ||
2352 | - 产品回访登记: | ||
2353 | - {optRecord.feedbackRegistrationContent === undefined || | ||
2354 | - optRecord.feedbackRegistrationContent === null | ||
2355 | - ? '暂无' | ||
2356 | - : optRecord.feedbackRegistrationContent} | ||
2357 | - </span> | ||
2358 | - </Tooltip> | ||
2359 | - </div> | ||
2360 | - </div> | ||
2361 | - </div> | ||
2362 | - </Flex> | ||
2363 | - ) : ( | ||
2364 | - '' | ||
2365 | - )} | ||
2366 | - </> | ||
2367 | - ); | ||
2368 | - }; | ||
2369 | - const expandedRowRender = (record) => { | ||
2370 | - let subOrders = record.subOrderInformationLists; | ||
2371 | - | ||
2372 | - return ( | ||
2373 | - <ProTable | ||
2374 | - id="sub-table" | ||
2375 | - className="w-full " | ||
2376 | - showHeader={false} | ||
2377 | - columns={[ | ||
2378 | - { | ||
2379 | - title: 'ID', | ||
2380 | - dataIndex: 'id', | ||
2381 | - key: 'id', | ||
2382 | - render: (text: any, optRecord: any) => { | ||
2383 | - return <SubOderRander record={record} optRecord={optRecord} />; | ||
2384 | - }, | ||
2385 | - }, | ||
2386 | - ]} | ||
2387 | - rowSelection={{ | ||
2388 | - onSelect: (row: any) => { | ||
2389 | - let subId = row.id; | ||
2390 | - let mainId = row.mainOrderId; | ||
2391 | - let newSelectedSubOrderKeys = [...selectedSubOrderKeys]; | ||
2392 | - let currentMainOrderSelectedSubOrderList = | ||
2393 | - subOrderSelectedMap.get(mainId); | ||
2394 | - if (!selectedSubOrderKeys.includes(subId)) { | ||
2395 | - //选中子订单 | ||
2396 | - newSelectedSubOrderKeys.push(subId); | ||
2397 | - | ||
2398 | - //在Map中添加对应的主订单中的子订单 | ||
2399 | - if (currentMainOrderSelectedSubOrderList) { | ||
2400 | - currentMainOrderSelectedSubOrderList.push(row); | ||
2401 | - } else { | ||
2402 | - currentMainOrderSelectedSubOrderList = [row]; | ||
2403 | - } | ||
2404 | - | ||
2405 | - //如果该主订单的所有子订单都选中了,那么勾选上主订单 | ||
2406 | - if ( | ||
2407 | - currentMainOrderSelectedSubOrderList?.length === | ||
2408 | - mainOrderIdSubOrderIdRelationsMap.get(mainId)?.length | ||
2409 | - ) { | ||
2410 | - selectedMainOrderKeys.push(mainId, record); | ||
2411 | - mainOrderSelectedMap.set(mainId, record); | ||
2412 | - } | ||
2413 | - | ||
2414 | - //如果所有主订单都勾选上了,那么勾选上总选中按钮 | ||
2415 | - if ( | ||
2416 | - mainOrderSelectedMap?.size === | ||
2417 | - mainOrderIdSubOrderIdRelationsMap.size | ||
2418 | - ) { | ||
2419 | - setAllMainChecked(true); | ||
2420 | - } | ||
2421 | - } else { | ||
2422 | - //取消选中子订单 | ||
2423 | - newSelectedSubOrderKeys = newSelectedSubOrderKeys.filter( | ||
2424 | - (item) => { | ||
2425 | - return item !== subId; | ||
2426 | - }, | ||
2427 | - ); | ||
2428 | - | ||
2429 | - removeSelecetMainOrderKeyByMainOrderId(mainId); //某个子订单取消勾选了,对应的主订单也要取消勾选 | ||
2430 | - | ||
2431 | - //在Map中删除掉对应的主订单中的子订单 | ||
2432 | - if (currentMainOrderSelectedSubOrderList) { | ||
2433 | - currentMainOrderSelectedSubOrderList = | ||
2434 | - currentMainOrderSelectedSubOrderList.filter((item) => { | ||
2435 | - return item.id !== subId; | ||
2436 | - }); | ||
2437 | - } else { | ||
2438 | - subOrderSelectedMap.set(mainId, [row]); | ||
2439 | - } | ||
2440 | - | ||
2441 | - mainOrderSelectedMap.delete(mainId); | ||
2442 | - //总选中按钮取消选中 | ||
2443 | - setAllMainChecked(false); | ||
2444 | - } | ||
2445 | - | ||
2446 | - //如果该主订单已经没有子订单选中,删除key | ||
2447 | - if (currentMainOrderSelectedSubOrderList?.length === 0) { | ||
2448 | - subOrderSelectedMap.delete(record.id); | ||
2449 | - } else { | ||
2450 | - subOrderSelectedMap.set( | ||
2451 | - record.id, | ||
2452 | - currentMainOrderSelectedSubOrderList, | ||
2453 | - ); | ||
2454 | - } | ||
2455 | - | ||
2456 | - setSelectedSubOrderKeys(newSelectedSubOrderKeys); | ||
2457 | - setSelectedRows(currentMainOrderSelectedSubOrderList); | ||
2458 | - }, | ||
2459 | - selectedRowKeys: selectedSubOrderKeys, | ||
2460 | - // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom | ||
2461 | - // 注释该行则默认不显示下拉选项 | ||
2462 | - // selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT], | ||
2463 | - // defaultSelectedRowKeys: [], | ||
2464 | - }} | ||
2465 | - rowKey="id" | ||
2466 | - headerTitle={false} | ||
2467 | - search={false} | ||
2468 | - options={false} | ||
2469 | - dataSource={subOrders} | ||
2470 | - pagination={false} | ||
2471 | - tableAlertRender={false} | ||
2472 | - /> | ||
2473 | - ); | ||
2474 | - }; | ||
2475 | - | ||
2476 | - // 主订单内容渲染 | ||
2477 | - const MainOrderColumnRender = ({ record }: { record: OrderListItemType }) => { | ||
2478 | - return ( | ||
2479 | - <Flex vertical={true}> | ||
2480 | - {/* 编号、时间、销售信息 */} | ||
2481 | - <Flex | ||
2482 | - className="px-4 py-4 bg-white rounded-t-lg" | ||
2483 | - justify="space-between" | ||
2484 | - > | ||
2485 | - <Flex wrap="wrap" gap="middle" vertical> | ||
2486 | - <Flex> | ||
2487 | - <Flex> | ||
2488 | - <Checkbox | ||
2489 | - onChange={() => onCheckboxChange(record)} | ||
2490 | - checked={selectedMainOrderKeys.includes(record.id)} | ||
2491 | - > | ||
2492 | - <Space split={<Divider type="vertical" />}> | ||
2493 | - <div> | ||
2494 | - <span className="text-[#8C8C8C]">订单号:</span> | ||
2495 | - <span className="text-slate-700">{record.id}</span> | ||
2496 | - {record.modified ? ( | ||
2497 | - <Tooltip title="点击查看详情"> | ||
2498 | - <span | ||
2499 | - className="text-[#f44e4e] cursor-pointer" | ||
2500 | - onClick={async () => { | ||
2501 | - createOptObject(null, record.id); | ||
2502 | - setModifiedDiffModalVisible(true); | ||
2503 | - }} | ||
2504 | - > | ||
2505 | - (修改过) | ||
2506 | - </span> | ||
2507 | - </Tooltip> | ||
2508 | - ) : ( | ||
2509 | - '' | ||
2510 | - )} | ||
2511 | - </div> | ||
2512 | - </Space> | ||
2513 | - </Checkbox> | ||
2514 | - <Tooltip title="点击复制订单号"> | ||
2515 | - <CopyOutlined | ||
2516 | - className="hover:cursor-pointer" | ||
2517 | - style={{ color: '#8C8C8C' }} | ||
2518 | - onClick={() => { | ||
2519 | - copyToClipboard(record.id); | ||
2520 | - message.info('订单号复制成功!'); | ||
2521 | - }} | ||
2522 | - /> | ||
2523 | - </Tooltip> | ||
2524 | - <Divider type="vertical" /> | ||
2525 | - <span>{formatDateTime(record.createTime)}</span> | ||
2526 | - <Divider type="vertical" /> | ||
2527 | - <Space split={<Divider type="vertical" />}> | ||
2528 | - <div | ||
2529 | - className="hover:cursor-pointer" | ||
2530 | - onClick={() => { | ||
2531 | - copyToClipboard(record.salesCode); | ||
2532 | - message.info('代表复制成功:' + record.salesCode); | ||
2533 | - }} | ||
2534 | - > | ||
2535 | - <span className="text-[#8C8C8C]">代表:</span> | ||
2536 | - <span className="text-slate-700">{record.salesCode}</span> | ||
2537 | - </div> | ||
2538 | - {!isSupplier() ? ( | ||
2539 | - <> | ||
2540 | - <div | ||
2541 | - title={record.institution} | ||
2542 | - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[150px]" | ||
2543 | - > | ||
2544 | - <span className="text-[#8C8C8C]">单位:</span> | ||
2545 | - <span className="text-slate-700"> | ||
2546 | - {record.institution} | ||
2547 | - </span> | ||
2548 | - </div> | ||
2549 | - <span> | ||
2550 | - <span className="text-[#8C8C8C]">联系人:</span> | ||
2551 | - <span className="text-slate-700"> | ||
2552 | - {record.institutionContactName + ' '} | ||
2553 | - </span> | ||
2554 | - </span> | ||
2555 | - </> | ||
2556 | - ) : ( | ||
2557 | - '' | ||
2558 | - )} | ||
2559 | - <div | ||
2560 | - title={record.institution} | ||
2561 | - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[150px]" | ||
2562 | - > | ||
2563 | - <span | ||
2564 | - className="hover:cursor-pointer" | ||
2565 | - onClick={() => { | ||
2566 | - copyToClipboard(record.customerName); | ||
2567 | - message.info('收货人复制成功:' + record.customerName); | ||
2568 | - }} | ||
2569 | - > | ||
2570 | - <span className="text-[#8C8C8C]">收货人:</span> | ||
2571 | - {!isSupplier() && ( | ||
2572 | - <Tooltip className="order-tooltip" title="详情"> | ||
2573 | - <ContainerTwoTone | ||
2574 | - className="px-1 hover:curcor-pointer" | ||
2575 | - onClick={() => { | ||
2576 | - createOptObject(null, record.id); | ||
2577 | - setDeliverInfoDrawerVisible(true); | ||
2578 | - }} | ||
2579 | - /> | ||
2580 | - </Tooltip> | ||
2581 | - )} | ||
2582 | - <span className="text-slate-700"> | ||
2583 | - {record.customerName + ' '} | ||
2584 | - </span> | ||
2585 | - </span> | ||
2586 | - </div> | ||
2587 | - | ||
2588 | - {isSupplier() ? ( | ||
2589 | - <div | ||
2590 | - title={record.customerShippingAddress} | ||
2591 | - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[400px] hover:cursor-pointer" | ||
2592 | - onClick={() => { | ||
2593 | - copyToClipboard(record.customerShippingAddress); | ||
2594 | - message.info( | ||
2595 | - '收货地址复制成功:' + record.customerShippingAddress, | ||
2596 | - ); | ||
2597 | - }} | ||
2598 | - > | ||
2599 | - <span className="text-[#8C8C8C]">收货地址:</span> | ||
2600 | - <span className="text-slate-700"> | ||
2601 | - {record.customerShippingAddress} | ||
2602 | - </span> | ||
2603 | - </div> | ||
2604 | - ) : ( | ||
2605 | - '' | ||
2606 | - )} | ||
2607 | - </Space> | ||
2608 | - </Flex> | ||
2609 | - </Flex> | ||
2610 | - | ||
2611 | - {isSupplier() ? ( | ||
2612 | - <Flex className="pl-6" align="center"> | ||
2613 | - <Flex | ||
2614 | - className="hover:cursor-pointer" | ||
2615 | - onClick={() => { | ||
2616 | - copyToClipboard(record.customerContactNumber); | ||
2617 | - message.info( | ||
2618 | - '联系电话复制成功:' + record.customerContactNumber, | ||
2619 | - ); | ||
2620 | - }} | ||
2621 | - > | ||
2622 | - <span className="text-[#8C8C8C]">联系电话:</span> | ||
2623 | - <span className="text-slate-700"> | ||
2624 | - {record.customerContactNumber + ' '} | ||
2625 | - </span> | ||
2626 | - </Flex> | ||
2627 | - </Flex> | ||
2628 | - ) : ( | ||
2629 | - '' | ||
2630 | - )} | ||
2631 | - | ||
2632 | - <Flex className="pl-6" align="center"> | ||
2633 | - {roleCode === 'finance' ? ( | ||
2634 | - <div | ||
2635 | - title={enumValueToLabel( | ||
2636 | - record.receivingCompany, | ||
2637 | - getReceivingCompanyOptions(PAYEE_OPTIONS), | ||
2638 | - )} | ||
2639 | - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[400px]" | ||
2640 | - > | ||
2641 | - <span className="text-[#8C8C8C]">开票收款单位:</span> | ||
2642 | - <span className="text-slate-700"> | ||
2643 | - {record.receivingCompany !== null | ||
2644 | - ? enumValueToLabel( | ||
2645 | - record.receivingCompany, | ||
2646 | - getReceivingCompanyOptions(PAYEE_OPTIONS), | ||
2647 | - ) | ||
2648 | - : '暂无'} | ||
2649 | - </span> | ||
2650 | - </div> | ||
2651 | - ) : ( | ||
2652 | - '' | ||
2653 | - )} | ||
2654 | - | ||
2655 | - {roleCode === 'finance' ? <Divider type="vertical" /> : ''} | ||
2656 | - | ||
2657 | - <div title={record.notes}> | ||
2658 | - <div | ||
2659 | - className="max-w-[850px] whitespace-normal overflow-hidden overflow-ellipsis hover:cursor-pointer" | ||
2660 | - onClick={() => { | ||
2661 | - copyToClipboard(record.notes); | ||
2662 | - message.info('备注复制成功:' + record.notes); | ||
2663 | - }} | ||
2664 | - > | ||
2665 | - <span className="text-[#8C8C8C]">备注:</span> | ||
2666 | - <span className="ml-2"> | ||
2667 | - {record.notes === null ? '暂无备注' : record.notes} | ||
2668 | - </span> | ||
2669 | - </div> | ||
2670 | - </div> | ||
2671 | - | ||
2672 | - {!isSupplier() ? ( | ||
2673 | - <Tooltip title="编辑"> | ||
2674 | - <EditTwoTone | ||
2675 | - className="pl-1 hover:curcor-pointer" | ||
2676 | - onClick={() => { | ||
2677 | - setNotesEditVisible(true); | ||
2678 | - setSelectedRows([record.id]); | ||
2679 | - setNotes(record.notes); | ||
2680 | - setNotesType(0); | ||
2681 | - }} | ||
2682 | - /> | ||
2683 | - </Tooltip> | ||
2684 | - ) : ( | ||
2685 | - '' | ||
2686 | - )} | ||
2687 | - | ||
2688 | - {record.goodsWeight !== null ? ( | ||
2689 | - <div title={record.goodsWeight + 'kg'} className="pl-3"> | ||
2690 | - <div | ||
2691 | - className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer" | ||
2692 | - onClick={() => { | ||
2693 | - copyToClipboard(record.goodsWeight + 'kg'); | ||
2694 | - message.info( | ||
2695 | - '包裹重量复制成功:' + record.goodsWeight + 'kg', | ||
2696 | - ); | ||
2697 | - }} | ||
2698 | - > | ||
2699 | - <span className="text-[#8C8C8C]">包裹重量:</span> | ||
2700 | - <span className="ml-2">{record.goodsWeight + 'kg'}</span> | ||
2701 | - </div> | ||
2702 | - </div> | ||
2703 | - ) : ( | ||
2704 | - '' | ||
2705 | - )} | ||
2706 | - | ||
2707 | - {record.goodsVolume !== null ? ( | ||
2708 | - <div title={record.goodsVolume + 'm³'} className="pl-3"> | ||
2709 | - <div | ||
2710 | - className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer" | ||
2711 | - onClick={() => { | ||
2712 | - copyToClipboard(record.goodsVolume + 'm³'); | ||
2713 | - message.info( | ||
2714 | - '包裹体积复制成功:' + record.goodsVolume + 'm³', | ||
2715 | - ); | ||
2716 | - }} | ||
2717 | - > | ||
2718 | - <span className="text-[#8C8C8C]">包裹体积:</span> | ||
2719 | - <span className="ml-2">{record.goodsVolume + 'm³'}</span> | ||
2720 | - </div> | ||
2721 | - </div> | ||
2722 | - ) : ( | ||
2723 | - '' | ||
2724 | - )} | ||
2725 | - </Flex> | ||
2726 | - </Flex> | ||
2727 | - <Flex wrap="wrap" gap="middle" vertical> | ||
2728 | - <Flex justify="flex-end"> | ||
2729 | - <Flex wrap="wrap" gap="middle" align="center"> | ||
2730 | - {!isSupplier() ? ( | ||
2731 | - <div> | ||
2732 | - <span className="text-[#8C8C8C]">总金额:¥</span> | ||
2733 | - <span className="text-lg font-medium"> | ||
2734 | - {record.totalPayment} | ||
2735 | - </span> | ||
2736 | - </div> | ||
2737 | - ) : ( | ||
2738 | - '' | ||
2739 | - )} | ||
2740 | - | ||
2741 | - {rolePath?.includes('addOrder') ? ( | ||
2742 | - <Tooltip title="复制"> | ||
2743 | - <CopyTwoTone | ||
2744 | - className="hover:cursor-pointer" | ||
2745 | - onClick={() => { | ||
2746 | - createOptObject(null, record.id); | ||
2747 | - copyOrderToClipboard(record); | ||
2748 | - setOrderOptType('copy'); | ||
2749 | - setOrderDrawerVisible(true); | ||
2750 | - }} | ||
2751 | - /> | ||
2752 | - </Tooltip> | ||
2753 | - ) : ( | ||
2754 | - <Tooltip title="复制文本"> | ||
2755 | - <CopyTwoTone | ||
2756 | - className="hover:cursor-pointer" | ||
2757 | - onClick={() => { | ||
2758 | - copyOrderToClipboard(record); | ||
2759 | - }} | ||
2760 | - /> | ||
2761 | - </Tooltip> | ||
2762 | - )} | ||
2763 | - {!isSupplier() ? ( | ||
2764 | - <Tooltip title="历史"> | ||
2765 | - <ClockCircleTwoTone | ||
2766 | - className="hover:cursor-pointer" | ||
2767 | - onClick={() => { | ||
2768 | - setHistoryModalVisible(true); | ||
2769 | - if (subOrderSelectedMap.get(record.id)?.length) { | ||
2770 | - setSelectedRows(subOrderSelectedMap.get(record.id)); | ||
2771 | - } else { | ||
2772 | - setSelectedRows(record.subOrderInformationLists); | ||
2773 | - } | ||
2774 | - }} | ||
2775 | - /> | ||
2776 | - </Tooltip> | ||
2777 | - ) : ( | ||
2778 | - '' | ||
2779 | - )} | ||
2780 | - </Flex> | ||
2781 | - </Flex> | ||
2782 | - <Flex justify="flex-end"> | ||
2783 | - <Space.Compact direction="vertical" align="end"> | ||
2784 | - <Space wrap> | ||
2785 | - {record.paths?.includes('postAudit') ? ( | ||
2786 | - <Button | ||
2787 | - className="p-0" | ||
2788 | - type="link" | ||
2789 | - onClick={() => { | ||
2790 | - setCurrentMainId(record.id); | ||
2791 | - setCurretnOptSubId(null); | ||
2792 | - setCheckVisible(true); | ||
2793 | - setOrderCheckType(CHECK_TYPE.WAITING_FOR_POST_AUDIT); | ||
2794 | - }} | ||
2795 | - > | ||
2796 | - 后置审核 | ||
2797 | - </Button> | ||
2798 | - ) : ( | ||
2799 | - '' | ||
2800 | - )} | ||
2801 | - {record.paths?.includes('URGENT_INVOICE_AUDITING') ? ( | ||
2802 | - <Button | ||
2803 | - className="p-0" | ||
2804 | - type="link" | ||
2805 | - onClick={() => { | ||
2806 | - createOptObject(null, record.id); | ||
2807 | - setCheckVisible(true); | ||
2808 | - setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING); | ||
2809 | - }} | ||
2810 | - > | ||
2811 | - 加急审核(新) | ||
2812 | - </Button> | ||
2813 | - ) : ( | ||
2814 | - '' | ||
2815 | - )} | ||
2816 | - {record.paths?.includes('URGENT_INVOICE_AUDITING_old') ? ( | ||
2817 | - <Button | ||
2818 | - className="p-0" | ||
2819 | - type="link" | ||
2820 | - onClick={() => { | ||
2821 | - createOptObject(null, record.id); | ||
2822 | - setCheckVisible(true); | ||
2823 | - setOrderCheckType( | ||
2824 | - CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD, | ||
2825 | - ); | ||
2826 | - }} | ||
2827 | - > | ||
2828 | - 加急审核(旧) | ||
2829 | - </Button> | ||
2830 | - ) : ( | ||
2831 | - '' | ||
2832 | - )} | ||
2833 | - {record.paths?.includes('salesConfirm') && ( | ||
2834 | - <ButtonConfirm | ||
2835 | - className="p-0" | ||
2836 | - title="是否确认此商城订单信息无误?确认无误之后订单将进入审核流程。" | ||
2837 | - text="订单确认" | ||
2838 | - onConfirm={async () => { | ||
2839 | - let subIds = subOrderSelectedMap | ||
2840 | - .get(record.id) | ||
2841 | - ?.map((item) => { | ||
2842 | - return item.id; | ||
2843 | - }); | ||
2844 | - if (subIds === null || subIds === undefined) { | ||
2845 | - subIds = record.subOrderInformationLists.map( | ||
2846 | - (item) => { | ||
2847 | - return item.id; | ||
2848 | - }, | ||
2849 | - ); | ||
2850 | - } | ||
2851 | - let res = await postServiceOrderSalesConfirm({ | ||
2852 | - data: { | ||
2853 | - subOrderIds: subIds, | ||
2854 | - }, | ||
2855 | - }); | ||
2856 | - | ||
2857 | - if (res && res.result === RESPONSE_CODE.SUCCESS) { | ||
2858 | - message.success(res.message); | ||
2859 | - refreshTable(); | ||
2860 | - } | ||
2861 | - }} | ||
2862 | - /> | ||
2863 | - )} | ||
2864 | - {record.paths?.includes('uploadPaymentReceiptBill') ? ( | ||
2865 | - <Button | ||
2866 | - className="p-0" | ||
2867 | - type="link" | ||
2868 | - onClick={() => { | ||
2869 | - createOptObject(null, record.id); | ||
2870 | - setUploadPayBillModalVisible(true); | ||
2871 | - }} | ||
2872 | - > | ||
2873 | - 回款 | ||
2874 | - </Button> | ||
2875 | - ) : ( | ||
2876 | - '' | ||
2877 | - )} | ||
2878 | - | ||
2879 | - {record.paths?.includes('modifiedAuditRequest') ? ( | ||
2880 | - <Button | ||
2881 | - className="p-0" | ||
2882 | - type="link" | ||
2883 | - onClick={() => { | ||
2884 | - createOptObject(null, record.id); | ||
2885 | - setCheckVisible(true); | ||
2886 | - setOrderCheckType(CHECK_TYPE.NODE_OPERATING_AUDIT); | ||
2887 | - }} | ||
2888 | - > | ||
2889 | - 节点修改审核 | ||
2890 | - </Button> | ||
2891 | - ) : ( | ||
2892 | - '' | ||
2893 | - )} | ||
2894 | - | ||
2895 | - {record.paths?.includes('auditPaymentReceipt') ? ( | ||
2896 | - <Button | ||
2897 | - className="p-0" | ||
2898 | - type="link" | ||
2899 | - onClick={() => { | ||
2900 | - createOptObject(null, record.id); | ||
2901 | - setCheckVisible(true); | ||
2902 | - setOrderCheckType(CHECK_TYPE.PAYMENT_RECEIPTS_AUDIT); | ||
2903 | - }} | ||
2904 | - > | ||
2905 | - 回款审核 | ||
2906 | - </Button> | ||
2907 | - ) : ( | ||
2908 | - '' | ||
2909 | - )} | ||
2910 | - | ||
2911 | - {record.paths?.includes('modifiedLeaderAuditRequest') ? ( | ||
2912 | - <Button | ||
2913 | - className="p-0" | ||
2914 | - type="link" | ||
2915 | - onClick={() => { | ||
2916 | - createOptObject(null, record.id); | ||
2917 | - setCheckVisible(true); | ||
2918 | - setOrderCheckType(CHECK_TYPE.MODIFY_LEADER_AUDIT); | ||
2919 | - }} | ||
2920 | - > | ||
2921 | - 领导修改审核 | ||
2922 | - </Button> | ||
2923 | - ) : ( | ||
2924 | - '' | ||
2925 | - )} | ||
2926 | - | ||
2927 | - {false ? ( | ||
2928 | - <Button | ||
2929 | - className="p-0" | ||
2930 | - type="link" | ||
2931 | - onClick={() => { | ||
2932 | - createOptObject(null, record.id); | ||
2933 | - setFinancialReceiptsModalVisible(true); | ||
2934 | - setIsEdit(true); | ||
2935 | - }} | ||
2936 | - > | ||
2937 | - 收款记录 | ||
2938 | - </Button> | ||
2939 | - ) : ( | ||
2940 | - '' | ||
2941 | - )} | ||
2942 | - | ||
2943 | - {record.paths?.includes('reissue_old') ? ( | ||
2944 | - /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'|| | ||
2945 | - optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/ | ||
2946 | - <Button | ||
2947 | - className="p-0" | ||
2948 | - type="link" | ||
2949 | - onClick={() => { | ||
2950 | - setCurrentMainId(record.id); | ||
2951 | - setReissueVisibleOld(true); | ||
2952 | - console.log(reissueVisible); | ||
2953 | - }} | ||
2954 | - > | ||
2955 | - 重新开票(旧) | ||
2956 | - </Button> | ||
2957 | - ) : ( | ||
2958 | - '' | ||
2959 | - )} | ||
2960 | - | ||
2961 | - {record.paths?.includes('confirmReissue_old') ? ( | ||
2962 | - <Button | ||
2963 | - className="p-0" | ||
2964 | - type="link" | ||
2965 | - onClick={() => { | ||
2966 | - setCurrentMainId(record.id); | ||
2967 | - setCurretnOptSubId(null); | ||
2968 | - setCheckVisible(true); | ||
2969 | - setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE_OLD); | ||
2970 | - }} | ||
2971 | - > | ||
2972 | - 重新开票审核(旧) | ||
2973 | - </Button> | ||
2974 | - ) : ( | ||
2975 | - '' | ||
2976 | - )} | ||
2977 | - | ||
2978 | - {record.paths?.includes('reissue') ? ( | ||
2979 | - /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'|| | ||
2980 | - optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/ | ||
2981 | - <Button | ||
2982 | - className="p-0" | ||
2983 | - type="link" | ||
2984 | - onClick={() => { | ||
2985 | - setCurrentMainId(record.id); | ||
2986 | - setReissueVisible(true); | ||
2987 | - }} | ||
2988 | - > | ||
2989 | - 重新开票(新) | ||
2990 | - </Button> | ||
2991 | - ) : ( | ||
2992 | - '' | ||
2993 | - )} | ||
2994 | - | ||
2995 | - {record.paths?.includes('confirmReissue') ? ( | ||
2996 | - <Button | ||
2997 | - className="p-0" | ||
2998 | - type="link" | ||
2999 | - onClick={() => { | ||
3000 | - setCurrentMainId(record.id); | ||
3001 | - setCurretnOptSubId(null); | ||
3002 | - setCheckVisible(true); | ||
3003 | - setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE); | ||
3004 | - }} | ||
3005 | - > | ||
3006 | - 重新开票审核(新) | ||
3007 | - </Button> | ||
3008 | - ) : ( | ||
3009 | - '' | ||
3010 | - )} | ||
3011 | - | ||
3012 | - {record.paths?.includes('procureOrder') ? ( | ||
3013 | - <ButtonConfirm | ||
3014 | - className="p-0" | ||
3015 | - title="是否下单?" | ||
3016 | - text="下单" | ||
3017 | - onConfirm={async () => { | ||
3018 | - let subIds = subOrderSelectedMap | ||
3019 | - .get(record.id) | ||
3020 | - ?.map((item) => { | ||
3021 | - return item.id; | ||
3022 | - }); | ||
3023 | - if (subIds === null || subIds === undefined) { | ||
3024 | - subIds = record.subOrderInformationLists.map( | ||
3025 | - (item) => { | ||
3026 | - return item.id; | ||
3027 | - }, | ||
3028 | - ); | ||
3029 | - } | ||
3030 | - let res = await postServiceOrderProcureOrder({ | ||
3031 | - data: { subIds: subIds }, | ||
3032 | - }); | ||
3033 | - if (res.result === RESPONSE_CODE.SUCCESS) { | ||
3034 | - message.success(res.message); | ||
3035 | - refreshTable(); | ||
3036 | - return true; | ||
3037 | - } | ||
3038 | - }} | ||
3039 | - /> | ||
3040 | - ) : ( | ||
3041 | - '' | ||
3042 | - )} | ||
3043 | - | ||
3044 | - {record.paths?.includes('cancelSend') ? ( | ||
3045 | - <ButtonConfirm | ||
3046 | - className="p-0" | ||
3047 | - title="是否取消发货?" | ||
3048 | - text="取消发货" | ||
3049 | - onConfirm={async () => { | ||
3050 | - let subIds = subOrderSelectedMap | ||
3051 | - .get(record.id) | ||
3052 | - ?.map((item) => { | ||
3053 | - return item.id; | ||
3054 | - }); | ||
3055 | - if (subIds === null || subIds === undefined) { | ||
3056 | - subIds = record.subOrderInformationLists.map( | ||
3057 | - (item) => { | ||
3058 | - return item.id; | ||
3059 | - }, | ||
3060 | - ); | ||
3061 | - } | ||
3062 | - let res = await postServiceOrderCancelSend({ | ||
3063 | - data: { subIds: subIds }, | ||
3064 | - }); | ||
3065 | - if (res.result === RESPONSE_CODE.SUCCESS) { | ||
3066 | - message.success(res.message); | ||
3067 | - refreshTable(); | ||
3068 | - return true; | ||
3069 | - } | ||
3070 | - }} | ||
3071 | - /> | ||
3072 | - ) : ( | ||
3073 | - '' | ||
3074 | - )} | ||
3075 | - | ||
3076 | - {record.paths?.includes('applyModify') ? ( | ||
3077 | - <Button | ||
3078 | - className="p-0" | ||
3079 | - type="link" | ||
3080 | - onClick={() => { | ||
3081 | - createOptObject(null, record.id); | ||
3082 | - setOrderDrawerVisible(true); | ||
3083 | - setOrderOptType('order-change-normal'); | ||
3084 | - }} | ||
3085 | - > | ||
3086 | - 申请修改 | ||
3087 | - </Button> | ||
3088 | - ) : ( | ||
3089 | - '' | ||
3090 | - )} | ||
3091 | - | ||
3092 | - {record.paths?.includes('leaderAudit') ? ( | ||
3093 | - <Button | ||
3094 | - className="p-0" | ||
3095 | - type="link" | ||
3096 | - onClick={() => { | ||
3097 | - let selectedSubOrders = subOrderSelectedMap.get( | ||
3098 | - record.id, | ||
3099 | - ); | ||
3100 | - setSelectedRows(selectedSubOrders); | ||
3101 | - if (selectedSubOrders === undefined) { | ||
3102 | - selectedSubOrders = record.subOrderInformationLists; | ||
3103 | - } | ||
3104 | - for (let i = 0; i < selectedSubOrders.length; i++) { | ||
3105 | - if ( | ||
3106 | - selectedSubOrders[i].orderStatus !== | ||
3107 | - 'LEADER_PROCESS' | ||
3108 | - ) { | ||
3109 | - message.error('请选择领导待审核的子订单进行审核'); | ||
3110 | - return; | ||
3111 | - } | ||
3112 | - } | ||
3113 | - createOptObject(null, record.id); | ||
3114 | - setCheckVisible(true); | ||
3115 | - setOrderCheckType(CHECK_TYPE.LEADER_AUDIT); | ||
3116 | - }} | ||
3117 | - > | ||
3118 | - 审核 | ||
3119 | - </Button> | ||
3120 | - ) : ( | ||
3121 | - '' | ||
3122 | - )} | ||
3123 | - | ||
3124 | - {record.paths?.includes('changeOrderAudit') ? ( | ||
3125 | - <Button | ||
3126 | - className="p-0" | ||
3127 | - type="link" | ||
3128 | - onClick={() => { | ||
3129 | - let selectedSubOrders = subOrderSelectedMap.get( | ||
3130 | - record.id, | ||
3131 | - ); | ||
3132 | - setSelectedRows(selectedSubOrders); | ||
3133 | - if (selectedSubOrders === undefined) { | ||
3134 | - selectedSubOrders = record.subOrderInformationLists; | ||
3135 | - } | ||
3136 | - for (let i = 0; i < selectedSubOrders.length; i++) { | ||
3137 | - if ( | ||
3138 | - selectedSubOrders[i].orderStatus !== | ||
3139 | - 'MODIFY_APPLY_WAIT_FOR_AUDIT' | ||
3140 | - ) { | ||
3141 | - message.error('请选择[修改待审核]的子订单进行审核'); | ||
3142 | - return; | ||
3143 | - } | ||
3144 | - } | ||
3145 | - createOptObject(null, record.id); | ||
3146 | - setCheckVisible(true); | ||
3147 | - setOrderCheckType( | ||
3148 | - CHECK_TYPE.MODIFY_APPLY_WAIT_FOR_AUDIT, | ||
3149 | - ); | ||
3150 | - }} | ||
3151 | - > | ||
3152 | - 审核 | ||
3153 | - </Button> | ||
3154 | - ) : ( | ||
3155 | - '' | ||
3156 | - )} | ||
3157 | - | ||
3158 | - {record.paths?.includes('creditAudit') ? ( | ||
3159 | - <Button | ||
3160 | - className="p-0" | ||
3161 | - type="link" | ||
3162 | - onClick={() => { | ||
3163 | - let selectedSubOrders = subOrderSelectedMap.get( | ||
3164 | - record.id, | ||
3165 | - ); | ||
3166 | - setSelectedRows(selectedSubOrders); | ||
3167 | - if (selectedSubOrders === undefined) { | ||
3168 | - selectedSubOrders = record.subOrderInformationLists; | ||
3169 | - } | ||
3170 | - for (let i = 0; i < selectedSubOrders.length; i++) { | ||
3171 | - if ( | ||
3172 | - selectedSubOrders[i].orderStatus !== | ||
3173 | - 'CREDIT_CONFIRM' | ||
3174 | - ) { | ||
3175 | - message.error('请选择[赊账待审核]的子订单进行审核'); | ||
3176 | - return; | ||
3177 | - } | ||
3178 | - } | ||
3179 | - createOptObject(null, record.id); | ||
3180 | - setCheckVisible(true); | ||
3181 | - setOrderCheckType(CHECK_TYPE.CREDIT_AUDIT); | ||
3182 | - }} | ||
3183 | - > | ||
3184 | - 赊账审核 | ||
3185 | - </Button> | ||
3186 | - ) : ( | ||
3187 | - '' | ||
3188 | - )} | ||
3189 | - | ||
3190 | - {record.paths?.includes('editProductionTime') ? ( | ||
3191 | - <Button | ||
3192 | - className="p-0" | ||
3193 | - type="link" | ||
3194 | - onClick={() => { | ||
3195 | - createOptObject(null, record.id); | ||
3196 | - setProductionTimeModalVisible(true); | ||
3197 | - }} | ||
3198 | - > | ||
3199 | - 生产时间 | ||
3200 | - </Button> | ||
3201 | - ) : ( | ||
3202 | - '' | ||
3203 | - )} | ||
3204 | - | ||
3205 | - {record.paths?.includes('procureConvertProcure') ? ( | ||
3206 | - <Button | ||
3207 | - className="p-0" | ||
3208 | - type="link" | ||
3209 | - onClick={() => { | ||
3210 | - let selectedSubOrders = subOrderSelectedMap.get( | ||
3211 | - record.id, | ||
3212 | - ); | ||
3213 | - if (selectedSubOrders === undefined) { | ||
3214 | - selectedSubOrders = record.subOrderInformationLists; | ||
3215 | - } | ||
3216 | - | ||
3217 | - for (let i = 0; i < selectedSubOrders.length; i++) { | ||
3218 | - if ( | ||
3219 | - !selectedSubOrders[i].paths.includes( | ||
3220 | - 'procureConvertProcure', | ||
3221 | - ) | ||
3222 | - ) { | ||
3223 | - message.error('请选择允许转发的子订单进行转发'); | ||
3224 | - return; | ||
3225 | - } | ||
3226 | - } | ||
3227 | - createOptObject(null, record.id); | ||
3228 | - setOrderCheckType(CHECK_TYPE.PROCURE); | ||
3229 | - setProcureConvertModalVisible(true); | ||
3230 | - }} | ||
3231 | - > | ||
3232 | - 转发 | ||
3233 | - </Button> | ||
3234 | - ) : ( | ||
3235 | - '' | ||
3236 | - )} | ||
3237 | - {record.paths?.includes('sendProduct') ? ( | ||
3238 | - <Button | ||
3239 | - className="p-0" | ||
3240 | - type="link" | ||
3241 | - onClick={() => { | ||
3242 | - if (!subOrderSelectedMap.get(record.id)?.length) { | ||
3243 | - return message.error('请选择选择子订单'); | ||
3244 | - } | ||
3245 | - createOptObject(null, record.id); | ||
3246 | - setDeliverVisible(true); | ||
3247 | - setIsSendProduct(true); | ||
3248 | - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | ||
3249 | - }} | ||
3250 | - > | ||
3251 | - 仓库发货 | ||
3252 | - </Button> | ||
3253 | - ) : ( | ||
3254 | - '' | ||
3255 | - )} | ||
3256 | - | ||
3257 | - {/* 供应商发货 */} | ||
3258 | - {record.paths?.includes('supplierSendOrder') ? ( | ||
3259 | - <Button | ||
3260 | - className="p-0" | ||
3261 | - type="link" | ||
3262 | - onClick={() => { | ||
3263 | - if (!subOrderSelectedMap.get(record.id)?.length) { | ||
3264 | - return message.error('请选择选择子订单'); | ||
3265 | - } | ||
3266 | - createOptObject(null, record.id); | ||
3267 | - setDeliverVisible(true); | ||
3268 | - setIsSendProduct(true); | ||
3269 | - setOrderCheckType(CHECK_TYPE.SUPPLIER); | ||
3270 | - }} | ||
3271 | - > | ||
3272 | - 供应商发货 | ||
3273 | - </Button> | ||
3274 | - ) : ( | ||
3275 | - '' | ||
3276 | - )} | ||
3277 | - | ||
3278 | - {record.paths?.includes('procureSend') ? ( | ||
3279 | - <Button | ||
3280 | - className="p-0" | ||
3281 | - type="link" | ||
3282 | - onClick={() => { | ||
3283 | - if (!subOrderSelectedMap.get(record.id)?.length) { | ||
3284 | - return message.error('请选择选择子订单'); | ||
3285 | - } | ||
3286 | - createOptObject(null, record.id); | ||
3287 | - setDeliverVisible(true); | ||
3288 | - setIsSendProduct(true); | ||
3289 | - setOrderCheckType(CHECK_TYPE.PROCURE); | ||
3290 | - }} | ||
3291 | - > | ||
3292 | - {isSupplier() ? '发货' : '采购发货'} | ||
3293 | - </Button> | ||
3294 | - ) : ( | ||
3295 | - '' | ||
3296 | - )} | ||
3297 | - | ||
3298 | - {record.paths?.includes('printOrder') ? ( | ||
3299 | - <Button | ||
3300 | - className="p-0" | ||
3301 | - type="link" | ||
3302 | - onClick={() => { | ||
3303 | - const selectedSubOrders = subOrderSelectedMap.get( | ||
3304 | - record.id, | ||
3305 | - ); | ||
3306 | - if (!selectedSubOrders?.length) { | ||
3307 | - return message.error('请选择选择子订单'); | ||
3308 | - } | ||
3309 | - | ||
3310 | - for (let subOrderRecord of selectedSubOrders) { | ||
3311 | - let paths = subOrderRecord.paths; | ||
3312 | - if (!checkePrintable(paths)) { | ||
3313 | - return message.error('请选择可以打印的子订单'); | ||
3314 | - } | ||
3315 | - } | ||
3316 | - createOptObject(null, record.id); | ||
3317 | - setOrderPrintVisible(true); | ||
3318 | - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | ||
3319 | - }} | ||
3320 | - > | ||
3321 | - 仓库打印 | ||
3322 | - </Button> | ||
3323 | - ) : ( | ||
3324 | - '' | ||
3325 | - )} | ||
3326 | - | ||
3327 | - {record.paths?.includes('supplierPrint') ? ( | ||
3328 | - <Button | ||
3329 | - className="p-0" | ||
3330 | - type="link" | ||
3331 | - onClick={() => { | ||
3332 | - if (!subOrderSelectedMap.get(record.id)?.length) { | ||
3333 | - return message.error('请选择选择子订单'); | ||
3334 | - } | ||
3335 | - | ||
3336 | - createOptObject(null, record.id); | ||
3337 | - setOrderPrintVisible(true); | ||
3338 | - setOrderCheckType(CHECK_TYPE.SUPPLIER); | ||
3339 | - }} | ||
3340 | - > | ||
3341 | - 供应商打印 | ||
3342 | - </Button> | ||
3343 | - ) : ( | ||
3344 | - '' | ||
3345 | - )} | ||
3346 | - | ||
3347 | - {record.paths?.includes('rePrintOrder') ? ( | ||
3348 | - <Button | ||
3349 | - className="p-0" | ||
3350 | - type="link" | ||
3351 | - onClick={() => { | ||
3352 | - if (!subOrderSelectedMap.get(record.id)?.length) { | ||
3353 | - return message.error('请选择选择子订单'); | ||
3354 | - } | ||
3355 | - createOptObject(null, record.id); | ||
3356 | - setOrderPrintVisible(true); | ||
3357 | - setIsRePrintOrder(true); | ||
3358 | - }} | ||
3359 | - > | ||
3360 | - 重新打印 | ||
3361 | - </Button> | ||
3362 | - ) : ( | ||
3363 | - '' | ||
3364 | - )} | ||
3365 | - {record.paths?.includes('confirmReceipt') ? ( | ||
3366 | - <Button | ||
3367 | - className="p-0" | ||
3368 | - type="link" | ||
3369 | - onClick={() => { | ||
3370 | - createOptObject(null, record.id); | ||
3371 | - setConfirmReceiptVisible(true); | ||
3372 | - }} | ||
3373 | - > | ||
3374 | - 确认收货 | ||
3375 | - </Button> | ||
3376 | - ) : ( | ||
3377 | - '' | ||
3378 | - )} | ||
3379 | - {record.paths?.includes('modifySendInformation') ? ( | ||
3380 | - <Button | ||
3381 | - className="p-0" | ||
3382 | - type="link" | ||
3383 | - onClick={() => { | ||
3384 | - if (!subOrderSelectedMap.get(record.id)?.length) { | ||
3385 | - return message.error( | ||
3386 | - '请选择已经发货或者已经确认收货的子订单', | ||
3387 | - ); | ||
3388 | - } | ||
3389 | - for (let row of subOrderSelectedMap.get(record.id)) { | ||
3390 | - if ( | ||
3391 | - row.orderStatus !== 'CONFIRM_RECEIPT' && | ||
3392 | - row.orderStatus !== 'SHIPPED' | ||
3393 | - ) { | ||
3394 | - return message.error( | ||
3395 | - '请选择已经发货或者已经确认收货的子订单', | ||
3396 | - ); | ||
3397 | - } | ||
3398 | - } | ||
3399 | - createOptObject(null, record.id); | ||
3400 | - setDeliverVisible(true); | ||
3401 | - setIsSendProduct(false); | ||
3402 | - }} | ||
3403 | - > | ||
3404 | - 修改发货信息 | ||
3405 | - </Button> | ||
3406 | - ) : ( | ||
3407 | - '' | ||
3408 | - )} | ||
3409 | - {record.paths?.includes('invoicing') ? ( | ||
3410 | - <Button | ||
3411 | - type="link" | ||
3412 | - className="p-0" | ||
3413 | - onClick={() => { | ||
3414 | - createOptObject(null, record.id); | ||
3415 | - setFinancialVisible(true); | ||
3416 | - setIsEdit(false); | ||
3417 | - }} | ||
3418 | - > | ||
3419 | - 开票 | ||
3420 | - </Button> | ||
3421 | - ) : ( | ||
3422 | - '' | ||
3423 | - )} | ||
3424 | - | ||
3425 | - {record.paths?.includes('applyInvoicing_old') ? ( | ||
3426 | - <Button | ||
3427 | - type="link" | ||
3428 | - className="p-0" | ||
3429 | - onClick={() => { | ||
3430 | - let selectedSubOrders = subOrderSelectedMap.get( | ||
3431 | - record.id, | ||
3432 | - ); | ||
3433 | - if (selectedSubOrders === undefined) { | ||
3434 | - selectedSubOrders = record.subOrderInformationLists; | ||
3435 | - } | ||
3436 | - for (let i = 0; i < selectedSubOrders.length; i++) { | ||
3437 | - if ( | ||
3438 | - selectedSubOrders[i].invoicingStatus === | ||
3439 | - 'UN_INVOICE' || | ||
3440 | - selectedSubOrders[i].afterInvoicingStatus === | ||
3441 | - 'APPLY_FOR_INVOICING' | ||
3442 | - ) { | ||
3443 | - message.error( | ||
3444 | - '请选择需要开票且未申请开票的子订单进行申请', | ||
3445 | - ); | ||
3446 | - return; | ||
3447 | - } | ||
3448 | - } | ||
3449 | - | ||
3450 | - createOptObject(null, record.id); | ||
3451 | - setApplyForInvoicingVisible(true); | ||
3452 | - setIsEdit(false); | ||
3453 | - setIsMainOrder(false); | ||
3454 | - }} | ||
3455 | - > | ||
3456 | - 申请开票(旧) | ||
3457 | - </Button> | ||
3458 | - ) : ( | ||
3459 | - '' | ||
3460 | - )} | ||
3461 | - | ||
3462 | - {record.paths?.includes('applyInvoicing') ? ( | ||
3463 | - <Button | ||
3464 | - type="link" | ||
3465 | - className="p-0" | ||
3466 | - onClick={() => { | ||
3467 | - let selectedSubOrders = subOrderSelectedMap.get( | ||
3468 | - record.id, | ||
3469 | - ); | ||
3470 | - if (selectedSubOrders === undefined) { | ||
3471 | - selectedSubOrders = record.subOrderInformationLists; | ||
3472 | - } | ||
3473 | - for (let i = 0; i < selectedSubOrders.length; i++) { | ||
3474 | - if ( | ||
3475 | - selectedSubOrders[i].invoicingStatus === | ||
3476 | - 'UN_INVOICE' || | ||
3477 | - selectedSubOrders[i].afterInvoicingStatus === | ||
3478 | - 'APPLY_FOR_INVOICING' | ||
3479 | - ) { | ||
3480 | - message.error( | ||
3481 | - '请选择需要开票且未申请开票的子订单进行申请', | ||
3482 | - ); | ||
3483 | - return; | ||
3484 | - } | ||
3485 | - } | ||
3486 | - | ||
3487 | - createOptObject(null, record.id); | ||
3488 | - setInvoicingDrawerFormVisible(true); | ||
3489 | - setIsEdit(false); | ||
3490 | - setIsMainOrder(false); | ||
3491 | - }} | ||
3492 | - > | ||
3493 | - 申请开票(新) | ||
3494 | - </Button> | ||
3495 | - ) : ( | ||
3496 | - '' | ||
3497 | - )} | ||
3498 | - | ||
3499 | - {record.paths?.includes('updateOrder') ? ( | ||
3500 | - <Button | ||
3501 | - className="p-0" | ||
3502 | - type="link" | ||
3503 | - onClick={() => { | ||
3504 | - //勾选的子订单:如果有勾选,后面只校验有勾选的 | ||
3505 | - | ||
3506 | - let selectedSubOrders = subOrderSelectedMap.get( | ||
3507 | - record.id, | ||
3508 | - ); | ||
3509 | - if ( | ||
3510 | - selectedSubOrders === undefined || | ||
3511 | - selectedSubOrders.length === 0 | ||
3512 | - ) { | ||
3513 | - selectedSubOrders = record.subOrderInformationLists; | ||
3514 | - } | ||
3515 | - for ( | ||
3516 | - let index = 0; | ||
3517 | - index < selectedSubOrders.length; | ||
3518 | - index++ | ||
3519 | - ) { | ||
3520 | - let orderStatus = | ||
3521 | - selectedSubOrders[index].orderStatus; | ||
3522 | - //仓库管理员在审核之后的任何时候都可以编辑 | ||
3523 | - if ( | ||
3524 | - roleCode !== 'warehouseKeeper' && | ||
3525 | - roleCode !== 'admin' | ||
3526 | - ) { | ||
3527 | - //是审核通过及之后的订单 | ||
3528 | - if ( | ||
3529 | - orderStatus !== 'UNAUDITED' && | ||
3530 | - orderStatus !== 'PROCURE_REJECT' && | ||
3531 | - orderStatus !== 'AUDIT_FAILED' && | ||
3532 | - orderStatus !== 'LEADER_PROCESS' && | ||
3533 | - orderStatus !== 'SALES_CONFIRM' && | ||
3534 | - orderStatus !== 'CREDIT_CONFIRM' | ||
3535 | - ) { | ||
3536 | - message.error( | ||
3537 | - '请选择【未审核、审核失败、销售待确认、赊账待审核】的订单进行编辑', | ||
3538 | - ); | ||
3539 | - return; | ||
3540 | - } | ||
3541 | - } else { | ||
3542 | - //仓库管理员只能编辑是还未审核的订单 | ||
3543 | - if ( | ||
3544 | - roleCode !== 'admin' && | ||
3545 | - (orderStatus === 'UNAUDITED' || | ||
3546 | - orderStatus === 'PROCURE_REJECT' || | ||
3547 | - orderStatus === 'AUDIT_FAILED') | ||
3548 | - ) { | ||
3549 | - message.error('请选择已审核的订单进行编辑'); | ||
3550 | - return; | ||
3551 | - } | ||
3552 | - } | ||
3553 | - } | ||
3554 | - | ||
3555 | - createOptObject(null, record.id); | ||
3556 | - setOrderDrawerVisible(true); | ||
3557 | - setOrderOptType('edit'); | ||
3558 | - }} | ||
3559 | - > | ||
3560 | - 编辑 | ||
3561 | - </Button> | ||
3562 | - ) : ( | ||
3563 | - '' | ||
3564 | - )} | ||
3565 | - | ||
3566 | - {record?.subOrderInformationLists[0].paths?.includes( | ||
3567 | - 'noNeedInvoicingEdit', | ||
3568 | - ) ? ( | ||
3569 | - <Button | ||
3570 | - className="p-0" | ||
3571 | - type="link" | ||
3572 | - onClick={() => { | ||
3573 | - createOptObject(null, record.id); | ||
3574 | - setFinancialEditVisible(true); | ||
3575 | - setIsMainOrder(true); | ||
3576 | - }} | ||
3577 | - > | ||
3578 | - 财务编辑 | ||
3579 | - </Button> | ||
3580 | - ) : ( | ||
3581 | - '' | ||
3582 | - )} | ||
3583 | - | ||
3584 | - {record.paths?.includes('checkOrder') ? ( | ||
3585 | - <Button | ||
3586 | - className="p-0" | ||
3587 | - type="link" | ||
3588 | - onClick={() => { | ||
3589 | - let selectedSubOrders = subOrderSelectedMap.get( | ||
3590 | - record.id, | ||
3591 | - ); | ||
3592 | - setSelectedRows(selectedSubOrders); | ||
3593 | - if (selectedSubOrders === undefined) { | ||
3594 | - selectedSubOrders = record.subOrderInformationLists; | ||
3595 | - } | ||
3596 | - for (let i = 0; i < selectedSubOrders.length; i++) { | ||
3597 | - let orderStatus = selectedSubOrders[i].orderStatus; | ||
3598 | - if ( | ||
3599 | - orderStatus !== 'UNAUDITED' && | ||
3600 | - orderStatus !== 'PROCURE_REJECT' && | ||
3601 | - orderStatus !== 'FINANCE_PROCESS' && | ||
3602 | - orderStatus !== 'LEADER_AUDITED' | ||
3603 | - ) { | ||
3604 | - message.error( | ||
3605 | - '请选择未审核或者领导已审核的子订单进行审核', | ||
3606 | - ); | ||
3607 | - return; | ||
3608 | - } | ||
3609 | - } | ||
3610 | - | ||
3611 | - createOptObject(null, record.id); | ||
3612 | - setCheckVisible(true); | ||
3613 | - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | ||
3614 | - }} | ||
3615 | - > | ||
3616 | - 审核 | ||
3617 | - </Button> | ||
3618 | - ) : ( | ||
3619 | - '' | ||
3620 | - )} | ||
3621 | - | ||
3622 | - {record.paths?.includes('afterSalesCheck') ? ( | ||
3623 | - <Button | ||
3624 | - className="p-0" | ||
3625 | - type="link" | ||
3626 | - onClick={() => { | ||
3627 | - let selectedSubOrders = subOrderSelectedMap.get( | ||
3628 | - record.id, | ||
3629 | - ); | ||
3630 | - setSelectedRows(selectedSubOrders); | ||
3631 | - if (selectedSubOrders === undefined) { | ||
3632 | - selectedSubOrders = record.subOrderInformationLists; | ||
3633 | - } | ||
3634 | - for (let i = 0; i < selectedSubOrders.length; i++) { | ||
3635 | - if ( | ||
3636 | - selectedSubOrders[i].orderStatus !== | ||
3637 | - 'IN_AFTER_SALES' | ||
3638 | - ) { | ||
3639 | - message.error('请选择售后中的子订单进行审核'); | ||
3640 | - return; | ||
3641 | - } | ||
3642 | - } | ||
3643 | - | ||
3644 | - createOptObject(null, record.id); | ||
3645 | - setCheckVisible(true); | ||
3646 | - setOrderCheckType(CHECK_TYPE.AFTER_SALES); | ||
3647 | - }} | ||
3648 | - > | ||
3649 | - 售后审核 | ||
3650 | - </Button> | ||
3651 | - ) : ( | ||
3652 | - '' | ||
3653 | - )} | ||
3654 | - | ||
3655 | - {record.paths?.includes('noNeedSend') ? ( | ||
3656 | - <ButtonConfirm | ||
3657 | - className="p-0" | ||
3658 | - title="此订单是否无需发货?" | ||
3659 | - text="无需发货" | ||
3660 | - onConfirm={async () => { | ||
3661 | - let selectedSubOrders = subOrderSelectedMap.get( | ||
3662 | - record.id, | ||
3663 | - ); | ||
3664 | - if (selectedSubOrders === undefined) { | ||
3665 | - selectedSubOrders = record.subOrderInformationLists; | ||
3666 | - } | ||
3667 | - setSelectedRows(selectedSubOrders); | ||
3668 | - for (let i = 0; i < selectedSubOrders.length; i++) { | ||
3669 | - if ( | ||
3670 | - selectedSubOrders[i].orderStatus !== 'AUDITED' && | ||
3671 | - selectedSubOrders[i].orderStatus !== | ||
3672 | - 'PROCURE_PROCESS' && | ||
3673 | - selectedSubOrders[i].orderStatus !== | ||
3674 | - 'PROCURE_PROCESS_FOR_MINE' && | ||
3675 | - selectedSubOrders[i].orderStatus !== | ||
3676 | - 'PROCURE_WAIT_SHIP' && | ||
3677 | - selectedSubOrders[i].orderStatus !== | ||
3678 | - 'SUPPLIER_WAIT_SHIP' && | ||
3679 | - selectedSubOrders[i].orderStatus !== 'WAIT_SHIP' | ||
3680 | - ) { | ||
3681 | - message.error( | ||
3682 | - '请选择未发货的子订单进行无需发货操作', | ||
3683 | - ); | ||
3684 | - return; | ||
3685 | - } | ||
3686 | - } | ||
3687 | - | ||
3688 | - const data = await postServiceOrderNoNeedSend({ | ||
3689 | - data: { | ||
3690 | - ids: selectedSubOrders.map((item) => { | ||
3691 | - return item.id; | ||
3692 | - }), | ||
3693 | - }, | ||
3694 | - }); | ||
3695 | - if (data.result === RESPONSE_CODE.SUCCESS) { | ||
3696 | - message.success(data.message); | ||
3697 | - refreshTable(); | ||
3698 | - } | ||
3699 | - }} | ||
3700 | - /> | ||
3701 | - ) : ( | ||
3702 | - '' | ||
3703 | - )} | ||
3704 | - | ||
3705 | - {record.paths?.includes('saleCancelInvoicing_old') ? ( | ||
3706 | - <ButtonConfirm | ||
3707 | - className="p-0" | ||
3708 | - title="确认取消申请开票?" | ||
3709 | - text="取消申请(旧)" | ||
3710 | - onConfirm={async () => { | ||
3711 | - let selectedSubOrders = subOrderSelectedMap.get( | ||
3712 | - record.id, | ||
3713 | - ); | ||
3714 | - if (selectedSubOrders === undefined) { | ||
3715 | - selectedSubOrders = record.subOrderInformationLists; | ||
3716 | - } | ||
3717 | - | ||
3718 | - console.log(selectedSubOrders); | ||
3719 | - for (let i = 0; i < selectedSubOrders.length; i++) { | ||
3720 | - if ( | ||
3721 | - selectedSubOrders[i].afterInvoicingStatus !== | ||
3722 | - 'APPLY_FOR_INVOICING' | ||
3723 | - ) { | ||
3724 | - message.error( | ||
3725 | - '请选择已[申请开票]的子订单进行取消申请', | ||
3726 | - ); | ||
3727 | - return; | ||
3728 | - } | ||
3729 | - } | ||
3730 | - let res = await postServiceOrderSaleCancelInvoicing({ | ||
3731 | - data: { | ||
3732 | - subOrderIds: selectedSubOrders.map((item) => { | ||
3733 | - return item.id; | ||
3734 | - }), | ||
3735 | - }, | ||
3736 | - }); | ||
3737 | - | ||
3738 | - if (res && res.result === RESPONSE_CODE.SUCCESS) { | ||
3739 | - message.success(res.message); | ||
3740 | - refreshTable(); | ||
3741 | - } | ||
3742 | - }} | ||
3743 | - /> | ||
3744 | - ) : ( | ||
3745 | - '' | ||
3746 | - )} | ||
3747 | - {/* 财务审核:主订单暂无 */} | ||
3748 | - {record.paths?.includes('financeCheckOrder') ? ( | ||
3749 | - <Button | ||
3750 | - className="p-0" | ||
3751 | - type="link" | ||
3752 | - onClick={() => { | ||
3753 | - let selectedSubOrders = subOrderSelectedMap.get( | ||
3754 | - record.id, | ||
3755 | - ); | ||
3756 | - setSelectedRows(selectedSubOrders); | ||
3757 | - if (selectedSubOrders === undefined) { | ||
3758 | - selectedSubOrders = record.subOrderInformationLists; | ||
3759 | - } | ||
3760 | - for (let i = 0; i < selectedSubOrders.length; i++) { | ||
3761 | - if ( | ||
3762 | - selectedSubOrders[i].orderStatus !== 'UNAUDITED' && | ||
3763 | - selectedSubOrders[i].orderStatus !== | ||
3764 | - 'PROCURE_REJECT' && | ||
3765 | - selectedSubOrders[i].orderStatus !== | ||
3766 | - 'FINANCE_PROCESS' && | ||
3767 | - selectedSubOrders[i].orderStatus !== | ||
3768 | - 'LEADER_AUDITED' | ||
3769 | - ) { | ||
3770 | - message.error( | ||
3771 | - '请选择[未审核]、[财务待审核]、[领导已审核]的子订单进行审核', | ||
3772 | - ); | ||
3773 | - return; | ||
3774 | - } | ||
3775 | - } | ||
3776 | - createOptObject(null, record.id); | ||
3777 | - setCheckVisible(true); | ||
3778 | - setOrderCheckType(CHECK_TYPE.FINALCIAL); | ||
3779 | - }} | ||
3780 | - > | ||
3781 | - 财务审核 | ||
3782 | - </Button> | ||
3783 | - ) : ( | ||
3784 | - '' | ||
3785 | - )} | ||
3786 | - | ||
3787 | - {/* 采购审核 */} | ||
3788 | - {record.paths?.includes('procureCheckOrder') ? ( | ||
3789 | - <Button | ||
3790 | - className="p-0" | ||
3791 | - type="link" | ||
3792 | - onClick={() => { | ||
3793 | - let selectedSubOrders = subOrderSelectedMap.get( | ||
3794 | - record.id, | ||
3795 | - ); | ||
3796 | - setSelectedRows(selectedSubOrders); | ||
3797 | - if (selectedSubOrders === undefined) { | ||
3798 | - selectedSubOrders = record.subOrderInformationLists; | ||
3799 | - } | ||
3800 | - for (let i = 0; i < selectedSubOrders.length; i++) { | ||
3801 | - if ( | ||
3802 | - selectedSubOrders[i].orderStatus !== | ||
3803 | - 'PROCURE_UN_PROCESS' | ||
3804 | - ) { | ||
3805 | - message.error('请选择未审核的子订单进行审核'); | ||
3806 | - return; | ||
3807 | - } | ||
3808 | - } | ||
3809 | - | ||
3810 | - createOptObject(null, record.id); | ||
3811 | - setProcureCheckModalVisible(true); | ||
3812 | - setOrderCheckType(CHECK_TYPE.PROCURE); | ||
3813 | - }} | ||
3814 | - > | ||
3815 | - 采购审核 | ||
3816 | - </Button> | ||
3817 | - ) : ( | ||
3818 | - '' | ||
3819 | - )} | ||
3820 | - | ||
3821 | - {record.paths?.includes('applyAfterSales') ? ( | ||
3822 | - <Button | ||
3823 | - className="p-0" | ||
3824 | - type="link" | ||
3825 | - onClick={() => { | ||
3826 | - let selectedSubOrders = subOrderSelectedMap.get( | ||
3827 | - record.id, | ||
3828 | - ); | ||
3829 | - if (selectedSubOrders === undefined) { | ||
3830 | - selectedSubOrders = record.subOrderInformationLists; | ||
3831 | - } | ||
3832 | - setSelectedRows(selectedSubOrders); | ||
3833 | - for (let i = 0; i < selectedSubOrders.length; i++) { | ||
3834 | - if ( | ||
3835 | - selectedSubOrders[i].orderStatus !== | ||
3836 | - 'CONFIRM_RECEIPT' && | ||
3837 | - selectedSubOrders[i].orderStatus !== | ||
3838 | - 'AFTER_SALES_FAILURE' && | ||
3839 | - selectedSubOrders[i].orderStatus !== | ||
3840 | - 'AFTER_SALES_COMPLETION' | ||
3841 | - ) { | ||
3842 | - message.error('请选择确认收货状态的子订单进行售后'); | ||
3843 | - return; | ||
3844 | - } | ||
3845 | - } | ||
3846 | - | ||
3847 | - createOptObject(null, record.id); | ||
3848 | - setOrderDrawerVisible(true); | ||
3849 | - setOrderOptType('after-sales'); | ||
3850 | - }} | ||
3851 | - > | ||
3852 | - 申请售后 | ||
3853 | - </Button> | ||
3854 | - ) : ( | ||
3855 | - '' | ||
3856 | - )} | ||
3857 | - | ||
3858 | - {/* {record.paths?.includes('afterSalesCompletion') ? ( | ||
3859 | - <ButtonConfirm | ||
3860 | - className="p-0" | ||
3861 | - title="售后是否已完成?" | ||
3862 | - text="完成售后" | ||
3863 | - onConfirm={async () => { | ||
3864 | - let selectedSubOrders = subOrderSelectedMap.get(record.id); | ||
3865 | - if (selectedSubOrders === undefined) { | ||
3866 | - selectedSubOrders = record.subOrderInformationLists; | ||
3867 | - } | ||
3868 | - for (let i = 0; i < selectedSubOrders.length; i++) { | ||
3869 | - if ( | ||
3870 | - selectedSubOrders[i].orderStatus !== | ||
3871 | - 'IN_AFTER_SALES' | ||
3872 | - ) { | ||
3873 | - message.error( | ||
3874 | - '请选择售后中状态的子订单进行完成售后', | ||
3875 | - ); | ||
3876 | - return false; | ||
3877 | - } | ||
3878 | - } | ||
3879 | - | ||
3880 | - const ids = selectedSubOrders?.map((item) => { | ||
3881 | - return item.id; | ||
3882 | - }); | ||
3883 | - | ||
3884 | - let body = { | ||
3885 | - ids: ids, | ||
3886 | - }; | ||
3887 | - const data = await postServiceOrderAfterSalesCompletion( | ||
3888 | - { | ||
3889 | - data: body, | ||
3890 | - }, | ||
3891 | - ); | ||
3892 | - if (data.result === RESPONSE_CODE.SUCCESS) { | ||
3893 | - message.success(data.message); | ||
3894 | - refreshTable(); | ||
3895 | - } | ||
3896 | - }} | ||
3897 | - /> | ||
3898 | - ) : ( | ||
3899 | - '' | ||
3900 | - )} */} | ||
3901 | - | ||
3902 | - {record.paths?.includes('salOrderSave') ? ( | ||
3903 | - <ButtonConfirm | ||
3904 | - className="p-0" | ||
3905 | - title="是否推送至金蝶ERP?" | ||
3906 | - text="推送ERP" | ||
3907 | - onConfirm={async () => { | ||
3908 | - let res = await postKingdeeRepSalOrderSave({ | ||
3909 | - data: { | ||
3910 | - id: record.id, | ||
3911 | - }, | ||
3912 | - }); | ||
3913 | - | ||
3914 | - if (res && res.result === RESPONSE_CODE.SUCCESS) { | ||
3915 | - message.success('推送成功'); | ||
3916 | - mainTableRef.current.reload(); | ||
3917 | - } | ||
3918 | - }} | ||
3919 | - /> | ||
3920 | - ) : ( | ||
3921 | - '' | ||
3922 | - )} | ||
3923 | - | ||
3924 | - {record.paths?.includes('salBillOutbound') ? ( | ||
3925 | - <ButtonConfirm | ||
3926 | - className="p-0" | ||
3927 | - title="是否下推金蝶ERP出库单?" | ||
3928 | - text="下推出库" | ||
3929 | - onConfirm={async () => { | ||
3930 | - let res = await postKingdeeRepSalBillOutbound({ | ||
3931 | - data: { | ||
3932 | - id: record.id, | ||
3933 | - }, | ||
3934 | - }); | ||
3935 | - | ||
3936 | - if (res && res.result === RESPONSE_CODE.SUCCESS) { | ||
3937 | - message.success('下推成功'); | ||
3938 | - mainTableRef.current.reload(); | ||
3939 | - } | ||
3940 | - }} | ||
3941 | - /> | ||
3942 | - ) : ( | ||
3943 | - '' | ||
3944 | - )} | ||
3945 | - | ||
3946 | - {record.paths?.includes('confirmInvoice') ? ( | ||
3947 | - <ButtonConfirm | ||
3948 | - className="p-0" | ||
3949 | - title="已和客户确认发票?" | ||
3950 | - text="确认发票" | ||
3951 | - onConfirm={async () => { | ||
3952 | - let body = [ | ||
3953 | - ...record.subOrderInformationLists.map( | ||
3954 | - (subOrder) => subOrder.id, | ||
3955 | - ), | ||
3956 | - ]; | ||
3957 | - const data = await postServiceOrderConfirmInvoice({ | ||
3958 | - data: body, | ||
3959 | - }); | ||
3960 | - if (data.result === RESPONSE_CODE.SUCCESS) { | ||
3961 | - message.success(data.message); | ||
3962 | - refreshTable(); | ||
3963 | - } | ||
3964 | - }} | ||
3965 | - /> | ||
3966 | - ) : ( | ||
3967 | - '' | ||
3968 | - )} | ||
3969 | - | ||
3970 | - {record.paths?.includes('orderCancel') ? ( | ||
3971 | - <ButtonConfirm | ||
3972 | - className="p-0" | ||
3973 | - title="确认作废?" | ||
3974 | - text="作废" | ||
3975 | - onConfirm={async () => { | ||
3976 | - let body = { | ||
3977 | - ids: [record.id], | ||
3978 | - checkIsMainOrderId: true, | ||
3979 | - }; | ||
3980 | - const data = await postServiceOrderOrderCancel({ | ||
3981 | - data: body, | ||
3982 | - }); | ||
3983 | - if (data.result === RESPONSE_CODE.SUCCESS) { | ||
3984 | - message.success(data.message); | ||
3985 | - refreshTable(); | ||
3986 | - } | ||
3987 | - }} | ||
3988 | - /> | ||
3989 | - ) : ( | ||
3990 | - '' | ||
3991 | - )} | ||
3992 | - | ||
3993 | - {record.paths?.includes('procurePrint') ? ( | ||
3994 | - <ButtonConfirm | ||
3995 | - className="p-0" | ||
3996 | - title="确认打印?" | ||
3997 | - text="采购打印" | ||
3998 | - onConfirm={async () => { | ||
3999 | - let selectedSubOrders = subOrderSelectedMap.get( | ||
4000 | - record.id, | ||
4001 | - ); | ||
4002 | - if (selectedSubOrders === undefined) { | ||
4003 | - selectedSubOrders = record.subOrderInformationLists; | ||
4004 | - } | ||
4005 | - for (let i = 0; i < selectedSubOrders.length; i++) { | ||
4006 | - if ( | ||
4007 | - selectedSubOrders[i].orderStatus !== | ||
4008 | - 'PROCURE_PROCESS_FOR_MINE' | ||
4009 | - ) { | ||
4010 | - message.error( | ||
4011 | - '请选择采购待打印状态的子订单进行打印', | ||
4012 | - ); | ||
4013 | - return false; | ||
4014 | - } | ||
4015 | - } | ||
4016 | - | ||
4017 | - const ids = selectedSubOrders?.map((item) => { | ||
4018 | - return item.id; | ||
4019 | - }); | ||
4020 | - let res = await postServiceOrderProcurePrint({ | ||
4021 | - data: { | ||
4022 | - ids: ids, | ||
4023 | - }, | ||
4024 | - }); | ||
4025 | - | ||
4026 | - if (res.result === RESPONSE_CODE.SUCCESS) { | ||
4027 | - message.success(res.message); | ||
4028 | - refreshTable(); | ||
4029 | - } | ||
4030 | - }} | ||
4031 | - /> | ||
4032 | - ) : ( | ||
4033 | - // <Button | ||
4034 | - // className="p-0" | ||
4035 | - // type="link" | ||
4036 | - // onClick={() => { | ||
4037 | - // if (!subOrderSelectedMap.get(record.id)?.length) { | ||
4038 | - // return message.error('请选择选择子订单'); | ||
4039 | - // } | ||
4040 | - // setSelectedRows(subOrderSelectedMap.get(record.id)); | ||
4041 | - // setOrderRow(record); | ||
4042 | - // setOrderPrintVisible(true); | ||
4043 | - // setOrderCheckType(CHECK_TYPE.PROCURE); | ||
4044 | - // }} | ||
4045 | - // > | ||
4046 | - // 采购打印 | ||
4047 | - // </Button> | ||
4048 | - '' | ||
4049 | - )} | ||
4050 | - </Space> | ||
4051 | - </Space.Compact> | ||
4052 | - </Flex> | ||
4053 | - </Flex> | ||
4054 | - </Flex> | ||
4055 | - | ||
4056 | - <Flex className="p-0 pb-[24px] pt-[4px] pl-[23px] pr-[5px] bg-white rounded-b-lg"> | ||
4057 | - {expandedRowRender(record)} | ||
4058 | - </Flex> | ||
4059 | - </Flex> | ||
4060 | - ); | ||
4061 | - }; | ||
4062 | - | ||
4063 | - // 主订单列表 | ||
4064 | - const mainOrdersColumns: ProColumns<OrderType>[] = MAIN_ORDER_COLUMNS.map( | ||
4065 | - (item) => { | ||
4066 | - //首能账号只能搜索订单编号 | ||
4067 | - let canSearchIndex = [ | ||
4068 | - 'id', | ||
4069 | - 'salesCode', | ||
4070 | - 'subNotes', | ||
4071 | - 'orderStatus', | ||
4072 | - 'createTime', | ||
4073 | - 'modifiedAuditStatus', | ||
4074 | - ]; | ||
4075 | - if (isSupplier() && !canSearchIndex.includes(item.dataIndex)) { | ||
4076 | - item.search = false; | ||
4077 | - } | ||
4078 | - | ||
4079 | - canSearchIndex = [ | ||
4080 | - 'id', | ||
4081 | - 'salesCode', | ||
4082 | - 'customerName', | ||
4083 | - 'institution', | ||
4084 | - 'productName', | ||
4085 | - 'orderStatus', | ||
4086 | - 'createTime', | ||
4087 | - ]; | ||
4088 | - | ||
4089 | - if (isExaminer() && !canSearchIndex.includes(item.dataIndex)) { | ||
4090 | - item.search = false; | ||
4091 | - } | ||
4092 | - | ||
4093 | - if (item.dataIndex === 'name') { | ||
4094 | - return { | ||
4095 | - ...item, | ||
4096 | - title: <OrderTableHeader />, | ||
4097 | - render: (text, record) => { | ||
4098 | - return <MainOrderColumnRender record={record} />; | ||
4099 | - }, | ||
4100 | - }; | ||
4101 | - } | ||
4102 | - | ||
4103 | - /** | ||
4104 | - * 采购的订单状态筛选内容 | ||
4105 | - */ | ||
4106 | - if (roles.includes('PROCURE') && item.dataIndex === 'orderStatus') { | ||
4107 | - item.valueEnum = enumToProTableEnumValue( | ||
4108 | - PROCURE_PRIMARY_ORDER_STATUS_OPTIONS, | ||
4109 | - ); | ||
4110 | - } | ||
4111 | - return item; | ||
4112 | - }, | ||
4113 | - ); | ||
4114 | - | ||
4115 | - /** | ||
4116 | - * 采购可以筛选供应商备注 | ||
4117 | - */ | ||
4118 | - if ( | ||
4119 | - (roleCode === 'procure' || | ||
4120 | - roles.includes('PROCURE') || | ||
4121 | - roleCode === 'admin') && | ||
4122 | - !isSupplier() | ||
4123 | - ) { | ||
4124 | - mainOrdersColumns.push({ | ||
4125 | - title: '供应商备注', | ||
4126 | - width: 120, | ||
4127 | - dataIndex: 'supplierNotes', | ||
4128 | - valueType: 'text', | ||
4129 | - hideInTable: true, | ||
4130 | - }); | ||
4131 | - } | ||
4132 | - | ||
4133 | - /** | ||
4134 | - * 采购可以筛选其他采购 | ||
4135 | - */ | ||
4136 | - if ( | ||
4137 | - (roleCode === 'procure' || | ||
4138 | - roles.includes('PROCURE') || | ||
4139 | - roleCode === 'admin') && | ||
4140 | - !isSupplier() | ||
4141 | - ) { | ||
4142 | - mainOrdersColumns.push({ | ||
4143 | - title: '采购名称', | ||
4144 | - width: 120, | ||
4145 | - dataIndex: 'supplierName', | ||
4146 | - valueType: 'select', | ||
4147 | - request: async () => { | ||
4148 | - const res = await postServiceOrderProvideProcurementRoles(); | ||
4149 | - let options = res.data?.map((item) => { | ||
4150 | - return { label: item, value: item }; | ||
4151 | - }); | ||
4152 | - return options; | ||
4153 | - }, | ||
4154 | - hideInTable: true, | ||
4155 | - }); | ||
4156 | - } | ||
4157 | - | ||
4158 | - /** | ||
4159 | - * 排除采购 | ||
4160 | - */ | ||
4161 | - if ( | ||
4162 | - (roleCode === 'procure' || | ||
4163 | - roles.includes('PROCURE') || | ||
4164 | - roleCode === 'admin') && | ||
4165 | - !isSupplier() | ||
4166 | - ) { | ||
4167 | - mainOrdersColumns.push({ | ||
4168 | - title: '采购排除', | ||
4169 | - width: 120, | ||
4170 | - dataIndex: 'excludeProcureNames', | ||
4171 | - fieldProps: { | ||
4172 | - mode: 'multiple', | ||
4173 | - }, | ||
4174 | - valueType: 'select', | ||
4175 | - request: async () => { | ||
4176 | - const res = await postServiceOrderProvideProcurementRoles(); | ||
4177 | - let options = res.data?.map((item) => { | ||
4178 | - return { label: item, value: item }; | ||
4179 | - }); | ||
4180 | - return options; | ||
4181 | - }, | ||
4182 | - hideInTable: true, | ||
4183 | - }); | ||
4184 | - } | ||
4185 | - | ||
4186 | - /** | ||
4187 | - * 仓库可以筛选发货仓库 | ||
4188 | - */ | ||
4189 | - if (roleCode === 'warehouseKeeper' || roleCode === 'admin') { | ||
4190 | - mainOrdersColumns.push({ | ||
4191 | - title: '发货仓库', | ||
4192 | - width: 120, | ||
4193 | - dataIndex: 'shippingWarehouse', | ||
4194 | - valueType: 'select', | ||
4195 | - valueEnum: enumToProTableEnumValue(SHIPPING_WAREHOUSE_OPTIONS), | ||
4196 | - hideInTable: true, | ||
4197 | - }); | ||
4198 | - } | ||
4199 | - | ||
4200 | - //判断是否是采购,是的话新增一个筛选条件 | ||
4201 | - if ( | ||
4202 | - roleCode === 'procure' || | ||
4203 | - roles.includes('PROCURE') || | ||
4204 | - roleCode === 'admin' | ||
4205 | - ) { | ||
4206 | - mainOrdersColumns.push({ | ||
4207 | - title: isSupplier() ? '下单状态' : '采购下单状态', | ||
4208 | - dataIndex: 'procureOrderStatus', | ||
4209 | - valueType: 'select', | ||
4210 | - hideInTable: true, | ||
4211 | - valueEnum: enumToProTableEnumValue(PROCURE_ORDER_STATUS), | ||
4212 | - }); | ||
4213 | - } | ||
4214 | - | ||
4215 | - function toolBarRender() { | ||
4216 | - let toolBtns = []; | ||
4217 | - let radios: any[] = []; | ||
4218 | - | ||
4219 | - radios.push(<Radio value={0}>全部</Radio>); | ||
4220 | - | ||
4221 | - if ( | ||
4222 | - roleCode === 'admin' || | ||
4223 | - roleCode === 'salesManager' || | ||
4224 | - roles.includes('PROCURE') || | ||
4225 | - roleCode === 'salesRepresentative' | ||
4226 | - ) { | ||
4227 | - radios.push(<Radio value={70}>只看作废</Radio>); | ||
4228 | - } | ||
4229 | - | ||
4230 | - if (roleCode === 'warehouseKeeper') { | ||
4231 | - radios.push(<Radio value={40}>待处理</Radio>); | ||
4232 | - } | ||
4233 | - | ||
4234 | - //采购可以筛选出需要处理的订单 | ||
4235 | - if (roles.includes('PROCURE') && !isSupplier()) { | ||
4236 | - radios.push(<Radio value={60}>其他采购</Radio>); | ||
4237 | - radios.push(<Radio value={10}>待处理</Radio>); | ||
4238 | - } | ||
4239 | - | ||
4240 | - //财务可以将需要处理的订单排序到前面 | ||
4241 | - if (roleCode === 'finance') { | ||
4242 | - radios.push(<Radio value={50}>加急</Radio>); | ||
4243 | - | ||
4244 | - radios.push(<Radio value={40}>待处理</Radio>); | ||
4245 | - | ||
4246 | - radios.push(<Checkbox onChange={financeSorted}>排序</Checkbox>); | ||
4247 | - } | ||
4248 | - | ||
4249 | - if (roleCode === 'salesRepresentative' || roleCode === 'salesManager') { | ||
4250 | - radios.push(<Radio value={30}>只看我创建</Radio>); | ||
4251 | - | ||
4252 | - radios.push(<Radio value={40}>待审核</Radio>); | ||
4253 | - } | ||
4254 | - | ||
4255 | - if (roleCode === 'admin') { | ||
4256 | - radios.push(<Radio value={10}>待处理</Radio>); | ||
4257 | - radios.push(<Checkbox onChange={financeSorted}>排序</Checkbox>); | ||
4258 | - } | ||
4259 | - | ||
4260 | - //筛选按钮配置 | ||
4261 | - let radioGroup = ( | ||
4262 | - <Radio.Group | ||
4263 | - onChange={(e: any) => { | ||
4264 | - setFilterCondition(e.target.value); | ||
4265 | - refreshTable(); | ||
4266 | - }} | ||
4267 | - defaultValue={0} | ||
4268 | - > | ||
4269 | - {radios} | ||
4270 | - </Radio.Group> | ||
4271 | - ); | ||
4272 | - | ||
4273 | - toolBtns.push(radioGroup); | ||
4274 | - | ||
4275 | - toolBtns.push(<ImportExpressBillModal></ImportExpressBillModal>); | ||
4276 | - | ||
4277 | - //导出按钮配置 | ||
4278 | - const exportItems: MenuProps['items'] = [ | ||
4279 | - { | ||
4280 | - label: '导出查询结果订单', | ||
4281 | - key: '2', | ||
4282 | - onClick: async () => { | ||
4283 | - let body = { flag: 50, ...searchParams }; | ||
4284 | - exportLoading(); | ||
4285 | - downloadFile( | ||
4286 | - '/api/service/order/export', | ||
4287 | - '订单导出结果.xls', | ||
4288 | - 'POST', | ||
4289 | - body, | ||
4290 | - exportLoadingDestory, | ||
4291 | - ); | ||
4292 | - }, | ||
4293 | - }, | ||
4294 | - { | ||
4295 | - label: '导出已选中订单', | ||
4296 | - key: '1', | ||
4297 | - onClick: async () => { | ||
4298 | - if (mainOrderSelectedMap.size === 0) { | ||
4299 | - message.error('请选择订单'); | ||
4300 | - return; | ||
4301 | - } | ||
4302 | - let body = { flag: 30, id: Array.from(mainOrderSelectedMap.keys()) }; | ||
4303 | - exportLoading(); | ||
4304 | - downloadFile( | ||
4305 | - '/api/service/order/export', | ||
4306 | - '订单导出结果.xls', | ||
4307 | - 'POST', | ||
4308 | - body, | ||
4309 | - exportLoadingDestory, | ||
4310 | - ); | ||
4311 | - }, | ||
4312 | - }, | ||
4313 | - { | ||
4314 | - label: '导出当天订单', | ||
4315 | - key: '4', | ||
4316 | - onClick: async () => { | ||
4317 | - let body = { flag: 40, ids: [] }; | ||
4318 | - exportLoading(); | ||
4319 | - downloadFile( | ||
4320 | - '/api/service/order/export', | ||
4321 | - '订单导出结果.xls', | ||
4322 | - 'POST', | ||
4323 | - body, | ||
4324 | - exportLoadingDestory, | ||
4325 | - ); | ||
4326 | - }, | ||
4327 | - }, | ||
4328 | - { | ||
4329 | - label: '导出所有订单', | ||
4330 | - key: '3', | ||
4331 | - onClick: async () => { | ||
4332 | - let body = { flag: 10, ids: [] }; | ||
4333 | - exportLoading(); | ||
4334 | - downloadFile( | ||
4335 | - '/api/service/order/export', | ||
4336 | - '订单导出结果.xls', | ||
4337 | - 'POST', | ||
4338 | - body, | ||
4339 | - exportLoadingDestory, | ||
4340 | - ); | ||
4341 | - }, | ||
4342 | - }, | ||
4343 | - ]; | ||
4344 | - | ||
4345 | - const exportMenuProps = { | ||
4346 | - items: exportItems, | ||
4347 | - onClick: () => {}, | ||
4348 | - }; | ||
4349 | - | ||
4350 | - //一键审核按钮配置 | ||
4351 | - const auditItems: MenuProps['items'] = [ | ||
4352 | - { | ||
4353 | - label: '后置审核', | ||
4354 | - key: '1', | ||
4355 | - onClick: async () => { | ||
4356 | - setIsMainOrder(true); | ||
4357 | - setCheckVisible(true); | ||
4358 | - setOrderCheckType(CHECK_TYPE.WAITING_FOR_POST_AUDIT); | ||
4359 | - }, | ||
4360 | - }, | ||
4361 | - { | ||
4362 | - label: '加急开票审核(旧)', | ||
4363 | - key: '2', | ||
4364 | - disabled: true, | ||
4365 | - onClick: async () => { | ||
4366 | - setIsMainOrder(true); | ||
4367 | - setCheckVisible(true); | ||
4368 | - setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD); | ||
4369 | - }, | ||
4370 | - }, | ||
4371 | - { | ||
4372 | - label: '领导审核', | ||
4373 | - key: '3', | ||
4374 | - onClick: async () => { | ||
4375 | - setIsMainOrder(true); | ||
4376 | - setCheckVisible(true); | ||
4377 | - setOrderCheckType(CHECK_TYPE.LEADER_AUDIT); | ||
4378 | - }, | ||
4379 | - }, | ||
4380 | - { | ||
4381 | - label: '修改申请审核', | ||
4382 | - key: '4', | ||
4383 | - onClick: async () => { | ||
4384 | - setIsMainOrder(true); | ||
4385 | - setCheckVisible(true); | ||
4386 | - setOrderCheckType(CHECK_TYPE.MODIFY_APPLY_WAIT_FOR_AUDIT); | ||
4387 | - }, | ||
4388 | - }, | ||
4389 | - ]; | ||
4390 | - | ||
4391 | - const auditProps = { | ||
4392 | - items: auditItems, | ||
4393 | - onClick: () => {}, | ||
4394 | - }; | ||
4395 | - | ||
4396 | - if (rolePath?.includes('leaderMergeAudit')) { | ||
4397 | - toolBtns.push( | ||
4398 | - <Dropdown | ||
4399 | - disabled={selectedSubOrderKeys.length === 0} | ||
4400 | - menu={auditProps} | ||
4401 | - > | ||
4402 | - <Button> | ||
4403 | - <Space> | ||
4404 | - 一键审核 | ||
4405 | - <DownOutlined /> | ||
4406 | - </Space> | ||
4407 | - </Button> | ||
4408 | - </Dropdown>, | ||
4409 | - ); | ||
4410 | - } | ||
4411 | - | ||
4412 | - if (rolePath?.includes('mergeAudit')) { | ||
4413 | - toolBtns.push( | ||
4414 | - <Button | ||
4415 | - type="primary" | ||
4416 | - key="out" | ||
4417 | - onClick={() => { | ||
4418 | - setIsMainOrder(true); | ||
4419 | - if (roles.includes('PROCURE')) { | ||
4420 | - setProcureCheckModalVisible(true); | ||
4421 | - } | ||
4422 | - | ||
4423 | - if (roleCode === 'warehouseKeeper') { | ||
4424 | - setCheckVisible(true); | ||
4425 | - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | ||
4426 | - } | ||
4427 | - }} | ||
4428 | - disabled={selectedSubOrderKeys?.length === 0} | ||
4429 | - > | ||
4430 | - 一键审核 | ||
4431 | - </Button>, | ||
4432 | - ); | ||
4433 | - } | ||
4434 | - | ||
4435 | - if (rolePath?.includes('mergeProcureOrder')) { | ||
4436 | - toolBtns.push( | ||
4437 | - <Button | ||
4438 | - key="mergeProcureOrder" | ||
4439 | - type="primary" | ||
4440 | - disabled={selectedSubOrderKeys.length === 0} | ||
4441 | - onClick={() => { | ||
4442 | - Modal.confirm({ | ||
4443 | - title: '一键下单', | ||
4444 | - content: '选中的订单是否都已下单?', | ||
4445 | - onOk: async () => { | ||
4446 | - let res = await postServiceOrderProcureOrder({ | ||
4447 | - data: { subIds: [...selectedSubOrderKeys.values()].flat() }, | ||
4448 | - }); | ||
4449 | - if (res.result === RESPONSE_CODE.SUCCESS) { | ||
4450 | - message.success(res.message); | ||
4451 | - refreshTable(); | ||
4452 | - return true; | ||
4453 | - } | ||
4454 | - }, | ||
4455 | - }); | ||
4456 | - }} | ||
4457 | - > | ||
4458 | - 一键下单 | ||
4459 | - </Button>, | ||
4460 | - ); | ||
4461 | - } | ||
4462 | - | ||
4463 | - if (rolePath?.includes('mergeApplyInvoicing')) { | ||
4464 | - toolBtns.push( | ||
4465 | - <Button | ||
4466 | - type="primary" | ||
4467 | - key="out" | ||
4468 | - onClick={() => { | ||
4469 | - setIsEdit(false); | ||
4470 | - setIsMainOrder(true); | ||
4471 | - setApplyForInvoicingVisible(true); | ||
4472 | - }} | ||
4473 | - disabled={!canMergeInvoicing} /*{selectedSubOrderKeys?.length === 0}*/ | ||
4474 | - > | ||
4475 | - {roleCode === 'admin' ? '合并(销售)' : '合并开票'} | ||
4476 | - </Button>, | ||
4477 | - ); | ||
4478 | - } | ||
4479 | - | ||
4480 | - <Button | ||
4481 | - type="primary" | ||
4482 | - key="out" | ||
4483 | - onClick={() => { | ||
4484 | - setIsEdit(false); | ||
4485 | - setIsMainOrder(true); | ||
4486 | - setInvoicingDrawerFormVisible(true); | ||
4487 | - }} | ||
4488 | - disabled={selectedSubOrderKeys?.length === 0} | ||
4489 | - > | ||
4490 | - 申请开票(旧) | ||
4491 | - </Button>; | ||
4492 | - | ||
4493 | - if (rolePath?.includes('mergeInvoicing')) { | ||
4494 | - toolBtns.push( | ||
4495 | - <Button | ||
4496 | - type="primary" | ||
4497 | - key="out" | ||
4498 | - onClick={() => { | ||
4499 | - //检查订单状态是否正确 | ||
4500 | - // 遍历Map中的键值对 | ||
4501 | - let errorIds = new Set(); | ||
4502 | - [...subOrderSelectedMap.values()].flat().forEach((subOrder) => { | ||
4503 | - if ( | ||
4504 | - subOrder.afterInvoicingStatus !== 'APPLY_FOR_INVOICING' && | ||
4505 | - subOrder.afterInvoicingStatus !== 'PARTIAL_INVOICING' | ||
4506 | - ) { | ||
4507 | - errorIds.add(subOrder.mainOrderId); | ||
4508 | - return; | ||
4509 | - } | ||
4510 | - }); | ||
4511 | - if (errorIds.size > 0) { | ||
4512 | - message.error( | ||
4513 | - '订单号为:' + | ||
4514 | - [...errorIds.values()].join(',') + | ||
4515 | - '的订单存在不是[申请开票]或者[部分开票]状态的子订单,请检查!', | ||
4516 | - ); | ||
4517 | - return; | ||
4518 | - } | ||
4519 | - setIsMainOrder(true); | ||
4520 | - setFinancialVisible(true); | ||
4521 | - }} | ||
4522 | - disabled={selectedSubOrderKeys?.length === 0} | ||
4523 | - > | ||
4524 | - {roleCode === 'admin' ? '合并(财务)' : '合并开票'} | ||
4525 | - </Button>, | ||
4526 | - ); | ||
4527 | - } | ||
4528 | - | ||
4529 | - toolBtns.push( | ||
4530 | - <Button | ||
4531 | - type="primary" | ||
4532 | - key="inv" | ||
4533 | - onClick={() => { | ||
4534 | - setIsMainOrder(true); | ||
4535 | - let flat = [...subOrderSelectedMap.values()].flat(); | ||
4536 | - //遍历flat,判断afterInvoicingStatusList存在于canApplyAfterInvoicingStatus | ||
4537 | - flat.forEach((item) => { | ||
4538 | - if ( | ||
4539 | - item.invoicingStatus === 'UN_INVOICE' || | ||
4540 | - (item.afterInvoicingStatus !== null && | ||
4541 | - !canApplyAfterInvoicingStatus.includes( | ||
4542 | - item.afterInvoicingStatus, | ||
4543 | - )) | ||
4544 | - ) { | ||
4545 | - message.error('存在不能进行开票的订单'); | ||
4546 | - return; | ||
4547 | - } | ||
4548 | - }); | ||
4549 | - //遍历afterInvoicingStatusList | ||
4550 | - setInvoicingDrawerFormVisible(true); | ||
4551 | - }} | ||
4552 | - disabled={selectedSubOrderKeys?.length === 0} | ||
4553 | - > | ||
4554 | - 申请开票 | ||
4555 | - </Button>, | ||
4556 | - ); | ||
4557 | - | ||
4558 | - if (rolePath?.includes('addOrder')) { | ||
4559 | - toolBtns.push( | ||
4560 | - <Button | ||
4561 | - type="primary" | ||
4562 | - key="out" | ||
4563 | - onClick={() => { | ||
4564 | - setOrderDrawerVisible(true); | ||
4565 | - setOrderOptType('add'); | ||
4566 | - }} | ||
4567 | - > | ||
4568 | - 新增 | ||
4569 | - </Button>, | ||
4570 | - ); | ||
4571 | - } | ||
4572 | - | ||
4573 | - if (rolePath?.includes('importExcel')) { | ||
4574 | - toolBtns.push( | ||
4575 | - <Button | ||
4576 | - type="primary" | ||
4577 | - key="out" | ||
4578 | - onClick={() => { | ||
4579 | - setImportModalVisible(true); | ||
4580 | - }} | ||
4581 | - > | ||
4582 | - 批量发货 | ||
4583 | - </Button>, | ||
4584 | - ); | ||
4585 | - } | ||
4586 | - | ||
4587 | - if (rolePath?.includes('export')) { | ||
4588 | - toolBtns.push( | ||
4589 | - <Dropdown menu={exportMenuProps}> | ||
4590 | - <Button> | ||
4591 | - <Space> | ||
4592 | - 导出 | ||
4593 | - <DownOutlined /> | ||
4594 | - </Space> | ||
4595 | - </Button> | ||
4596 | - </Dropdown>, | ||
4597 | - ); | ||
4598 | - } | ||
4599 | - | ||
4600 | - return toolBtns; | ||
4601 | - } | ||
4602 | - function setOriginTime(value) { | ||
4603 | - const currentDate = new Date(); | ||
4604 | - | ||
4605 | - // 创建一个新的日期对象,并在当前日期的基础上加上 daysToAdd 天 | ||
4606 | - const newDate = new Date(currentDate); | ||
4607 | - newDate.setDate(currentDate.getDate() - value); | ||
4608 | - // 检查日期是否有效,并格式化输出 | ||
4609 | - function formatDate(date) { | ||
4610 | - const year = date.getFullYear(); | ||
4611 | - const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需加1 | ||
4612 | - const day = String(date.getDate()).padStart(2, '0'); // 确保是两位数 | ||
4613 | - return `${year}-${month}-${day} ${date.toTimeString().split(' ')[0]}`; // 获取时间部分 | ||
4614 | - } | ||
4615 | - const formattedDate = formatDate(newDate); | ||
4616 | - // const formattedDate = format(newDate, 'YYYY-MM-dd HH:mm:ss'); | ||
4617 | - return formattedDate; | ||
4618 | - } | ||
4619 | - const [invoiceWarningNum, setInvoiceWarningNum] = useState(0); | ||
4620 | - const [invoiceRefundWarningNum, setInvoiceRefundWarningNum] = useState(0); | ||
4621 | - const [waitConfirmPayment, setWaitConfirmPayment] = useState(0); | ||
4622 | - const [waitFeedback, setWaitFeedback] = useState(0); | ||
4623 | - const [open, setOpen] = useState(false); | ||
4624 | - const { openCount, setOpenCount } = useModel('count'); | ||
4625 | - | ||
4626 | - async function getInvoiceWarningNum() { | ||
4627 | - const res = await postServiceOrderWarningOrderStatistics({ | ||
4628 | - data: { | ||
4629 | - salesCode: userInfo.username, | ||
4630 | - waitConfirmReiceptStatusDateTimeLe: setOriginTime(7), | ||
4631 | - waitFeedbackStatusDateTimeLe: setOriginTime(20), | ||
4632 | - waitConfirmInvoiceStatusDateTimeLe: setOriginTime(5), | ||
4633 | - waitConfirmPaymentStatusDateTimeLe: setOriginTime(30), | ||
4634 | - }, | ||
4635 | - }); | ||
4636 | - if ( | ||
4637 | - (res.data.waitConfirmInvoice !== 0 || | ||
4638 | - res.data.waitConfirmReceipt !== 0) && | ||
4639 | - openCount !== true | ||
4640 | - ) { | ||
4641 | - setOpenCount(true); | ||
4642 | - setOpen(true); | ||
4643 | - } | ||
4644 | - setInvoiceWarningNum(res.data.waitConfirmInvoice); | ||
4645 | - setInvoiceRefundWarningNum(res.data.waitConfirmReceipt); | ||
4646 | - setWaitConfirmPayment(res.data.waitConfirmPayment); | ||
4647 | - setWaitFeedback(res.data.waitFeedback); | ||
4648 | - } | ||
4649 | - | ||
4650 | - useEffect(() => { | ||
4651 | - //预警订单数 | ||
4652 | - getInvoiceWarningNum(); | ||
4653 | - }, []); | ||
4654 | - // 隐藏弹窗 | ||
4655 | - const navigateToWarning = () => { | ||
4656 | - setOpen(false); | ||
4657 | - // history.push('/order/OrderWarning'); | ||
4658 | - // window.location.replace = '/order/OrderWarning'; | ||
4659 | - // navigate('/order/OrderWarning'); | ||
4660 | - history.push('/order/OrderWarning'); | ||
4661 | - // location.href = '/order/OrderWarning'; | ||
4662 | - // history.pushState(null, '', '/order/OrderWarning'); | ||
4663 | - }; | ||
4664 | - return ( | ||
4665 | - <div className="order-page-container"> | ||
4666 | - <div id="resizeDiv"></div> | ||
4667 | - <div id="resizeDiv"></div> | ||
4668 | - {roleCode === 'SALES_REPRESENTATIVE' && ( | ||
4669 | - <Modal | ||
4670 | - title="订单预警提醒" | ||
4671 | - open={open} | ||
4672 | - width={800} | ||
4673 | - closable={false} | ||
4674 | - footer={[ | ||
4675 | - <Button | ||
4676 | - key="confirm" | ||
4677 | - size="large" | ||
4678 | - type="primary" | ||
4679 | - onClick={navigateToWarning} | ||
4680 | - > | ||
4681 | - 去处理 | ||
4682 | - </Button>, | ||
4683 | - ]} | ||
4684 | - > | ||
4685 | - <Row | ||
4686 | - gutter={16} | ||
4687 | - justify="space-between" // Aligns Cols to the start and end | ||
4688 | - align="middle" // Vertically center contents | ||
4689 | - > | ||
4690 | - {/* 新增卡片1: 待确认收货订单 */} | ||
4691 | - <Col span={6}> | ||
4692 | - {' '} | ||
4693 | - {/* 修改位置:将 span 改为 6,以保证一行四个卡片 */} | ||
4694 | - <div | ||
4695 | - style={{ | ||
4696 | - display: 'flex', | ||
4697 | - justifyContent: 'center', | ||
4698 | - marginTop: '20px', | ||
4699 | - }} | ||
4700 | - > | ||
4701 | - <Card | ||
4702 | - bordered={true} | ||
4703 | - style={{ | ||
4704 | - backgroundColor: '#f0f0f0', // 背景颜色 | ||
4705 | - width: '200px', // 卡片宽度 | ||
4706 | - height: '200px', // 卡片高度 | ||
4707 | - display: 'flex', | ||
4708 | - alignItems: 'center', | ||
4709 | - justifyContent: 'center', | ||
4710 | - }} | ||
4711 | - > | ||
4712 | - <div | ||
4713 | - style={{ | ||
4714 | - fontWeight: 'bold', // 字体加粗 | ||
4715 | - color: 'black', // 字体颜色 | ||
4716 | - fontSize: '18px', // 字体大小 | ||
4717 | - }} | ||
4718 | - > | ||
4719 | - <div | ||
4720 | - style={{ | ||
4721 | - fontWeight: 'bold', // 字体加粗 | ||
4722 | - color: 'black', // 字体颜色 | ||
4723 | - fontSize: '40px', // 字体大小 | ||
4724 | - justifyContent: 'center', | ||
4725 | - display: 'flex', | ||
4726 | - alignItems: 'center', | ||
4727 | - marginBottom: '20px', | ||
4728 | - }} | ||
4729 | - > | ||
4730 | - {invoiceRefundWarningNum} | ||
4731 | - </div> | ||
4732 | - 待确认收货订单 | ||
4733 | - </div> | ||
4734 | - </Card> | ||
4735 | - </div> | ||
4736 | - </Col> | ||
4737 | - | ||
4738 | - {/* 新增卡片2: 待回访登记订单 */} | ||
4739 | - <Col span={6}> | ||
4740 | - {' '} | ||
4741 | - {/* 修改位置:将 span 改为 6,以保证一行四个卡片 */} | ||
4742 | - <div | ||
4743 | - style={{ | ||
4744 | - display: 'flex', | ||
4745 | - justifyContent: 'center', | ||
4746 | - marginTop: '20px', | ||
4747 | - }} | ||
4748 | - > | ||
4749 | - <Card | ||
4750 | - bordered={true} | ||
4751 | - style={{ | ||
4752 | - backgroundColor: '#f0f0f0', // 背景颜色 | ||
4753 | - width: '200px', // 卡片宽度 | ||
4754 | - height: '200px', // 卡片高度 | ||
4755 | - display: 'flex', | ||
4756 | - alignItems: 'center', | ||
4757 | - justifyContent: 'center', | ||
4758 | - }} | ||
4759 | - > | ||
4760 | - <div | ||
4761 | - style={{ | ||
4762 | - fontWeight: 'bold', // 字体加粗 | ||
4763 | - color: 'black', // 字体颜色 | ||
4764 | - fontSize: '18px', // 字体大小 | ||
4765 | - }} | ||
4766 | - > | ||
4767 | - <div | ||
4768 | - style={{ | ||
4769 | - fontWeight: 'bold', // 字体加粗 | ||
4770 | - color: 'black', // 字体颜色 | ||
4771 | - fontSize: '40px', // 字体大小 | ||
4772 | - justifyContent: 'center', | ||
4773 | - display: 'flex', | ||
4774 | - alignItems: 'center', | ||
4775 | - marginBottom: '20px', | ||
4776 | - }} | ||
4777 | - > | ||
4778 | - {waitFeedback} | ||
4779 | - </div> | ||
4780 | - 待回访登记订单 | ||
4781 | - </div> | ||
4782 | - </Card> | ||
4783 | - </div> | ||
4784 | - </Col> | ||
4785 | - | ||
4786 | - {/* 现有卡片: 发票待确认订单 */} | ||
4787 | - <Col span={6}> | ||
4788 | - {' '} | ||
4789 | - {/* 修改位置:将 span 改为 6,以保证一行四个卡片 */} | ||
4790 | - <div | ||
4791 | - style={{ | ||
4792 | - display: 'flex', | ||
4793 | - justifyContent: 'center', | ||
4794 | - marginTop: '20px', | ||
4795 | - }} | ||
4796 | - > | ||
4797 | - <Card | ||
4798 | - bordered={true} | ||
4799 | - style={{ | ||
4800 | - backgroundColor: '#f0f0f0', // 背景颜色 | ||
4801 | - width: '200px', // 卡片宽度 | ||
4802 | - height: '200px', // 卡片高度 | ||
4803 | - display: 'flex', | ||
4804 | - alignItems: 'center', | ||
4805 | - justifyContent: 'center', | ||
4806 | - }} | ||
4807 | - > | ||
4808 | - <div | ||
4809 | - style={{ | ||
4810 | - fontWeight: 'bold', // 字体加粗 | ||
4811 | - color: 'black', // 字体颜色 | ||
4812 | - fontSize: '18px', // 字体大小 | ||
4813 | - }} | ||
4814 | - > | ||
4815 | - <div | ||
4816 | - style={{ | ||
4817 | - fontWeight: 'bold', // 字体加粗 | ||
4818 | - color: 'black', // 字体颜色 | ||
4819 | - fontSize: '40px', // 字体大小 | ||
4820 | - justifyContent: 'center', | ||
4821 | - display: 'flex', | ||
4822 | - alignItems: 'center', | ||
4823 | - marginBottom: '20px', | ||
4824 | - }} | ||
4825 | - > | ||
4826 | - {invoiceWarningNum} | ||
4827 | - </div> | ||
4828 | - 待确认发票订单 | ||
4829 | - </div> | ||
4830 | - </Card> | ||
4831 | - </div> | ||
4832 | - </Col> | ||
4833 | - | ||
4834 | - {/* 现有卡片: 回款待确认订单 */} | ||
4835 | - <Col span={6}> | ||
4836 | - {' '} | ||
4837 | - {/* 修改位置:将 span 改为 6,以保证一行四个卡片 */} | ||
4838 | - <div | ||
4839 | - style={{ | ||
4840 | - display: 'flex', | ||
4841 | - justifyContent: 'center', | ||
4842 | - marginTop: '20px', | ||
4843 | - }} | ||
4844 | - > | ||
4845 | - <Card | ||
4846 | - bordered={true} | ||
4847 | - style={{ | ||
4848 | - backgroundColor: '#f0f0f0', // 背景颜色 | ||
4849 | - width: '200px', // 卡片宽度 | ||
4850 | - height: '200px', // 卡片高度 | ||
4851 | - display: 'flex', | ||
4852 | - alignItems: 'center', | ||
4853 | - justifyContent: 'center', | ||
4854 | - }} | ||
4855 | - > | ||
4856 | - <div | ||
4857 | - style={{ | ||
4858 | - fontWeight: 'bold', // 字体加粗 | ||
4859 | - color: 'black', // 字体颜色 | ||
4860 | - fontSize: '18px', // 字体大小 | ||
4861 | - }} | ||
4862 | - > | ||
4863 | - <div | ||
4864 | - style={{ | ||
4865 | - fontWeight: 'bold', // 字体加粗 | ||
4866 | - color: 'black', // 字体颜色 | ||
4867 | - fontSize: '40px', // 字体大小 | ||
4868 | - justifyContent: 'center', | ||
4869 | - display: 'flex', | ||
4870 | - alignItems: 'center', | ||
4871 | - marginBottom: '20px', | ||
4872 | - }} | ||
4873 | - > | ||
4874 | - {waitConfirmPayment} | ||
4875 | - </div> | ||
4876 | - 待回款订单 | ||
4877 | - </div> | ||
4878 | - </Card> | ||
4879 | - </div> | ||
4880 | - </Col> | ||
4881 | - </Row> | ||
4882 | - | ||
4883 | - <div> | ||
4884 | - <p | ||
4885 | - style={{ | ||
4886 | - color: 'red', | ||
4887 | - paddingLeft: '20px', | ||
4888 | - paddingRight: '20px', | ||
4889 | - marginTop: '10px', | ||
4890 | - }} | ||
4891 | - > | ||
4892 | - 预警说明: | ||
4893 | - </p> | ||
4894 | - <div | ||
4895 | - style={{ | ||
4896 | - marginLeft: '20px', | ||
4897 | - marginRight: '20px', | ||
4898 | - marginBottom: '20px', | ||
4899 | - }} | ||
4900 | - > | ||
4901 | - <span style={{ color: 'red' }}>确认收货预警:</span> | ||
4902 | - <span> | ||
4903 | - 从发货之日起计算,国内超过7天(海外30天)未【确认收货】,将进行确认收货预警提醒,超过10天(海外60天)未确认收货将锁单,并且每次登录都会提醒 | ||
4904 | - </span> | ||
4905 | - </div> | ||
4906 | - <div | ||
4907 | - style={{ | ||
4908 | - marginLeft: '20px', | ||
4909 | - marginRight: '20px', | ||
4910 | - marginBottom: '20px', | ||
4911 | - }} | ||
4912 | - > | ||
4913 | - <span style={{ color: 'red' }}>回访登记预警:</span> | ||
4914 | - <span> | ||
4915 | - 从【确认收货】之日起计算,国内超过20天(海外30天)未【回访登记】,将进行回访登记预警提醒,超过45天(海外60天)未回访登记将锁单,并且每次登录都会提醒 | ||
4916 | - </span> | ||
4917 | - </div> | ||
4918 | - <div | ||
4919 | - style={{ | ||
4920 | - marginLeft: '20px', | ||
4921 | - marginRight: '20px', | ||
4922 | - marginBottom: '20px', | ||
4923 | - }} | ||
4924 | - > | ||
4925 | - <span style={{ color: 'red' }}>确认发票预警:</span> | ||
4926 | - <span> | ||
4927 | - 从发票开出之日起,超过5天未和客户确认发票(不开票的订单除外)的订单将会进行第一次提醒;超过15天未和客户确认发票(不开票的订单除外)的订单将会每天进行一次提醒,并限制下单功能 | ||
4928 | - </span> | ||
4929 | - </div> | ||
4930 | - <div | ||
4931 | - style={{ | ||
4932 | - marginLeft: '20px', | ||
4933 | - marginRight: '20px', | ||
4934 | - marginBottom: '20px', | ||
4935 | - }} | ||
4936 | - > | ||
4937 | - <span style={{ color: 'red' }}>回款预警:</span> | ||
4938 | - <span> | ||
4939 | - 从【发票确认】之日起,超过30天未确认回款的订单将会每周提醒,超过90天未确认回款的订单将会每天进行一次提醒,并限制下单功能 | ||
4940 | - </span> | ||
4941 | - </div> | ||
4942 | - </div> | ||
4943 | - </Modal> | ||
4944 | - )} | ||
4945 | - <ProTable | ||
4946 | - id="main-table" | ||
4947 | - // tableStyle={{backgroundColor:'red'}} | ||
4948 | - | ||
4949 | - actionRef={mainTableRef} | ||
4950 | - formRef={mainTableFormRef} | ||
4951 | - expandIconColumnIndex={-1} | ||
4952 | - columns={mainOrdersColumns} | ||
4953 | - rowKey="id" | ||
4954 | - pagination={{ | ||
4955 | - showQuickJumper: true, | ||
4956 | - pageSize: pageSize, | ||
4957 | - current: currentPage, | ||
4958 | - showSizeChanger: true, | ||
4959 | - onChange: (page, size) => { | ||
4960 | - setPageSize(size); | ||
4961 | - setCurrentPage(page); | ||
4962 | - }, | ||
4963 | - showTotal: (total, range) => { | ||
4964 | - return ( | ||
4965 | - <> | ||
4966 | - <span> | ||
4967 | - {'第 ' + | ||
4968 | - range[0] + | ||
4969 | - '-' + | ||
4970 | - range[1] + | ||
4971 | - ' 条/总共 ' + | ||
4972 | - total + | ||
4973 | - ' 条主订单 '} | ||
4974 | - </span> | ||
4975 | - <span className="text-[#8C8C8C]"> | ||
4976 | - {' (' + subOrderCount + ' 条子订单)'} | ||
4977 | - </span> | ||
4978 | - </> | ||
4979 | - ); | ||
4980 | - }, | ||
4981 | - }} | ||
4982 | - // showHeader={false} | ||
4983 | - expandedRowKeys={expandedRowKeys} | ||
4984 | - // expandable={{ expandedRowRender }} | ||
4985 | - dateFormatter="string" | ||
4986 | - options={false} | ||
4987 | - headerTitle="" | ||
4988 | - search={{ | ||
4989 | - labelWidth: 'auto', | ||
4990 | - // onCollapse: resize, | ||
4991 | - }} | ||
4992 | - request={async ( | ||
4993 | - // 第一个参数 params 查询表单和 params 参数的结合 | ||
4994 | - // 第一个参数中一定会有 pageSize 和 current ,这两个参数是 antd 的规范 | ||
4995 | - params, | ||
4996 | - sorter, | ||
4997 | - filter, | ||
4998 | - ) => { | ||
4999 | - //订单id处理 | ||
5000 | - /** | ||
5001 | - * 以params中的id为主,如果params没id,则取url中的id | ||
5002 | - * 第一次进来这个页面,url带有id的话,会自动填充到查询表单中,但是第一次查询params不会带这个id进来 | ||
5003 | - */ | ||
5004 | - let orderIds = mainTableFormRef.current?.getFieldValue('id'); | ||
5005 | - let subOrderId = | ||
5006 | - mainTableFormRef.current?.getFieldValue('subOrderId'); | ||
5007 | - params.id = params.id || orderIds; | ||
5008 | - params.subOrderId = params.subOrderId || subOrderId; | ||
5009 | - if (params.id !== '') { | ||
5010 | - params.id = params.id?.replace(/ /g, ''); | ||
5011 | - if (params.id?.indexOf(',')) { | ||
5012 | - params.id = params.id.split(','); | ||
5013 | - params.id = params.id.filter((id) => { | ||
5014 | - return id !== ''; | ||
5015 | - }); | ||
5016 | - } | ||
5017 | - } | ||
5018 | - | ||
5019 | - params.condition = filterCondifion; | ||
5020 | - | ||
5021 | - //排序 | ||
5022 | - params.sorted = sorted; | ||
5023 | - //是否只查看已作废 | ||
5024 | - params.isDeleteQueryOrder = filterCondifion === 70; | ||
5025 | - //保存这个搜索条件 | ||
5026 | - setSearchParam(params); | ||
5027 | - const { data } = await postServiceOrderQueryServiceOrder({ | ||
5028 | - // ...params, | ||
5029 | - // FIXME: remove @ts-ignore | ||
5030 | - // @ts-ignore | ||
5031 | - sorter, | ||
5032 | - filter, | ||
5033 | - data: { ...params }, | ||
5034 | - }); | ||
5035 | - | ||
5036 | - setRolePath(data.specialPath); | ||
5037 | - setSubOrderCount(data.count); | ||
5038 | - setAllMainChecked(false); | ||
5039 | - setSelectedMainOrderKeys([]); | ||
5040 | - subOrderSelectedMap.clear(); | ||
5041 | - mainOrderSelectedMap.clear(); | ||
5042 | - setData(data?.data); | ||
5043 | - | ||
5044 | - //主订单id与子订单id的对照关系保存 | ||
5045 | - mainOrderIdSubOrderIdRelationsMap.clear(); | ||
5046 | - for (let row of data?.data) { | ||
5047 | - let mianOrderId = row.id; | ||
5048 | - let subOrderIds = row.subOrderInformationLists?.map((item) => { | ||
5049 | - //目前子订单存储的totalPayment不准确,这里重新处理取主订单的totalPayment | ||
5050 | - //totalPayment在财务开票计算金额时使用到 | ||
5051 | - item.totalPayment = row.totalPayment; | ||
5052 | - return item.id; | ||
5053 | - }); | ||
5054 | - mainOrderIdSubOrderIdRelationsMap.set(mianOrderId, subOrderIds); | ||
5055 | - } | ||
5056 | - | ||
5057 | - return { | ||
5058 | - data: data?.data || [], | ||
5059 | - total: data?.total || 0, | ||
5060 | - }; | ||
5061 | - }} | ||
5062 | - toolbar={{ | ||
5063 | - multipleLine: true, | ||
5064 | - }} | ||
5065 | - toolBarRender={() => { | ||
5066 | - return toolBarRender(); | ||
5067 | - }} | ||
5068 | - /> | ||
5069 | - | ||
5070 | - {orderDrawerVisible && ( | ||
5071 | - <OrderDrawer | ||
5072 | - data={orderOptType === 'add' ? {} : buildMainOrder()} | ||
5073 | - subOrders={orderOptType === 'add' ? [] : buildSubOrders()} | ||
5074 | - onClose={(isSuccess: boolean) => { | ||
5075 | - setOrderDrawerVisible(false); | ||
5076 | - // clearOptObject(); | ||
5077 | - if (isSuccess) { | ||
5078 | - refreshTable(); | ||
5079 | - } | ||
5080 | - }} | ||
5081 | - orderOptType={orderOptType} | ||
5082 | - /> | ||
5083 | - )} | ||
5084 | - | ||
5085 | - {checkVisible && ( | ||
5086 | - <CheckModal | ||
5087 | - setCheckVisible={(val: boolean) => { | ||
5088 | - setCheckVisible(val); | ||
5089 | - if (!val) { | ||
5090 | - clearOptObject(); | ||
5091 | - } | ||
5092 | - }} | ||
5093 | - data={isMainOrder ? getFirstMainOrder() : buildMainOrder()} | ||
5094 | - subOrders={ | ||
5095 | - isMainOrder | ||
5096 | - ? [...subOrderSelectedMap.values()].flat() | ||
5097 | - : buildSubOrders() | ||
5098 | - } | ||
5099 | - orderCheckType={orderCheckType} | ||
5100 | - openOrderDrawer={(type: any, id: any) => { | ||
5101 | - setCurrentMainId(id); | ||
5102 | - setOrderOptType(type); | ||
5103 | - setOrderDrawerVisible(true); | ||
5104 | - }} | ||
5105 | - onClose={() => { | ||
5106 | - clearOptObject(); | ||
5107 | - setCheckVisible(false); | ||
5108 | - refreshTable(); | ||
5109 | - }} | ||
5110 | - /> | ||
5111 | - )} | ||
5112 | - | ||
5113 | - {applyForInvoicingVisible && ( | ||
5114 | - <ApplyForInvoicingModal | ||
5115 | - setCheckVisible={(val: boolean) => { | ||
5116 | - setApplyForInvoicingVisible(val); | ||
5117 | - if (!val) { | ||
5118 | - clearOptObject(); | ||
5119 | - } | ||
5120 | - }} | ||
5121 | - subOrders={ | ||
5122 | - isMainOrder | ||
5123 | - ? [...subOrderSelectedMap.values()].flat() | ||
5124 | - : buildSubOrders() | ||
5125 | - } | ||
5126 | - totalPayment={getApplyInvoicingTotalPayment()} | ||
5127 | - isMainOrder={isMainOrder} | ||
5128 | - isEdit={isEdit} | ||
5129 | - onClose={() => { | ||
5130 | - setApplyForInvoicingVisible(false); | ||
5131 | - setIsMainOrder(false); | ||
5132 | - clearOptObject(); | ||
5133 | - refreshTable(); | ||
5134 | - }} | ||
5135 | - /> | ||
5136 | - )} | ||
5137 | - | ||
5138 | - {notesEditVisible && ( | ||
5139 | - <OrderNotesEditModal | ||
5140 | - setNotesEditVisible={(val: boolean) => { | ||
5141 | - setNotesEditVisible(val); | ||
5142 | - if (!val) { | ||
5143 | - clearOptObject(); | ||
5144 | - } | ||
5145 | - }} | ||
5146 | - ids={selectedRows} | ||
5147 | - notesType={notesType} | ||
5148 | - notes={notes} | ||
5149 | - onClose={() => { | ||
5150 | - setNotesEditVisible(false); | ||
5151 | - setSelectedRows([]); | ||
5152 | - setNotes(notes); | ||
5153 | - setNotesType(1); | ||
5154 | - refreshTable(); | ||
5155 | - }} | ||
5156 | - /> | ||
5157 | - )} | ||
5158 | - | ||
5159 | - {deliverVisible && ( | ||
5160 | - <DeliverModal | ||
5161 | - data={buildSubOrders()} | ||
5162 | - isSendProduct={isSendProduct} | ||
5163 | - setVisible={(val: boolean) => { | ||
5164 | - setDeliverVisible(val); | ||
5165 | - if (!val) { | ||
5166 | - clearOptObject(); | ||
5167 | - } | ||
5168 | - }} | ||
5169 | - sendType={orderCheckType} | ||
5170 | - onClose={() => { | ||
5171 | - clearOptObject(); | ||
5172 | - setDeliverVisible(false); | ||
5173 | - setIsSendProduct(false); | ||
5174 | - refreshTable(); | ||
5175 | - }} | ||
5176 | - /> | ||
5177 | - )} | ||
5178 | - | ||
5179 | - {financialVisible && ( | ||
5180 | - <FinancialDrawer | ||
5181 | - isEdit={isEdit} | ||
5182 | - mainOrder={isMainOrder ? getFirstMainOrder() : buildMainOrder()} | ||
5183 | - subOrders={ | ||
5184 | - isMainOrder | ||
5185 | - ? [...subOrderSelectedMap.values()].flat() | ||
5186 | - : buildSubOrders() | ||
5187 | - } | ||
5188 | - isMainOrder={isMainOrder} | ||
5189 | - cancel={() => { | ||
5190 | - setFinancialVisible(false); | ||
5191 | - clearOptObject(); | ||
5192 | - setIsMainOrder(false); | ||
5193 | - setIsEdit(false); | ||
5194 | - }} | ||
5195 | - onClose={() => { | ||
5196 | - setFinancialVisible(false); | ||
5197 | - clearOptObject(); | ||
5198 | - refreshTable(); | ||
5199 | - setIsMainOrder(false); | ||
5200 | - setIsEdit(false); | ||
5201 | - }} | ||
5202 | - /> | ||
5203 | - )} | ||
5204 | - | ||
5205 | - {financialEditVisible && ( | ||
5206 | - <FinancialEditDrawer | ||
5207 | - mainOrder={buildMainOrder()} | ||
5208 | - subOrders={buildSubOrders()} | ||
5209 | - isMainOrder={isMainOrder} | ||
5210 | - setVisible={() => { | ||
5211 | - setFinancialEditVisible(false); | ||
5212 | - clearOptObject(); | ||
5213 | - }} | ||
5214 | - onClose={() => { | ||
5215 | - setFinancialEditVisible(false); | ||
5216 | - refreshTable(); | ||
5217 | - setIsMainOrder(false); | ||
5218 | - clearOptObject(); | ||
5219 | - }} | ||
5220 | - /> | ||
5221 | - )} | ||
5222 | - | ||
5223 | - {orderPrintVisible && ( | ||
5224 | - <OrderPrintModal | ||
5225 | - mainOrder={buildMainOrder()} | ||
5226 | - subOrders={buildSubOrders()} | ||
5227 | - isRePrint={isRePrintOrder} | ||
5228 | - setVisible={(val: boolean) => { | ||
5229 | - setOrderPrintVisible(val); | ||
5230 | - if (!val) { | ||
5231 | - clearOptObject(); | ||
5232 | - } | ||
5233 | - }} | ||
5234 | - printOptType={orderCheckType} | ||
5235 | - onClose={() => { | ||
5236 | - setOrderPrintVisible(false); | ||
5237 | - clearOptObject(); | ||
5238 | - setIsRePrintOrder(false); | ||
5239 | - refreshTable(); | ||
5240 | - }} | ||
5241 | - /> | ||
5242 | - )} | ||
5243 | - | ||
5244 | - {confirmReceiptVisible && ( | ||
5245 | - <ConfirmReceiptModal | ||
5246 | - data={buildSubOrders()} | ||
5247 | - onClose={() => { | ||
5248 | - setConfirmReceiptVisible(false); | ||
5249 | - clearOptObject(); | ||
5250 | - refreshTable(); | ||
5251 | - }} | ||
5252 | - /> | ||
5253 | - )} | ||
5254 | - | ||
5255 | - {imagesViewerModalVisible && ( | ||
5256 | - <ImagesViewerModal | ||
5257 | - optType={imagesViewerOptType} | ||
5258 | - setVisible={(val: boolean) => { | ||
5259 | - setImagesViewerModalVisible(val); | ||
5260 | - if (!val) { | ||
5261 | - clearOptObject(); | ||
5262 | - } | ||
5263 | - }} | ||
5264 | - onClose={() => { | ||
5265 | - setImagesViewerModalVisible(false); | ||
5266 | - }} | ||
5267 | - orderRow={buildSubOrders()[0]} | ||
5268 | - /> | ||
5269 | - )} | ||
5270 | - | ||
5271 | - {importModalVisible && ( | ||
5272 | - <ImportModal | ||
5273 | - onClose={() => { | ||
5274 | - setImportModalVisible(false); | ||
5275 | - refreshTable(); | ||
5276 | - }} | ||
5277 | - /> | ||
5278 | - )} | ||
5279 | - | ||
5280 | - {attachmentModalVisible && ( | ||
5281 | - <AttachmentModal | ||
5282 | - data={buildSubOrders()[0]} | ||
5283 | - onClose={() => { | ||
5284 | - setAttachmentModalVisible(false); | ||
5285 | - clearOptObject(); | ||
5286 | - }} | ||
5287 | - /> | ||
5288 | - )} | ||
5289 | - | ||
5290 | - {historyModalVisible && ( | ||
5291 | - <HistoryModal | ||
5292 | - subOrders={selectedRows} | ||
5293 | - isCancelledOrder={filterCondifion === 70} | ||
5294 | - onClose={() => { | ||
5295 | - setHistoryModalVisible(false); | ||
5296 | - setSelectedRows({}); | ||
5297 | - clearOptObject(); | ||
5298 | - }} | ||
5299 | - /> | ||
5300 | - )} | ||
5301 | - | ||
5302 | - {deliverInfoDrawerVisible && ( | ||
5303 | - <DeliverInfoDrawer | ||
5304 | - data={buildMainOrder()} | ||
5305 | - onClose={() => { | ||
5306 | - setDeliverInfoDrawerVisible(false); | ||
5307 | - clearOptObject(); | ||
5308 | - }} | ||
5309 | - /> | ||
5310 | - )} | ||
5311 | - | ||
5312 | - {deliverInfoDrawerVisible && ( | ||
5313 | - <DeliverInfoDrawer | ||
5314 | - data={buildMainOrder()} | ||
5315 | - onClose={() => { | ||
5316 | - setDeliverInfoDrawerVisible(false); | ||
5317 | - clearOptObject(); | ||
5318 | - }} | ||
5319 | - /> | ||
5320 | - )} | ||
5321 | - | ||
5322 | - {procureCheckModalVisible && ( | ||
5323 | - <ProcureCheckModal | ||
5324 | - setCheckVisible={(val: boolean) => { | ||
5325 | - setProcureCheckModalVisible(val); | ||
5326 | - if (!val) { | ||
5327 | - clearOptObject(); | ||
5328 | - } | ||
5329 | - }} | ||
5330 | - isMainOrder={isMainOrder} | ||
5331 | - orders={ | ||
5332 | - isMainOrder | ||
5333 | - ? [...subOrderSelectedMap.values()].flat() | ||
5334 | - : buildSubOrders() | ||
5335 | - } | ||
5336 | - onClose={() => { | ||
5337 | - setProcureCheckModalVisible(false); | ||
5338 | - clearOptObject(); | ||
5339 | - setIsMainOrder(false); | ||
5340 | - refreshTable(); | ||
5341 | - }} | ||
5342 | - /> | ||
5343 | - )} | ||
5344 | - | ||
5345 | - {afterSalesDrawerVisible && ( | ||
5346 | - <AfterSalesDrawer | ||
5347 | - setVisible={(val: boolean) => { | ||
5348 | - setAfterSalesDrawerVisible(val); | ||
5349 | - if (!val) { | ||
5350 | - clearOptObject(); | ||
5351 | - } | ||
5352 | - }} | ||
5353 | - mainOrder={buildMainOrder()} | ||
5354 | - subOrders={buildSubOrders()} | ||
5355 | - onClose={() => { | ||
5356 | - setAfterSalesDrawerVisible(false); | ||
5357 | - clearOptObject(); | ||
5358 | - refreshTable(); | ||
5359 | - }} | ||
5360 | - /> | ||
5361 | - )} | ||
5362 | - | ||
5363 | - {procureConvertModalVisible && ( | ||
5364 | - <ProcureConvertModal | ||
5365 | - setVisible={(val: boolean) => { | ||
5366 | - setProcureConvertModalVisible(val); | ||
5367 | - if (!val) { | ||
5368 | - clearOptObject(); | ||
5369 | - } | ||
5370 | - }} | ||
5371 | - subOrders={buildSubOrders()} | ||
5372 | - onClose={() => { | ||
5373 | - setProcureConvertModalVisible(false); | ||
5374 | - clearOptObject(); | ||
5375 | - refreshTable(); | ||
5376 | - }} | ||
5377 | - /> | ||
5378 | - )} | ||
5379 | - | ||
5380 | - {financialMergeDrawerVisible && ( | ||
5381 | - <FinancialMergeDrawer | ||
5382 | - setVisible={(val: boolean) => { | ||
5383 | - setFinancialMergeDrawerVisible(val); | ||
5384 | - if (!val) { | ||
5385 | - clearOptObject(); | ||
5386 | - } | ||
5387 | - }} | ||
5388 | - dataList={ | ||
5389 | - isMainOrder | ||
5390 | - ? [...subOrderSelectedMap.values()].flat() | ||
5391 | - : buildSubOrders() | ||
5392 | - } | ||
5393 | - onClose={() => { | ||
5394 | - setFinancialMergeDrawerVisible(false); | ||
5395 | - setIsMainOrder(false); | ||
5396 | - clearOptObject(); | ||
5397 | - refreshTable(); | ||
5398 | - }} | ||
5399 | - /> | ||
5400 | - )} | ||
5401 | - | ||
5402 | - {financialReceiptsModalVisible && ( | ||
5403 | - <FinancialReceiptsModal | ||
5404 | - setVisible={(val: boolean) => { | ||
5405 | - setFinancialReceiptsModalVisible(val); | ||
5406 | - if (!val) { | ||
5407 | - clearOptObject(); | ||
5408 | - } | ||
5409 | - }} | ||
5410 | - datas={selectedRows} | ||
5411 | - onClose={() => { | ||
5412 | - setFinancialReceiptsModalVisible(false); | ||
5413 | - setSelectedRows({}); | ||
5414 | - refreshTable(); | ||
5415 | - }} | ||
5416 | - /> | ||
5417 | - )} | ||
5418 | - | ||
5419 | - {shippingWarehouseChangeModalVisible && ( | ||
5420 | - <ShippingWarehouseChangeModal | ||
5421 | - setVisible={(val: boolean) => { | ||
5422 | - setShippingWarehouseChangeModalVisible(val); | ||
5423 | - if (!val) { | ||
5424 | - clearOptObject(); | ||
5425 | - } | ||
5426 | - }} | ||
5427 | - subOrderIds={ids} | ||
5428 | - originShippingWarehouse={buildSubOrders()[0].shippingWarehouse} | ||
5429 | - onClose={() => { | ||
5430 | - setShippingWarehouseChangeModalVisible(false); | ||
5431 | - clearOptObject(); | ||
5432 | - setIds([]); | ||
5433 | - refreshTable(); | ||
5434 | - }} | ||
5435 | - /> | ||
5436 | - )} | ||
5437 | - {reissueVisible && ( | ||
5438 | - <ReissueModal | ||
5439 | - setVisible={(val: boolean) => { | ||
5440 | - setReissueVisible(val); | ||
5441 | - if (!val) { | ||
5442 | - clearOptObject(); | ||
5443 | - } | ||
5444 | - }} | ||
5445 | - subOrders={ | ||
5446 | - isMainOrder | ||
5447 | - ? [...subOrderSelectedMap.values()].flat() | ||
5448 | - : buildSubOrders() | ||
5449 | - } | ||
5450 | - onClose={() => { | ||
5451 | - setReissueVisible(false); | ||
5452 | - clearOptObject(); | ||
5453 | - refreshTable(); | ||
5454 | - }} | ||
5455 | - /> | ||
5456 | - )} | ||
5457 | - {reissueVisibleOld && ( | ||
5458 | - <ReissueModal_old | ||
5459 | - setVisible={(val: boolean) => { | ||
5460 | - setReissueVisibleOld(val); | ||
5461 | - console.log(reissueVisible); | ||
5462 | - if (!val) { | ||
5463 | - clearOptObject(); | ||
5464 | - } | ||
5465 | - }} | ||
5466 | - mainOrder={buildMainOrder()} | ||
5467 | - subOrders={buildSubOrders()} | ||
5468 | - onClose={() => { | ||
5469 | - setReissueVisibleOld(false); | ||
5470 | - clearOptObject(); | ||
5471 | - refreshTable(); | ||
5472 | - }} | ||
5473 | - /> | ||
5474 | - )} | ||
5475 | - {productionTimeModalVisible && ( | ||
5476 | - <ProductionTimeModal | ||
5477 | - setVisible={(val: boolean) => { | ||
5478 | - setProductionTimeModalVisible(val); | ||
5479 | - if (!val) { | ||
5480 | - clearOptObject(); | ||
5481 | - } | ||
5482 | - }} | ||
5483 | - subOrders={buildSubOrders()} | ||
5484 | - onClose={() => { | ||
5485 | - setProductionTimeModalVisible(false); | ||
5486 | - clearOptObject(); | ||
5487 | - refreshTable(); | ||
5488 | - }} | ||
5489 | - /> | ||
5490 | - )} | ||
5491 | - | ||
5492 | - {modifiedDiffModalVisible && ( | ||
5493 | - <ModifiedDiffModal | ||
5494 | - setVisible={(val: boolean) => { | ||
5495 | - setModifiedDiffModalVisible(val); | ||
5496 | - if (!val) { | ||
5497 | - clearOptObject(); | ||
5498 | - } | ||
5499 | - }} | ||
5500 | - subOrders={buildSubOrders()} | ||
5501 | - mainOrder={buildMainOrder()} | ||
5502 | - onClose={() => { | ||
5503 | - setModifiedDiffModalVisible(false); | ||
5504 | - clearOptObject(); | ||
5505 | - }} | ||
5506 | - /> | ||
5507 | - )} | ||
5508 | - | ||
5509 | - {uploadPayBillModalVisible && ( | ||
5510 | - <UploadPayBillModal | ||
5511 | - setVisible={(val: boolean) => { | ||
5512 | - setUploadPayBillModalVisible(val); | ||
5513 | - if (!val) { | ||
5514 | - clearOptObject(); | ||
5515 | - } | ||
5516 | - }} | ||
5517 | - subOrders={buildSubOrders()} | ||
5518 | - mainOrder={buildMainOrder()} | ||
5519 | - onClose={() => { | ||
5520 | - setUploadPayBillModalVisible(false); | ||
5521 | - clearOptObject(); | ||
5522 | - refreshTable(); | ||
5523 | - }} | ||
5524 | - /> | ||
5525 | - )} | ||
5526 | - {feedbackRegistrationModalVisible && ( | ||
5527 | - <FeedbackRegistrationModal | ||
5528 | - setVisible={(val: boolean) => { | ||
5529 | - setFeedbackRegistrationModalVisible(val); | ||
5530 | - if (!val) { | ||
5531 | - clearOptObject(); | ||
5532 | - } | ||
5533 | - }} | ||
5534 | - subOrders={buildSubOrders()} | ||
5535 | - mainOrder={buildMainOrder()} | ||
5536 | - onClose={() => { | ||
5537 | - setFeedbackRegistrationModalVisible(false); | ||
5538 | - clearOptObject(); | ||
5539 | - refreshTable(); | ||
5540 | - }} | ||
5541 | - /> | ||
5542 | - )} | ||
5543 | - | ||
5544 | - {invoicingDrawerFormVisible && ( | ||
5545 | - <InvoicingDrawerForm | ||
5546 | - dataList={ | ||
5547 | - isMainOrder | ||
5548 | - ? [...subOrderSelectedMap.values()].flat() | ||
5549 | - : buildSubOrders() | ||
5550 | - } | ||
5551 | - setVisible={(val: boolean) => { | ||
5552 | - setInvoicingDrawerFormVisible(val); | ||
5553 | - if (!val) { | ||
5554 | - clearOptObject(); | ||
5555 | - } | ||
5556 | - }} | ||
5557 | - mainOrder={isMainOrder ? getFirstMainOrder() : buildMainOrder()} | ||
5558 | - onClose={() => { | ||
5559 | - setInvoicingDrawerFormVisible(false); | ||
5560 | - setIsMainOrder(true); | ||
5561 | - clearOptObject(); | ||
5562 | - refreshTable(); | ||
5563 | - }} | ||
5564 | - /> | ||
5565 | - )} | ||
5566 | - {contextHolder} | ||
5567 | - <FloatButton.BackTop visibilityHeight={0} /> | ||
5568 | - </div> | ||
5569 | - ); | ||
5570 | -}; | ||
5571 | - | ||
5572 | -export default OrderPage; |
src/pages/Order/OrderList/OrderDrawer.tsx
@@ -908,7 +908,7 @@ export default ({ onClose, data, subOrders, orderOptType }) => { | @@ -908,7 +908,7 @@ export default ({ onClose, data, subOrders, orderOptType }) => { | ||
908 | values.productBelongBusinessUpdateTime = formattedDate; | 908 | values.productBelongBusinessUpdateTime = formattedDate; |
909 | } else { | 909 | } else { |
910 | values.productBelongBusinessUpdateTime = | 910 | values.productBelongBusinessUpdateTime = |
911 | - data.productBelongBusinessUpdateTime; | 911 | + copyData.productBelongBusinessUpdateTime; |
912 | } | 912 | } |
913 | return item; | 913 | return item; |
914 | }); | 914 | }); |
src/pages/OrderReport/components/OrderDualAxes.tsx
1 | +// import { DualAxes } from '@ant-design/charts'; | ||
2 | + | ||
3 | +// const OrderDualAxes = ({ data, statisticMethod }) => { | ||
4 | +// console.log(data); | ||
5 | +// let yFiledString = 'curTime'; | ||
6 | +// if ( | ||
7 | +// statisticMethod === 'MONTH_STATISTICS' || | ||
8 | +// statisticMethod === 'LAST_MONTH_STATISTICS' | ||
9 | +// ) { | ||
10 | +// yFiledString = 'curTime'; | ||
11 | +// } else { | ||
12 | +// yFiledString = 'curMonth'; | ||
13 | +// } | ||
14 | +// const config = { | ||
15 | +// data: [ | ||
16 | +// data.targetAndTotalPaymentDtoList === undefined || | ||
17 | +// data.targetAndTotalPaymentDtoList === null | ||
18 | +// ? [] | ||
19 | +// : data.targetAndTotalPaymentDtoList, | ||
20 | +// data.orderNumberDtoList === undefined || data.orderNumberDtoList === null | ||
21 | +// ? [] | ||
22 | +// : data.orderNumberDtoList, | ||
23 | +// ], | ||
24 | +// xField: yFiledString, | ||
25 | +// yField: ['curDayTotalPayment', 'curDayTotalOrderNumber', 'lastTime'], | ||
26 | +// geometryOptions: [ | ||
27 | +// { | ||
28 | +// geometry: 'line', | ||
29 | +// seriesField: 'type', | ||
30 | +// lineStyle: { | ||
31 | +// lineWidth: 3, | ||
32 | +// lineDash: [5, 5], | ||
33 | +// }, | ||
34 | +// smooth: true, | ||
35 | +// }, | ||
36 | +// { | ||
37 | +// geometry: 'line', | ||
38 | +// seriesField: 'name', | ||
39 | +// point: {}, | ||
40 | +// }, | ||
41 | +// ], | ||
42 | +// }; | ||
43 | +// const handleClick = (event) => { | ||
44 | +// console.log('点击事件event:', event); | ||
45 | +// console.log('点击事件:', event?.data); | ||
46 | +// alert(`你点击了数据: ${JSON.stringify(event?.data)}`); | ||
47 | +// console.log('点击事件:', JSON.stringify(event?.data)); | ||
48 | + | ||
49 | +// }; | ||
50 | + | ||
51 | +// const handleReady = (plot) => { | ||
52 | +// // 绑定多个事件以确保响应 | ||
53 | +// plot.on('plot:click', handleClick); | ||
54 | +// plot.on('element:click', handleClick); | ||
55 | +// }; | ||
56 | +// return <DualAxes {...config} onReady={handleReady} />; | ||
57 | +// }; | ||
58 | + | ||
59 | +// export default OrderDualAxes; | ||
60 | + | ||
1 | import { DualAxes } from '@ant-design/charts'; | 61 | import { DualAxes } from '@ant-design/charts'; |
2 | 62 | ||
3 | const OrderDualAxes = ({ data, statisticMethod }) => { | 63 | const OrderDualAxes = ({ data, statisticMethod }) => { |
4 | - console.log(data); | 64 | + console.log('传入的数据:', data); |
65 | + | ||
5 | let yFiledString = 'curTime'; | 66 | let yFiledString = 'curTime'; |
67 | + | ||
6 | if ( | 68 | if ( |
7 | statisticMethod === 'MONTH_STATISTICS' || | 69 | statisticMethod === 'MONTH_STATISTICS' || |
8 | statisticMethod === 'LAST_MONTH_STATISTICS' | 70 | statisticMethod === 'LAST_MONTH_STATISTICS' |
@@ -11,18 +73,15 @@ const OrderDualAxes = ({ data, statisticMethod }) => { | @@ -11,18 +73,15 @@ const OrderDualAxes = ({ data, statisticMethod }) => { | ||
11 | } else { | 73 | } else { |
12 | yFiledString = 'curMonth'; | 74 | yFiledString = 'curMonth'; |
13 | } | 75 | } |
76 | + | ||
77 | + const targetData = data.targetAndTotalPaymentDtoList || []; | ||
78 | + const orderData = data.orderNumberDtoList || []; | ||
79 | + console.log(orderData, '传入的数据:', targetData); | ||
80 | + | ||
14 | const config = { | 81 | const config = { |
15 | - data: [ | ||
16 | - data.targetAndTotalPaymentDtoList === undefined || | ||
17 | - data.targetAndTotalPaymentDtoList === null | ||
18 | - ? [] | ||
19 | - : data.targetAndTotalPaymentDtoList, | ||
20 | - data.orderNumberDtoList === undefined || data.orderNumberDtoList === null | ||
21 | - ? [] | ||
22 | - : data.orderNumberDtoList, | ||
23 | - ], | 82 | + data: [targetData, orderData], |
24 | xField: yFiledString, | 83 | xField: yFiledString, |
25 | - yField: ['curDayTotalPayment', 'curDayTotalOrderNumber'], | 84 | + yField: ['curDayTotalPayment', 'curDayTotalOrderNumber', 'lastTime'], |
26 | geometryOptions: [ | 85 | geometryOptions: [ |
27 | { | 86 | { |
28 | geometry: 'line', | 87 | geometry: 'line', |
@@ -32,15 +91,53 @@ const OrderDualAxes = ({ data, statisticMethod }) => { | @@ -32,15 +91,53 @@ const OrderDualAxes = ({ data, statisticMethod }) => { | ||
32 | lineDash: [5, 5], | 91 | lineDash: [5, 5], |
33 | }, | 92 | }, |
34 | smooth: true, | 93 | smooth: true, |
94 | + point: { | ||
95 | + shape: 'circle', | ||
96 | + }, | ||
35 | }, | 97 | }, |
36 | { | 98 | { |
37 | geometry: 'line', | 99 | geometry: 'line', |
38 | seriesField: 'name', | 100 | seriesField: 'name', |
39 | - point: {}, | 101 | + point: { |
102 | + shape: 'circle', | ||
103 | + }, | ||
40 | }, | 104 | }, |
41 | ], | 105 | ], |
42 | }; | 106 | }; |
43 | - return <DualAxes {...config} />; | 107 | + |
108 | + const handleClick = (event) => { | ||
109 | + // console.log(targetData, '5656') | ||
110 | + // 获取当前点击点的数据 | ||
111 | + const pointData = event?.data?.data; | ||
112 | + | ||
113 | + if (pointData) { | ||
114 | + if (pointData.type === '上年营业额' || pointData.type === '订单量') { | ||
115 | + const xValue = pointData[yFiledString]; // 获取当前列的 xField 值 | ||
116 | + | ||
117 | + // 合并两个数据源 | ||
118 | + const allData = [...targetData, ...orderData]; | ||
119 | + console.log(orderData, '5656传入的数据:', targetData); | ||
120 | + // 筛选出当前列的所有数据 | ||
121 | + const columnData = allData.filter( | ||
122 | + (item) => item[yFiledString] === xValue, | ||
123 | + ); | ||
124 | + | ||
125 | + console.log(`当前列中 ${yFiledString} = ${xValue} 的数据:`, columnData); | ||
126 | + | ||
127 | + // 可选择将筛选出的数据展示到页面或以其他方式处理 | ||
128 | + alert(`当前列数据: ${JSON.stringify(columnData, null, 2)}`); | ||
129 | + } | ||
130 | + } else { | ||
131 | + console.warn('点击事件未携带有效数据'); | ||
132 | + } | ||
133 | + }; | ||
134 | + | ||
135 | + const handleReady = (plot) => { | ||
136 | + // 绑定点击事件 | ||
137 | + plot.on('element:click', handleClick); | ||
138 | + }; | ||
139 | + | ||
140 | + return <DualAxes {...config} onReady={handleReady} />; | ||
44 | }; | 141 | }; |
45 | 142 | ||
46 | export default OrderDualAxes; | 143 | export default OrderDualAxes; |
src/pages/OrderReport/index.tsx
1 | import { | 1 | import { |
2 | getOrderErpOrderZoNingSelectAll, | 2 | getOrderErpOrderZoNingSelectAll, |
3 | postOrderErpOrderZoNingSelectSaleUserByProvince, | 3 | postOrderErpOrderZoNingSelectSaleUserByProvince, |
4 | - postServiceOrderQueryReportFormsInformation, | 4 | + // postServiceOrderQueryReportFormsInformation, |
5 | postServiceOrderQuerySalesCode, | 5 | postServiceOrderQuerySalesCode, |
6 | } from '@/services'; | 6 | } from '@/services'; |
7 | import { enumToSelect } from '@/utils'; | 7 | import { enumToSelect } from '@/utils'; |
8 | import { | 8 | import { |
9 | ProCard, | 9 | ProCard, |
10 | + ProForm, | ||
10 | ProFormCheckbox, | 11 | ProFormCheckbox, |
11 | ProFormDigit, | 12 | ProFormDigit, |
12 | ProFormSelect, | 13 | ProFormSelect, |
@@ -110,9 +111,131 @@ const OrderReportPage = () => { | @@ -110,9 +111,131 @@ const OrderReportPage = () => { | ||
110 | // body.endTime=formatDate(form.getFieldValue("dateRange")[1]) | 111 | // body.endTime=formatDate(form.getFieldValue("dateRange")[1]) |
111 | // } | 112 | // } |
112 | body.statisticsMethod = statisticsMethod; | 113 | body.statisticsMethod = statisticsMethod; |
113 | - const { data } = await postServiceOrderQueryReportFormsInformation({ | ||
114 | - data: body, | ||
115 | - }); | 114 | + // const { data } = await postServiceOrderQueryReportFormsInformation({ |
115 | + // data: body, | ||
116 | + // }); | ||
117 | + const { data } = { | ||
118 | + data: { | ||
119 | + invoicedAndReiceptedCount: 1593, | ||
120 | + invoicedAndReiceptedPriceSum: 3303364.71, | ||
121 | + invoicedNotReiceptCount: 31798, | ||
122 | + invoicedNotReiceptPriceSum: 3.276437229e7, | ||
123 | + orderNumberDtoList: [ | ||
124 | + { | ||
125 | + curDayTotalOrderNumber: 2, | ||
126 | + curMonth: null, | ||
127 | + curTime: '2025-01-01', | ||
128 | + name: '订单量', | ||
129 | + }, | ||
130 | + { | ||
131 | + curDayTotalOrderNumber: 204, | ||
132 | + curMonth: null, | ||
133 | + curTime: '2025-01-02', | ||
134 | + name: '订单量', | ||
135 | + }, | ||
136 | + { | ||
137 | + curDayTotalOrderNumber: 0, | ||
138 | + curMonth: null, | ||
139 | + curTime: '2025-01-03', | ||
140 | + name: '订单量', | ||
141 | + }, | ||
142 | + ], | ||
143 | + subTotalOrderNumber: 308, | ||
144 | + target: 3500000, | ||
145 | + targetAndTotalPaymentDtoList: [ | ||
146 | + { | ||
147 | + curDayTotalPayment: 222000, | ||
148 | + curMonth: null, | ||
149 | + lastTime: '2024-01-01', | ||
150 | + curTime: '2025-01-01', | ||
151 | + type: '上年营业额', | ||
152 | + }, | ||
153 | + { | ||
154 | + curDayTotalPayment: 24820, | ||
155 | + curMonth: null, | ||
156 | + lastTime: '2024-01-01', | ||
157 | + curTime: '2025-01-01', | ||
158 | + type: '上年指标', | ||
159 | + }, | ||
160 | + { | ||
161 | + curDayTotalPayment: 248200, | ||
162 | + curMonth: null, | ||
163 | + lastTime: '2024-01-02', | ||
164 | + curTime: '2025-01-02', | ||
165 | + type: '上年指标', | ||
166 | + }, | ||
167 | + { | ||
168 | + curDayTotalPayment: 1906180.59, | ||
169 | + curMonth: null, | ||
170 | + lastTime: '2024-01-02', | ||
171 | + curTime: '2025-01-02', | ||
172 | + type: '上年营业额', | ||
173 | + }, | ||
174 | + { | ||
175 | + curDayTotalPayment: 248200, | ||
176 | + curMonth: null, | ||
177 | + lastTime: '2024-01-03', | ||
178 | + curTime: '2025-01-03', | ||
179 | + type: '上年指标', | ||
180 | + }, | ||
181 | + { | ||
182 | + curDayTotalPayment: 768000, | ||
183 | + curMonth: null, | ||
184 | + curTime: '2025-01-03', | ||
185 | + lastTime: '2024-01-03', | ||
186 | + type: '上年营业额', | ||
187 | + }, | ||
188 | + { | ||
189 | + curDayTotalPayment: 2482, | ||
190 | + curMonth: null, | ||
191 | + lastTime: '2024-01-01', | ||
192 | + curTime: '2025-01-01', | ||
193 | + type: '指标', | ||
194 | + }, | ||
195 | + { | ||
196 | + curDayTotalPayment: 650, | ||
197 | + curMonth: null, | ||
198 | + lastTime: '2024-01-01', | ||
199 | + curTime: '2025-01-01', | ||
200 | + type: '营业额', | ||
201 | + }, | ||
202 | + { | ||
203 | + curDayTotalPayment: 2482, | ||
204 | + curMonth: null, | ||
205 | + curTime: '2025-01-02', | ||
206 | + type: '指标', | ||
207 | + }, | ||
208 | + { | ||
209 | + curDayTotalPayment: 190618.59, | ||
210 | + curMonth: null, | ||
211 | + curTime: '2025-01-02', | ||
212 | + type: '营业额', | ||
213 | + }, | ||
214 | + { | ||
215 | + curDayTotalPayment: 2482, | ||
216 | + curMonth: null, | ||
217 | + curTime: '2025-01-03', | ||
218 | + type: '指标', | ||
219 | + }, | ||
220 | + { | ||
221 | + curDayTotalPayment: 0, | ||
222 | + curMonth: null, | ||
223 | + curTime: '2025-01-03', | ||
224 | + type: '营业额', | ||
225 | + }, | ||
226 | + ], | ||
227 | + totalOrderNumber: 206, | ||
228 | + totalOrderNumberTrend: null, | ||
229 | + totalPayment: 191268.59, | ||
230 | + totalPaymentTrend: null, | ||
231 | + unCheckOrderNumber: 80, | ||
232 | + unSendOrderNumber: 37, | ||
233 | + waitInvoicingCount: 386, | ||
234 | + waitInvoicingPriceSum: 211136.11, | ||
235 | + }, | ||
236 | + message: '成功', | ||
237 | + result: 0, | ||
238 | + }; | ||
116 | if (data !== undefined) { | 239 | if (data !== undefined) { |
117 | setStatisticData(data); | 240 | setStatisticData(data); |
118 | } | 241 | } |
@@ -129,6 +252,76 @@ const OrderReportPage = () => { | @@ -129,6 +252,76 @@ const OrderReportPage = () => { | ||
129 | getSalesCodeOptions(); | 252 | getSalesCodeOptions(); |
130 | }, []); | 253 | }, []); |
131 | 254 | ||
255 | + const yearOptions = [ | ||
256 | + { | ||
257 | + value: 'all', | ||
258 | + label: '全部', | ||
259 | + }, | ||
260 | + { | ||
261 | + value: '2024', | ||
262 | + label: '2024', | ||
263 | + }, | ||
264 | + { | ||
265 | + value: '2025', | ||
266 | + label: '2025', | ||
267 | + }, | ||
268 | + ]; | ||
269 | + | ||
270 | + const monthOptions = [ | ||
271 | + { | ||
272 | + value: 'all', | ||
273 | + label: '全部', | ||
274 | + }, | ||
275 | + { | ||
276 | + value: '1', | ||
277 | + label: '1', | ||
278 | + }, | ||
279 | + { | ||
280 | + value: '2', | ||
281 | + label: '2', | ||
282 | + }, | ||
283 | + { | ||
284 | + value: '3', | ||
285 | + label: '3', | ||
286 | + }, | ||
287 | + { | ||
288 | + value: '4', | ||
289 | + label: '4', | ||
290 | + }, | ||
291 | + { | ||
292 | + value: '5', | ||
293 | + label: '5', | ||
294 | + }, | ||
295 | + { | ||
296 | + value: '6', | ||
297 | + label: '6', | ||
298 | + }, | ||
299 | + { | ||
300 | + value: '7', | ||
301 | + label: '7', | ||
302 | + }, | ||
303 | + { | ||
304 | + value: '8', | ||
305 | + label: '8', | ||
306 | + }, | ||
307 | + { | ||
308 | + value: '9', | ||
309 | + label: '9', | ||
310 | + }, | ||
311 | + { | ||
312 | + value: '10', | ||
313 | + label: '10', | ||
314 | + }, | ||
315 | + { | ||
316 | + value: '11', | ||
317 | + label: '11', | ||
318 | + }, | ||
319 | + { | ||
320 | + value: '12', | ||
321 | + label: '12', | ||
322 | + }, | ||
323 | + ]; | ||
324 | + | ||
132 | // const items: TabsProps['items'] = [ | 325 | // const items: TabsProps['items'] = [ |
133 | // { | 326 | // { |
134 | // key: 'MONTH_STATISTICS', | 327 | // key: 'MONTH_STATISTICS', |
@@ -226,12 +419,72 @@ const OrderReportPage = () => { | @@ -226,12 +419,72 @@ const OrderReportPage = () => { | ||
226 | title="汇总统计" | 419 | title="汇总统计" |
227 | tooltip="下方汇总统计未统计实验设备事业部数据,如需要请勾选包含实验设备事业部汇总统计" | 420 | tooltip="下方汇总统计未统计实验设备事业部数据,如需要请勾选包含实验设备事业部汇总统计" |
228 | extra={ | 421 | extra={ |
229 | - <Segmented | ||
230 | - options={['本月', '上月', '本年']} | ||
231 | - onChange={(val: any) => { | ||
232 | - onChange(val); | ||
233 | - }} | ||
234 | - /> | 422 | + <div> |
423 | + <Segmented | ||
424 | + options={['本月', '上月', '本年']} | ||
425 | + onChange={(val: any) => { | ||
426 | + onChange(val); | ||
427 | + }} | ||
428 | + /> | ||
429 | + <div> | ||
430 | + <ProForm.Group> | ||
431 | + <ProFormSelect | ||
432 | + name="salesCode" | ||
433 | + key="salesCode" | ||
434 | + width="100px" | ||
435 | + // actionRef={mainTableRef} | ||
436 | + // formRef={mainTableFormRef} | ||
437 | + initialValue={'1'} | ||
438 | + showSearch | ||
439 | + placeholder="月份" | ||
440 | + options={monthOptions} | ||
441 | + // onChange={(_, option) => { | ||
442 | + // // if (option === undefined) { | ||
443 | + // // selectSalesCode(userInfo.username); | ||
444 | + // // } | ||
445 | + // // // if (option.value !== undefined) { | ||
446 | + // // // selectSalesCode(option.value); | ||
447 | + // // // } | ||
448 | + // // if (option && option.value !== undefined) { | ||
449 | + // // selectSalesCode(option.value); | ||
450 | + // // } | ||
451 | + // }} | ||
452 | + // request={async () => { | ||
453 | + // let options = await getSalesCodeOptions(); | ||
454 | + // setSalesCodeOptions(options); | ||
455 | + // return options; | ||
456 | + // }} | ||
457 | + /> | ||
458 | + <ProFormSelect | ||
459 | + name="salesCode" | ||
460 | + key="salesCode" | ||
461 | + width="100px" | ||
462 | + // actionRef={mainTableRef} | ||
463 | + // formRef={mainTableFormRef} | ||
464 | + initialValue={'2025'} | ||
465 | + showSearch | ||
466 | + placeholder="年份" | ||
467 | + options={yearOptions} | ||
468 | + // onChange={(_, option) => { | ||
469 | + // // if (option === undefined) { | ||
470 | + // // selectSalesCode(userInfo.username); | ||
471 | + // // } | ||
472 | + // // // if (option.value !== undefined) { | ||
473 | + // // // selectSalesCode(option.value); | ||
474 | + // // // } | ||
475 | + // // if (option && option.value !== undefined) { | ||
476 | + // // selectSalesCode(option.value); | ||
477 | + // // } | ||
478 | + // }} | ||
479 | + // request={async () => { | ||
480 | + // let options = await getSalesCodeOptions(); | ||
481 | + // setSalesCodeOptions(options); | ||
482 | + // return options; | ||
483 | + // }} | ||
484 | + /> | ||
485 | + </ProForm.Group> | ||
486 | + </div> | ||
487 | + </div> | ||
235 | } | 488 | } |
236 | bordered | 489 | bordered |
237 | > | 490 | > |