Commit 3201699b76da79362b0ec9a1d73bb8ead931e078

Authored by 曾国涛
1 parent 2d6efa55

Merge branch 'master' into zgt移除ManualInvoicingModal中的非必要注释代码

发现并删除了ManualInvoicingModal组件中未使用的注释代码,以提高代码清晰度和维护性。
src/pages/Client/index.tsx
... ... @@ -256,7 +256,6 @@ export default () => {
256 256 return data;
257 257 }}
258 258 search={{
259   - defaultCollapsed: false,
260 259 optionRender: (searchConfig, formProps, dom) => [
261 260 ...dom.reverse(),
262 261 <Button
... ...
src/pages/Invoice/InvoiceRecord/index.tsx
... ... @@ -53,11 +53,13 @@ const InvoiceRecord = () =&gt; {
53 53 {
54 54 dataIndex: 'index',
55 55 valueType: 'indexBorder',
  56 + width: 50,
56 57 },
57 58 {
58 59 title: '开票编号',
59 60 valueType: 'text',
60 61 dataIndex: 'id',
  62 + width: 100,
61 63 copyable: true,
62 64 ellipsis: true,
63 65 },
... ... @@ -65,13 +67,14 @@ const InvoiceRecord = () =&gt; {
65 67 title: '发票号码',
66 68 valueType: 'text',
67 69 dataIndex: 'invoiceNumber',
  70 + width: 150,
68 71 copyable: true,
69 72 ellipsis: true,
70 73 },
71 74 {
72 75 title: '重开发票',
73 76 key: 'reissueInvoiceNumbers',
74   - width: 120,
  77 + width: 150,
75 78 ellipsis: true,
76 79 hideInSearch: true,
77 80 render: (_, record) => {
... ... @@ -101,6 +104,7 @@ const InvoiceRecord = () =&gt; {
101 104 title: '发票类型',
102 105 valueType: 'Text',
103 106 dataIndex: 'typeText',
  107 + width: 100,
104 108 hideInSearch: true,
105 109 ellipsis: true,
106 110 },
... ... @@ -108,6 +112,7 @@ const InvoiceRecord = () =&gt; {
108 112 title: '发票状态',
109 113 valueType: 'Text',
110 114 dataIndex: 'statusText',
  115 + width: 100,
111 116 hideInSearch: true,
112 117 ellipsis: true,
113 118 },
... ... @@ -122,6 +127,7 @@ const InvoiceRecord = () =&gt; {
122 127 title: '联系人',
123 128 valueType: 'text',
124 129 dataIndex: 'contacts',
  130 + width: 100,
125 131 hideInSearch: true,
126 132 ellipsis: true,
127 133 },
... ... @@ -141,6 +147,7 @@ const InvoiceRecord = () =&gt; {
141 147 {
142 148 title: '申请人',
143 149 valueType: 'text',
  150 + width: 100,
144 151 dataIndex: 'createByName',
145 152 hideInSearch: true,
146 153 ellipsis: true,
... ... @@ -149,6 +156,7 @@ const InvoiceRecord = () =&gt; {
149 156 title: '开票金额(元)',
150 157 valueType: 'money',
151 158 dataIndex: 'price',
  159 + width: 100,
152 160 hideInSearch: true,
153 161 ellipsis: true,
154 162 },
... ... @@ -395,7 +403,7 @@ const InvoiceRecord = () =&gt; {
395 403 form={{}}
396 404 dateFormatter="string"
397 405 headerTitle="待开票列表"
398   - scroll={{ x: 1400, y: 360 }}
  406 + scroll={{ x: 2400, y: 360 }}
399 407 toolBarRender={() => []}
400 408 />
401 409  
... ...
src/pages/Invoice/waitProcessRecord/index.tsx
... ... @@ -135,6 +135,14 @@ const InvoiceRecord = () =&gt; {
135 135 ellipsis: true,
136 136 },
137 137 {
  138 + title: '联系人',
  139 + valueType: 'text',
  140 + dataIndex: 'contacts',
  141 + width: 100,
  142 + hideInSearch: true,
  143 + ellipsis: true,
  144 + },
  145 + {
138 146 title: '购方税号',
139 147 valueType: 'text',
140 148 hideInSearch: true,
... ... @@ -194,6 +202,12 @@ const InvoiceRecord = () =&gt; {
194 202 hideInTable: true,
195 203 },
196 204 {
  205 + title: '联系人',
  206 + valueType: 'text',
  207 + dataIndex: 'contactsLike',
  208 + hideInTable: true,
  209 + },
  210 + {
197 211 title: '收款单位',
198 212 valueType: 'select',
199 213 dataIndex: 'partyB',
... ... @@ -402,7 +416,7 @@ const InvoiceRecord = () =&gt; {
402 416 form={{}}
403 417 dateFormatter="string"
404 418 headerTitle="待开票列表"
405   - scroll={{ x: 2400, y: 500 }}
  419 + scroll={{ x: 2000, y: 500 }}
406 420 />
407 421 {invoiceRecordDetailVisible ? (
408 422 <InvoiceRecordDetailModal
... ...
src/pages/Order/index.tsx
... ... @@ -77,7 +77,7 @@ import {
77 77 } from 'antd';
78 78 import Base64 from 'base-64';
79 79 import { cloneDeep } from 'lodash';
80   -import React, { Key, useEffect, useRef, useState } from 'react';
  80 +import React, { Key, useEffect, useMemo, useRef, useState } from 'react';
81 81 import OrderPrintModal from '../OrderPrint/OrderPrintModal';
82 82 import AfterSalesDrawer from './components/AfterSalesDrawer';
83 83 import ApplyForInvoicingModal from './components/ApplyForInvoicingModal';
... ... @@ -188,7 +188,7 @@ const OrderPage = () =&gt; {
188 188 const [imagesViewerOptType, setImagesViewerOptType] = useState('');
189 189 const [filterCondifion, setFilterCondition] = useState(0);
190 190 const [mainOrderSelectedMap] = useState(new Map()); //选中的主订单Map key:主订单id value:主订单数据
191   - const [subOrderSelectedMap] = useState(new Map()); //选中的子订单Map key:主订单id value:选中的子订单数据集合
  191 + const [subOrderSelectedMap, setSubOrderSelectedMap] = useState(new Map()); //选中的子订单Map key:主订单id value:选中的子订单数据集合
192 192 const [currentOptMainId, setCurrentMainId] = useState<any>(undefined); //当前操作对象的主订单id
193 193 const [curretnOptSubId, setCurretnOptSubId] = useState<any>(undefined); //当前操作对象的子订单id
194 194 const [subOrderCount, setSubOrderCount] = useState(0);
... ... @@ -206,6 +206,18 @@ const OrderPage = () =&gt; {
206 206 const [ids, setIds] = useState([]);
207 207 const [recordOptNode, setRecordOptNode] = useState(null);
208 208 const roleCode = userInfo?.roleSmallVO?.code;
  209 + const canMergeInvoicing = useMemo(() => {
  210 + if (subOrderSelectedMap.size === 0) {
  211 + return false;
  212 + }
  213 + // 检查 value.items 中的每个元素
  214 + console.log(
  215 + 'map' + JSON.stringify([...subOrderSelectedMap.values()].flat()),
  216 + );
  217 + return [...subOrderSelectedMap.values()]
  218 + .flat()
  219 + .every((subItem) => subItem.paths.includes('applyInvoicing_old'));
  220 + }, [selectedSubOrderKeys]);
209 221  
210 222 const triggerRecordOptNode = async (id) => {
211 223 const res = await postServiceOrderGetCurrentOptNode({
... ... @@ -227,12 +239,6 @@ const OrderPage = () =&gt; {
227 239 const exportLoadingDestory = () => {
228 240 messageApi.destroy();
229 241 };
230   - useEffect(() => {
231   - console.log(
232   - 'selectedRows',
233   - selectedRows.every((item) => item.paths.includes('applyInvoicing_old')),
234   - );
235   - }, [selectedRows]);
236 242  
237 243 const refreshTable = () => {
238 244 mainTableRef.current?.reload();
... ... @@ -580,6 +586,7 @@ const OrderPage = () =&gt; {
580 586 mainOrderSelectedMap.set(record.id, record);
581 587 //选中子订单
582 588 subOrderSelectedMap.set(record.id, record.subOrderInformationLists);
  589 + setSubOrderSelectedMap(new Map(subOrderSelectedMap));
583 590  
584 591 //如果所有主订单都勾选上了,那么勾选上总选中按钮
585 592 if (
... ... @@ -2347,7 +2354,7 @@ const OrderPage = () =&gt; {
2347 2354 }
2348 2355  
2349 2356 //如果该主订单已经没有子订单选中,删除key
2350   - if (currentMainOrderSelectedSubOrderList.length === 0) {
  2357 + if (currentMainOrderSelectedSubOrderList?.length === 0) {
2351 2358 subOrderSelectedMap.delete(record.id);
2352 2359 } else {
2353 2360 subOrderSelectedMap.set(
... ... @@ -4322,12 +4329,7 @@ const OrderPage = () =&gt; {
4322 4329 setIsMainOrder(true);
4323 4330 setApplyForInvoicingVisible(true);
4324 4331 }}
4325   - disabled={
4326   - selectedRows.length === 0 ||
4327   - !selectedRows.every((item) =>
4328   - item.paths.includes('applyInvoicing_old'),
4329   - )
4330   - } /*{selectedSubOrderKeys?.length === 0}*/
  4332 + disabled={!canMergeInvoicing} /*{selectedSubOrderKeys?.length === 0}*/
4331 4333 >
4332 4334 {roleCode === 'admin' ? '合并(销售)' : '合并开票'}
4333 4335 </Button>,
... ...
src/pages/procure/components/AddDrawer.tsx
  1 +import { RESPONSE_CODE } from '@/constants/enum';
1 2 import {
2 3 postOrderErpOrderStagesUpload,
  4 + postProcureReturnBillAdd,
3 5 postServiceConstStores,
4 6 } from '@/services';
5 7 import { enumToSelect } from '@/utils';
... ... @@ -13,7 +15,7 @@ import {
13 15 import { Button, Form, message } from 'antd';
14 16 import { RcFile } from 'antd/es/upload';
15 17  
16   -export default () => {
  18 +export default ({ reloadTable }) => {
17 19 const [form] = Form.useForm();
18 20 return (
19 21 <DrawerForm
... ... @@ -33,8 +35,15 @@ export default () =&gt; {
33 35 }}
34 36 submitTimeout={2000}
35 37 onFinish={async (values) => {
36   - console.log(values.name);
  38 + const res = await postProcureReturnBillAdd({
  39 + data: values,
  40 + });
  41 + if (res.result === RESPONSE_CODE.SUCCESS) {
  42 + message.success('新增成功');
  43 + return true;
  44 + }
37 45 message.success('提交成功');
  46 + reloadTable();
38 47 // 不返回不会关闭弹框
39 48 return true;
40 49 }}
... ... @@ -84,7 +93,7 @@ export default () =&gt; {
84 93 ]}
85 94 ></ProFormTextArea>
86 95 <ProFormSelect
87   - name="sendStore"
  96 + name="sendStoreCode"
88 97 label="发货仓库"
89 98 request={async () => {
90 99 const res = await postServiceConstStores();
... ... @@ -106,22 +115,26 @@ export default () =&gt; {
106 115 label="附件"
107 116 name="attachmentsFile"
108 117 action="upload.do"
109   - onChange={({ fileList: newFileList }) => {
110   - if (newFileList.length > 0) {
111   - const formData = new FormData();
112   - formData.append('file', newFileList[0].originFileObj as RcFile);
113   - const res = await postOrderErpOrderStagesUpload({
114   - data: formData,
115   - headers: {
116   - 'Content-Type':
117   - 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq',
118   - },
119   - });
120   - const url = res.data;
121   - form.setFieldValue('attachments', url);
122   - } else {
123   - form.setFieldValue('attachments', null);
124   - }
  118 + onChange={(info) => {
  119 + const uploadFile = async ({ fileList: newFileList }) => {
  120 + if (newFileList.length > 0) {
  121 + const formData = new FormData();
  122 + formData.append('file', newFileList[0].originFileObj as RcFile);
  123 + const res = await postOrderErpOrderStagesUpload({
  124 + data: formData,
  125 + headers: {
  126 + 'Content-Type':
  127 + 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq',
  128 + },
  129 + });
  130 + const url = res.data;
  131 + console.log('attachments' + JSON.stringify(url));
  132 + form.setFieldValue('attachments', url);
  133 + } else {
  134 + form.setFieldValue('attachments', null);
  135 + }
  136 + };
  137 + uploadFile(info);
125 138 }}
126 139 max={1}
127 140 />
... ...