Commit 46ba5ba79881891e9ccac29b52587faf34866e69

Authored by boyang
1 parent c35d1eb5

feat: 预警页面销售代表选择器

.umirc.ts
... ... @@ -14,9 +14,9 @@ export default defineConfig({
14 14 },
15 15 proxy: {
16 16 '/api/': {
17   - target: 'http://localhost:8085/',
  17 + // target: 'http://localhost:8085/',
18 18 // target: 'http://192.168.1.6:8085/',
19   - // target: 'http://39.108.227.113:8085/',
  19 + target: 'http://39.108.227.113:8085/',
20 20 changeOrigin: true,
21 21 pathRewrite: { '^/api': '' },
22 22 },
... ...
src/pages/Order/OrderWarning/index.tsx
... ... @@ -32,6 +32,7 @@ import {
32 32 } from '@/utils';
33 33 import {
34 34 getReceivingCompanyOptions,
  35 + getSalesCodeOptions,
35 36 isAdmin,
36 37 isExaminer,
37 38 isFinance,
... ... @@ -53,6 +54,7 @@ import {
53 54 ActionType,
54 55 ProColumns,
55 56 ProFormInstance,
  57 + ProFormSelect,
56 58 ProTable,
57 59 } from '@ant-design/pro-components';
58 60 import {
... ... @@ -120,12 +122,15 @@ import ShippingWarehouseChangeModal from './components/ShippingWarehouseChangeMo
120 122 import UploadPayBillModal from './components/UploadPayBillModal';
121 123 import './index.less';
122 124 import { OrderListItemType, OrderType } from './type.d';
  125 +// import { useParams } from '@umijs/max';
123 126  
124 127 const OrderPage = () => {
125 128 const [orderDrawerVisible, setOrderDrawerVisible] = useState<boolean>(false);
126 129 const [checkVisible, setCheckVisible] = useState<boolean>(false);
127 130 const [orderPrintVisible, setOrderPrintVisible] = useState<boolean>(false);
  131 + const [salesCodeOptions, setSalesCodeOptions] = useState([]);
128 132 const [allMainChecked, setAllMainChecked] = useState(false);
  133 + const [salesCodeSelect, setSalesCodeSelect] = useState();
129 134 const [imagesViewerModalVisible, setImagesViewerModalVisible] =
130 135 useState<boolean>(false);
131 136 const [data, setData] = useState([]); //列表数据
... ... @@ -789,7 +794,7 @@ const OrderPage = () =&gt; {
789 794 onConfirm={() => {
790 795 window.open(
791 796 '/previewApi/onlinePreview?url=' +
792   - encodeURIComponent(Base64.encode(item.url)),
  797 + encodeURIComponent(Base64.encode(item.url)),
793 798 );
794 799 }}
795 800 onCancel={() => {
... ... @@ -861,7 +866,7 @@ const OrderPage = () =&gt; {
861 866 </span>
862 867 {(roleCode === 'salesRepresentative' ||
863 868 roleCode === 'salesManager') &&
864   - !optRecord.isCurrentUserOrder ? (
  869 + !optRecord.isCurrentUserOrder ? (
865 870 <span className="text-[#f44e4e]">(非本账号订单)</span>
866 871 ) : (
867 872 ''
... ... @@ -1045,13 +1050,13 @@ const OrderPage = () =&gt; {
1045 1050 <Tooltip
1046 1051 title={
1047 1052 optRecord.invoicingUrgentCause !== null &&
1048   - optRecord.afterInvoicingStatus ===
  1053 + optRecord.afterInvoicingStatus ===
1049 1054 'URGENT_INVOICE_AUDITING'
1050 1055 ? optRecord.invoicingUrgentCause
1051 1056 : enumValueToLabel(
1052   - optRecord.afterInvoicingStatus,
1053   - AFTER_INVOICING_STATUS,
1054   - )
  1057 + optRecord.afterInvoicingStatus,
  1058 + AFTER_INVOICING_STATUS,
  1059 + )
1055 1060 }
1056 1061 >
1057 1062 <Tag
... ... @@ -1082,7 +1087,7 @@ const OrderPage = () =&gt; {
1082 1087 )}
1083 1088  
1084 1089 {(roleCode === 'warehouseKeeper' || roleCode === 'admin') &&
1085   - optRecord.shippingWarehouse !== null ? (
  1090 + optRecord.shippingWarehouse !== null ? (
1086 1091 <div
1087 1092 className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
1088 1093 title={enumValueToLabel(
... ... @@ -1104,7 +1109,7 @@ const OrderPage = () =&gt; {
1104 1109 {/* 生产时间 */}
1105 1110 <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1106 1111 {optRecord.productionStartTime !== null ||
1107   - optRecord.productionEndTime !== null ? (
  1112 + optRecord.productionEndTime !== null ? (
1108 1113 <MyToolTip
1109 1114 title={
1110 1115 formatdate(optRecord.productionStartTime) +
... ... @@ -1134,7 +1139,7 @@ const OrderPage = () =&gt; {
1134 1139 <Tag
1135 1140 color={
1136 1141 optRecord.invoicingTime === null ||
1137   - optRecord.invoicingTime === undefined
  1142 + optRecord.invoicingTime === undefined
1138 1143 ? TAGS_COLOR.get(optRecord.invoicingStatus)
1139 1144 : 'success'
1140 1145 }
... ... @@ -1162,7 +1167,7 @@ const OrderPage = () =&gt; {
1162 1167  
1163 1168 {/**采购是否已下单状态 */}
1164 1169 {optRecord.procureOrderStatus !== null &&
1165   - optRecord.procureOrderStatus !== undefined ? (
  1170 + optRecord.procureOrderStatus !== undefined ? (
1166 1171 <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1167 1172 <Tag color="success">
1168 1173 {enumValueToLabel(
... ... @@ -1178,21 +1183,21 @@ const OrderPage = () =&gt; {
1178 1183 {/* 物流信息 */}
1179 1184 <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1180 1185 {optRecord.orderStatus === 'CONFIRM_RECEIPT' ||
1181   - optRecord.orderStatus === 'AFTER_SALES_COMPLETION' ||
1182   - optRecord.orderStatus === 'IN_AFTER_SALES' ||
1183   - optRecord.orderStatus === 'SHIPPED' ? (
  1186 + optRecord.orderStatus === 'AFTER_SALES_COMPLETION' ||
  1187 + optRecord.orderStatus === 'IN_AFTER_SALES' ||
  1188 + optRecord.orderStatus === 'SHIPPED' ? (
1184 1189 <MyToolTip
1185 1190 title={
1186 1191 optRecord.serialNumber === undefined
1187 1192 ? '暂无物流信息'
1188 1193 : enumValueToLabel(
1189   - optRecord.logisticsMethod,
1190   - LOGISTICS_STATUS_OPTIONS,
1191   - ) +
1192   - ' ' +
1193   - optRecord.serialNumber +
1194   - ' ' +
1195   - optRecord.logisticsNotes
  1194 + optRecord.logisticsMethod,
  1195 + LOGISTICS_STATUS_OPTIONS,
  1196 + ) +
  1197 + ' ' +
  1198 + optRecord.serialNumber +
  1199 + ' ' +
  1200 + optRecord.logisticsNotes
1196 1201 }
1197 1202 content={
1198 1203 <Button type="link" size="small" style={{ padding: 0 }}>
... ... @@ -1206,7 +1211,7 @@ const OrderPage = () =&gt; {
1206 1211  
1207 1212 {/* 修改审核状态 */}
1208 1213 {optRecord.modifiedAuditStatus !== null &&
1209   - optRecord.modifiedAuditStatus !== 'AUDIT_FAILURE' ? (
  1214 + optRecord.modifiedAuditStatus !== 'AUDIT_FAILURE' ? (
1210 1215 <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1211 1216 <Tooltip
1212 1217 title={recordOptNode ? recordOptNode : <Spin />}
... ... @@ -1646,7 +1651,7 @@ const OrderPage = () =&gt; {
1646 1651 )}
1647 1652  
1648 1653 {optRecord.paths?.includes('queryAnnex') &&
1649   - optRecord.listAnnex?.length > 0 ? (
  1654 + optRecord.listAnnex?.length > 0 ? (
1650 1655 <Button
1651 1656 className="p-0"
1652 1657 type="link"
... ... @@ -2113,7 +2118,7 @@ const OrderPage = () =&gt; {
2113 2118 </Flex>
2114 2119  
2115 2120 {(isProcure() || isWarehousekeeper() || isSales() || isAdmin()) &&
2116   - !isSupplier() ? (
  2121 + !isSupplier() ? (
2117 2122 <div className="pt-2">
2118 2123 <Flex title={optRecord.supplierName}>
2119 2124 <div>
... ... @@ -2188,7 +2193,7 @@ const OrderPage = () =&gt; {
2188 2193 <span className="text-[#8C8C8C]">
2189 2194 申请开票备注:
2190 2195 {optRecord.applyInvoicingNotes === undefined ||
2191   - optRecord.applyInvoicingNotes === null
  2196 + optRecord.applyInvoicingNotes === null
2192 2197 ? '暂无备注'
2193 2198 : optRecord.applyInvoicingNotes}
2194 2199 </span>
... ... @@ -2216,7 +2221,7 @@ const OrderPage = () =&gt; {
2216 2221 <span className="text-[#8C8C8C] mr-3">
2217 2222 财务审核备注:
2218 2223 {optRecord.checkNotes === undefined ||
2219   - optRecord.checkNotes === null
  2224 + optRecord.checkNotes === null
2220 2225 ? '暂无备注'
2221 2226 : optRecord.checkNotes}
2222 2227 </span>
... ... @@ -2240,7 +2245,7 @@ const OrderPage = () =&gt; {
2240 2245 <span className="text-[#8C8C8C]">
2241 2246 重新开票备注:
2242 2247 {optRecord.reissueNotes === undefined ||
2243   - optRecord.reissueNotes === null
  2248 + optRecord.reissueNotes === null
2244 2249 ? '暂无备注'
2245 2250 : optRecord.reissueNotes}
2246 2251 </span>
... ... @@ -2277,7 +2282,7 @@ const OrderPage = () =&gt; {
2277 2282 <span className="text-[#8C8C8C] mr-3">
2278 2283 产品回访登记:
2279 2284 {optRecord.feedbackRegistrationContent === undefined ||
2280   - optRecord.feedbackRegistrationContent === null
  2285 + optRecord.feedbackRegistrationContent === null
2281 2286 ? '暂无'
2282 2287 : optRecord.feedbackRegistrationContent}
2283 2288 </span>
... ... @@ -2568,9 +2573,9 @@ const OrderPage = () =&gt; {
2568 2573 <span className="text-slate-700">
2569 2574 {record.receivingCompany !== null
2570 2575 ? enumValueToLabel(
2571   - record.receivingCompany,
2572   - getReceivingCompanyOptions(PAYEE_OPTIONS),
2573   - )
  2576 + record.receivingCompany,
  2577 + getReceivingCompanyOptions(PAYEE_OPTIONS),
  2578 + )
2574 2579 : '暂无'}
2575 2580 </span>
2576 2581 </div>
... ... @@ -3362,9 +3367,9 @@ const OrderPage = () =&gt; {
3362 3367 for (let i = 0; i < selectedSubOrders.length; i++) {
3363 3368 if (
3364 3369 selectedSubOrders[i].invoicingStatus ===
3365   - 'UN_INVOICE' ||
  3370 + 'UN_INVOICE' ||
3366 3371 selectedSubOrders[i].afterInvoicingStatus ===
3367   - 'APPLY_FOR_INVOICING'
  3372 + 'APPLY_FOR_INVOICING'
3368 3373 ) {
3369 3374 message.error(
3370 3375 '请选择需要开票且未申请开票的子订单进行申请',
... ... @@ -3399,9 +3404,9 @@ const OrderPage = () =&gt; {
3399 3404 for (let i = 0; i < selectedSubOrders.length; i++) {
3400 3405 if (
3401 3406 selectedSubOrders[i].invoicingStatus ===
3402   - 'UN_INVOICE' ||
  3407 + 'UN_INVOICE' ||
3403 3408 selectedSubOrders[i].afterInvoicingStatus ===
3404   - 'APPLY_FOR_INVOICING'
  3409 + 'APPLY_FOR_INVOICING'
3405 3410 ) {
3406 3411 message.error(
3407 3412 '请选择需要开票且未申请开票的子订单进行申请',
... ... @@ -3615,13 +3620,13 @@ const OrderPage = () =&gt; {
3615 3620 if (
3616 3621 selectedSubOrders[i].orderStatus !== 'AUDITED' &&
3617 3622 selectedSubOrders[i].orderStatus !==
3618   - 'PROCURE_PROCESS' &&
  3623 + 'PROCURE_PROCESS' &&
3619 3624 selectedSubOrders[i].orderStatus !==
3620   - 'PROCURE_PROCESS_FOR_MINE' &&
  3625 + 'PROCURE_PROCESS_FOR_MINE' &&
3621 3626 selectedSubOrders[i].orderStatus !==
3622   - 'PROCURE_WAIT_SHIP' &&
  3627 + 'PROCURE_WAIT_SHIP' &&
3623 3628 selectedSubOrders[i].orderStatus !==
3624   - 'SUPPLIER_WAIT_SHIP' &&
  3629 + 'SUPPLIER_WAIT_SHIP' &&
3625 3630 selectedSubOrders[i].orderStatus !== 'WAIT_SHIP'
3626 3631 ) {
3627 3632 message.error(
... ... @@ -3707,9 +3712,9 @@ const OrderPage = () =&gt; {
3707 3712 if (
3708 3713 selectedSubOrders[i].orderStatus !== 'UNAUDITED' &&
3709 3714 selectedSubOrders[i].orderStatus !==
3710   - 'FINANCE_PROCESS' &&
  3715 + 'FINANCE_PROCESS' &&
3711 3716 selectedSubOrders[i].orderStatus !==
3712   - 'LEADER_AUDITED'
  3717 + 'LEADER_AUDITED'
3713 3718 ) {
3714 3719 message.error(
3715 3720 '请选择[未审核]、[财务待审核]、[领导已审核]的子订单进行审核',
... ... @@ -3777,9 +3782,9 @@ const OrderPage = () =&gt; {
3777 3782 for (let i = 0; i < selectedSubOrders.length; i++) {
3778 3783 if (
3779 3784 selectedSubOrders[i].orderStatus !==
3780   - 'CONFIRM_RECEIPT' &&
  3785 + 'CONFIRM_RECEIPT' &&
3781 3786 selectedSubOrders[i].orderStatus !==
3782   - 'AFTER_SALES_FAILURE'
  3787 + 'AFTER_SALES_FAILURE'
3783 3788 ) {
3784 3789 message.error('请选择确认收货状态的子订单进行售后');
3785 3790 return;
... ... @@ -4201,10 +4206,6 @@ const OrderPage = () =&gt; {
4201 4206 ) {
4202 4207 setValue1(0); // 清空 value1
4203 4208 }
4204   - // const currentDate = new Date();
4205   - // const newDate = new Date(currentDate);
4206   - // newDate.setDate(currentDate.getDate() - 0);
4207   - // console.log(value1, '5656value1');
4208 4209 mainTableRef.current?.reload(); // **修改位置:在选择第二个标签时请求request2**
4209 4210 }, [activeTabKey]);
4210 4211 // 修改位置:监听 value1 的变化
... ... @@ -4214,12 +4215,14 @@ const OrderPage = () =&gt; {
4214 4215 mainTableRef.current?.reload(); // 重新请求数据
4215 4216 }
4216 4217 }, [value1]); // 添加了 value1 作为依赖
4217   -
4218 4218 //biaojidown2
4219 4219 //取消单选,将时间设为null
4220 4220 const handleSetNull = () => {
4221 4221 setCalDate(null); // 这应该会触发 useEffect
4222 4222 };
  4223 + const selectSalesCode = (value) => {
  4224 + setSalesCodeSelect(value); // 这应该会触发 useEffect
  4225 + };
4223 4226 const warningOptions = [
4224 4227 {
4225 4228 value: 1,
... ... @@ -4274,35 +4277,73 @@ const OrderPage = () =&gt; {
4274 4277 />
4275 4278 </div>
4276 4279 <div style={{ height: '25px' }}></div>
4277   - {/* <Tabs defaultActiveKey="1" items={tabsItems} onChange={() => { }} /> */}
4278   - <Radio.Group
4279   - value={value1}
4280   - onChange={radioOnChange1}
4281   - // 通过 onClick 处理单独 Radio 的点击事件
  4280 + <div
  4281 + style={{
  4282 + display: 'flex',
  4283 + justifyContent: 'space-between',
  4284 + alignItems: 'center',
  4285 + width: '100%',
  4286 + }}
4282 4287 >
4283   - {(activeTabKey === 1
4284   - ? options1
4285   - : activeTabKey === 2
4286   - ? options2
4287   - : activeTabKey === 3
4288   - ? options3
4289   - : options4
4290   - ).map((option) => (
4291   - <Radio
4292   - key={option.value}
4293   - value={option.value}
4294   - onClick={(e) => {
4295   - radioOnChange1(
4296   - e as unknown as React.ChangeEvent<HTMLInputElement>,
4297   - );
4298   - handleSetNull();
  4288 + {/* 左边的 Radio.Group */}
  4289 + <span style={{ flex: '1' }}>
  4290 + {' '}
  4291 + {/* 修改:设置 flex 属性 */}
  4292 + <Radio.Group value={value1} onChange={radioOnChange1}>
  4293 + {(activeTabKey === 1
  4294 + ? options1
  4295 + : activeTabKey === 2
  4296 + ? options2
  4297 + : activeTabKey === 3
  4298 + ? options3
  4299 + : options4
  4300 + ).map((option) => (
  4301 + <Radio
  4302 + key={option.value}
  4303 + value={option.value}
  4304 + onClick={(e) => {
  4305 + radioOnChange1(
  4306 + e as unknown as React.ChangeEvent<HTMLInputElement>,
  4307 + );
  4308 + handleSetNull();
  4309 + }}
  4310 + >
  4311 + {option.label}
  4312 + </Radio>
  4313 + ))}
  4314 + </Radio.Group>
  4315 + </span>
  4316 +
  4317 + {/* 右边的 ProFormSelect */}
  4318 + <span style={{ width: '300px', marginLeft: 'auto', marginTop: '30px' }}>
  4319 + {' '}
  4320 + {/* 修改:设置 width 和 marginLeft */}
  4321 + <ProFormSelect
  4322 + name="salesCode"
  4323 + key="salesCode"
  4324 + width="200px"
  4325 + actionRef={mainTableRef}
  4326 + formRef={mainTableFormRef}
  4327 + initialValue={userInfo.nickName}
  4328 + showSearch
  4329 + label="销售代表"
  4330 + placeholder="请输入销售代表"
  4331 + options={salesCodeOptions}
  4332 + onChange={(_, option) => {
  4333 + console.log(option, '5656option');
  4334 + selectSalesCode(option.value);
  4335 + mainTableRef.current?.reload();
4299 4336 }}
4300   - >
4301   - {option.label}
4302   - </Radio>
4303   - ))}
4304   - </Radio.Group>
4305   - <div style={{ height: '25px' }}></div>
  4337 + request={async () => {
  4338 + let options = await getSalesCodeOptions();
  4339 + setSalesCodeOptions(options);
  4340 + return options;
  4341 + }}
  4342 + />
  4343 + </span>
  4344 + </div>
  4345 +
  4346 + <div style={{ height: '15px' }}></div>
4306 4347 <ProTable
4307 4348 id="main-table"
4308 4349 // tableStyle={{backgroundColor:'red'}}
... ... @@ -4373,9 +4414,8 @@ const OrderPage = () =&gt; {
4373 4414 });
4374 4415 }
4375 4416 }
4376   -
  4417 + params.salesCode = userInfo.nickName;
4377 4418 params.condition = filterCondifion;
4378   -
4379 4419 //排序
4380 4420 params.sorted = sorted;
4381 4421 //是否只查看已作废
... ... @@ -4399,7 +4439,10 @@ const OrderPage = () =&gt; {
4399 4439 // params.applyTimeIsNotNull = true; // 要求申请时间非空
4400 4440 params.orderStatus = 'SHIPPED'; // 发票确认预警
4401 4441 params.isDeleteQueryOrder = false; // 强制查询非作废订单
4402   - params.salesCode = userInfo.username;
  4442 + params.salesCode = userInfo.nickName;
  4443 + if (salesCodeSelect !== undefined) {
  4444 + params.salesCode = salesCodeSelect;
  4445 + }
4403 4446 // params.paymentMethod = 'UNPAID';
4404 4447 finalParams = {
4405 4448 ...params,
... ... @@ -4413,7 +4456,10 @@ const OrderPage = () =&gt; {
4413 4456 // params.applyTimeLe = calDate;
4414 4457 // }
4415 4458 // params.applyTimeIsNotNull = true; // 要求申请时间非空
4416   - params.salesCode = userInfo.username;
  4459 + params.salesCode = userInfo.nickName;
  4460 + if (salesCodeSelect !== undefined) {
  4461 + params.salesCode = salesCodeSelect;
  4462 + }
4417 4463 params.warningStatus = 'waitFeedbackWarning'; // 发票确认预警
4418 4464 params.isDeleteQueryOrder = false; // 强制查询非作废订单
4419 4465 // params.paymentMethod = 'UNPAID';
... ... @@ -4429,7 +4475,10 @@ const OrderPage = () =&gt; {
4429 4475 // params.applyTimeLe = calDate;
4430 4476 // }
4431 4477 // params.applyTimeIsNotNull = true; // 要求申请时间非空
4432   - params.salesCode = userInfo.username;
  4478 + params.salesCode = userInfo.nickName;
  4479 + if (salesCodeSelect !== undefined) {
  4480 + params.salesCode = salesCodeSelect;
  4481 + }
4433 4482 params.warningStatus = 'invoiceConfirmWarning'; // 发票确认预警
4434 4483 params.isDeleteQueryOrder = false; // 强制查询非作废订单
4435 4484 // params.paymentMethod = 'UNPAID';
... ... @@ -4444,14 +4493,16 @@ const OrderPage = () =&gt; {
4444 4493 } else {
4445 4494 params.applyTimeLe = calDate;
4446 4495 }
4447   - params.salesCode = userInfo.username;
  4496 + params.salesCode = userInfo.nickName;
  4497 + if (salesCodeSelect !== undefined) {
  4498 + params.salesCode = salesCodeSelect;
  4499 + }
4448 4500 params.isDeleteQueryOrder = false; // 强制查询非作废订单
4449 4501 params.paymentNotReceipt = true; // 在回款预警中标记未支付订单
4450 4502 finalParams = {
4451 4503 ...params,
4452 4504 };
4453 4505 }
4454   -
4455 4506 //保存这个搜索条件
4456 4507 setSearchParam(params);
4457 4508 const { data } = await postServiceOrderQueryServiceOrder({
... ... @@ -4492,9 +4543,9 @@ const OrderPage = () =&gt; {
4492 4543 toolbar={{
4493 4544 multipleLine: true,
4494 4545 }}
4495   - // toolBarRender={() => {
4496   - // return toolBarRender();
4497   - // }}
  4546 + // toolBarRender={() => {
  4547 + // return toolBarRender();
  4548 + // }}
4498 4549 />
4499 4550  
4500 4551 {orderDrawerVisible && (
... ...