Commit a2a206d0ec262b3fc64d29f79552daad9f956a0d

Authored by 曾国涛
1 parent 1eedc1b2

chore: 发票核销修改

src/pages/Invoice/Invoice/components/invoiceWriteOffModal.tsx
... ... @@ -30,17 +30,14 @@ export default ({ getData, triggerButton, readOnly }) => {
30 30 {
31 31 title: '发票号码',
32 32 dataIndex: 'invoiceNumber',
33   - ellipsis: true,
34 33 },
35 34 {
36 35 title: '收款方',
37 36 dataIndex: 'payeeText',
38   - ellipsis: true,
39 37 },
40 38 {
41 39 title: '付款方',
42 40 dataIndex: 'purchaser',
43   - ellipsis: true,
44 41 },
45 42 {
46 43 title: '金额',
... ... @@ -87,17 +84,14 @@ export default ({ getData, triggerButton, readOnly }) => {
87 84 {
88 85 title: '流水号',
89 86 dataIndex: 'serialNumber',
90   - ellipsis: true,
91 87 },
92 88 {
93 89 title: '收款方',
94 90 dataIndex: 'payeeText',
95   - ellipsis: true,
96 91 },
97 92 {
98 93 title: '付款方',
99 94 dataIndex: 'payer',
100   - ellipsis: true,
101 95 },
102 96 {
103 97 title: '金额',
... ... @@ -110,29 +104,27 @@ export default ({ getData, triggerButton, readOnly }) => {
110 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 128 return columns;
137 129 };
138 130  
... ... @@ -161,9 +153,9 @@ export default ({ getData, triggerButton, readOnly }) =&gt; {
161 153 return getData();
162 154 }}
163 155 /*initialValues={{
164   - invoiceWriteOffId:invoiceWriteOffId,
165   - invoices:originInvoices,
166   - }}*/
  156 + invoiceWriteOffId:invoiceWriteOffId,
  157 + invoices:originInvoices,
  158 + }}*/
167 159 >
168 160 <ProFormText name={'invoiceWriteOffId'} hidden={true}></ProFormText>
169 161  
... ... @@ -301,30 +293,27 @@ export default ({ getData, triggerButton, readOnly }) =&gt; {
301 293 recordCreatorProps={false}
302 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 319 columns={getBankStatementColumns()}
... ...
src/pages/Invoice/InvoiceVerification/index.tsx
1 1 import ButtonConfirm from '@/components/ButtomConfirm';
2 2 import EllipsisDiv from '@/components/Div/EllipsisDiv';
3 3 import { RESPONSE_CODE } from '@/constants/enum';
  4 +import InvoiceWriteOffModal from '@/pages/Invoice/Invoice/components/invoiceWriteOffModal';
4 5 import BankImportModal from '@/pages/Invoice/InvoiceVerification/components/BankImportModal';
5 6 import InvoiceRecordDetailModal from '@/pages/Invoice/InvoiceVerification/components/InvoiceRecordDetailModal';
6 7 import InvoiceVerificationModal from '@/pages/Invoice/InvoiceVerification/components/InvoiceVerificationModal';
... ... @@ -13,6 +14,7 @@ import {
13 14 postServiceBankStatementDeleteBankStatement,
14 15 postServiceBankStatementEditBankStatement,
15 16 postServiceBankStatementQueryBankStatement,
  17 + postServiceInvoiceGetWriteOffRecord,
16 18 } from '@/services';
17 19 import { enumValueToLabel, formatDateTime } from '@/utils';
18 20 import { formatDate } from '@/utils/time';
... ... @@ -133,6 +135,27 @@ const InvoiceRecord = () =&gt; {
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 159 if (record.paths?.includes('deleteBankStatement')) {
137 160 btns.push(
138 161 <ButtonConfirm
... ...