Commit 6e61e86c45855a540039dd6594322f2dec364aa2

Authored by boyang
1 parent 0567bf0b

fix: 修改回款bug

src/pages/Order/OrderWarning/index.tsx
@@ -197,10 +197,8 @@ const OrderPage = () => { @@ -197,10 +197,8 @@ const OrderPage = () => {
197 const mainTableSecondRef = useRef<ActionType>(); 197 const mainTableSecondRef = useRef<ActionType>();
198 const mainTableFormRef = useRef<ProFormInstance>(); 198 const mainTableFormRef = useRef<ProFormInstance>();
199 const mainTableSecondFormRef = useRef<ProFormInstance>(); 199 const mainTableSecondFormRef = useRef<ProFormInstance>();
200 - let [searchParams, setSearchParam] = useState(Object); //表格的查询条件存储  
201 - console.log(searchParams);  
202 - const [messageApi, contextHolder] = message.useMessage();  
203 - console.log(messageApi); 200 + let [setSearchParam] = useState(Object); //表格的查询条件存储
  201 + const [contextHolder] = message.useMessage();
204 const [ 202 const [
205 shippingWarehouseChangeModalVisible, 203 shippingWarehouseChangeModalVisible,
206 setShippingWarehouseChangeModalVisible, 204 setShippingWarehouseChangeModalVisible,
@@ -208,6 +206,7 @@ const OrderPage = () =&gt; { @@ -208,6 +206,7 @@ const OrderPage = () =&gt; {
208 const [ids, setIds] = useState([]); 206 const [ids, setIds] = useState([]);
209 const [recordOptNode, setRecordOptNode] = useState(null); 207 const [recordOptNode, setRecordOptNode] = useState(null);
210 const roleCode = userInfo?.roleSmallVO?.code; 208 const roleCode = userInfo?.roleSmallVO?.code;
  209 + const [activeTabKey, setActiveTabKey] = useState('1'); // **新增状态**
211 210
212 const triggerRecordOptNode = async (id) => { 211 const triggerRecordOptNode = async (id) => {
213 const res = await postServiceOrderGetCurrentOptNode({ 212 const res = await postServiceOrderGetCurrentOptNode({
@@ -333,10 +332,8 @@ const OrderPage = () =&gt; { @@ -333,10 +332,8 @@ const OrderPage = () =&gt; {
333 * @param mainId 332 * @param mainId
334 */ 333 */
335 function createOptObject(subId: any, mainId: any) { 334 function createOptObject(subId: any, mainId: any) {
336 - console.log(currentOptMainId, '5656createOptObject1', curretnOptSubId);  
337 setCurrentMainId(mainId); 335 setCurrentMainId(mainId);
338 setCurretnOptSubId(subId); 336 setCurretnOptSubId(subId);
339 - console.log(currentOptMainId, '5656createOptObject2', curretnOptSubId);  
340 } 337 }
341 338
342 /** 339 /**
@@ -385,11 +382,6 @@ const OrderPage = () =&gt; { @@ -385,11 +382,6 @@ const OrderPage = () =&gt; {
385 * 返回当前操作的主订单数据 382 * 返回当前操作的主订单数据
386 */ 383 */
387 function buildMainOrder() { 384 function buildMainOrder() {
388 - console.log(  
389 - currentOptMainId,  
390 - '5656buildMainOrder currentOptMainId/curretnOptSubId',  
391 - curretnOptSubId,  
392 - );  
393 if (!currentOptMainId) { 385 if (!currentOptMainId) {
394 message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员'); 386 message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员');
395 return; 387 return;
@@ -399,11 +391,9 @@ const OrderPage = () =&gt; { @@ -399,11 +391,9 @@ const OrderPage = () =&gt; {
399 let matchedData = data.filter((item) => { 391 let matchedData = data.filter((item) => {
400 return item.id === currentOptMainId; 392 return item.id === currentOptMainId;
401 }); 393 });
402 - console.log(data, '5656buildMainOrder2 data/matchedData', matchedData);  
403 if (matchedData.length > 0) { 394 if (matchedData.length > 0) {
404 mainOrderClone = cloneDeep(matchedData[0]); 395 mainOrderClone = cloneDeep(matchedData[0]);
405 } 396 }
406 - console.log(mainOrderClone, '5656buildMainOrder mainOrderClone');  
407 if (!mainOrderClone) { 397 if (!mainOrderClone) {
408 message.error('页面错误:当前操作的主订单数据不存在,请联系系统管理员'); 398 message.error('页面错误:当前操作的主订单数据不存在,请联系系统管理员');
409 } 399 }
@@ -414,11 +404,6 @@ const OrderPage = () =&gt; { @@ -414,11 +404,6 @@ const OrderPage = () =&gt; {
414 * 返回当前操作的子订单集合 404 * 返回当前操作的子订单集合
415 */ 405 */
416 function buildSubOrders() { 406 function buildSubOrders() {
417 - console.log(  
418 - curretnOptSubId,  
419 - '5656buildSubOrders currentOptMainId/currentOptMainId',  
420 - currentOptMainId,  
421 - );  
422 if (!currentOptMainId) { 407 if (!currentOptMainId) {
423 message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员'); 408 message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员');
424 return; 409 return;
@@ -431,11 +416,6 @@ const OrderPage = () =&gt; { @@ -431,11 +416,6 @@ const OrderPage = () =&gt; {
431 // if (!curretnOptSubId) { 416 // if (!curretnOptSubId) {
432 //如果有选中子订单,那么取选中的子订单为操作对象,否则取当前主订单的全部子订单为操作对象 417 //如果有选中子订单,那么取选中的子订单为操作对象,否则取当前主订单的全部子订单为操作对象
433 let currentOptSubOrders = subOrderSelectedMap.get(currentOptMainId); 418 let currentOptSubOrders = subOrderSelectedMap.get(currentOptMainId);
434 - console.log(  
435 - subOrderSelectedMap,  
436 - '5656buildSubOrders subOrderSelectedMap/currentOptSubOrders',  
437 - currentOptSubOrders,  
438 - );  
439 if ( 419 if (
440 currentOptSubOrders === null || 420 currentOptSubOrders === null ||
441 currentOptSubOrders === undefined || 421 currentOptSubOrders === undefined ||
@@ -455,11 +435,6 @@ const OrderPage = () =&gt; { @@ -455,11 +435,6 @@ const OrderPage = () =&gt; {
455 } 435 }
456 } else { 436 } else {
457 //操作的是子订单 437 //操作的是子订单
458 - console.log(  
459 - subOrderSelectedMap,  
460 - '5656buildSubOrders2 subOrderSelectedMap/data',  
461 - data,  
462 - );  
463 for (let item of data) { 438 for (let item of data) {
464 if (item.id === currentOptMainId) { 439 if (item.id === currentOptMainId) {
465 for (let subOrder of item?.subOrderInformationLists) { 440 for (let subOrder of item?.subOrderInformationLists) {
@@ -471,11 +446,6 @@ const OrderPage = () =&gt; { @@ -471,11 +446,6 @@ const OrderPage = () =&gt; {
471 } 446 }
472 } 447 }
473 } 448 }
474 - console.log(  
475 - cloneSubOrders,  
476 - '5656cloneSubOrders/length',  
477 - cloneSubOrders.length,  
478 - );  
479 if (cloneSubOrders.length === 0) { 449 if (cloneSubOrders.length === 0) {
480 message.error('页面错误:当前操作的订单数据不存在,请联系系统管理员'); 450 message.error('页面错误:当前操作的订单数据不存在,请联系系统管理员');
481 return; 451 return;
@@ -670,8 +640,6 @@ const OrderPage = () =&gt; { @@ -670,8 +640,6 @@ const OrderPage = () =&gt; {
670 * @param optRecord 640 * @param optRecord
671 */ 641 */
672 function getOrderStatusTag(optRecord: any): import('react').ReactNode { 642 function getOrderStatusTag(optRecord: any): import('react').ReactNode {
673 - console.log(optRecord);  
674 -  
675 const orderStatus = optRecord.orderStatus; 643 const orderStatus = optRecord.orderStatus;
676 const paymentMethod = optRecord.paymentMethod; 644 const paymentMethod = optRecord.paymentMethod;
677 let orderStatusTagText = enumValueToLabel( 645 let orderStatusTagText = enumValueToLabel(
@@ -1362,11 +1330,6 @@ const OrderPage = () =&gt; { @@ -1362,11 +1330,6 @@ const OrderPage = () =&gt; {
1362 className="p-0" 1330 className="p-0"
1363 type="link" 1331 type="link"
1364 onClick={() => { 1332 onClick={() => {
1365 - console.log(  
1366 - optRecord.id,  
1367 - '5656optRecord.id, record.id',  
1368 - record.id,  
1369 - );  
1370 createOptObject(optRecord.id, record.id); 1333 createOptObject(optRecord.id, record.id);
1371 setUploadPayBillModalVisible(true); 1334 setUploadPayBillModalVisible(true);
1372 }} 1335 }}
@@ -2873,7 +2836,6 @@ const OrderPage = () =&gt; { @@ -2873,7 +2836,6 @@ const OrderPage = () =&gt; {
2873 onClick={() => { 2836 onClick={() => {
2874 setCurrentMainId(record.id); 2837 setCurrentMainId(record.id);
2875 setReissueVisibleOld(true); 2838 setReissueVisibleOld(true);
2876 - console.log(reissueVisible);  
2877 }} 2839 }}
2878 > 2840 >
2879 重新开票(旧) 2841 重新开票(旧)
@@ -4028,6 +3990,58 @@ const OrderPage = () =&gt; { @@ -4028,6 +3990,58 @@ const OrderPage = () =&gt; {
4028 }, 3990 },
4029 ); 3991 );
4030 3992
  3993 + // 主订单列表
  3994 + const mainOrdersColumns2: ProColumns<OrderType>[] = MAIN_ORDER_COLUMNS.map(
  3995 + (item) => {
  3996 + //首能账号只能搜索订单编号
  3997 + let canSearchIndex = [
  3998 + 'id',
  3999 + 'salesCode',
  4000 + 'subNotes',
  4001 + 'orderStatus',
  4002 + 'createTime',
  4003 + 'modifiedAuditStatus',
  4004 + ];
  4005 + if (isSupplier() && !canSearchIndex.includes(item.dataIndex)) {
  4006 + item.search = false;
  4007 + }
  4008 +
  4009 + canSearchIndex = [
  4010 + 'id',
  4011 + 'salesCode',
  4012 + 'customerName',
  4013 + 'institution',
  4014 + 'productName',
  4015 + 'orderStatus',
  4016 + 'createTime',
  4017 + ];
  4018 +
  4019 + if (isExaminer() && !canSearchIndex.includes(item.dataIndex)) {
  4020 + item.search = false;
  4021 + }
  4022 +
  4023 + if (item.dataIndex === 'name') {
  4024 + return {
  4025 + ...item,
  4026 + title: <OrderTableHeader />,
  4027 + render: (text, record) => {
  4028 + return <MainOrderColumnRender record={record} />;
  4029 + },
  4030 + };
  4031 + }
  4032 +
  4033 + /**
  4034 + * 采购的订单状态筛选内容
  4035 + */
  4036 + if (roleCode === 'procure' && item.dataIndex === 'orderStatus') {
  4037 + item.valueEnum = enumToProTableEnumValue(
  4038 + PROCURE_PRIMARY_ORDER_STATUS_OPTIONS,
  4039 + );
  4040 + }
  4041 + return item;
  4042 + },
  4043 + );
  4044 +
4031 /** 4045 /**
4032 * 采购可以筛选供应商备注 4046 * 采购可以筛选供应商备注
4033 */ 4047 */
@@ -4039,6 +4053,13 @@ const OrderPage = () =&gt; { @@ -4039,6 +4053,13 @@ const OrderPage = () =&gt; {
4039 valueType: 'text', 4053 valueType: 'text',
4040 hideInTable: true, 4054 hideInTable: true,
4041 }); 4055 });
  4056 + mainOrdersColumns2.push({
  4057 + title: '供应商备注',
  4058 + width: 120,
  4059 + dataIndex: 'supplierNotes',
  4060 + valueType: 'text',
  4061 + hideInTable: true,
  4062 + });
4042 } 4063 }
4043 4064
4044 /** 4065 /**
@@ -4059,6 +4080,20 @@ const OrderPage = () =&gt; { @@ -4059,6 +4080,20 @@ const OrderPage = () =&gt; {
4059 }, 4080 },
4060 hideInTable: true, 4081 hideInTable: true,
4061 }); 4082 });
  4083 + mainOrdersColumns2.push({
  4084 + title: '采购名称',
  4085 + width: 120,
  4086 + dataIndex: 'supplierName',
  4087 + valueType: 'select',
  4088 + request: async () => {
  4089 + const res = await postServiceOrderProvideProcurementRoles();
  4090 + let options = res.data?.map((item) => {
  4091 + return { label: item, value: item };
  4092 + });
  4093 + return options;
  4094 + },
  4095 + hideInTable: true,
  4096 + });
4062 } 4097 }
4063 4098
4064 /** 4099 /**
@@ -4082,6 +4117,23 @@ const OrderPage = () =&gt; { @@ -4082,6 +4117,23 @@ const OrderPage = () =&gt; {
4082 }, 4117 },
4083 hideInTable: true, 4118 hideInTable: true,
4084 }); 4119 });
  4120 + mainOrdersColumns2.push({
  4121 + title: '采购排除',
  4122 + width: 120,
  4123 + dataIndex: 'excludeProcureNames',
  4124 + fieldProps: {
  4125 + mode: 'multiple',
  4126 + },
  4127 + valueType: 'select',
  4128 + request: async () => {
  4129 + const res = await postServiceOrderProvideProcurementRoles();
  4130 + let options = res.data?.map((item) => {
  4131 + return { label: item, value: item };
  4132 + });
  4133 + return options;
  4134 + },
  4135 + hideInTable: true,
  4136 + });
4085 } 4137 }
4086 4138
4087 /** 4139 /**
@@ -4096,6 +4148,14 @@ const OrderPage = () =&gt; { @@ -4096,6 +4148,14 @@ const OrderPage = () =&gt; {
4096 valueEnum: enumToProTableEnumValue(SHIPPING_WAREHOUSE_OPTIONS), 4148 valueEnum: enumToProTableEnumValue(SHIPPING_WAREHOUSE_OPTIONS),
4097 hideInTable: true, 4149 hideInTable: true,
4098 }); 4150 });
  4151 + mainOrdersColumns2.push({
  4152 + title: '发货仓库',
  4153 + width: 120,
  4154 + dataIndex: 'shippingWarehouse',
  4155 + valueType: 'select',
  4156 + valueEnum: enumToProTableEnumValue(SHIPPING_WAREHOUSE_OPTIONS),
  4157 + hideInTable: true,
  4158 + });
4099 } 4159 }
4100 4160
4101 //判断是否是采购,是的话新增一个筛选条件 4161 //判断是否是采购,是的话新增一个筛选条件
@@ -4107,6 +4167,13 @@ const OrderPage = () =&gt; { @@ -4107,6 +4167,13 @@ const OrderPage = () =&gt; {
4107 hideInTable: true, 4167 hideInTable: true,
4108 valueEnum: enumToProTableEnumValue(PROCURE_ORDER_STATUS), 4168 valueEnum: enumToProTableEnumValue(PROCURE_ORDER_STATUS),
4109 }); 4169 });
  4170 + mainOrdersColumns2.push({
  4171 + title: isSupplier() ? '下单状态' : '采购下单状态',
  4172 + dataIndex: 'procureOrderStatus',
  4173 + valueType: 'select',
  4174 + hideInTable: true,
  4175 + valueEnum: enumToProTableEnumValue(PROCURE_ORDER_STATUS),
  4176 + });
4110 } 4177 }
4111 4178
4112 //选择天数1 4179 //选择天数1
@@ -4217,6 +4284,7 @@ const OrderPage = () =&gt; { @@ -4217,6 +4284,7 @@ const OrderPage = () =&gt; {
4217 filter, 4284 filter,
4218 data: { ...params, statusDatetimeGe: calDate }, 4285 data: { ...params, statusDatetimeGe: calDate },
4219 }); 4286 });
  4287 + console.log(res.data, '5656request');
4220 4288
4221 const data = res.data; 4289 const data = res.data;
4222 setRolePath(data.specialPath); 4290 setRolePath(data.specialPath);
@@ -4252,6 +4320,14 @@ const OrderPage = () =&gt; { @@ -4252,6 +4320,14 @@ const OrderPage = () =&gt; {
4252 mainTableSecondRef.current?.reload(); 4320 mainTableSecondRef.current?.reload();
4253 } 4321 }
4254 }, [calDate2]); 4322 }, [calDate2]);
  4323 + useEffect(() => {
  4324 + if (activeTabKey === '1') {
  4325 + mainTableRef.current?.reload(); // **修改位置:在选择第二个标签时请求request2**
  4326 + }
  4327 + if (activeTabKey === '2') {
  4328 + mainTableSecondRef.current?.reload(); // **修改位置:在选择第二个标签时请求request2**
  4329 + }
  4330 + }, [activeTabKey]);
4255 4331
4256 const request2 = async ( 4332 const request2 = async (
4257 // 第一个参数 params 查询表单和 params 参数的结合 4333 // 第一个参数 params 查询表单和 params 参数的结合
@@ -4307,6 +4383,7 @@ const OrderPage = () =&gt; { @@ -4307,6 +4383,7 @@ const OrderPage = () =&gt; {
4307 filter, 4383 filter,
4308 data: { ...params }, 4384 data: { ...params },
4309 }); 4385 });
  4386 + console.log(data, '5656request2');
4310 4387
4311 setRolePath(data.specialPath); 4388 setRolePath(data.specialPath);
4312 setSubOrderCount(data.count); 4389 setSubOrderCount(data.count);
@@ -4344,7 +4421,7 @@ const OrderPage = () =&gt; { @@ -4344,7 +4421,7 @@ const OrderPage = () =&gt; {
4344 }; 4421 };
4345 const tabsItems = [ 4422 const tabsItems = [
4346 { 4423 {
4347 - key: 1, 4424 + key: '1',
4348 label: ( 4425 label: (
4349 <span> 4426 <span>
4350 发票确认预警 4427 发票确认预警
@@ -4431,7 +4508,8 @@ const OrderPage = () =&gt; { @@ -4431,7 +4508,8 @@ const OrderPage = () =&gt; {
4431 search={false} 4508 search={false}
4432 // labelWidth: 'auto', 4509 // labelWidth: 'auto',
4433 // onCollapse: resize, 4510 // onCollapse: resize,
4434 - request={request} 4511 + // request={request}
  4512 + request={activeTabKey === '1' ? request : null} // **条件请求**
4435 toolbar={{ 4513 toolbar={{
4436 multipleLine: true, 4514 multipleLine: true,
4437 }} 4515 }}
@@ -4924,7 +5002,7 @@ const OrderPage = () =&gt; { @@ -4924,7 +5002,7 @@ const OrderPage = () =&gt; {
4924 ), 5002 ),
4925 }, 5003 },
4926 { 5004 {
4927 - key: 2, 5005 + key: '2',
4928 label: ( 5006 label: (
4929 <span> 5007 <span>
4930 订单回款预警 5008 订单回款预警
@@ -4962,7 +5040,7 @@ const OrderPage = () =&gt; { @@ -4962,7 +5040,7 @@ const OrderPage = () =&gt; {
4962 actionRef={mainTableSecondRef} 5040 actionRef={mainTableSecondRef}
4963 formRef={mainTableSecondFormRef} 5041 formRef={mainTableSecondFormRef}
4964 expandIconColumnIndex={-1} 5042 expandIconColumnIndex={-1}
4965 - columns={mainOrdersColumns} 5043 + columns={mainOrdersColumns2}
4966 rowKey="id" 5044 rowKey="id"
4967 pagination={{ 5045 pagination={{
4968 showQuickJumper: true, 5046 showQuickJumper: true,
@@ -4972,6 +5050,7 @@ const OrderPage = () =&gt; { @@ -4972,6 +5050,7 @@ const OrderPage = () =&gt; {
4972 onChange: (page, size) => { 5050 onChange: (page, size) => {
4973 setPageSize(size); 5051 setPageSize(size);
4974 setCurrentPage(page); 5052 setCurrentPage(page);
  5053 + mainTableSecondRef.current?.reload();
4975 }, 5054 },
4976 showTotal: (total, range) => { 5055 showTotal: (total, range) => {
4977 return ( 5056 return (
@@ -5001,7 +5080,8 @@ const OrderPage = () =&gt; { @@ -5001,7 +5080,8 @@ const OrderPage = () =&gt; {
5001 search={false} 5080 search={false}
5002 // labelWidth: 'auto', 5081 // labelWidth: 'auto',
5003 // onCollapse: resize, 5082 // onCollapse: resize,
5004 - request={request2} 5083 + // request={request2}
  5084 + request={activeTabKey === '2' ? request2 : null} // **条件请求**
5005 toolbar={{ 5085 toolbar={{
5006 multipleLine: true, 5086 multipleLine: true,
5007 }} 5087 }}
@@ -5498,7 +5578,21 @@ const OrderPage = () =&gt; { @@ -5498,7 +5578,21 @@ const OrderPage = () =&gt; {
5498 return ( 5578 return (
5499 <div className="order-page-container"> 5579 <div className="order-page-container">
5500 <div id="resizeDiv"></div> 5580 <div id="resizeDiv"></div>
5501 - <Tabs defaultActiveKey="1" items={tabsItems} onChange={() => {}} /> 5581 + {/* <Tabs defaultActiveKey="1" items={tabsItems} onChange={() => { }} /> */}
  5582 + <Tabs
  5583 + defaultActiveKey="1"
  5584 + items={tabsItems}
  5585 + onChange={(key) => {
  5586 + setActiveTabKey(key); // **修改位置:更新 activeTabKey**
  5587 + if (key === '1') {
  5588 + setActiveTabKey(key); // **修改位置:更新 activeTabKey**
  5589 + mainTableRef.current?.reload(); // **请求主订单的 request**
  5590 + } else if (key === '2') {
  5591 + setActiveTabKey(key); // **修改位置:更新 activeTabKey**
  5592 + mainTableSecondRef.current?.reload(); // **请求订单回款的 request2**
  5593 + }
  5594 + }}
  5595 + />
5502 </div> 5596 </div>
5503 ); 5597 );
5504 }; 5598 };