Commit 349f730f7f872e0ff37da1bf6270dc32b26c2bdd

Authored by zhongnanhuang
1 parent 1d87cfcc

feat: update 发票对账

src/pages/Invoice/components/BankChooseModal.tsx
@@ -14,7 +14,6 @@ import { useRef, useState } from 'react'; @@ -14,7 +14,6 @@ import { useRef, useState } from 'react';
14 import { BANK_STATEMENT_COLUMNS, INVOICE_STATUS } from '../constant'; 14 import { BANK_STATEMENT_COLUMNS, INVOICE_STATUS } from '../constant';
15 import '../index.less'; 15 import '../index.less';
16 export default ({ invoiceId, setVisible, onClose }) => { 16 export default ({ invoiceId, setVisible, onClose }) => {
17 - const [bankData, setBankData] = useState([]);  
18 const [selectedStatement, setSelectedStatement] = useState([]); 17 const [selectedStatement, setSelectedStatement] = useState([]);
19 const [selectedStatementIdSet, setSelectedStatementIdSet] = useState( 18 const [selectedStatementIdSet, setSelectedStatementIdSet] = useState(
20 new Set(), 19 new Set(),
@@ -154,21 +153,17 @@ export default ({ invoiceId, setVisible, onClose }) => { @@ -154,21 +153,17 @@ export default ({ invoiceId, setVisible, onClose }) => {
154 return columns; 153 return columns;
155 }; 154 };
156 155
  156 + /**
  157 + * 删除已选中
  158 + * @param record
  159 + */
157 const removeSelectedStatement = (record: any) => { 160 const removeSelectedStatement = (record: any) => {
158 - console.log(record);  
159 - console.log(selectedStatement);  
160 - console.log(bankData);  
161 -  
162 - //在已选中区域中移除  
163 - let newSelectedStatement = selectedStatement.filter((item) => {  
164 - return item.id !== record.id;  
165 - });  
166 - setSelectedStatement(newSelectedStatement);  
167 -  
168 - //将数据添加回到表格中  
169 - let newBankData = [...bankData];  
170 - newBankData.push(record);  
171 - setBankData(newBankData); 161 + setSelectedStatement(
  162 + selectedStatement.filter((item) => {
  163 + return item.id !== record.id;
  164 + }),
  165 + );
  166 + removeElement(record.id);
172 }; 167 };
173 168
174 const showSelectedStatement = () => { 169 const showSelectedStatement = () => {
@@ -217,7 +212,7 @@ export default ({ invoiceId, setVisible, onClose }) => { @@ -217,7 +212,7 @@ export default ({ invoiceId, setVisible, onClose }) => {
217 }); 212 });
218 213
219 if (res.result === RESPONSE_CODE.SUCCESS) { 214 if (res.result === RESPONSE_CODE.SUCCESS) {
220 - message.info(res.message); 215 + message.success(res.message);
221 onClose(); 216 onClose();
222 } 217 }
223 218
@@ -258,7 +253,7 @@ export default ({ invoiceId, setVisible, onClose }) => { @@ -258,7 +253,7 @@ export default ({ invoiceId, setVisible, onClose }) => {
258 }} 253 }}
259 request={async (params) => { 254 request={async (params) => {
260 const res = await postServiceBankStatementQueryBankStatement({ 255 const res = await postServiceBankStatementQueryBankStatement({
261 - data: { ...params }, 256 + data: { ...params, status: 'ABNORMAL' },
262 }); 257 });
263 if (res) { 258 if (res) {
264 return { 259 return {
src/pages/Invoice/components/InvoiceVerificationModal.tsx
@@ -244,71 +244,6 @@ export default ({ invoiceId, setVisible, onClose }) => { @@ -244,71 +244,6 @@ export default ({ invoiceId, setVisible, onClose }) => {
244 return columns; 244 return columns;
245 }; 245 };
246 246
247 - /**  
248 - * 银行流水表  
249 - * @param param0  
250 - * @returns  
251 - */  
252 - const BankTable = ({ actionRef = undefined }) => {  
253 - return (  
254 - <ProTable  
255 - columns={bankStatementColumnsInit()}  
256 - actionRef={actionRef}  
257 - cardBordered  
258 - pagination={{  
259 - pageSize: 10,  
260 - }}  
261 - dataSource={relationBankStatements}  
262 - columnsState={{  
263 - persistenceKey: 'pro-table-singe-demos',  
264 - persistenceType: 'localStorage',  
265 - defaultValue: {  
266 - option: { fixed: 'right', disable: true },  
267 - },  
268 - onChange(value) {  
269 - console.log('value: ', value);  
270 - },  
271 - }}  
272 - rowKey="id"  
273 - search={false}  
274 - options={{  
275 - setting: {  
276 - listsHeight: 400,  
277 - },  
278 - reload: false,  
279 - }}  
280 - form={{  
281 - // 由于配置了 transform,提交的参与与定义的不同这里需要转化一下  
282 - syncToUrl: (values, type) => {  
283 - if (type === 'get') {  
284 - return {  
285 - ...values,  
286 - created_at: [values.startTime, values.endTime],  
287 - };  
288 - }  
289 - return values;  
290 - },  
291 - }}  
292 - dateFormatter="string"  
293 - headerTitle="银行流水"  
294 - scroll={{ x: 1400, y: 360 }}  
295 - toolBarRender={() => [  
296 - <Button  
297 - key="button"  
298 - icon={<PlusOutlined />}  
299 - onClick={() => {  
300 - setBankChooseModalVisible(true);  
301 - }}  
302 - hidden={invoiceInfo?.status === 'VERIFIED'}  
303 - type="primary"  
304 - >  
305 - 添加  
306 - </Button>,  
307 - ]}  
308 - />  
309 - );  
310 - };  
311 -  
312 useEffect(() => { 247 useEffect(() => {
313 loadInvoiceData(); 248 loadInvoiceData();
314 }, []); 249 }, []);
@@ -361,7 +296,60 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; { @@ -361,7 +296,60 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; {
361 296
362 <Divider plain></Divider> 297 <Divider plain></Divider>
363 298
364 - <BankTable></BankTable> 299 + <ProTable
  300 + columns={bankStatementColumnsInit()}
  301 + cardBordered
  302 + pagination={{
  303 + pageSize: 10,
  304 + }}
  305 + dataSource={relationBankStatements}
  306 + columnsState={{
  307 + persistenceKey: 'pro-table-singe-demos',
  308 + persistenceType: 'localStorage',
  309 + defaultValue: {
  310 + option: { fixed: 'right', disable: true },
  311 + },
  312 + onChange(value) {
  313 + console.log('value: ', value);
  314 + },
  315 + }}
  316 + rowKey="id"
  317 + search={false}
  318 + options={{
  319 + setting: {
  320 + listsHeight: 400,
  321 + },
  322 + reload: false,
  323 + }}
  324 + form={{
  325 + // 由于配置了 transform,提交的参与与定义的不同这里需要转化一下
  326 + syncToUrl: (values, type) => {
  327 + if (type === 'get') {
  328 + return {
  329 + ...values,
  330 + created_at: [values.startTime, values.endTime],
  331 + };
  332 + }
  333 + return values;
  334 + },
  335 + }}
  336 + dateFormatter="string"
  337 + headerTitle="银行流水"
  338 + scroll={{ x: 1400, y: 360 }}
  339 + toolBarRender={() => [
  340 + <Button
  341 + key="button"
  342 + icon={<PlusOutlined />}
  343 + onClick={() => {
  344 + setBankChooseModalVisible(true);
  345 + }}
  346 + hidden={invoiceInfo?.status === 'VERIFIED'}
  347 + type="primary"
  348 + >
  349 + 添加
  350 + </Button>,
  351 + ]}
  352 + />
365 </ModalForm> 353 </ModalForm>
366 354
367 {bankChooseModalVisible ? ( 355 {bankChooseModalVisible ? (
src/pages/Invoice/index.tsx
@@ -265,142 +265,124 @@ const InvoicePage = () =&gt; { @@ -265,142 +265,124 @@ const InvoicePage = () =&gt; {
265 return columns; 265 return columns;
266 }; 266 };
267 267
268 - /**  
269 - * 发票表  
270 - * @param param0  
271 - * @returns  
272 - */  
273 - const InvoiceTable = ({ actionRef = undefined }) => {  
274 - return (  
275 - <ProTable  
276 - columns={invoicecColumnsInit()}  
277 - actionRef={actionRef}  
278 - cardBordered  
279 - pagination={{  
280 - pageSize: 10,  
281 - }}  
282 - request={async (params) => {  
283 - const res = await postServiceInvoiceQueryInvoice({  
284 - data: { ...params },  
285 - });  
286 - if (res) {  
287 - return {  
288 - data: res?.data?.data || [],  
289 - total: res?.data?.total || 0,  
290 - };  
291 - }  
292 - }}  
293 - columnsState={{  
294 - persistenceKey: 'pro-table-singe-demos',  
295 - persistenceType: 'localStorage',  
296 - defaultValue: {  
297 - option: { fixed: 'right', disable: true },  
298 - },  
299 - onChange(value) {  
300 - console.log('value: ', value);  
301 - },  
302 - }}  
303 - rowKey="id"  
304 - search={{  
305 - labelWidth: 'auto',  
306 - }}  
307 - options={{  
308 - setting: {  
309 - listsHeight: 400,  
310 - },  
311 - }}  
312 - form={{}}  
313 - dateFormatter="string"  
314 - headerTitle="发票列表"  
315 - scroll={{ x: 1400, y: 360 }}  
316 - />  
317 - );  
318 - };  
319 -  
320 - /**  
321 - * 银行流水表  
322 - * @param param0  
323 - * @returns  
324 - */  
325 - const BankTable = ({ actionRef = undefined }) => {  
326 - return (  
327 - <ProTable  
328 - columns={bankStatemetColumnsInit()}  
329 - actionRef={actionRef}  
330 - cardBordered  
331 - pagination={{  
332 - pageSize: 10,  
333 - }}  
334 - editable={{  
335 - type: 'multiple',  
336 - onSave: async (rowKey, data) => {  
337 - await postServiceBankStatementEditBankStatement({ data: data });  
338 - },  
339 - actionRender: (row, config, defaultDom) => [  
340 - defaultDom.save,  
341 - defaultDom.cancel,  
342 - ],  
343 - }}  
344 - request={async (params) => {  
345 - const res = await postServiceBankStatementQueryBankStatement({  
346 - data: { ...params },  
347 - });  
348 - if (res) {  
349 - return {  
350 - data: res?.data?.data || [],  
351 - total: res?.data?.total || 0,  
352 - };  
353 - }  
354 - }}  
355 - columnsState={{  
356 - persistenceKey: 'pro-table-singe-demos',  
357 - persistenceType: 'localStorage',  
358 - defaultValue: {  
359 - option: { fixed: 'right', disable: true },  
360 - },  
361 - onChange(value) {  
362 - console.log('value: ', value);  
363 - },  
364 - }}  
365 - rowKey="id"  
366 - search={{  
367 - labelWidth: 'auto',  
368 - }}  
369 - options={{  
370 - setting: {  
371 - listsHeight: 400,  
372 - },  
373 - }}  
374 - form={{}}  
375 - dateFormatter="string"  
376 - headerTitle="银行流水列表"  
377 - scroll={{ x: 1400, y: 360 }}  
378 - toolBarRender={() => [  
379 - <Button  
380 - key="button"  
381 - icon={<PlusOutlined />}  
382 - onClick={() => {  
383 - setBankImportModalVisible(true);  
384 - }}  
385 - type="primary"  
386 - >  
387 - 导入  
388 - </Button>,  
389 - ]}  
390 - />  
391 - );  
392 - };  
393 -  
394 const tabsItems = [ 268 const tabsItems = [
395 { 269 {
396 key: 1, 270 key: 1,
397 label: '发票管理', 271 label: '发票管理',
398 - children: <InvoiceTable actionRef={invoiceActionRef} />, 272 + children: (
  273 + <ProTable
  274 + columns={invoicecColumnsInit()}
  275 + actionRef={invoiceActionRef}
  276 + cardBordered
  277 + pagination={{
  278 + pageSize: 10,
  279 + }}
  280 + request={async (params) => {
  281 + const res = await postServiceInvoiceQueryInvoice({
  282 + data: { ...params },
  283 + });
  284 + if (res) {
  285 + return {
  286 + data: res?.data?.data || [],
  287 + total: res?.data?.total || 0,
  288 + };
  289 + }
  290 + }}
  291 + columnsState={{
  292 + persistenceKey: 'pro-table-singe-demos',
  293 + persistenceType: 'localStorage',
  294 + defaultValue: {
  295 + option: { fixed: 'right', disable: true },
  296 + },
  297 + onChange(value) {
  298 + console.log('value: ', value);
  299 + },
  300 + }}
  301 + rowKey="id"
  302 + search={{
  303 + labelWidth: 'auto',
  304 + }}
  305 + options={{
  306 + setting: {
  307 + listsHeight: 400,
  308 + },
  309 + }}
  310 + form={{}}
  311 + dateFormatter="string"
  312 + headerTitle="发票列表"
  313 + scroll={{ x: 1400, y: 360 }}
  314 + />
  315 + ),
399 }, 316 },
400 { 317 {
401 key: 2, 318 key: 2,
402 label: '银行流水', 319 label: '银行流水',
403 - children: <BankTable actionRef={bankActionRef} />, 320 + children: (
  321 + <ProTable
  322 + columns={bankStatemetColumnsInit()}
  323 + actionRef={bankActionRef}
  324 + cardBordered
  325 + pagination={{
  326 + pageSize: 10,
  327 + }}
  328 + editable={{
  329 + type: 'multiple',
  330 + onSave: async (rowKey, data) => {
  331 + await postServiceBankStatementEditBankStatement({ data: data });
  332 + },
  333 + actionRender: (row, config, defaultDom) => [
  334 + defaultDom.save,
  335 + defaultDom.cancel,
  336 + ],
  337 + }}
  338 + request={async (params) => {
  339 + const res = await postServiceBankStatementQueryBankStatement({
  340 + data: { ...params },
  341 + });
  342 + if (res) {
  343 + return {
  344 + data: res?.data?.data || [],
  345 + total: res?.data?.total || 0,
  346 + };
  347 + }
  348 + }}
  349 + columnsState={{
  350 + persistenceKey: 'pro-table-singe-demos',
  351 + persistenceType: 'localStorage',
  352 + defaultValue: {
  353 + option: { fixed: 'right', disable: true },
  354 + },
  355 + onChange(value) {
  356 + console.log('value: ', value);
  357 + },
  358 + }}
  359 + rowKey="id"
  360 + search={{
  361 + labelWidth: 'auto',
  362 + }}
  363 + options={{
  364 + setting: {
  365 + listsHeight: 400,
  366 + },
  367 + }}
  368 + form={{}}
  369 + dateFormatter="string"
  370 + headerTitle="银行流水列表"
  371 + scroll={{ x: 1400, y: 360 }}
  372 + toolBarRender={() => [
  373 + <Button
  374 + key="button"
  375 + icon={<PlusOutlined />}
  376 + onClick={() => {
  377 + setBankImportModalVisible(true);
  378 + }}
  379 + type="primary"
  380 + >
  381 + 导入
  382 + </Button>,
  383 + ]}
  384 + />
  385 + ),
404 }, 386 },
405 ]; 387 ];
406 return ( 388 return (