Commit 1db34f9955a3b59de6ea099a3364a1ac0f120151

Authored by 曾国涛
2 parents 19ca3d46 967ee14e

Too many changes to show.

To preserve performance only 2 of 3 files are displayed.

dist.zip 0 → 100644
No preview for this file type
src/pages/Order/OrderWarning/index.tsx
@@ -188,7 +188,9 @@ const OrderPage = () => { @@ -188,7 +188,9 @@ const OrderPage = () => {
188 const [mainOrderSelectedMap] = useState(new Map()); //选中的主订单Map key:主订单id value:主订单数据 188 const [mainOrderSelectedMap] = useState(new Map()); //选中的主订单Map key:主订单id value:主订单数据
189 const [subOrderSelectedMap, setSubOrderSelectedMap] = useState(new Map()); //选中的子订单Map key:主订单id value:选中的子订单数据集合 189 const [subOrderSelectedMap, setSubOrderSelectedMap] = useState(new Map()); //选中的子订单Map key:主订单id value:选中的子订单数据集合
190 const [currentOptMainId, setCurrentMainId] = useState<any>(undefined); //当前操作对象的主订单id 190 const [currentOptMainId, setCurrentMainId] = useState<any>(undefined); //当前操作对象的主订单id
  191 + // const [currentOptMainId, setCurrentMainId] = useState<any>(undefined); //当前操作对象的主订单id
191 const [curretnOptSubId, setCurretnOptSubId] = useState<any>(undefined); //当前操作对象的子订单id 192 const [curretnOptSubId, setCurretnOptSubId] = useState<any>(undefined); //当前操作对象的子订单id
  193 + // const [curretnOptSubId, setCurretnOptSubId] = useState<any>(undefined); //当前操作对象的子订单id
192 const [subOrderCount, setSubOrderCount] = useState(0); 194 const [subOrderCount, setSubOrderCount] = useState(0);
193 const [sorted] = useState(false); 195 const [sorted] = useState(false);
194 const mainTableRef = useRef<ActionType>(); 196 const mainTableRef = useRef<ActionType>();
@@ -206,6 +208,7 @@ const OrderPage = () =&gt; { @@ -206,6 +208,7 @@ const OrderPage = () =&gt; {
206 const [ids, setIds] = useState([]); 208 const [ids, setIds] = useState([]);
207 const [recordOptNode, setRecordOptNode] = useState(null); 209 const [recordOptNode, setRecordOptNode] = useState(null);
208 const roleCode = userInfo?.roleSmallVO?.code; 210 const roleCode = userInfo?.roleSmallVO?.code;
  211 + const [activeTabKey, setActiveTabKey] = useState('1'); // **新增状态**
209 212
210 const triggerRecordOptNode = async (id) => { 213 const triggerRecordOptNode = async (id) => {
211 const res = await postServiceOrderGetCurrentOptNode({ 214 const res = await postServiceOrderGetCurrentOptNode({
@@ -381,7 +384,7 @@ const OrderPage = () =&gt; { @@ -381,7 +384,7 @@ const OrderPage = () =&gt; {
381 * 返回当前操作的主订单数据 384 * 返回当前操作的主订单数据
382 */ 385 */
383 function buildMainOrder() { 386 function buildMainOrder() {
384 - if (currentOptMainId === undefined || currentOptMainId === null) { 387 + if (!currentOptMainId) {
385 message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员'); 388 message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员');
386 return; 389 return;
387 } 390 }
@@ -393,11 +396,9 @@ const OrderPage = () =&gt; { @@ -393,11 +396,9 @@ const OrderPage = () =&gt; {
393 if (matchedData.length > 0) { 396 if (matchedData.length > 0) {
394 mainOrderClone = cloneDeep(matchedData[0]); 397 mainOrderClone = cloneDeep(matchedData[0]);
395 } 398 }
396 -  
397 - if (mainOrderClone === null) { 399 + if (!mainOrderClone) {
398 message.error('页面错误:当前操作的主订单数据不存在,请联系系统管理员'); 400 message.error('页面错误:当前操作的主订单数据不存在,请联系系统管理员');
399 } 401 }
400 -  
401 return mainOrderClone; 402 return mainOrderClone;
402 } 403 }
403 404
@@ -405,7 +406,7 @@ const OrderPage = () =&gt; { @@ -405,7 +406,7 @@ const OrderPage = () =&gt; {
405 * 返回当前操作的子订单集合 406 * 返回当前操作的子订单集合
406 */ 407 */
407 function buildSubOrders() { 408 function buildSubOrders() {
408 - if (currentOptMainId === undefined || currentOptMainId === null) { 409 + if (!currentOptMainId) {
409 message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员'); 410 message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员');
410 return; 411 return;
411 } 412 }
@@ -414,8 +415,10 @@ const OrderPage = () =&gt; { @@ -414,8 +415,10 @@ const OrderPage = () =&gt; {
414 415
415 //如果没有传当前操作的子订单id,说明是操作主订单 416 //如果没有传当前操作的子订单id,说明是操作主订单
416 if (curretnOptSubId === undefined || curretnOptSubId === null) { 417 if (curretnOptSubId === undefined || curretnOptSubId === null) {
  418 + // if (!curretnOptSubId) {
417 //如果有选中子订单,那么取选中的子订单为操作对象,否则取当前主订单的全部子订单为操作对象 419 //如果有选中子订单,那么取选中的子订单为操作对象,否则取当前主订单的全部子订单为操作对象
418 let currentOptSubOrders = subOrderSelectedMap.get(currentOptMainId); 420 let currentOptSubOrders = subOrderSelectedMap.get(currentOptMainId);
  421 +
419 if ( 422 if (
420 currentOptSubOrders === null || 423 currentOptSubOrders === null ||
421 currentOptSubOrders === undefined || 424 currentOptSubOrders === undefined ||
@@ -446,12 +449,10 @@ const OrderPage = () =&gt; { @@ -446,12 +449,10 @@ const OrderPage = () =&gt; {
446 } 449 }
447 } 450 }
448 } 451 }
449 -  
450 if (cloneSubOrders.length === 0) { 452 if (cloneSubOrders.length === 0) {
451 message.error('页面错误:当前操作的订单数据不存在,请联系系统管理员'); 453 message.error('页面错误:当前操作的订单数据不存在,请联系系统管理员');
452 return; 454 return;
453 } 455 }
454 -  
455 return cloneSubOrders; 456 return cloneSubOrders;
456 } 457 }
457 458
@@ -3995,6 +3996,58 @@ const OrderPage = () =&gt; { @@ -3995,6 +3996,58 @@ const OrderPage = () =&gt; {
3995 }, 3996 },
3996 ); 3997 );
3997 3998
  3999 + // 主订单列表
  4000 + const mainOrdersColumns2: ProColumns<OrderType>[] = MAIN_ORDER_COLUMNS.map(
  4001 + (item) => {
  4002 + //首能账号只能搜索订单编号
  4003 + let canSearchIndex = [
  4004 + 'id',
  4005 + 'salesCode',
  4006 + 'subNotes',
  4007 + 'orderStatus',
  4008 + 'createTime',
  4009 + 'modifiedAuditStatus',
  4010 + ];
  4011 + if (isSupplier() && !canSearchIndex.includes(item.dataIndex)) {
  4012 + item.search = false;
  4013 + }
  4014 +
  4015 + canSearchIndex = [
  4016 + 'id',
  4017 + 'salesCode',
  4018 + 'customerName',
  4019 + 'institution',
  4020 + 'productName',
  4021 + 'orderStatus',
  4022 + 'createTime',
  4023 + ];
  4024 +
  4025 + if (isExaminer() && !canSearchIndex.includes(item.dataIndex)) {
  4026 + item.search = false;
  4027 + }
  4028 +
  4029 + if (item.dataIndex === 'name') {
  4030 + return {
  4031 + ...item,
  4032 + title: <OrderTableHeader />,
  4033 + render: (text, record) => {
  4034 + return <MainOrderColumnRender record={record} />;
  4035 + },
  4036 + };
  4037 + }
  4038 +
  4039 + /**
  4040 + * 采购的订单状态筛选内容
  4041 + */
  4042 + if (roleCode === 'procure' && item.dataIndex === 'orderStatus') {
  4043 + item.valueEnum = enumToProTableEnumValue(
  4044 + PROCURE_PRIMARY_ORDER_STATUS_OPTIONS,
  4045 + );
  4046 + }
  4047 + return item;
  4048 + },
  4049 + );
  4050 +
3998 /** 4051 /**
3999 * 采购可以筛选供应商备注 4052 * 采购可以筛选供应商备注
4000 */ 4053 */
@@ -4006,6 +4059,13 @@ const OrderPage = () =&gt; { @@ -4006,6 +4059,13 @@ const OrderPage = () =&gt; {
4006 valueType: 'text', 4059 valueType: 'text',
4007 hideInTable: true, 4060 hideInTable: true,
4008 }); 4061 });
  4062 + mainOrdersColumns2.push({
  4063 + title: '供应商备注',
  4064 + width: 120,
  4065 + dataIndex: 'supplierNotes',
  4066 + valueType: 'text',
  4067 + hideInTable: true,
  4068 + });
4009 } 4069 }
4010 4070
4011 /** 4071 /**
@@ -4026,6 +4086,20 @@ const OrderPage = () =&gt; { @@ -4026,6 +4086,20 @@ const OrderPage = () =&gt; {
4026 }, 4086 },
4027 hideInTable: true, 4087 hideInTable: true,
4028 }); 4088 });
  4089 + mainOrdersColumns2.push({
  4090 + title: '采购名称',
  4091 + width: 120,
  4092 + dataIndex: 'supplierName',
  4093 + valueType: 'select',
  4094 + request: async () => {
  4095 + const res = await postServiceOrderProvideProcurementRoles();
  4096 + let options = res.data?.map((item) => {
  4097 + return { label: item, value: item };
  4098 + });
  4099 + return options;
  4100 + },
  4101 + hideInTable: true,
  4102 + });
4029 } 4103 }
4030 4104
4031 /** 4105 /**
@@ -4049,6 +4123,23 @@ const OrderPage = () =&gt; { @@ -4049,6 +4123,23 @@ const OrderPage = () =&gt; {
4049 }, 4123 },
4050 hideInTable: true, 4124 hideInTable: true,
4051 }); 4125 });
  4126 + mainOrdersColumns2.push({
  4127 + title: '采购排除',
  4128 + width: 120,
  4129 + dataIndex: 'excludeProcureNames',
  4130 + fieldProps: {
  4131 + mode: 'multiple',
  4132 + },
  4133 + valueType: 'select',
  4134 + request: async () => {
  4135 + const res = await postServiceOrderProvideProcurementRoles();
  4136 + let options = res.data?.map((item) => {
  4137 + return { label: item, value: item };
  4138 + });
  4139 + return options;
  4140 + },
  4141 + hideInTable: true,
  4142 + });
4052 } 4143 }
4053 4144
4054 /** 4145 /**
@@ -4063,6 +4154,14 @@ const OrderPage = () =&gt; { @@ -4063,6 +4154,14 @@ const OrderPage = () =&gt; {
4063 valueEnum: enumToProTableEnumValue(SHIPPING_WAREHOUSE_OPTIONS), 4154 valueEnum: enumToProTableEnumValue(SHIPPING_WAREHOUSE_OPTIONS),
4064 hideInTable: true, 4155 hideInTable: true,
4065 }); 4156 });
  4157 + mainOrdersColumns2.push({
  4158 + title: '发货仓库',
  4159 + width: 120,
  4160 + dataIndex: 'shippingWarehouse',
  4161 + valueType: 'select',
  4162 + valueEnum: enumToProTableEnumValue(SHIPPING_WAREHOUSE_OPTIONS),
  4163 + hideInTable: true,
  4164 + });
4066 } 4165 }
4067 4166
4068 //判断是否是采购,是的话新增一个筛选条件 4167 //判断是否是采购,是的话新增一个筛选条件
@@ -4074,6 +4173,13 @@ const OrderPage = () =&gt; { @@ -4074,6 +4173,13 @@ const OrderPage = () =&gt; {
4074 hideInTable: true, 4173 hideInTable: true,
4075 valueEnum: enumToProTableEnumValue(PROCURE_ORDER_STATUS), 4174 valueEnum: enumToProTableEnumValue(PROCURE_ORDER_STATUS),
4076 }); 4175 });
  4176 + mainOrdersColumns2.push({
  4177 + title: isSupplier() ? '下单状态' : '采购下单状态',
  4178 + dataIndex: 'procureOrderStatus',
  4179 + valueType: 'select',
  4180 + hideInTable: true,
  4181 + valueEnum: enumToProTableEnumValue(PROCURE_ORDER_STATUS),
  4182 + });
4077 } 4183 }
4078 4184
4079 //选择天数1 4185 //选择天数1
@@ -4184,6 +4290,7 @@ const OrderPage = () =&gt; { @@ -4184,6 +4290,7 @@ const OrderPage = () =&gt; {
4184 filter, 4290 filter,
4185 data: { ...params, statusDatetimeGe: calDate }, 4291 data: { ...params, statusDatetimeGe: calDate },
4186 }); 4292 });
  4293 + console.log(res.data, '5656request');
4187 4294
4188 const data = res.data; 4295 const data = res.data;
4189 setRolePath(data.specialPath); 4296 setRolePath(data.specialPath);
@@ -4219,6 +4326,14 @@ const OrderPage = () =&gt; { @@ -4219,6 +4326,14 @@ const OrderPage = () =&gt; {
4219 mainTableSecondRef.current?.reload(); 4326 mainTableSecondRef.current?.reload();
4220 } 4327 }
4221 }, [calDate2]); 4328 }, [calDate2]);
  4329 + useEffect(() => {
  4330 + if (activeTabKey === '1') {
  4331 + mainTableRef.current?.reload(); // **修改位置:在选择第二个标签时请求request2**
  4332 + }
  4333 + if (activeTabKey === '2') {
  4334 + mainTableSecondRef.current?.reload(); // **修改位置:在选择第二个标签时请求request2**
  4335 + }
  4336 + }, [activeTabKey]);
4222 4337
4223 const request2 = async ( 4338 const request2 = async (
4224 // 第一个参数 params 查询表单和 params 参数的结合 4339 // 第一个参数 params 查询表单和 params 参数的结合
@@ -4274,6 +4389,7 @@ const OrderPage = () =&gt; { @@ -4274,6 +4389,7 @@ const OrderPage = () =&gt; {
4274 filter, 4389 filter,
4275 data: { ...params }, 4390 data: { ...params },
4276 }); 4391 });
  4392 + console.log(data, '5656request2');
4277 4393
4278 setRolePath(data.specialPath); 4394 setRolePath(data.specialPath);
4279 setSubOrderCount(data.count); 4395 setSubOrderCount(data.count);
@@ -4311,7 +4427,7 @@ const OrderPage = () =&gt; { @@ -4311,7 +4427,7 @@ const OrderPage = () =&gt; {
4311 }; 4427 };
4312 const tabsItems = [ 4428 const tabsItems = [
4313 { 4429 {
4314 - key: 1, 4430 + key: '1',
4315 label: ( 4431 label: (
4316 <span> 4432 <span>
4317 发票确认预警 4433 发票确认预警
@@ -4398,7 +4514,8 @@ const OrderPage = () =&gt; { @@ -4398,7 +4514,8 @@ const OrderPage = () =&gt; {
4398 search={false} 4514 search={false}
4399 // labelWidth: 'auto', 4515 // labelWidth: 'auto',
4400 // onCollapse: resize, 4516 // onCollapse: resize,
4401 - request={request} 4517 + // request={request}
  4518 + request={activeTabKey === '1' ? request : null} // **条件请求**
4402 toolbar={{ 4519 toolbar={{
4403 multipleLine: true, 4520 multipleLine: true,
4404 }} 4521 }}
@@ -4891,7 +5008,7 @@ const OrderPage = () =&gt; { @@ -4891,7 +5008,7 @@ const OrderPage = () =&gt; {
4891 ), 5008 ),
4892 }, 5009 },
4893 { 5010 {
4894 - key: 2, 5011 + key: '2',
4895 label: ( 5012 label: (
4896 <span> 5013 <span>
4897 订单回款预警 5014 订单回款预警
@@ -4929,7 +5046,7 @@ const OrderPage = () =&gt; { @@ -4929,7 +5046,7 @@ const OrderPage = () =&gt; {
4929 actionRef={mainTableSecondRef} 5046 actionRef={mainTableSecondRef}
4930 formRef={mainTableSecondFormRef} 5047 formRef={mainTableSecondFormRef}
4931 expandIconColumnIndex={-1} 5048 expandIconColumnIndex={-1}
4932 - columns={mainOrdersColumns} 5049 + columns={mainOrdersColumns2}
4933 rowKey="id" 5050 rowKey="id"
4934 pagination={{ 5051 pagination={{
4935 showQuickJumper: true, 5052 showQuickJumper: true,
@@ -4939,6 +5056,7 @@ const OrderPage = () =&gt; { @@ -4939,6 +5056,7 @@ const OrderPage = () =&gt; {
4939 onChange: (page, size) => { 5056 onChange: (page, size) => {
4940 setPageSize(size); 5057 setPageSize(size);
4941 setCurrentPage(page); 5058 setCurrentPage(page);
  5059 + mainTableSecondRef.current?.reload();
4942 }, 5060 },
4943 showTotal: (total, range) => { 5061 showTotal: (total, range) => {
4944 return ( 5062 return (
@@ -4968,7 +5086,8 @@ const OrderPage = () =&gt; { @@ -4968,7 +5086,8 @@ const OrderPage = () =&gt; {
4968 search={false} 5086 search={false}
4969 // labelWidth: 'auto', 5087 // labelWidth: 'auto',
4970 // onCollapse: resize, 5088 // onCollapse: resize,
4971 - request={request2} 5089 + // request={request2}
  5090 + request={activeTabKey === '2' ? request2 : null} // **条件请求**
4972 toolbar={{ 5091 toolbar={{
4973 multipleLine: true, 5092 multipleLine: true,
4974 }} 5093 }}
@@ -5465,7 +5584,21 @@ const OrderPage = () =&gt; { @@ -5465,7 +5584,21 @@ const OrderPage = () =&gt; {
5465 return ( 5584 return (
5466 <div className="order-page-container"> 5585 <div className="order-page-container">
5467 <div id="resizeDiv"></div> 5586 <div id="resizeDiv"></div>
5468 - <Tabs defaultActiveKey="1" items={tabsItems} onChange={() => {}} /> 5587 + {/* <Tabs defaultActiveKey="1" items={tabsItems} onChange={() => { }} /> */}
  5588 + <Tabs
  5589 + defaultActiveKey="1"
  5590 + items={tabsItems}
  5591 + onChange={(key) => {
  5592 + setActiveTabKey(key); // **修改位置:更新 activeTabKey**
  5593 + if (key === '1') {
  5594 + setActiveTabKey(key); // **修改位置:更新 activeTabKey**
  5595 + mainTableRef.current?.reload(); // **请求主订单的 request**
  5596 + } else if (key === '2') {
  5597 + setActiveTabKey(key); // **修改位置:更新 activeTabKey**
  5598 + mainTableSecondRef.current?.reload(); // **请求订单回款的 request2**
  5599 + }
  5600 + }}
  5601 + />
5469 </div> 5602 </div>
5470 ); 5603 );
5471 }; 5604 };