import ButtonConfirm from '@/components/ButtomConfirm'; import { RESPONSE_CODE } from '@/constants/enum'; import { postKingdeeRepSalBillOutbound, postKingdeeRepSalOrderSave, postServiceOrderNoNeedSend, postServiceOrderOrderCancel, postServiceOrderProcureOrder, postServiceOrderProcurePrint, postServiceOrderProvideProcurementRoles, postServiceOrderQueryServiceOrder, postServiceOrderSaleCancelInvoicing, } from '@/services'; import { orderExport } from '@/services/order'; import { copyToClipboard, enumToProTableEnumValue, enumValueToLabel, formatDateTime, formatdate, } from '@/utils'; import { getReceivingCompanyOptions } from '@/utils/order'; import { getUserInfo } from '@/utils/user'; import { ClockCircleTwoTone, ContainerTwoTone, CopyOutlined, CopyTwoTone, DownOutlined, EditTwoTone, EllipsisOutlined, QuestionCircleOutlined, } from '@ant-design/icons'; import { ActionType, PageContainer, ProColumns, ProFormInstance, ProTable, } from '@ant-design/pro-components'; import { history } from '@umijs/max'; import { Avatar, Button, Checkbox, Divider, Dropdown, Flex, Image, MenuProps, Radio, Space, Tag, Tooltip, message, } from 'antd'; import { cloneDeep } from 'lodash'; import React, { Key, useEffect, useRef, useState } from 'react'; import OrderPrintModal from '../OrderPrint/OrderPrintModal'; import AfterSalesDrawer from './components/AfterSalesDrawer'; import ApplyForInvoicingModal from './components/ApplyForInvoicingModal'; import AttachmentModal from './components/AttachmentModal'; import CheckModal from './components/CheckModal'; import ConfirmReceiptModal from './components/ConfirmReceiptModal'; import DeliverInfoDrawer from './components/DeliverInfoDrawer'; import DeliverModal from './components/DeliverModal'; import FinancialDrawer from './components/FinancialDrawer'; import FinancialEditDrawer from './components/FinancialEditDrawer'; import FinancialMergeDrawer from './components/FinancialMergeDrawer'; import FinancialReceiptsModal from './components/FinancialReceiptsModal'; import HistoryModal from './components/HistoryModal'; import ImportModal from './components/ImportModal'; import OrderDrawer from './components/OrderDrawer'; import OrderNotesEditModal from './components/OrderNotesEditModal'; import ProcureCheckModal from './components/ProcureCheckModal'; import ProcureConvertModal from './components/ProcureConvertModal'; import ShippingWarehouseChangeModal from './components/ShippingWarehouseChangeModal'; import SubOrderComfirmReceiptImagesModal from './components/SubOrderComfirmReceiptImagesModal'; import { AFTER_INVOICING_STATUS, CHECK_TYPE, LOGISTICS_STATUS_OPTIONS, MAIN_ORDER_COLUMNS, ORDER_STATUS_OPTIONS, PAYEE_OPTIONS, PAYMENT_CHANNEL_OPTIONS, PAYMENT_METHOD_OPTIONS, PROCURE_ORDER_STATUS, PROCURE_PRIMARY_ORDER_STATUS_OPTIONS, PRODUCT_BELONG_DEPARTMENT_OPTIONS, SHIPPING_WAREHOUSE_OPTIONS, TAGS_COLOR, getInvoicingType, getNeedInvoicing, } from './constant'; import './index.less'; import { OrderListItemType, OrderType } from './type.d'; const OrderPage = () => { const [orderDrawerVisible, setOrderDrawerVisible] = useState<boolean>(false); const [checkVisible, setCheckVisible] = useState<boolean>(false); const [orderPrintVisible, setOrderPrintVisible] = useState<boolean>(false); const [allMainChecked, setAllMainChecked] = useState(false); const [ subOrderConfirmReceiptImagesVisible, setSubOrderConfirmReceiptImagesVisible, ] = useState<boolean>(false); const [data, setData] = useState([]); //列表数据 const [notesEditVisible, setNotesEditVisible] = useState<boolean>(false); const [financialMergeDrawerVisible, setFinancialMergeDrawerVisible] = useState<boolean>(false); const [attachmentModalVisible, setAttachmentModalVisible] = useState<boolean>(false); const [financialReceiptsModalVisible, setFinancialReceiptsModalVisible] = useState(false); const [financialVisible, setFinancialVisible] = useState<boolean>(false); const [financialEditVisible, setFinancialEditVisible] = useState<boolean>(false); const [afterSalesDrawerVisible, setAfterSalesDrawerVisible] = useState<boolean>(false); const [historyModalVisible, setHistoryModalVisible] = useState<boolean>(false); const [isRePrintOrder, setIsRePrintOrder] = useState<boolean>(false); const [isSendProduct, setIsSendProduct] = useState<boolean>(false); const [isMainOrder, setIsMainOrder] = useState<boolean>(false); const [importModalVisible, setImportModalVisible] = useState<boolean>(false); const [applyForInvoicingVisible, setApplyForInvoicingVisible] = useState<boolean>(false); const [procureCheckModalVisible, setProcureCheckModalVisible] = useState<boolean>(false); const [procureConvertModalVisible, setProcureConvertModalVisible] = useState<boolean>(false); const [confirmReceiptVisible, setConfirmReceiptVisible] = useState<boolean>(false); const [deliverVisible, setDeliverVisible] = useState<boolean>(false); const [deliverInfoDrawerVisible, setDeliverInfoDrawerVisible] = useState<boolean>(false); const [orderOptType, setOrderOptType] = useState<string>(''); const [isEdit, setIsEdit] = useState<boolean>(false); const [expandedRowKeys, setExpandedRowKeys] = useState<Key[]>([]); const [orderRow, setOrderRow] = useState<Partial<OrderType>>({}); const [notesType, setNotesType] = useState(1); const [notes, setNotes] = useState(1); const [mainOrderAllItemKeys, setMainOrderAllItemKeys] = useState([]); const [rolePath, setRolePath] = useState([]); //当前角色权限(新增跟打印按钮) const userInfo = getUserInfo(); // const [tableHeight, setTableHeight] = useState(200); const [selectedRows, setSelectedRows] = useState({}); const [selectedRowObj, setSelectedRowObj] = useState({}); const [selectedItems, setSelectedItems] = useState([]); const [selectedRowKeys, setSelectedRowKeys] = useState([]); const [pageSize, setPageSize] = useState(10); const [currentPage, setCurrentPage] = useState(1); const [orderCheckType, setOrderCheckType] = useState(''); const [filterCondifion, setFilterCondition] = useState(0); const [mainOrderSelectedMap] = useState(new Map()); //选中的主订单Map key:主订单id value:主订单数据 const [subOrderSelectedMap] = useState(new Map()); //选中的子订单Map key:主订单id value:选中的子订单数据集合 const [mainOrderSelectedRows, setMainOrderSelectedRows] = useState([]); //选中的主订单集合 const mainTableRef = useRef<ActionType>(); const mainTableFormRef = useRef<ProFormInstance>(); let [searchParams, setSearchParam] = useState(Object); //表格的查询条件存储 const [messageApi, contextHolder] = message.useMessage(); const [ shippingWarehouseChangeModalVisible, setShippingWarehouseChangeModalVisible, ] = useState(false); const [ids, setIds] = useState([]); const roleCode = userInfo?.roleSmallVO?.code; // const openCheckNotes = (checkNotes: string) => { // Modal.info({ // title: '驳回备注', // content: ( // <div> // <p>{checkNotes}</p> // </div> // ), // onOk() { }, // }); // }; const exportLoading = () => { messageApi.open({ type: 'loading', content: '正在导出文件...', duration: 0, }); }; const exportLoadingDestory = () => { messageApi.destroy(); }; const refreshTable = () => { mainTableRef.current?.reload(); //刷新表格数据的时候,取消选中行 setSelectedRowObj([]); setSelectedRows([]); setSelectedRowKeys([]); }; // function changeCancelOrderShow(e: any) { // setOnlyShowCancelOrder(e.target.checked); // refreshTable(); // } // function changeProcureToBeProcessed(e: any) { // setOnlyShowProcureToBeProcessed(e.target.checked); // refreshTable(); // } // function changeOnlyShowOtherProcure(e: any) { // setOnlyShowOtherProcure(e.target.checked); // refreshTable(); // } // function changeShowCurrentLeaderNeedAuditOrders(e: any) { // setShowCurrentLeaderNeedAuditOrders(e.target.checked); // refreshTable(); // } // function changeFinancialToBeProcessed(e: any) { // setOnlyShowFinancialToBeProcessed(e.target.checked); // refreshTable(); // } // function changeOnlyShowIsUrgentOrders(e: any) { // setOnlyShowIsUrgentOrders(e.target.checked); // refreshTable(); // } // function changeSalesCreateProcessed(e: any) { // setOnlyShowSalesCreateProcessed(e.target.checked); // refreshTable(); // } /** * 复制订单到剪贴板 * @param record */ function copyOrderToClipboard(record: any) { let text = ''; text += record?.id; text += ',' + record?.salesCode; text += ',' + record?.customerName; text += ',' + record?.customerContactNumber; text += ',' + record?.customerShippingAddress; text += ',' + record?.institutionContactName; text += ',' + record?.institution; record?.subOrderInformationLists?.forEach((item) => { text += '\n'; text += item?.productName; text += ' ' + item?.parameters; text += ' ' + item?.quantity; text += ' ' + item?.unit; }); if (copyToClipboard(text)) { message.info('已复制到剪贴板'); } else { message.info('无法复制到剪贴板'); } } // const resize = () => { // // 计算元素底部到视口顶部的距离 // let bottomDistance = document // .getElementById('mainTable') // ?.getElementsByClassName('ant-table-thead')[0] // .getBoundingClientRect().bottom; // // 获取屏幕高度 // let screenHeight = // window.innerHeight || document.documentElement.clientHeight; // // 计算元素底部到屏幕底部的距离 // let bottomToScreenBottomDistance = screenHeight - bottomDistance; // // //底部分页元素的高度 // // var pH = screenHeight - document.getElementById("main-table").getElementsByClassName('ant-table-body')[0].getBoundingClientRect().bottom; // setTableHeight(bottomToScreenBottomDistance - 88); // }; // useEffect(() => { // resize(); // // 添加事件监听器,当窗口大小改变时调用resize方法 // window.addEventListener('resize', resize); // }); const MyToolTip = ({ title, content }) => { return ( <Tooltip color="#FFFFFF" placement="bottom" title={<div className="px-5 py-4 text-black">{title}</div>} > {content} </Tooltip> ); }; /** * 检查是否可以打印 * @param paths 按钮集合 * @returns */ function checkePrintable(paths: any) { if ( !paths?.includes('printOrder') && !paths?.includes('supplierPrint') && !paths?.includes('procurePrint') && !paths?.includes('rePrintOrder') ) { return false; } return true; } const onCheckboxChange = (record: never) => { console.log(subOrderSelectedMap); let newSelectedItems = []; if (selectedItems.includes(record.id)) { newSelectedItems = selectedItems.filter((key) => key !== record.id); setSelectedRowKeys([]); setSelectedRowObj({ ...setSelectedRowObj, [record.id]: [], }); selectedRowObj[record.id] = []; setSelectedRows([]); //取消选中主订单 mainOrderSelectedMap.delete(record.id); } else { newSelectedItems = [...selectedItems, record.id]; //子订单全部自动选中 let subIds = record.subOrderInformationLists?.map((item) => { return item.id; }); setSelectedRowKeys(subIds); setSelectedRowObj({ ...setSelectedRowObj, [record.id]: record.subOrderInformationLists, }); selectedRowObj[record.id] = record.subOrderInformationLists; setSelectedRows(record.subOrderInformationLists); //选中主订单 mainOrderSelectedMap.set(record.id, record); } setSelectedItems(newSelectedItems); }; const handleTableExpand = (mainOrderIds: any) => { setExpandedRowKeys(mainOrderIds); }; const allMainCheckBoxChange = () => { let checked = !allMainChecked; setAllMainChecked(checked); mainOrderSelectedMap.clear(); if (checked) { let mainOrderIds = data?.map((item) => { mainOrderSelectedMap.set(item.id, item); return item.id; }); let rowObj = {}; data?.forEach((item) => { let id = item.id; rowObj[id] = item; }); setSelectedItems(mainOrderIds); } else { setSelectedItems([]); } }; //表头渲染 const OrderTableHeader = () => { return ( <Flex className="w-full"> <Flex className="w-[1%] ml-[7px]"> <Checkbox onChange={allMainCheckBoxChange} checked={allMainChecked} ></Checkbox> </Flex> <Flex className="w-[30%] ml-[1%]"> <span className="font-medium">商品信息</span> </Flex> <Flex className="w-[13%]"> <span className="font-medium">交易金额</span> </Flex> <Flex className="w-[10%]"> <span className="font-medium">支付</span> </Flex> <Flex className="w-[12%]"> <span className="font-medium">其他</span> </Flex> <Flex className="w-[10%]"> <span className="font-medium">交易状态</span> </Flex> <Flex className="w-[17%]"> <span className="font-medium">操作</span> </Flex> </Flex> ); }; //子订单内容渲染 const SubOderRander = ({ record, optRecord }) => { /** * 获取订单状态标签 * @param optRecord */ function getOrderStatusTag(optRecord: any): import('react').ReactNode { const orderStatus = optRecord.orderStatus; if (orderStatus === 'AUDIT_FAILED') { return ( <MyToolTip key="key" title={optRecord.checkNotes} content={ <> <Tag color={TAGS_COLOR.get(optRecord.orderStatus)} style={{ marginRight: '4px' }} > {enumValueToLabel( optRecord.orderStatus, ORDER_STATUS_OPTIONS, )} </Tag> <QuestionCircleOutlined style={{ color: '#C1C1C1' }} /> </> } /> ); } if ( orderStatus === 'AFTER_SALES_COMPLETION' || orderStatus === 'IN_AFTER_SALES' ) { return ( // <MyToolTip // key="key" // title={ // enumValueToLabel( // optRecord.afterSalesPlan, // AFTE_SALES_PLAN_OPTIONS, // ) + // ' ' + // optRecord.afterSalesNotes // } // content={ // <> // <Tag // color={TAGS_COLOR.get(optRecord.orderStatus)} // style={{ marginRight: '4px' }} // > // {enumValueToLabel( // optRecord.orderStatus, // ORDER_STATUS_OPTIONS, // )} // </Tag> // <QuestionCircleOutlined style={{ color: '#C1C1C1' }} /> // </> // } // /> <Tag color={TAGS_COLOR.get(optRecord.orderStatus)} style={{ marginRight: '4px' }} > {enumValueToLabel(optRecord.orderStatus, ORDER_STATUS_OPTIONS)} </Tag> ); } if (orderStatus === 'PROCURE_CONVERT_WAREHOUSE_KEEPER') { return ( <MyToolTip key="key" title={optRecord.checkNotes} content={ <> <Tag color={TAGS_COLOR.get(optRecord.orderStatus)} style={{ marginRight: '4px' }} > {enumValueToLabel( optRecord.orderStatus, ORDER_STATUS_OPTIONS, )} </Tag> <QuestionCircleOutlined style={{ color: '#C1C1C1' }} /> </> } /> ); } return ( <Tag key="key" color={TAGS_COLOR.get(optRecord.orderStatus)}> {enumValueToLabel(optRecord.orderStatus, ORDER_STATUS_OPTIONS)} </Tag> ); } //申请开票附件处理 const getAfterAnnexList = () => { let links = []; let afterAnnexList = optRecord.afterAnnexList; let i = 1; if (afterAnnexList?.length > 0) { for (let url of afterAnnexList) { links.push( <a key={i} className="pl-2" href={url}> 附件{i++} </a>, ); } } return links; }; //财务审核附件处理 const getInvoicingCheckAnnexList = () => { let invoicingCheckAnnexList = optRecord.invoicingCheckAnnexList; return ( <div> <Image.PreviewGroup className="mr-10" preview={{ onChange: (current, prev) => console.log(`current index: ${current}, prev index: ${prev}`), }} > {invoicingCheckAnnexList.map((url, index) => ( <React.Fragment key={index}> <Image className="max-h-[50px] max-w-[70px]" src={url} />{' '} <Divider type="vertical" /> </React.Fragment> ))} </Image.PreviewGroup> </div> ); }; return ( <> <Flex className="w-full border-b-indigo-500"> <Flex vertical className="w-[31%]" gap="small"> {/* 商品名称 */} <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis" title={optRecord.productName} > <span className="font-medium text-black "> {optRecord.productName} </span> </div> <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis" title={optRecord.parameters} > <span className="text-[#8C8C8C]"> 参数:{optRecord.parameters} </span> </div> <Flex title={optRecord.notes}> <div className="max-w-[90%] whitespace-no-wrap overflow-hidden overflow-ellipsis"> <span className="text-[#8C8C8C]"> 备注: {optRecord.notes === null ? '暂无备注' : optRecord.notes} </span> </div> {/* 编辑备注按钮 */} <EditTwoTone className="pl-1 hover:curcor-pointer" onClick={() => { setNotesEditVisible(true); setSelectedRows([optRecord.id]); setNotes(optRecord.notes); setNotesType(1); }} /> </Flex> {roleCode === 'procure' || roleCode === 'warehouseKeeper' || roleCode === 'admin' ? ( <Flex title={optRecord.procureNotes}> <div className="max-w-[90%] whitespace-no-wrap overflow-hidden overflow-ellipsis"> <span className="text-[#8C8C8C]"> 采购备注: {optRecord.procureNotes === null ? '暂无备注' : optRecord.procureNotes} </span> </div> {/* 编辑备注按钮 */} <EditTwoTone className="pl-1 hover:curcor-pointer" onClick={() => { setSelectedRows([optRecord.id]); setNotes(optRecord.procureNotes); setNotesEditVisible(true); setNotesType(2); }} /> </Flex> ) : ( '' )} {roleCode === 'procure' || roleCode === 'admin' ? ( <Flex title={optRecord.supplierNotes}> <div className="max-w-[90%] whitespace-no-wrap overflow-hidden overflow-ellipsis"> <span className="text-[#8C8C8C]"> 供应商备注: {optRecord.supplierNotes === null ? '暂无备注' : optRecord.supplierNotes} </span> </div> {/* 编辑备注按钮 */} <EditTwoTone className="pl-1 hover:curcor-pointer" onClick={() => { setSelectedRows([optRecord.id]); setNotes(optRecord.supplierNotes); setNotesEditVisible(true); setNotesType(3); }} /> </Flex> ) : ( '' )} {/* {optRecord.applyInvoicingNotes !== undefined && optRecord.applyInvoicingNotes !== null ? ( <Flex title={optRecord.notes}> <div className="max-w-[90%] whitespace-no-wrap overflow-hidden overflow-ellipsis"> <span className="text-[#8C8C8C]"> 开票备注: {optRecord.applyInvoicingNotes} </span> </div> </Flex> ) : ( '' )} */} </Flex> <Flex className="w-[13%]" vertical gap="small"> <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis" title={optRecord.productPrice} > <span className="text-[#8C8C8C]">单价:</span> <span className="text-slate-700">¥{optRecord.productPrice}</span> </div> <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis" title={optRecord.quantity} > <span className="text-[#8C8C8C]">数量:</span> <span className="text-slate-700"> x{optRecord.quantity + ' '} </span> <span className="text-[#8C8C8C]">{optRecord.unit}</span> </div> <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis" title={optRecord.subOrderPayment} > <span className="text-[#8C8C8C]">合计:</span> <span className="text-slate-700"> ¥{optRecord.subOrderPayment} </span> </div> </Flex> <Flex className="w-[10%]" vertical gap="small"> {/* 支付方式 */} <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> <span className="text-slate-700"> {enumValueToLabel( optRecord.paymentMethod, PAYMENT_METHOD_OPTIONS, )} </span> </div> {/* 支付渠道 */} <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> <span className="text-slate-700"> {enumValueToLabel( optRecord.paymentChannel, PAYMENT_CHANNEL_OPTIONS, )} </span> </div> </Flex> <Flex className="w-[13%]" vertical gap="small"> {/* 所属部门 */} <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis" title={enumValueToLabel( optRecord.productBelongBusiness, PRODUCT_BELONG_DEPARTMENT_OPTIONS, )} > <span className="text-slate-700"> {enumValueToLabel( optRecord.productBelongBusiness, PRODUCT_BELONG_DEPARTMENT_OPTIONS, )} </span> </div> {/* 开票类型 */} {getInvoicingType(optRecord) === undefined ? ( <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> <span className="text-slate-700"> {getInvoicingType(optRecord)} </span> </div> ) : ( '' )} {/* 开票状态 */} <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> <span className="text-slate-700"> {enumValueToLabel( optRecord.afterInvoicingStatus, AFTER_INVOICING_STATUS, )} </span> </div> {/* 是否加急图标显示 */} {optRecord.isUrgent ? ( <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> <Tooltip title={'期望开票时间:' + formatdate(optRecord.deadline)} > <Tag color="red">加急开票</Tag> </Tooltip> </div> ) : ( '' )} {(roleCode === 'warehouseKeeper' || roleCode === 'admin') && optRecord.shippingWarehouse !== null ? ( <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis" title={enumValueToLabel( optRecord.shippingWarehouse, SHIPPING_WAREHOUSE_OPTIONS, )} > <span className="text-slate-700"> {enumValueToLabel( optRecord.shippingWarehouse, SHIPPING_WAREHOUSE_OPTIONS, )} </span> </div> ) : ( '' )} </Flex> <Flex className="w-[10%]" vertical gap="small"> {/* 开票状态 */} <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> <Tag color={ optRecord.invoicingTime === null || optRecord.invoicingTime === undefined ? TAGS_COLOR.get(optRecord.invoicingStatus) : 'success' } > {getNeedInvoicing(optRecord)} </Tag> </div> {/* 订单状态 */} <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> {getOrderStatusTag(optRecord)} </div> {/**采购是否已下单状态 */} {optRecord.procureOrderStatus !== null && optRecord.procureOrderStatus !== undefined ? ( <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> <Tag color="success"> {enumValueToLabel( optRecord.procureOrderStatus, PROCURE_ORDER_STATUS, )} </Tag> </div> ) : ( '' )} {/* 物流信息 */} <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> {optRecord.orderStatus === 'CONFIRM_RECEIPT' || optRecord.orderStatus === 'AFTER_SALES_COMPLETION' || optRecord.orderStatus === 'IN_AFTER_SALES' || optRecord.orderStatus === 'SHIPPED' ? ( <MyToolTip title={ optRecord.serialNumber === undefined ? '暂无物流信息' : enumValueToLabel( optRecord.logisticsMethod, LOGISTICS_STATUS_OPTIONS, ) + ' ' + optRecord.serialNumber + ' ' + optRecord.logisticsNotes } content={ <Button type="link" size="small" style={{ padding: 0 }}> 物流信息 </Button> } /> ) : ( '' )} </div> </Flex> <Flex className="w-[18%]" wrap="wrap" gap="small"> {optRecord.subPath?.includes('leaderAudit') ? ( <Button className="p-0" type="link" onClick={() => { setOrderRow(record); setCheckVisible(true); setSelectedRows([optRecord]); setOrderCheckType(CHECK_TYPE.LEADER_AUDIT); }} > 审核 </Button> ) : ( '' )} {optRecord.subPath?.includes('shippingWarehouseChangeRequest') ? ( <Button className="p-0" type="link" onClick={() => { setIds([optRecord.id]); setOrderRow(optRecord); setShippingWarehouseChangeModalVisible(true); }} > 修改仓库 </Button> ) : ( '' )} {optRecord.subPath?.includes('saleCancelInvoicing') ? ( <ButtonConfirm className="p-0" title="确认取消申请开票?" text="取消申请" onConfirm={async () => { let res = await postServiceOrderSaleCancelInvoicing({ data: { subOrderIds: [optRecord.id], }, }); if (res && res.result === RESPONSE_CODE.SUCCESS) { message.success(res.message); refreshTable(); } }} /> ) : ( '' )} {optRecord.subPath?.includes('noNeedInvoicingEdit') ? ( <Button className="p-0" type="link" onClick={() => { setFinancialEditVisible(true); setSelectedRows([optRecord]); setOrderRow(record); setIsMainOrder(false); }} > 编辑时间 </Button> ) : ( '' )} {optRecord.subPath?.includes('sendProduct') ? ( <Button className="p-0" type="link" onClick={() => { optRecord.mainOrderId = record.id; setSelectedRows([cloneDeep(optRecord)]); //克隆一份数据,避免后续修改污染 setDeliverVisible(true); setIsSendProduct(true); setOrderCheckType(CHECK_TYPE.NORMAL); }} > 仓库发货 </Button> ) : ( '' )} {optRecord.subPath?.includes('supplierSendOrder') ? ( <Button className="p-0" type="link" onClick={() => { optRecord.mainOrderId = record.id; setSelectedRows([cloneDeep(optRecord)]); //克隆一份数据,避免后续修改污染 setDeliverVisible(true); setIsSendProduct(true); setOrderCheckType(CHECK_TYPE.SUPPLIER); }} > 供应商发货 </Button> ) : ( '' )} {optRecord.subPath?.includes('procureSend') ? ( <Button className="p-0" type="link" onClick={() => { optRecord.mainOrderId = record.id; setSelectedRows([cloneDeep(optRecord)]); //克隆一份数据,避免后续修改污染 setDeliverVisible(true); setIsSendProduct(true); setOrderCheckType(CHECK_TYPE.PROCURE); }} > 采购发货 </Button> ) : ( '' )} {optRecord.subPath?.includes('queryAnnex') && optRecord.listAnnex?.length > 0 ? ( <Button className="p-0" type="link" onClick={() => { optRecord.mainOrderId = record.id; setAttachmentModalVisible(true); setOrderRow(optRecord); }} > 附件 </Button> ) : ( '' )} {optRecord.subPath?.includes('modifySendInformation') ? ( <Button className="p-0" type="link" onClick={() => { optRecord.mainOrderId = record.id; setSelectedRows([cloneDeep(optRecord)]); //克隆一份数据,避免后续修改污染 setDeliverVisible(true); setIsSendProduct(false); }} > 修改发货信息 </Button> ) : ( '' )} {optRecord.subPath?.includes('printOrder') ? ( <Button className="p-0" type="link" onClick={async () => { setOrderPrintVisible(true); setSelectedRows([optRecord]); setOrderRow(record); setOrderCheckType(CHECK_TYPE.NORMAL); }} > 仓库打印 </Button> ) : ( '' )} {optRecord.subPath?.includes('supplierPrint') ? ( <Button className="p-0" type="link" onClick={async () => { setOrderPrintVisible(true); setSelectedRows([optRecord]); setOrderRow(record); setOrderCheckType(CHECK_TYPE.SUPPLIER); }} > 供应商打印 </Button> ) : ( '' )} {optRecord.subPath?.includes('procurePrint') ? ( <ButtonConfirm className="p-0" title="确认打印?" text="采购打印" onConfirm={async () => { let res = await postServiceOrderProcurePrint({ data: { ids: [optRecord.id], }, }); if (res.result === RESPONSE_CODE.SUCCESS) { message.success(res.message); refreshTable(); } }} /> ) : ( // <Button // className="p-0" // type="link" // onClick={async () => { // setOrderPrintVisible(true); // setSelectedRows([optRecord]); // setOrderRow(record); // setOrderCheckType(CHECK_TYPE.PROCURE); // }} // > // 采购打印 // </Button> '' )} {optRecord.subPath?.includes('editOrder') && false ? ( <Button className="p-0" type="link" onClick={() => { setFinancialVisible(true); setOrderRow(record); setSelectedRows([optRecord]); setIsEdit(true); }} > 编辑 </Button> ) : ( '' )} {optRecord.subPath?.includes('invoicing') ? ( <Button className="p-0" type="link" onClick={() => { setFinancialVisible(true); setIsEdit(false); setOrderRow(record); setSelectedRows([optRecord]); setIsMainOrder(false); }} > 开票 </Button> ) : ( '' )} {optRecord.subPath?.includes('applyInvoicing') ? ( <Button className="p-0" type="link" onClick={() => { setApplyForInvoicingVisible(true); setSelectedRows([optRecord]); setIsEdit(false); setIsMainOrder(false); }} > 申请开票 </Button> ) : ( '' )} {optRecord.subPath?.includes('checkOrder') ? ( <Button className="p-0" type="link" onClick={() => { setOrderRow(record); setCheckVisible(true); setSelectedRows([optRecord]); setOrderCheckType(CHECK_TYPE.NORMAL); }} > 审核 </Button> ) : ( '' )} {optRecord.subPath?.includes('afterSalesCheck') ? ( <Button className="p-0" type="link" onClick={() => { setOrderRow(record); setCheckVisible(true); setSelectedRows([optRecord]); setOrderCheckType(CHECK_TYPE.AFTER_SALES); }} > 售后审核 </Button> ) : ( '' )} {optRecord.subPath?.includes('financeCheckOrder') ? ( <Button className="p-0" type="link" onClick={() => { setOrderRow(record); setCheckVisible(true); setSelectedRows([optRecord]); setOrderCheckType(CHECK_TYPE.FINALCIAL); }} > 财务审核 </Button> ) : ( '' )} {optRecord.subPath?.includes('procureCheckOrder') ? ( <Button className="p-0" type="link" onClick={() => { setOrderRow(record); setSelectedRows([optRecord]); setOrderCheckType(CHECK_TYPE.PROCURE); setProcureCheckModalVisible(true); }} > 采购审核 </Button> ) : ( '' )} {optRecord.subPath?.includes('procureConvertProcure') ? ( <Button className="p-0" type="link" onClick={() => { setSelectedRows([optRecord]); setOrderCheckType(CHECK_TYPE.PROCURE); setProcureConvertModalVisible(true); }} > 转发 </Button> ) : ( '' )} {optRecord.subPath?.includes('rePrintOrder') ? ( <Button className="p-0" type="link" onClick={() => { setOrderPrintVisible(true); setSelectedRows([optRecord]); setOrderRow(record); setIsRePrintOrder(true); }} > 重新打印 </Button> ) : ( '' )} {optRecord.subPath?.includes('confirmReceipt') ? ( <Button className="p-0" type="link" onClick={() => { setConfirmReceiptVisible(true); setOrderRow(optRecord); }} > 确认收货 </Button> ) : ( '' )} {optRecord.subPath?.includes('applyAfterSales') ? ( <Button className="p-0" type="link" onClick={() => { setSelectedRows([optRecord]); setOrderDrawerVisible(true); setOrderRow(record); setOrderOptType('after-sales'); }} > 申请售后 </Button> ) : ( '' )} {optRecord.subPath?.includes('procureOrder') ? ( <ButtonConfirm className="p-0" title="是否已下单?" text="下单" onConfirm={async () => { let res = await postServiceOrderProcureOrder({ data: { subIds: [optRecord.id] }, }); if (res.result === RESPONSE_CODE.SUCCESS) { message.success(res.message); refreshTable(); return true; } }} /> ) : ( '' )} {optRecord.subPath?.includes('noNeedSend') ? ( <ButtonConfirm className="p-0" title="此订单是否无需发货?" text="无需发货" onConfirm={async () => { let res = await postServiceOrderNoNeedSend({ data: { ids: [optRecord.id] }, }); if (res.result === RESPONSE_CODE.SUCCESS) { message.success(res.message); refreshTable(); return true; } }} /> ) : ( '' )} {optRecord.subPath?.includes('viewImages') ? ( <Button className="p-0" type="link" onClick={() => { setSubOrderConfirmReceiptImagesVisible(true); setOrderRow(optRecord); }} > 查看收货凭证 </Button> ) : ( '' )} {optRecord.subPath?.includes('orderCancel') ? ( <ButtonConfirm className="p-0" title="确认作废?" text="作废" onConfirm={async () => { let body = { ids: [optRecord.id], checkIsMainOrderId: false }; const data = await postServiceOrderOrderCancel({ data: body, }); if (data.result === RESPONSE_CODE.SUCCESS) { message.success(data.message); refreshTable(); } }} /> ) : ( '' )} </Flex> </Flex> {roleCode === 'admin' || roleCode === 'salesManager' || roleCode === 'salesRepresentative' || roleCode === 'finance' ? ( <Flex title={optRecord.notes}> <div className="flex items-center"> <div className="flex items-center max-w-[500px]"> <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis"> <Tooltip title={optRecord.applyInvoicingNotes} placement="topLeft" > <span className="text-[#8C8C8C]"> 申请开票备注: {optRecord.applyInvoicingNotes === undefined || optRecord.applyInvoicingNotes === null ? '暂无备注' : optRecord.applyInvoicingNotes} </span> </Tooltip> </div> {getAfterAnnexList()} <Tooltip title="编辑"> <EditTwoTone className="pl-1 hover:curcor-pointer" onClick={() => { setNotesEditVisible(true); setSelectedRows([optRecord.id]); setNotes(optRecord.applyInvoicingNotes); setNotesType(4); }} /> </Tooltip> </div> <Divider type="vertical" className="mx-5" /> <div className="flex items-center max-w-[500px]"> <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis"> <Tooltip title={optRecord.checkNotes} placement="topLeft"> <span className="text-[#8C8C8C] mr-3"> 财务审核备注: {optRecord.checkNotes === undefined || optRecord.checkNotes === null ? '暂无备注' : optRecord.checkNotes} </span> </Tooltip> </div> {getInvoicingCheckAnnexList()} </div> </div> </Flex> ) : ( '' )} </> ); }; const expandedRowRender = (record) => { let subOrders = record.subOrderInformationLists; return ( <ProTable id="sub-table" className="w-full " showHeader={false} columns={[ { title: 'ID', dataIndex: 'id', key: 'id', render: (text: any, optRecord: any) => { return <SubOderRander record={record} optRecord={optRecord} />; }, }, ]} rowSelection={{ onChange: (selectedRowKeys: any, selectedRows: any) => { setSelectedRowKeys(selectedRowKeys); setSelectedRowObj({ ...setSelectedRowObj, [record.id]: selectedRows, }); selectedRowObj[record.id] = selectedRows; setSelectedRows(selectedRows); }, selectedRowKeys: selectedRowKeys, // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom // 注释该行则默认不显示下拉选项 // selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT], // defaultSelectedRowKeys: [], }} rowKey="id" headerTitle={false} search={false} options={false} dataSource={subOrders} pagination={false} tableAlertRender={false} /> ); }; // 主订单内容渲染 const MainOrderColumnRender = ({ record }: { record: OrderListItemType }) => { return ( <Flex vertical={true}> {/* 编号、时间、销售信息 */} <Flex className="px-4 py-4 bg-white rounded-t-lg" justify="space-between" > <Flex wrap="wrap" gap="middle" vertical> <Flex> <Flex> <Checkbox onChange={() => onCheckboxChange(record)} checked={selectedItems.includes(record.id)} > <Space split={<Divider type="vertical" />}> <div> <span className="text-[#8C8C8C]">订单号:</span> <span className="text-slate-700">{record.id}</span> </div> </Space> </Checkbox> <Tooltip title="点击复制订单号"> <CopyOutlined className="hover:cursor-pointer" style={{ color: '#8C8C8C' }} onClick={() => { copyToClipboard(record.id); message.info('订单号复制成功!'); }} /> </Tooltip> <Divider type="vertical" /> <span>{formatDateTime(record.createTime)}</span> <Divider type="vertical" /> <Space split={<Divider type="vertical" />}> <div> <span className="text-[#8C8C8C]">代表:</span> <span className="text-slate-700">{record.salesCode}</span> </div> <div title={record.institution} className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[150px]" > <span className="text-[#8C8C8C]">单位:</span> <span className="text-slate-700">{record.institution}</span> </div> <span> <span className="text-[#8C8C8C]">联系人:</span> <span className="text-slate-700"> {record.institutionContactName + ' '} </span> </span> <span> <span className="text-[#8C8C8C]">收货人:</span> <span className="text-slate-700"> {record.customerName + ' '} <Tooltip className="order-tooltip" title="详情"> <ContainerTwoTone className="hover:curcor-pointer" onClick={() => { setDeliverInfoDrawerVisible(true); setOrderRow(record); }} /> </Tooltip> </span> </span> </Space> </Flex> </Flex> <Flex className="pl-6" align="center"> {roleCode === 'finance' ? ( <div title={enumValueToLabel( record.receivingCompany, getReceivingCompanyOptions(PAYEE_OPTIONS), )} className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[400px]" > <span className="text-[#8C8C8C]">开票付款单位:</span> <span className="text-slate-700"> {record.receivingCompany !== null ? enumValueToLabel( record.receivingCompany, getReceivingCompanyOptions(PAYEE_OPTIONS), ) : '暂无'} </span> </div> ) : ( '' )} {roleCode === 'finance' ? <Divider type="vertical" /> : ''} <div title={record.notes}> <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis"> <span className="text-[#8C8C8C]">备注:</span> <span className="ml-2"> {record.notes === null ? '暂无备注' : record.notes} </span> </div> </div> <Tooltip title="编辑"> <EditTwoTone className="pl-1 hover:curcor-pointer" onClick={() => { setNotesEditVisible(true); setSelectedRows([record.id]); setNotes(record.notes); setNotesType(0); }} /> </Tooltip> </Flex> </Flex> <Flex wrap="wrap" gap="middle" vertical> <Flex justify="flex-end"> <Flex wrap="wrap" gap="middle" align="center"> <div> <span className="text-[#8C8C8C]">总金额:¥</span> <span className="text-lg font-medium"> {record.totalPayment} </span> </div> {rolePath?.includes('addOrder') ? ( <Tooltip title="复制"> <CopyTwoTone className="hover:cursor-pointer" onClick={() => { copyOrderToClipboard(record); setOrderOptType('copy'); setOrderDrawerVisible(true); let copy = cloneDeep(record); copy.id = undefined; copy.subOrderInformationLists?.forEach((item) => { item.id = undefined; }); setOrderRow(copy); }} /> </Tooltip> ) : ( <Tooltip title="复制文本"> <CopyTwoTone className="hover:cursor-pointer" onClick={() => { copyOrderToClipboard(record); }} /> </Tooltip> )} <Tooltip title="历史"> <ClockCircleTwoTone className="hover:cursor-pointer" onClick={() => { setHistoryModalVisible(true); if (selectedRowObj[record.id]?.length) { setSelectedRows(selectedRowObj[record.id]); } else { setSelectedRows(record.subOrderInformationLists); } }} /> </Tooltip> </Flex> </Flex> <Flex justify="flex-end"> <Space.Compact direction="vertical" align="end"> <Space> {false ? ( <Button className="p-0" type="link" onClick={() => { setFinancialReceiptsModalVisible(true); setOrderRow(record); setSelectedRows([record]); setIsEdit(true); }} > 收款记录 </Button> ) : ( '' )} {record.mainPath?.includes('orderChangeRequest') ? ( <Button className="p-0" type="link" onClick={() => { setOrderDrawerVisible(true); setOrderRow(record); setOrderOptType('order-change-normal'); }} > 申请修改 </Button> ) : ( '' )} {record.mainPath?.includes('leaderAudit') ? ( <Button className="p-0" type="link" onClick={() => { let selectedSubOrders = selectedRowObj[record.id]; setSelectedRows(selectedSubOrders); if (selectedSubOrders === undefined) { selectedSubOrders = record.subOrderInformationLists; } for (let i = 0; i < selectedSubOrders.length; i++) { if ( selectedSubOrders[i].orderStatus !== 'LEADER_PROCESS' ) { message.error('请选择领导待审核的子订单进行审核'); return; } } setOrderRow(record); setCheckVisible(true); setSelectedRows(selectedSubOrders); setOrderCheckType(CHECK_TYPE.LEADER_AUDIT); }} > 审核 </Button> ) : ( '' )} {record.mainPath?.includes('changeOrderAudit') ? ( <Button className="p-0" type="link" onClick={() => { let selectedSubOrders = selectedRowObj[record.id]; setSelectedRows(selectedSubOrders); if (selectedSubOrders === undefined) { selectedSubOrders = record.subOrderInformationLists; } for (let i = 0; i < selectedSubOrders.length; i++) { if ( selectedSubOrders[i].orderStatus !== 'MODIFY_APPLY_WAIT_FOR_AUDIT' ) { message.error('请选择[修改待审核]的子订单进行审核'); return; } } setOrderRow(record); setCheckVisible(true); setSelectedRows(selectedSubOrders); setOrderCheckType( CHECK_TYPE.MODIFY_APPLY_WAIT_FOR_AUDIT, ); }} > 审核 </Button> ) : ( '' )} {record.mainPath?.includes('procureConvertProcure') ? ( <Button className="p-0" type="link" onClick={() => { let selectedSubOrders = selectedRowObj[record.id]; if (selectedSubOrders === undefined) { selectedSubOrders = record.subOrderInformationLists; } setSelectedRows(selectedSubOrders); for (let i = 0; i < selectedSubOrders.length; i++) { if ( !selectedSubOrders[i].subPath.includes( 'procureConvertProcure', ) ) { message.error('请选择允许转发的子订单进行转发'); return; } } setSelectedRows(selectedSubOrders); setOrderCheckType(CHECK_TYPE.PROCURE); setProcureConvertModalVisible(true); }} > 转发 </Button> ) : ( '' )} {record.mainPath?.includes('sendProduct') ? ( <Button className="p-0" type="link" onClick={() => { if (!selectedRowObj[record.id]?.length) { return message.error('请选择选择子订单'); } setSelectedRows(selectedRowObj[record.id]); setDeliverVisible(true); setIsSendProduct(true); setOrderCheckType(CHECK_TYPE.NORMAL); }} > 仓库发货 </Button> ) : ( '' )} {/* 供应商发货 */} {record.mainPath?.includes('supplierSendOrder') ? ( <Button className="p-0" type="link" onClick={() => { if (!selectedRowObj[record.id]?.length) { return message.error('请选择选择子订单'); } setSelectedRows(selectedRowObj[record.id]); setDeliverVisible(true); setIsSendProduct(true); setOrderCheckType(CHECK_TYPE.SUPPLIER); }} > 供应商发货 </Button> ) : ( '' )} {record.mainPath?.includes('procureSend') ? ( <Button className="p-0" type="link" onClick={() => { if (!selectedRowObj[record.id]?.length) { return message.error('请选择选择子订单'); } setSelectedRows(selectedRowObj[record.id]); setDeliverVisible(true); setIsSendProduct(true); setOrderCheckType(CHECK_TYPE.PROCURE); }} > 采购发货 </Button> ) : ( '' )} {record.mainPath?.includes('printOrder') ? ( <Button className="p-0" type="link" onClick={() => { const selectedSubOrders = selectedRowObj[record.id]; if (!selectedSubOrders?.length) { return message.error('请选择选择子订单'); } for (let subOrderRecord of selectedSubOrders) { let subPath = subOrderRecord.subPath; if (!checkePrintable(subPath)) { return message.error('请选择可以打印的子订单'); } } setSelectedRows(selectedSubOrders); setOrderRow(record); setOrderPrintVisible(true); setOrderCheckType(CHECK_TYPE.NORMAL); }} > 仓库打印 </Button> ) : ( '' )} {record.mainPath?.includes('supplierPrint') ? ( <Button className="p-0" type="link" onClick={() => { if (!selectedRowObj[record.id]?.length) { return message.error('请选择选择子订单'); } setSelectedRows(selectedRowObj[record.id]); setOrderRow(record); setOrderPrintVisible(true); setOrderCheckType(CHECK_TYPE.SUPPLIER); }} > 供应商打印 </Button> ) : ( '' )} {record.mainPath?.includes('rePrintOrder') ? ( <Button className="p-0" type="link" onClick={() => { if (!selectedRowObj[record.id]?.length) { return message.error('请选择选择子订单'); } setSelectedRows(selectedRowObj[record.id]); setOrderRow(record); setOrderPrintVisible(true); setIsRePrintOrder(true); }} > 重新打印 </Button> ) : ( '' )} {record.mainPath?.includes('modifySendInformation') ? ( <Button className="p-0" type="link" onClick={() => { if (!selectedRowObj[record.id]?.length) { return message.error( '请选择已经发货或者已经确认收货的子订单', ); } for (let row of selectedRowObj[record.id]) { if ( row.orderStatus !== 'CONFIRM_RECEIPT' && row.orderStatus !== 'SHIPPED' ) { return message.error( '请选择已经发货或者已经确认收货的子订单', ); } } setSelectedRows(selectedRowObj[record.id]); setDeliverVisible(true); setIsSendProduct(false); }} > 修改发货信息 </Button> ) : ( '' )} {record.mainPath?.includes('invoicing') ? ( <Button type="link" className="p-0" onClick={() => { let selectedSubOrders = selectedRowObj[record.id]; setSelectedRows(selectedSubOrders); if (selectedSubOrders === undefined) { setIsMainOrder(true); setSelectedRows(record.subOrderInformationLists); } else { setIsMainOrder(false); } setOrderRow(record); setFinancialVisible(true); setIsEdit(false); }} > 开票 </Button> ) : ( '' )} {record.mainPath?.includes('applyInvoicing') ? ( <Button type="link" className="p-0" onClick={() => { let selectedSubOrders = selectedRowObj[record.id]; if (selectedSubOrders === undefined) { selectedSubOrders = record.subOrderInformationLists; } setSelectedRows(selectedSubOrders); for (let i = 0; i < selectedSubOrders.length; i++) { if ( selectedSubOrders[i].invoicingStatus === 'UN_INVOICE' || selectedSubOrders[i].afterInvoicingStatus === 'APPLY_FOR_INVOICING' ) { message.error( '请选择需要开票且未申请开票的子订单进行申请', ); return; } } setApplyForInvoicingVisible(true); setIsEdit(false); setIsMainOrder(false); }} > 申请开票 </Button> ) : ( '' )} {record.mainPath?.includes('updateOrder') ? ( <Button className="p-0" type="link" onClick={() => { //勾选的子订单:如果有勾选,后面只校验有勾选的 let selectedSubOrders = selectedRowObj[record.id]; if ( selectedSubOrders === undefined || selectedSubOrders.length === 0 ) { selectedSubOrders = record.subOrderInformationLists; } for ( let index = 0; index < selectedSubOrders.length; index++ ) { let orderStatus = selectedSubOrders[index].orderStatus; //仓库管理员在审核之后的任何时候都可以编辑 if ( roleCode !== 'warehouseKeeper' && roleCode !== 'admin' ) { //是审核通过及之后的订单 if ( orderStatus !== 'UNAUDITED' && orderStatus !== 'AUDIT_FAILED' && orderStatus !== 'LEADER_PROCESS' ) { message.error( '请选择未审核或者审核失败的订单进行编辑', ); return; } } else { //仓库管理员只能编辑是还未审核的订单 if ( roleCode !== 'admin' && (orderStatus === 'UNAUDITED' || orderStatus === 'AUDIT_FAILED') ) { message.error('请选择已审核的订单进行编辑'); return; } } } setOrderDrawerVisible(true); setOrderRow(record); setSelectedRows(selectedSubOrders); setOrderOptType('edit'); }} > 编辑 </Button> ) : ( '' )} {record?.subOrderInformationLists[0].subPath?.includes( 'noNeedInvoicingEdit', ) ? ( <Button className="p-0" type="link" onClick={() => { let selectedSubOrders = record.subOrderInformationLists; setFinancialEditVisible(true); setSelectedRows(selectedSubOrders); setOrderRow(record); setIsMainOrder(true); }} > 财务编辑 </Button> ) : ( '' )} {record.mainPath?.includes('checkOrder') ? ( <Button className="p-0" type="link" onClick={() => { let selectedSubOrders = selectedRowObj[record.id]; setSelectedRows(selectedSubOrders); if (selectedSubOrders === undefined) { selectedSubOrders = record.subOrderInformationLists; } for (let i = 0; i < selectedSubOrders.length; i++) { let orderStatus = selectedSubOrders[i].orderStatus; if ( orderStatus !== 'UNAUDITED' && orderStatus !== 'FINANCE_PROCESS' && orderStatus !== 'LEADER_AUDITED' ) { message.error( '请选择未审核或者领导已审核的子订单进行审核', ); return; } } setOrderRow(record); setCheckVisible(true); setSelectedRows(selectedSubOrders); setOrderCheckType(CHECK_TYPE.NORMAL); }} > 审核 </Button> ) : ( '' )} {record.mainPath?.includes('afterSalesCheck') ? ( <Button className="p-0" type="link" onClick={() => { let selectedSubOrders = selectedRowObj[record.id]; setSelectedRows(selectedSubOrders); if (selectedSubOrders === undefined) { selectedSubOrders = record.subOrderInformationLists; } for (let i = 0; i < selectedSubOrders.length; i++) { if ( selectedSubOrders[i].orderStatus !== 'IN_AFTER_SALES' ) { message.error('请选择售后中的子订单进行审核'); return; } } setOrderRow(record); setCheckVisible(true); setSelectedRows(selectedSubOrders); setOrderCheckType(CHECK_TYPE.AFTER_SALES); }} > 售后审核 </Button> ) : ( '' )} {record.mainPath?.includes('noNeedSend') ? ( <ButtonConfirm className="p-0" title="此订单是否无需发货?" text="无需发货" onConfirm={async () => { let selectedSubOrders = selectedRowObj[record.id]; if (selectedSubOrders === undefined) { selectedSubOrders = record.subOrderInformationLists; } setSelectedRows(selectedSubOrders); for (let i = 0; i < selectedSubOrders.length; i++) { if ( selectedSubOrders[i].orderStatus !== 'AUDITED' && selectedSubOrders[i].orderStatus !== 'PROCURE_PROCESS' && selectedSubOrders[i].orderStatus !== 'PROCURE_PROCESS_FOR_MINE' && selectedSubOrders[i].orderStatus !== 'PROCURE_WAIT_SHIP' && selectedSubOrders[i].orderStatus !== 'SUPPLIER_WAIT_SHIP' && selectedSubOrders[i].orderStatus !== 'WAIT_SHIP' ) { message.error( '请选择未发货的子订单进行无需发货操作', ); return; } } const data = await postServiceOrderNoNeedSend({ data: { ids: selectedSubOrders.map((item) => { return item.id; }), }, }); if (data.result === RESPONSE_CODE.SUCCESS) { message.success(data.message); refreshTable(); } }} /> ) : ( '' )} {record.mainPath?.includes('saleCancelInvoicing') ? ( <ButtonConfirm className="p-0" title="确认取消申请开票?" text="取消申请" onConfirm={async () => { let selectedSubOrders = selectedRowObj[record.id]; if (selectedSubOrders === undefined) { selectedSubOrders = record.subOrderInformationLists; } setSelectedRows(selectedSubOrders); for (let i = 0; i < selectedSubOrders.length; i++) { if ( selectedSubOrders[i].afterInvoicingStatus !== 'APPLY_FOR_INVOICING' ) { message.error( '请选择已[申请开票]的子订单进行取消申请', ); return; } } let res = await postServiceOrderSaleCancelInvoicing({ data: { subOrderIds: selectedSubOrders.map((item) => { return item.id; }), }, }); if (res && res.result === RESPONSE_CODE.SUCCESS) { message.success(res.message); refreshTable(); } }} /> ) : ( '' )} {/* 财务审核:主订单暂无 */} {record.mainPath?.includes('financeCheckOrder') ? ( <Button className="p-0" type="link" onClick={() => { let selectedSubOrders = selectedRowObj[record.id]; setSelectedRows(selectedSubOrders); if (selectedSubOrders === undefined) { selectedSubOrders = record.subOrderInformationLists; } for (let i = 0; i < selectedSubOrders.length; i++) { if ( selectedSubOrders[i].orderStatus !== 'UNAUDITED' && selectedSubOrders[i].orderStatus !== 'FINANCE_PROCESS' && selectedSubOrders[i].orderStatus !== 'LEADER_AUDITED' ) { message.error( '请选择[未审核]、[财务待审核]、[领导已审核]的子订单进行审核', ); return; } } setOrderRow(record); setCheckVisible(true); setSelectedRows(selectedSubOrders); setOrderCheckType(CHECK_TYPE.FINALCIAL); }} > 财务审核 </Button> ) : ( '' )} {/* 采购审核 */} {record.mainPath?.includes('procureCheckOrder') ? ( <Button className="p-0" type="link" onClick={() => { let selectedSubOrders = selectedRowObj[record.id]; setSelectedRows(selectedSubOrders); if (selectedSubOrders === undefined) { selectedSubOrders = record.subOrderInformationLists; } for (let i = 0; i < selectedSubOrders.length; i++) { if ( selectedSubOrders[i].orderStatus !== 'PROCURE_UN_PROCESS' ) { message.error('请选择未审核的子订单进行审核'); return; } } setOrderRow(record); setProcureCheckModalVisible(true); setSelectedRows(selectedSubOrders); setOrderCheckType(CHECK_TYPE.PROCURE); }} > 采购审核 </Button> ) : ( '' )} {record.mainPath?.includes('applyAfterSales') ? ( <Button className="p-0" type="link" onClick={() => { let selectedSubOrders = selectedRowObj[record.id]; if (selectedSubOrders === undefined) { selectedSubOrders = record.subOrderInformationLists; } setSelectedRows(selectedSubOrders); for (let i = 0; i < selectedSubOrders.length; i++) { if ( selectedSubOrders[i].orderStatus !== 'CONFIRM_RECEIPT' && selectedSubOrders[i].orderStatus !== 'AFTER_SALES_FAILURE' ) { message.error('请选择确认收货状态的子订单进行售后'); return; } } setOrderDrawerVisible(true); setOrderRow(record); setOrderOptType('after-sales'); }} > 申请售后 </Button> ) : ( '' )} {/* {record.mainPath?.includes('afterSalesCompletion') ? ( <ButtonConfirm className="p-0" title="售后是否已完成?" text="完成售后" onConfirm={async () => { let selectedSubOrders = selectedRowObj[record.id]; if (selectedSubOrders === undefined) { selectedSubOrders = record.subOrderInformationLists; } for (let i = 0; i < selectedSubOrders.length; i++) { if ( selectedSubOrders[i].orderStatus !== 'IN_AFTER_SALES' ) { message.error( '请选择售后中状态的子订单进行完成售后', ); return false; } } const ids = selectedSubOrders?.map((item) => { return item.id; }); let body = { ids: ids, }; const data = await postServiceOrderAfterSalesCompletion( { data: body, }, ); if (data.result === RESPONSE_CODE.SUCCESS) { message.success(data.message); refreshTable(); } }} /> ) : ( '' )} */} {record.mainPath?.includes('salOrderSave') ? ( <ButtonConfirm className="p-0" title="是否推送至金蝶ERP?" text="推送ERP" onConfirm={async () => { let res = await postKingdeeRepSalOrderSave({ data: { id: record.id, }, }); if (res && res.result === RESPONSE_CODE.SUCCESS) { message.success('推送成功'); mainTableRef.current.reload(); } }} /> ) : ( '' )} {record.mainPath?.includes('salBillOutbound') ? ( <ButtonConfirm className="p-0" title="是否下推金蝶ERP出库单?" text="下推出库" onConfirm={async () => { let res = await postKingdeeRepSalBillOutbound({ data: { id: record.id, }, }); if (res && res.result === RESPONSE_CODE.SUCCESS) { message.success('下推成功'); mainTableRef.current.reload(); } }} /> ) : ( '' )} {record.mainPath?.includes('orderCancel') ? ( <ButtonConfirm className="p-0" title="确认作废?" text="作废" onConfirm={async () => { let body = { ids: [record.id], checkIsMainOrderId: true, }; const data = await postServiceOrderOrderCancel({ data: body, }); if (data.result === RESPONSE_CODE.SUCCESS) { message.success(data.message); refreshTable(); } }} /> ) : ( '' )} {record.mainPath?.includes('procurePrint') ? ( <ButtonConfirm className="p-0" title="确认打印?" text="采购打印" onConfirm={async () => { let selectedSubOrders = selectedRowObj[record.id]; if (selectedSubOrders === undefined) { selectedSubOrders = record.subOrderInformationLists; } for (let i = 0; i < selectedSubOrders.length; i++) { if ( selectedSubOrders[i].orderStatus !== 'PROCURE_PROCESS_FOR_MINE' ) { message.error( '请选择采购待打印状态的子订单进行打印', ); return false; } } const ids = selectedSubOrders?.map((item) => { return item.id; }); let res = await postServiceOrderProcurePrint({ data: { ids: ids, }, }); if (res.result === RESPONSE_CODE.SUCCESS) { message.success(res.message); refreshTable(); } }} /> ) : ( // <Button // className="p-0" // type="link" // onClick={() => { // if (!selectedRowObj[record.id]?.length) { // return message.error('请选择选择子订单'); // } // setSelectedRows(selectedRowObj[record.id]); // setOrderRow(record); // setOrderPrintVisible(true); // setOrderCheckType(CHECK_TYPE.PROCURE); // }} // > // 采购打印 // </Button> '' )} </Space> </Space.Compact> </Flex> </Flex> </Flex> <Flex className="p-0 pb-[24px] pt-[4px] pl-[23px] pr-[5px] bg-white rounded-b-lg"> {expandedRowRender(record)} </Flex> </Flex> ); }; // 主订单列表 const mainOrdersColumns: ProColumns<OrderType>[] = MAIN_ORDER_COLUMNS.map( (item) => { if (item.dataIndex === 'name') { return { ...item, title: <OrderTableHeader />, render: (text, record) => { return <MainOrderColumnRender record={record} />; }, }; } /** * 采购的订单状态筛选内容 */ if (roleCode === 'procure' && item.dataIndex === 'orderStatus') { item.valueEnum = enumToProTableEnumValue( PROCURE_PRIMARY_ORDER_STATUS_OPTIONS, ); } return item; }, ); /** * 采购可以筛选供应商备注 */ if (roleCode === 'procure' || roleCode === 'admin') { mainOrdersColumns.push({ title: '供应商备注', width: 120, dataIndex: 'supplierNotes', valueType: 'text', hideInTable: true, }); } /** * 采购可以筛选其他采购 */ if (roleCode === 'procure' || roleCode === 'admin') { mainOrdersColumns.push({ title: '采购名称', width: 120, dataIndex: 'supplierName', valueType: 'select', request: async () => { const res = await postServiceOrderProvideProcurementRoles(); let options = res.data?.map((item) => { return { label: item, value: item }; }); return options; }, hideInTable: true, }); } /** * 仓库可以筛选发货仓库 */ if (roleCode === 'warehouseKeeper' || roleCode === 'admin') { mainOrdersColumns.push({ title: '发货仓库', width: 120, dataIndex: 'shippingWarehouse', valueType: 'select', valueEnum: enumToProTableEnumValue(SHIPPING_WAREHOUSE_OPTIONS), hideInTable: true, }); } //判断是否是采购,是的话新增一个筛选条件 if (roleCode === 'procure' || roleCode === 'admin') { mainOrdersColumns.push({ title: '采购下单状态', dataIndex: 'procureOrderStatus', valueType: 'select', hideInTable: true, valueEnum: enumToProTableEnumValue(PROCURE_ORDER_STATUS), }); } function toolBarRender() { let toolBtns = []; let radios: any[] = []; radios.push(<Radio value={0}>全部</Radio>); if ( roleCode === 'admin' || roleCode === 'salesManager' || roleCode === 'salesRepresentative' ) { radios.push(<Radio value={70}>只看作废</Radio>); } if (roleCode === 'warehouseKeeper') { radios.push(<Radio value={40}>待处理</Radio>); } //采购可以筛选出需要处理的订单 if (roleCode === 'procure') { radios.push(<Radio value={60}>其他采购</Radio>); radios.push(<Radio value={10}>待处理</Radio>); } //财务可以将需要处理的订单排序到前面 if (roleCode === 'finance') { radios.push(<Radio value={20}>排序</Radio>); radios.push(<Radio value={50}>加急</Radio>); radios.push(<Radio value={40}>待处理</Radio>); } if (roleCode === 'salesRepresentative' || roleCode === 'salesManager') { radios.push(<Radio value={30}>只看我创建</Radio>); radios.push(<Radio value={40}>待审核</Radio>); } if (roleCode === 'admin') { radios.push(<Radio value={10}>待处理</Radio>); radios.push(<Radio value={20}>排序</Radio>); } //筛选按钮配置 let radioGroup = ( <Radio.Group onChange={(e: any) => { setFilterCondition(e.target.value); refreshTable(); }} defaultValue={0} > {radios} </Radio.Group> ); toolBtns.push(radioGroup); //导出按钮配置 const items: MenuProps['items'] = [ { label: '导出查询结果订单', key: '2', onClick: async () => { let body = { flag: 50, ...searchParams }; exportLoading(); orderExport('/api/service/order/export', body, exportLoadingDestory); }, }, { label: '导出已选中订单', key: '1', onClick: async () => { if (selectedItems.length === 0) { message.error('请选择订单'); return; } let body = { flag: 30, ids: selectedItems }; exportLoading(); orderExport('/api/service/order/export', body, exportLoadingDestory); }, }, // { // label: '导出当前页订单', // key: '2', // onClick: async () => { // if (mainOrderAllItemKeys.length === 0) { // message.error('当前没有订单'); // return; // } // let body = { flag: 20, ids: mainOrderAllItemKeys }; // exportLoading(); // orderExport('/api/service/order/export', body, exportLoadingDestory); // }, // }, { label: '导出当天订单', key: '4', onClick: async () => { let body = { flag: 40, ids: [] }; exportLoading(); orderExport('/api/service/order/export', body, exportLoadingDestory); }, }, { label: '导出所有订单', key: '3', onClick: async () => { let body = { flag: 10, ids: [] }; exportLoading(); orderExport('/api/service/order/export', body, exportLoadingDestory); }, }, ]; const menuProps = { items, onClick: () => {}, }; if (rolePath?.includes('mergeAudit')) { toolBtns.push( <Button type="primary" key="out" onClick={() => { //选中订单 let mainOrderList = []; for (let order of mainOrderSelectedMap.values()) { mainOrderList.push(order); } setIsMainOrder(true); setSelectedRows(mainOrderList); setProcureCheckModalVisible(true); }} disabled={selectedItems?.length === 0} > 一键审核 </Button>, ); } if (rolePath?.includes('mergeApplyInvoicing')) { toolBtns.push( <Button type="primary" key="out" onClick={() => { setApplyForInvoicingVisible(true); //选中订单 setIsEdit(false); setIsMainOrder(true); let mainOrderList = []; for (let order of mainOrderSelectedMap.values()) { mainOrderList.push(order); } setSelectedRows(mainOrderList); }} disabled={selectedItems?.length === 0} > {roleCode === 'admin' ? '合并(销售)' : '合并开票'} </Button>, ); } if (rolePath?.includes('mergeInvoicing')) { toolBtns.push( <Button type="primary" key="out" onClick={() => { //检查订单状态是否正确 // 遍历Map中的键值对 let errorIds = []; let mainOrders = []; mainOrderSelectedMap.forEach((value) => { mainOrders.push(value); for (let subOrder of value.subOrderInformationLists) { if ( subOrder.afterInvoicingStatus !== 'APPLY_FOR_INVOICING' && subOrder.afterInvoicingStatus !== 'PARTIAL_INVOICING' ) { errorIds.push(value.id); return; } } }); if (errorIds.length > 0) { message.error( '订单号为:' + errorIds.join(',') + '的订单存在不是[申请开票]或者[部分开票]状态的子订单,请检查!', ); return; } setMainOrderSelectedRows(mainOrders); setFinancialMergeDrawerVisible(true); }} disabled={selectedItems?.length === 0} > {roleCode === 'admin' ? '合并(财务)' : '合并开票'} </Button>, ); } if (rolePath?.includes('addOrder')) { toolBtns.push( <Button type="primary" key="out" onClick={() => { setOrderDrawerVisible(true); setOrderOptType('add'); }} > 新增 </Button>, ); } if (rolePath?.includes('importExcel')) { toolBtns.push( <Button type="primary" key="out" onClick={() => { setImportModalVisible(true); }} > 导入 </Button>, ); } if (rolePath?.includes('export')) { toolBtns.push( <Dropdown menu={menuProps}> <Button> <Space> 导出 <DownOutlined /> </Space> </Button> </Dropdown>, ); } // toolBtns.push( // <Button // key="show" // onClick={() => { // handleAllExpand(); // }} // > // {mainOrderAllItemKeys?.length !== expandedRowKeys.length // ? '一键展开' // : '一键收起'} // </Button>, // ); return toolBtns; } useEffect(() => { // 使用URLSearchParams来解析查询参数 const params = new URLSearchParams(location.search); const id = params.get('id'); if (id) { mainTableFormRef.current?.setFieldValue('id', id); } }, []); return ( <PageContainer className="order-page-container" header={{ title: '订单管理', extra: [ <Avatar key="0" style={{ verticalAlign: 'middle' }} size="large"> {userInfo?.username} </Avatar>, <Tag key="nickName">{userInfo?.nickName}</Tag>, <Dropdown key="dropdown" trigger={['click']} menu={{ items: [ { label: '退出登录', key: '1', onClick: () => { localStorage.removeItem('token'); history.push('/login'); }, }, // { // label: '修改密码', // key: '2', // }, ], }} > <Button key="4" style={{ padding: '0 8px' }}> <EllipsisOutlined /> </Button> </Dropdown>, ], }} > <div id="resizeDiv"></div> <ProTable id="main-table" // tableStyle={{backgroundColor:'red'}} actionRef={mainTableRef} formRef={mainTableFormRef} expandIconColumnIndex={-1} columns={mainOrdersColumns} rowKey="id" pagination={{ showQuickJumper: true, pageSize: pageSize, current: currentPage, showSizeChanger: true, onChange: (page, size) => { setPageSize(size); setCurrentPage(page); }, }} // showHeader={false} expandedRowKeys={expandedRowKeys} // expandable={{ expandedRowRender }} dateFormatter="string" options={false} headerTitle="" search={{ labelWidth: 'auto', // onCollapse: resize, }} request={async ( // 第一个参数 params 查询表单和 params 参数的结合 // 第一个参数中一定会有 pageSize 和 current ,这两个参数是 antd 的规范 params, sorter, filter, ) => { //订单id处理 /** * 以params中的id为主,如果params没id,则取url中的id * 第一次进来这个页面,url带有id的话,会自动填充到查询表单中,但是第一次查询params不会带这个id进来 */ let orderIds = mainTableFormRef.current?.getFieldValue('id'); params.id = params.id || orderIds; if (params.id !== '') { if (params.id?.indexOf(',')) { params.id = params.id.split(','); params.id = params.id.filter((id) => { return id !== ''; }); } } params.condition = filterCondifion; //是否只查看已作废 params.isDeleteQueryOrder = filterCondifion === 70; //保存这个搜索条件 setSearchParam(params); const { data } = await postServiceOrderQueryServiceOrder({ // ...params, // FIXME: remove @ts-ignore // @ts-ignore sorter, filter, data: { ...params }, }); let mainOrderIds = data?.data?.map((d) => d.id); if (mainOrderAllItemKeys === undefined) { setMainOrderAllItemKeys([]); } else { setMainOrderAllItemKeys(mainOrderIds); } setRolePath(data.specialPath); handleTableExpand(mainOrderIds); setData(data?.data); return { data: data?.data || [], total: data?.total || 0, }; }} toolbar={{ multipleLine: true, }} toolBarRender={() => { return toolBarRender(); }} /> {orderDrawerVisible && ( <OrderDrawer data={orderRow} subOrders={selectedRows} onClose={(isSuccess: boolean) => { setOrderDrawerVisible(false); setOrderRow({}); if (isSuccess) { refreshTable(); } }} orderOptType={orderOptType} /> )} {checkVisible && ( <CheckModal setCheckVisible={setCheckVisible} data={orderRow} subOrders={selectedRows} orderCheckType={orderCheckType} openOrderDrawer={(type: any, id: any) => { setOrderRow({ id: id }); setOrderOptType(type); setOrderDrawerVisible(true); }} onClose={() => { setCheckVisible(false); setOrderRow({}); setSelectedRows({}); refreshTable(); }} /> )} {applyForInvoicingVisible && ( <ApplyForInvoicingModal setCheckVisible={setApplyForInvoicingVisible} data={selectedItems} subOrders={selectedRows} isMainOrder={isMainOrder} isEdit={isEdit} onClose={() => { setApplyForInvoicingVisible(false); setSelectedRows({}); setIsMainOrder(false); refreshTable(); }} /> )} {notesEditVisible && ( <OrderNotesEditModal setNotesEditVisible={setNotesEditVisible} ids={selectedRows} notesType={notesType} notes={notes} onClose={() => { setNotesEditVisible(false); setSelectedRows([]); setNotes(notes); setNotesType(1); refreshTable(); }} /> )} {deliverVisible && ( <DeliverModal data={selectedRows} isSendProduct={isSendProduct} setVisible={(b: boolean) => { setDeliverVisible(b); }} sendType={orderCheckType} onClose={() => { setDeliverVisible(false); setOrderRow({}); setIsSendProduct(false); refreshTable(); }} /> )} {financialVisible && ( <FinancialDrawer isEdit={isEdit} mainOrder={orderRow} subOrders={selectedRows} isMainOrder={isMainOrder} cancel={() => { setFinancialVisible(false); setOrderRow({}); setIsMainOrder(false); setIsEdit(false); }} onClose={() => { setFinancialVisible(false); setOrderRow({}); refreshTable(); setIsMainOrder(false); setIsEdit(false); }} /> )} {financialEditVisible && ( <FinancialEditDrawer mainOrder={orderRow} subOrders={selectedRows} isMainOrder={isMainOrder} setVisible={() => { setFinancialEditVisible(false); setIsMainOrder(false); }} onClose={() => { setFinancialEditVisible(false); refreshTable(); setIsMainOrder(false); setOrderRow({}); }} /> )} {orderPrintVisible && ( <OrderPrintModal mainOrder={orderRow} subOrders={selectedRows} isRePrint={isRePrintOrder} setVisible={(b: boolean) => { setOrderPrintVisible(b); }} printOptType={orderCheckType} onClose={() => { setOrderPrintVisible(false); setOrderRow({}); setIsRePrintOrder(false); refreshTable(); }} /> )} {confirmReceiptVisible && ( <ConfirmReceiptModal data={orderRow} onClose={() => { setConfirmReceiptVisible(false); setOrderRow({}); refreshTable(); }} /> )} {subOrderConfirmReceiptImagesVisible && ( <SubOrderComfirmReceiptImagesModal setVisible={setSubOrderConfirmReceiptImagesVisible} onClose={() => { setSubOrderConfirmReceiptImagesVisible(false); }} orderRow={orderRow} /> )} {importModalVisible && ( <ImportModal onClose={() => { setImportModalVisible(false); refreshTable(); }} /> )} {attachmentModalVisible && ( <AttachmentModal data={orderRow} onClose={() => { setAttachmentModalVisible(false); setOrderRow({}); }} /> )} {historyModalVisible && ( <HistoryModal subOrders={selectedRows} isCancelledOrder={filterCondifion === 70} onClose={() => { setHistoryModalVisible(false); setSelectedRows({}); }} /> )} {deliverInfoDrawerVisible && ( <DeliverInfoDrawer data={orderRow} onClose={() => { setDeliverInfoDrawerVisible(false); setOrderRow({}); }} /> )} {deliverInfoDrawerVisible && ( <DeliverInfoDrawer data={orderRow} onClose={() => { setDeliverInfoDrawerVisible(false); setOrderRow({}); }} /> )} {procureCheckModalVisible && ( <ProcureCheckModal setCheckVisible={setProcureCheckModalVisible} data={orderRow} isMainOrder={isMainOrder} orders={selectedRows} onClose={() => { setProcureCheckModalVisible(false); setOrderRow({}); setSelectedRows({}); setIsMainOrder(false); refreshTable(); }} /> )} {afterSalesDrawerVisible && ( <AfterSalesDrawer setVisible={setAfterSalesDrawerVisible} mainOrder={orderRow} subOrders={selectedRows} onClose={() => { setAfterSalesDrawerVisible(false); setSelectedRows({}); setOrderRow({}); refreshTable(); }} /> )} {procureConvertModalVisible && ( <ProcureConvertModal setVisible={setProcureConvertModalVisible} subOrders={selectedRows} onClose={() => { setProcureConvertModalVisible(false); setSelectedRows({}); refreshTable(); }} /> )} {financialMergeDrawerVisible && ( <FinancialMergeDrawer setVisible={setFinancialMergeDrawerVisible} dataList={mainOrderSelectedRows} onClose={() => { setFinancialMergeDrawerVisible(false); setMainOrderSelectedRows([]); refreshTable(); }} /> )} {financialReceiptsModalVisible && ( <FinancialReceiptsModal setVisible={setFinancialReceiptsModalVisible} datas={selectedRows} onClose={() => { setFinancialReceiptsModalVisible(false); setSelectedRows({}); refreshTable(); }} /> )} {shippingWarehouseChangeModalVisible && ( <ShippingWarehouseChangeModal setVisible={setShippingWarehouseChangeModalVisible} subOrderIds={ids} originShippingWarehouse={orderRow?.shippingWarehouse} onClose={() => { setShippingWarehouseChangeModalVisible(false); setOrderRow({}); setIds([]); refreshTable(); }} /> )} {contextHolder} </PageContainer> ); }; export default OrderPage;