Commit a2a206d0ec262b3fc64d29f79552daad9f956a0d
1 parent
1eedc1b2
chore: 发票核销修改
Showing
2 changed files
with
68 additions
and
56 deletions
src/pages/Invoice/Invoice/components/invoiceWriteOffModal.tsx
@@ -30,17 +30,14 @@ export default ({ getData, triggerButton, readOnly }) => { | @@ -30,17 +30,14 @@ export default ({ getData, triggerButton, readOnly }) => { | ||
30 | { | 30 | { |
31 | title: '发票号码', | 31 | title: '发票号码', |
32 | dataIndex: 'invoiceNumber', | 32 | dataIndex: 'invoiceNumber', |
33 | - ellipsis: true, | ||
34 | }, | 33 | }, |
35 | { | 34 | { |
36 | title: '收款方', | 35 | title: '收款方', |
37 | dataIndex: 'payeeText', | 36 | dataIndex: 'payeeText', |
38 | - ellipsis: true, | ||
39 | }, | 37 | }, |
40 | { | 38 | { |
41 | title: '付款方', | 39 | title: '付款方', |
42 | dataIndex: 'purchaser', | 40 | dataIndex: 'purchaser', |
43 | - ellipsis: true, | ||
44 | }, | 41 | }, |
45 | { | 42 | { |
46 | title: '金额', | 43 | title: '金额', |
@@ -87,17 +84,14 @@ export default ({ getData, triggerButton, readOnly }) => { | @@ -87,17 +84,14 @@ export default ({ getData, triggerButton, readOnly }) => { | ||
87 | { | 84 | { |
88 | title: '流水号', | 85 | title: '流水号', |
89 | dataIndex: 'serialNumber', | 86 | dataIndex: 'serialNumber', |
90 | - ellipsis: true, | ||
91 | }, | 87 | }, |
92 | { | 88 | { |
93 | title: '收款方', | 89 | title: '收款方', |
94 | dataIndex: 'payeeText', | 90 | dataIndex: 'payeeText', |
95 | - ellipsis: true, | ||
96 | }, | 91 | }, |
97 | { | 92 | { |
98 | title: '付款方', | 93 | title: '付款方', |
99 | dataIndex: 'payer', | 94 | dataIndex: 'payer', |
100 | - ellipsis: true, | ||
101 | }, | 95 | }, |
102 | { | 96 | { |
103 | title: '金额', | 97 | title: '金额', |
@@ -110,29 +104,27 @@ export default ({ getData, triggerButton, readOnly }) => { | @@ -110,29 +104,27 @@ export default ({ getData, triggerButton, readOnly }) => { | ||
110 | valueType: 'date', | 104 | valueType: 'date', |
111 | }, | 105 | }, |
112 | ]; | 106 | ]; |
113 | - if (!readOnly) { | ||
114 | - columns.push({ | ||
115 | - title: '操作', | ||
116 | - valueType: 'option', | ||
117 | - width: 200, | ||
118 | - render: (text, record) => [ | ||
119 | - <a | ||
120 | - key="delete" | ||
121 | - onClick={() => { | ||
122 | - const tableDataSource = | ||
123 | - formRef.current?.getFieldValue('bankStatements'); | ||
124 | - console.log(JSON.stringify(tableDataSource)); | ||
125 | - formRef.current?.setFieldValue( | ||
126 | - 'bankStatements', | ||
127 | - tableDataSource.filter((item) => item.id !== record.id), | ||
128 | - ); | ||
129 | - }} | ||
130 | - > | ||
131 | - 删除 | ||
132 | - </a>, | ||
133 | - ], | ||
134 | - }); | ||
135 | - } | 107 | + columns.push({ |
108 | + title: '操作', | ||
109 | + valueType: 'option', | ||
110 | + width: 200, | ||
111 | + render: (text, record) => [ | ||
112 | + <a | ||
113 | + key="delete" | ||
114 | + onClick={() => { | ||
115 | + const tableDataSource = | ||
116 | + formRef.current?.getFieldValue('bankStatements'); | ||
117 | + console.log(JSON.stringify(tableDataSource)); | ||
118 | + formRef.current?.setFieldValue( | ||
119 | + 'bankStatements', | ||
120 | + tableDataSource.filter((item) => item.id !== record.id), | ||
121 | + ); | ||
122 | + }} | ||
123 | + > | ||
124 | + 删除 | ||
125 | + </a>, | ||
126 | + ], | ||
127 | + }); | ||
136 | return columns; | 128 | return columns; |
137 | }; | 129 | }; |
138 | 130 | ||
@@ -161,9 +153,9 @@ export default ({ getData, triggerButton, readOnly }) => { | @@ -161,9 +153,9 @@ export default ({ getData, triggerButton, readOnly }) => { | ||
161 | return getData(); | 153 | return getData(); |
162 | }} | 154 | }} |
163 | /*initialValues={{ | 155 | /*initialValues={{ |
164 | - invoiceWriteOffId:invoiceWriteOffId, | ||
165 | - invoices:originInvoices, | ||
166 | - }}*/ | 156 | + invoiceWriteOffId:invoiceWriteOffId, |
157 | + invoices:originInvoices, | ||
158 | + }}*/ | ||
167 | > | 159 | > |
168 | <ProFormText name={'invoiceWriteOffId'} hidden={true}></ProFormText> | 160 | <ProFormText name={'invoiceWriteOffId'} hidden={true}></ProFormText> |
169 | 161 | ||
@@ -301,30 +293,27 @@ export default ({ getData, triggerButton, readOnly }) => { | @@ -301,30 +293,27 @@ export default ({ getData, triggerButton, readOnly }) => { | ||
301 | recordCreatorProps={false} | 293 | recordCreatorProps={false} |
302 | toolBarRender={() => [ | 294 | toolBarRender={() => [ |
303 | <> | 295 | <> |
304 | - {!readOnly && ( | ||
305 | - <AddBankStatementModal | ||
306 | - getRows={() => formRef.current?.getFieldValue('bankStatements')} | ||
307 | - onFinish={(datas) => { | ||
308 | - const bankStatements = | ||
309 | - formRef.current?.getFieldValue('bankStatements'); | ||
310 | - // 添加非空判断,并处理为空的情况 | ||
311 | - const mergedBankStatements = | ||
312 | - bankStatements && Array.isArray(bankStatements) | ||
313 | - ? bankStatements | ||
314 | - : []; | ||
315 | - const mergedDatas = | ||
316 | - datas && Array.isArray(datas) ? datas : []; | ||
317 | - let res = [...mergedBankStatements, ...mergedDatas]; | ||
318 | - //对res 进行去重处理,根据id去重 | ||
319 | - const resMap = new Map(); | ||
320 | - res.forEach((item) => { | ||
321 | - resMap.set(item.id, item); | ||
322 | - }); | ||
323 | - res = Array.from(resMap.values()); | ||
324 | - formRef.current?.setFieldValue('bankStatements', res); | ||
325 | - }} | ||
326 | - /> | ||
327 | - )} | 296 | + <AddBankStatementModal |
297 | + getRows={() => formRef.current?.getFieldValue('bankStatements')} | ||
298 | + onFinish={(datas) => { | ||
299 | + const bankStatements = | ||
300 | + formRef.current?.getFieldValue('bankStatements'); | ||
301 | + // 添加非空判断,并处理为空的情况 | ||
302 | + const mergedBankStatements = | ||
303 | + bankStatements && Array.isArray(bankStatements) | ||
304 | + ? bankStatements | ||
305 | + : []; | ||
306 | + const mergedDatas = datas && Array.isArray(datas) ? datas : []; | ||
307 | + let res = [...mergedBankStatements, ...mergedDatas]; | ||
308 | + //对res 进行去重处理,根据id去重 | ||
309 | + const resMap = new Map(); | ||
310 | + res.forEach((item) => { | ||
311 | + resMap.set(item.id, item); | ||
312 | + }); | ||
313 | + res = Array.from(resMap.values()); | ||
314 | + formRef.current?.setFieldValue('bankStatements', res); | ||
315 | + }} | ||
316 | + /> | ||
328 | </>, | 317 | </>, |
329 | ]} | 318 | ]} |
330 | columns={getBankStatementColumns()} | 319 | columns={getBankStatementColumns()} |
src/pages/Invoice/InvoiceVerification/index.tsx
1 | import ButtonConfirm from '@/components/ButtomConfirm'; | 1 | import ButtonConfirm from '@/components/ButtomConfirm'; |
2 | import EllipsisDiv from '@/components/Div/EllipsisDiv'; | 2 | import EllipsisDiv from '@/components/Div/EllipsisDiv'; |
3 | import { RESPONSE_CODE } from '@/constants/enum'; | 3 | import { RESPONSE_CODE } from '@/constants/enum'; |
4 | +import InvoiceWriteOffModal from '@/pages/Invoice/Invoice/components/invoiceWriteOffModal'; | ||
4 | import BankImportModal from '@/pages/Invoice/InvoiceVerification/components/BankImportModal'; | 5 | import BankImportModal from '@/pages/Invoice/InvoiceVerification/components/BankImportModal'; |
5 | import InvoiceRecordDetailModal from '@/pages/Invoice/InvoiceVerification/components/InvoiceRecordDetailModal'; | 6 | import InvoiceRecordDetailModal from '@/pages/Invoice/InvoiceVerification/components/InvoiceRecordDetailModal'; |
6 | import InvoiceVerificationModal from '@/pages/Invoice/InvoiceVerification/components/InvoiceVerificationModal'; | 7 | import InvoiceVerificationModal from '@/pages/Invoice/InvoiceVerification/components/InvoiceVerificationModal'; |
@@ -13,6 +14,7 @@ import { | @@ -13,6 +14,7 @@ import { | ||
13 | postServiceBankStatementDeleteBankStatement, | 14 | postServiceBankStatementDeleteBankStatement, |
14 | postServiceBankStatementEditBankStatement, | 15 | postServiceBankStatementEditBankStatement, |
15 | postServiceBankStatementQueryBankStatement, | 16 | postServiceBankStatementQueryBankStatement, |
17 | + postServiceInvoiceGetWriteOffRecord, | ||
16 | } from '@/services'; | 18 | } from '@/services'; |
17 | import { enumValueToLabel, formatDateTime } from '@/utils'; | 19 | import { enumValueToLabel, formatDateTime } from '@/utils'; |
18 | import { formatDate } from '@/utils/time'; | 20 | import { formatDate } from '@/utils/time'; |
@@ -133,6 +135,27 @@ const InvoiceRecord = () => { | @@ -133,6 +135,27 @@ const InvoiceRecord = () => { | ||
133 | ); | 135 | ); |
134 | } | 136 | } |
135 | 137 | ||
138 | + if (record.writeOffId !== null) { | ||
139 | + btns.push( | ||
140 | + <InvoiceWriteOffModal | ||
141 | + getData={async () => { | ||
142 | + const res = await postServiceInvoiceGetWriteOffRecord({ | ||
143 | + data: { id: record.writeOffId }, | ||
144 | + }); | ||
145 | + const data = res.data; | ||
146 | + return { | ||
147 | + invoiceWriteOffId: data.id, | ||
148 | + invoices: data.invoiceDtos, | ||
149 | + bankStatements: data.bankStatementDtos, | ||
150 | + }; | ||
151 | + }} | ||
152 | + key="writeOff" | ||
153 | + triggerButton={<Button type="link">核销记录</Button>} | ||
154 | + readOnly={true} | ||
155 | + />, | ||
156 | + ); | ||
157 | + } | ||
158 | + | ||
136 | if (record.paths?.includes('deleteBankStatement')) { | 159 | if (record.paths?.includes('deleteBankStatement')) { |
137 | btns.push( | 160 | btns.push( |
138 | <ButtonConfirm | 161 | <ButtonConfirm |