1
import ButtonConfirm from '@/components/ButtomConfirm';
2
import EllipsisDiv from '@/components/Div/EllipsisDiv';
3
import { RESPONSE_CODE } from '@/constants/enum';
曾国涛
authored
about a year ago
4
import AddInvoiceDrawerForm from '@/pages/Invoice/components/AddInvoiceDrawerForm';
曾国涛
authored
about a year ago
5
6
import InvoiceModal from '@/pages/Invoice/components/InvoiceModal';
import InvoiceRecordDetailModal from '@/pages/Invoice/components/InvoiceRecordDetailModal';
曾国涛
authored
about a year ago
7
import InvoicingModal from '@/pages/Invoice/components/InvoicingModal';
8
import {
9
10
11
12
13
14
BANK_STATEMENT_COLUMNS,
INVOICE_COLUMNS,
INVOICE_STATUS,
} from '@/pages/Invoice/constant';
import {
postServiceBankStatementDeleteBankStatement,
15
postServiceBankStatementEditBankStatement,
16
postServiceBankStatementQueryBankStatement,
曾国涛
authored
about a year ago
17
postServiceConstAfterInvoicingInvoiceRecordStatus,
曾国涛
authored
about a year ago
18
postServiceConstBeforeInvoicingInvoiceRecordStatus,
曾国涛
authored
about a year ago
19
20
postServiceConstInvoiceType,
postServiceConstInvoicingType,
21
postServiceInvoiceDeleteInvoice,
曾国涛
authored
about a year ago
22
postServiceInvoiceInvoicing,
23
postServiceInvoiceQueryInvoice,
曾国涛
authored
about a year ago
24
25
postServiceInvoiceQueryInvoiceRecordList,
postServiceOrderQuerySalesCode,
26
} from '@/services';
曾国涛
authored
about a year ago
27
import { excelExport } from '@/services/exportRequest';
曾国涛
authored
about a year ago
28
29
import {
enumToProTableEnumValue,
曾国涛
authored
about a year ago
30
enumToSelect,
曾国涛
authored
about a year ago
31
32
33
enumValueToLabel,
formatDateTime,
} from '@/utils';
34
import { formatDate } from '@/utils/time';
35
import { PlusOutlined } from '@ant-design/icons';
曾国涛
authored
about a year ago
36
import { ActionType, ModalForm, ProTable } from '@ant-design/pro-components';
曾国涛
authored
about a year ago
37
import { Button, Space, Table, Tabs, message } from 'antd';
曾国涛
authored
about a year ago
38
import { useEffect, useRef, useState } from 'react';
39
import { INVOCING_STATUS, PAYEE_OPTIONS } from '../Order/constant';
40
import BankImportModal from './components/BankImportModal';
41
import InvoiceVerificationModal from './components/InvoiceVerificationModal';
42
import './index.less';
曾国涛
authored
about a year ago
43
44
45
46
const InvoicePage = () => {
const invoiceActionRef = useRef<ActionType>();
const bankActionRef = useRef<ActionType>();
曾国涛
authored
about a year ago
47
const waitDealrecordActionRef = useRef<ActionType>();
曾国涛
authored
about a year ago
48
const processedRecordRef = useRef<ActionType>();
曾国涛
authored
about a year ago
49
50
51
const [invoiceTypeValueEnum, setInvoiceTypeValueEnum] = useState({});
const [invoicingTypeValueEnum, setInvoicingTypeValueEnum] = useState({});
const [salesCodeValueEnum, setSalesCodeValueEnum] = useState({});
52
const [bankImportModalVisible, setBankImportModalVisible] = useState(false);
53
54
55
const [invoiceVerificationVisible, setInvoiceVerificationVisible] =
useState(false);
const [invoiceId, setInvoiceId] = useState(undefined);
曾国涛
authored
about a year ago
56
57
58
const [invoiceRecordDetailVisible, setInvoiceRecordDetailVisible] =
useState(false);
const [invoiceRecord, setInvoiceRecord] = useState({});
曾国涛
authored
about a year ago
59
const [messageApi] = message.useMessage();
60
曾国涛
authored
about a year ago
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
useEffect(() => {
async function extracted() {
let invoiceTypeRet = await postServiceConstInvoiceType();
setInvoiceTypeValueEnum(invoiceTypeRet.data);
}
extracted().catch(console.error);
}, []);
useEffect(() => {
async function extracted() {
let invoicingTypeRet = await postServiceConstInvoicingType();
setInvoicingTypeValueEnum(invoicingTypeRet.data);
}
extracted().catch(console.error);
}, []);
useEffect(() => {
async function extracted() {
const res = await postServiceOrderQuerySalesCode();
let map = {};
res.data?.forEach((item) => {
map[item.userName] = {
text: item.userName,
status: item.userName,
};
});
setSalesCodeValueEnum(map);
}
extracted().catch(console.error);
曾国涛
authored
about a year ago
91
92
}, []);
93
94
95
96
97
98
const reloadInvoiceTable = () => {
invoiceActionRef.current?.reload();
};
const reloadBankStatementTable = () => {
bankActionRef.current?.reload();
99
};
曾国涛
authored
about a year ago
100
101
102
103
const reloadRecordTable = () => {
waitDealrecordActionRef.current?.reload();
processedRecordRef.current?.reload();
};
104
105
106
107
108
const getTableCellText = (target: any) => {
if (!target) {
return '';
}
109
110
111
112
if (target.props) {
return target.props.text;
}
113
114
115
return target;
};
116
曾国涛
authored
about a year ago
117
118
119
120
const waitDealRecordColumns = [
{
dataIndex: 'index',
valueType: 'indexBorder',
曾国涛
authored
about a year ago
121
hideInSearch: true,
曾国涛
authored
about a year ago
122
ellipsis: true,
曾国涛
authored
about a year ago
123
124
125
width: 48,
},
{
曾国涛
authored
about a year ago
126
title: '开票编号',
曾国涛
authored
about a year ago
127
128
129
valueType: 'text',
dataIndex: 'id',
copyable: true,
曾国涛
authored
about a year ago
130
hideInSearch: true,
曾国涛
authored
about a year ago
131
132
ellipsis: true,
width: 100,
曾国涛
authored
about a year ago
133
134
},
{
曾国涛
authored
about a year ago
135
136
137
title: '发票状态',
valueType: 'Text',
dataIndex: 'statusText',
曾国涛
authored
about a year ago
138
ellipsis: true,
曾国涛
authored
about a year ago
139
140
141
hideInSearch: true,
},
{
曾国涛
authored
about a year ago
142
143
144
145
title: '申请开票时间',
dataIndex: 'createTime',
valueType: 'dateTime',
hideInSearch: true,
曾国涛
authored
about a year ago
146
ellipsis: true,
曾国涛
authored
about a year ago
147
148
},
{
曾国涛
authored
about a year ago
149
title: '销售代表',
曾国涛
authored
about a year ago
150
valueType: 'text',
曾国涛
authored
about a year ago
151
hideInSearch: true,
曾国涛
authored
about a year ago
152
ellipsis: true,
曾国涛
authored
about a year ago
153
dataIndex: 'createByName',
曾国涛
authored
about a year ago
154
155
156
157
158
},
{
title: '购方名称',
valueType: 'text',
dataIndex: 'partyAName',
曾国涛
authored
about a year ago
159
hideInSearch: true,
曾国涛
authored
about a year ago
160
ellipsis: true,
曾国涛
authored
about a year ago
161
162
163
164
},
{
title: '购方税号',
valueType: 'text',
曾国涛
authored
about a year ago
165
hideInSearch: true,
曾国涛
authored
about a year ago
166
dataIndex: 'partyATaxid',
曾国涛
authored
about a year ago
167
ellipsis: true,
曾国涛
authored
about a year ago
168
169
170
171
},
{
title: '收款单位',
valueType: 'text',
曾国涛
authored
about a year ago
172
hideInSearch: true,
曾国涛
authored
about a year ago
173
dataIndex: 'partyBName',
曾国涛
authored
about a year ago
174
ellipsis: true,
曾国涛
authored
about a year ago
175
176
177
178
179
},
{
title: '开票金额',
valueType: 'money',
dataIndex: 'price',
曾国涛
authored
about a year ago
180
hideInSearch: true,
曾国涛
authored
about a year ago
181
ellipsis: true,
曾国涛
authored
about a year ago
182
183
184
185
186
187
},
{
title: '开具类型',
valueType: 'Text',
dataIndex: 'invoicingTypeText',
hideInSearch: true,
曾国涛
authored
about a year ago
188
ellipsis: true,
曾国涛
authored
about a year ago
189
190
191
192
193
},
{
title: '发票类型',
valueType: 'Text',
dataIndex: 'typeText',
曾国涛
authored
about a year ago
194
hideInSearch: true,
曾国涛
authored
about a year ago
195
ellipsis: true,
曾国涛
authored
about a year ago
196
197
198
199
200
201
},
{
title: '是否加急',
valueType: 'Text',
dataIndex: 'isUrgentText',
hideInSearch: true,
曾国涛
authored
about a year ago
202
ellipsis: true,
曾国涛
authored
about a year ago
203
},
曾国涛
authored
about a year ago
204
205
206
207
208
209
210
{
title: '申请备注',
valueType: 'text',
dataIndex: 'applyInvoicingNotes',
hideInSearch: true,
ellipsis: true,
},
曾国涛
authored
about a year ago
211
{
曾国涛
authored
about a year ago
212
213
214
215
216
217
218
title: '购方名称',
valueType: 'Text',
dataIndex: 'partyANameLike',
hideInTable: true,
},
{
title: '收款单位',
曾国涛
authored
about a year ago
219
valueType: 'select',
曾国涛
authored
about a year ago
220
dataIndex: 'partyB',
曾国涛
authored
about a year ago
221
222
223
filters: true,
onFilter: true,
hideInTable: true,
曾国涛
authored
about a year ago
224
valueEnum: enumToProTableEnumValue(PAYEE_OPTIONS),
曾国涛
authored
about a year ago
225
226
},
{
曾国涛
authored
about a year ago
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
title: '主订单号',
valueType: 'Text',
dataIndex: 'mainOrderId',
hideInTable: true,
},
{
title: '子订单号',
valueType: 'Text',
dataIndex: 'subOrderId',
hideInTable: true,
},
{
title: '销售代表',
valueType: 'select',
dataIndex: 'salesCode',
filters: true,
onFilter: true,
hideInTable: true,
valueEnum: salesCodeValueEnum,
},
{
title: '发票类型',
valueType: 'select',
dataIndex: 'type',
filters: true,
onFilter: true,
hideInTable: true,
valueEnum: enumToProTableEnumValue(invoiceTypeValueEnum),
},
{
title: '开具类型',
valueType: 'select',
dataIndex: 'invoicingType',
filters: true,
onFilter: true,
hideInTable: true,
valueEnum: enumToProTableEnumValue(invoicingTypeValueEnum),
},
{
曾国涛
authored
about a year ago
266
267
268
269
270
271
272
273
274
275
276
277
title: '开票状态',
valueType: 'select',
dataIndex: 'status',
filters: true,
onFilter: true,
hideInTable: true,
request: async () => {
const res = await postServiceConstBeforeInvoicingInvoiceRecordStatus();
return enumToSelect(res.data);
},
},
{
曾国涛
authored
about a year ago
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
title: '是否加急',
valueType: 'select',
dataIndex: 'isUrgent',
filters: true,
onFilter: true,
hideInTable: true,
valueEnum: {
true: {
text: '是',
status: true,
},
false: {
text: '否',
status: false,
},
},
},
{
title: '申请开票时间',
dataIndex: 'createTime',
valueType: 'dateRange',
width: 200,
hideInTable: true,
search: {
transform: (value) => {
if (value) {
return {
createTimeGe: value[0],
createTimeLe: value[1],
};
}
},
},
},
曾国涛
authored
about a year ago
312
{
曾国涛
authored
about a year ago
313
314
315
title: '操作',
valueType: 'option',
key: 'option',
曾国涛
authored
about a year ago
316
317
render: (text, record) => {
return [
曾国涛
authored
about a year ago
318
/*<InvoiceRecordDetailModal
曾国涛
authored
about a year ago
319
320
321
key="detail"
id={record.id}
subOrderIds={record.subOrderIds}
曾国涛
authored
about a year ago
322
323
324
325
326
327
328
329
330
331
332
333
334
335
onClose={()=>{
waitDealrecordActionRef.current?.reload();
}
}
/>*/
<a
key="detail"
onClick={() => {
setInvoiceRecordDetailVisible(true);
setInvoiceRecord(record);
}}
>
详情
</a>,
曾国涛
authored
about a year ago
336
337
338
<InvoiceModal key="invoiceModal" recordId={record.id} />,
];
},
曾国涛
authored
about a year ago
339
340
341
342
343
344
345
346
347
},
];
const processedRecordColumns = [
{
dataIndex: 'index',
valueType: 'indexBorder',
},
{
曾国涛
authored
about a year ago
348
title: '开票编号',
曾国涛
authored
about a year ago
349
350
351
valueType: 'text',
dataIndex: 'id',
copyable: true,
曾国涛
authored
about a year ago
352
ellipsis: true,
曾国涛
authored
about a year ago
353
354
355
356
},
{
title: '发票号码',
valueType: 'text',
曾国涛
authored
about a year ago
357
dataIndex: 'invoiceNumber',
曾国涛
authored
about a year ago
358
copyable: true,
曾国涛
authored
about a year ago
359
ellipsis: true,
曾国涛
authored
about a year ago
360
361
362
363
364
365
},
{
title: '开票日期',
dataIndex: 'invoicingTime',
valueType: 'dateTime',
hideInSearch: true,
曾国涛
authored
about a year ago
366
ellipsis: true,
曾国涛
authored
about a year ago
367
368
369
370
371
},
{
title: '发票类型',
valueType: 'Text',
dataIndex: 'typeText',
曾国涛
authored
about a year ago
372
hideInSearch: true,
曾国涛
authored
about a year ago
373
ellipsis: true,
曾国涛
authored
about a year ago
374
375
376
377
378
379
},
{
title: '发票状态',
valueType: 'Text',
dataIndex: 'statusText',
hideInSearch: true,
曾国涛
authored
about a year ago
380
ellipsis: true,
曾国涛
authored
about a year ago
381
382
383
384
385
},
{
title: '购方名称',
valueType: 'text',
dataIndex: 'partyAName',
曾国涛
authored
about a year ago
386
hideInSearch: true,
曾国涛
authored
about a year ago
387
ellipsis: true,
曾国涛
authored
about a year ago
388
389
390
391
392
},
{
title: '购方税号',
valueType: 'text',
dataIndex: 'partyATaxid',
曾国涛
authored
about a year ago
393
ellipsis: true,
曾国涛
authored
about a year ago
394
395
396
397
398
},
{
title: '收款单位',
valueType: 'text',
dataIndex: 'partyBName',
曾国涛
authored
about a year ago
399
hideInSearch: true,
曾国涛
authored
about a year ago
400
ellipsis: true,
曾国涛
authored
about a year ago
401
402
403
404
405
},
{
title: '联系人',
valueType: 'text',
dataIndex: 'contacts',
曾国涛
authored
about a year ago
406
hideInSearch: true,
曾国涛
authored
about a year ago
407
ellipsis: true,
曾国涛
authored
about a year ago
408
409
410
411
412
413
},
{
title: '申请人',
valueType: 'text',
dataIndex: 'createByName',
hideInSearch: true,
曾国涛
authored
about a year ago
414
ellipsis: true,
曾国涛
authored
about a year ago
415
416
417
418
419
},
{
title: '开票金额(元)',
valueType: 'money',
dataIndex: 'price',
曾国涛
authored
about a year ago
420
hideInSearch: true,
曾国涛
authored
about a year ago
421
ellipsis: true,
曾国涛
authored
about a year ago
422
423
424
425
426
},
{
title: '备注',
valueType: 'text',
dataIndex: 'contacts',
曾国涛
authored
about a year ago
427
hideInSearch: true,
曾国涛
authored
about a year ago
428
ellipsis: true,
曾国涛
authored
about a year ago
429
},
曾国涛
authored
about a year ago
430
431
432
433
434
435
436
{
title: '失败原因',
valueType: 'text',
dataIndex: 'failureReason',
hideInSearch: true,
ellipsis: true,
},
曾国涛
authored
about a year ago
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
{
title: '购方名称',
valueType: 'text',
dataIndex: 'partyANameLike',
hideInTable: true,
},
{
title: '发票类型',
valueType: 'select',
dataIndex: 'type',
filters: true,
onFilter: true,
hideInTable: true,
valueEnum: enumToProTableEnumValue(invoiceTypeValueEnum),
},
{
title: '开票状态',
valueType: 'select',
dataIndex: 'status',
filters: true,
onFilter: true,
hideInTable: true,
曾国涛
authored
about a year ago
461
462
463
request: async () => {
const res = await postServiceConstAfterInvoicingInvoiceRecordStatus();
return enumToSelect(res.data);
曾国涛
authored
about a year ago
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
},
},
{
title: '销售代表',
valueType: 'select',
dataIndex: 'salesCode',
filters: true,
onFilter: true,
hideInTable: true,
valueEnum: salesCodeValueEnum,
},
{
title: '联系人',
valueType: 'text',
dataIndex: 'contactsLike',
hideInTable: true,
},
{
title: '开票日期',
dataIndex: 'invoicingTime',
valueType: 'dateRange',
hideInTable: true,
search: {
transform: (value) => {
if (value) {
return {
invoicingTimeGe: value[0],
invoicingTimeLe: value[1],
};
}
},
},
曾国涛
authored
about a year ago
496
497
},
{
曾国涛
authored
about a year ago
498
499
500
501
502
503
504
505
506
title: '收款单位',
valueType: 'select',
dataIndex: 'partyB',
filters: true,
onFilter: true,
hideInTable: true,
valueEnum: enumToProTableEnumValue(PAYEE_OPTIONS),
},
{
曾国涛
authored
about a year ago
507
508
509
title: '操作',
valueType: 'option',
key: 'option',
曾国涛
authored
about a year ago
510
render: (text, record) => [
曾国涛
authored
about a year ago
511
<a
曾国涛
authored
about a year ago
512
key="detail"
曾国涛
authored
about a year ago
513
514
515
516
517
518
519
onClick={() => {
setInvoiceRecordDetailVisible(true);
setInvoiceRecord(record);
}}
>
详情
</a>,
曾国涛
authored
about a year ago
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
<>
{record.status === 'SUCCESS' && (
<>
{record.status === 'SUCCESS' && (
<a href={record.invoiceAddress} download>
下载发票
</a>
)}
</>
)}
</>,
<>
{record.status === 'FAIL' && (
<ModalForm
title="提示"
trigger={
<Button type="link" danger>
重试
</Button>
}
autoFocusFirstInput
modalProps={{
destroyOnClose: true,
}}
submitTimeout={2000}
onFinish={async () => {
const res = await postServiceInvoiceInvoicing({
data: {
invoiceRecordIds: [record.id],
},
});
if (res) {
message.success(res.message);
processedRecordRef?.current?.reload();
}
return true;
}}
>
确定重试订单信息吗?
</ModalForm>
)}
</>,
曾国涛
authored
about a year ago
562
563
564
],
},
];
565
566
567
568
569
570
571
572
573
574
575
576
/**
* 加载发票列表表格的各个列格式
*/
const invoicecColumnsInit = () => {
let columns = INVOICE_COLUMNS.map((item) => {
let newItem = { ...item };
let dataIndex = item.dataIndex;
let dataType = item.valueType;
newItem.render = (text, record) => {
let textValue = record[dataIndex];
577
if (dataType === 'dateRange' || dataType === 'date') {
578
579
580
581
582
583
584
585
586
587
588
589
590
591
textValue = formatDate(textValue);
}
if (dataType === 'dateTime') {
textValue = formatDateTime(textValue);
}
if (dataType === 'money') {
textValue = '¥' + textValue;
}
switch (dataIndex) {
case 'invoiceStatus':
return (
592
<EllipsisDiv
593
594
595
596
597
598
599
600
601
text={enumValueToLabel(
getTableCellText(textValue),
INVOCING_STATUS,
)}
/>
);
case 'status':
return (
602
<EllipsisDiv
603
604
605
606
607
608
609
610
611
text={enumValueToLabel(
getTableCellText(textValue),
INVOICE_STATUS,
)}
/>
);
case 'payee':
return (
612
<EllipsisDiv
613
614
615
616
617
618
619
620
text={enumValueToLabel(
getTableCellText(textValue),
PAYEE_OPTIONS,
)}
/>
);
default:
621
return <EllipsisDiv text={getTableCellText(textValue)} />;
622
623
624
625
626
627
628
629
630
631
632
633
}
};
return newItem;
});
columns.push({
title: '操作',
valueType: 'option',
key: 'option',
fixed: 'right',
width: 120,
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
render: (text, record) => {
let btns = [];
if (record.path?.includes('writeOff')) {
btns.push(
<a
key="editable"
onClick={() => {
setInvoiceVerificationVisible(true);
setInvoiceId(record.invoiceId);
}}
>
核销
</a>,
);
}
if (record.path?.includes('queryInvoiceDetails')) {
btns.push(
<Button
className="p-0"
key="view"
type="link"
onClick={() => {
setInvoiceVerificationVisible(true);
setInvoiceId(record.invoiceId);
}}
>
查看
</Button>,
);
}
if (record.path?.includes('deleteInvoice')) {
btns.push(
<ButtonConfirm
key="delete"
className="p-0"
title={
'确认删除发票号码为[ ' + record.invoiceNumber + ' ]的发票吗?'
}
text="删除"
onConfirm={async () => {
let res = await postServiceInvoiceDeleteInvoice({
data: { invoiceId: record.invoiceId },
});
if (res) {
message.success(res.message);
reloadInvoiceTable();
}
}}
/>,
);
}
return btns;
},
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
});
return columns;
};
const bankStatemetColumnsInit = () => {
let columns = BANK_STATEMENT_COLUMNS.map((item) => {
let newItem = { ...item };
let dataIndex = item.dataIndex;
let dataType = item.valueType;
newItem.render = (text, record) => {
let textValue = record[dataIndex];
if (dataType === 'date') {
textValue = formatDate(textValue);
}
if (dataType === 'dateTime') {
textValue = formatDateTime(textValue);
}
if (dataType === 'money') {
712
713
714
715
716
if (textValue === null || textValue === undefined) {
textValue = '';
} else {
textValue = '¥' + textValue;
}
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
}
switch (dataIndex) {
case 'invoiceStatus':
return (
<EllipsisDiv
text={enumValueToLabel(
getTableCellText(textValue),
INVOCING_STATUS,
)}
/>
);
case 'status':
return (
<EllipsisDiv
text={enumValueToLabel(
getTableCellText(textValue),
INVOICE_STATUS,
)}
/>
);
case 'payee':
return (
<EllipsisDiv
text={enumValueToLabel(
getTableCellText(textValue),
PAYEE_OPTIONS,
)}
/>
);
default:
return <EllipsisDiv text={getTableCellText(textValue)} />;
}
};
return newItem;
});
columns.push({
title: '操作',
valueType: 'option',
key: 'option',
fixed: 'right',
width: 120,
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
render: (text, record, _, action) => {
let btns = [];
if (record.path?.includes('editBankStatement')) {
btns.push(
<a
key="editable"
onClick={() => {
action?.startEditable?.(record.id);
}}
>
编辑
</a>,
);
}
if (record.path?.includes('deleteBankStatement')) {
btns.push(
<ButtonConfirm
key="delete"
className="p-0"
title={'是否删除该银行流水记录?'}
text="删除"
onConfirm={async () => {
let res = await postServiceBankStatementDeleteBankStatement({
data: { id: record.id },
});
if (res.result === RESPONSE_CODE.SUCCESS) {
message.success(res.message);
reloadBankStatementTable();
}
}}
/>,
);
}
return btns;
},
800
801
802
803
804
805
806
807
});
return columns;
};
const tabsItems = [
{
key: 1,
曾国涛
authored
about a year ago
808
809
810
811
812
813
814
815
816
label: '待处理',
children: (
<ProTable
columns={waitDealRecordColumns}
actionRef={waitDealrecordActionRef}
cardBordered
pagination={{
pageSize: 10,
}}
曾国涛
authored
about a year ago
817
818
rowSelection={{
selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
曾国涛
authored
about a year ago
819
alwaysShowAlert: true,
曾国涛
authored
about a year ago
820
821
822
823
824
825
826
}}
tableAlertOptionRender={({ selectedRowKeys, selectedRows }) => {
console.log(selectedRows);
console.log(selectedRowKeys);
return (
<Space size={16}>
<InvoicingModal
曾国涛
authored
about a year ago
827
reloadRecordTable={reloadRecordTable}
曾国涛
authored
about a year ago
828
829
830
831
832
833
key="button"
selectedRowKeys={selectedRowKeys}
/>
</Space>
);
}}
曾国涛
authored
about a year ago
834
835
request={async (params) => {
let res = await postServiceInvoiceQueryInvoiceRecordList({
曾国涛
authored
about a year ago
836
data: {
曾国涛
authored
about a year ago
837
...params,
曾国涛
authored
about a year ago
838
839
840
841
statusIn: [
'WAITING_FOR_INVOICING',
'AUDITING',
'AUDITING_NOT_PASSED',
曾国涛
authored
about a year ago
842
'CANCELED',
曾国涛
authored
about a year ago
843
],
曾国涛
authored
about a year ago
844
845
needBuildDetails: false,
needBuildSubOrders: true,
曾国涛
authored
about a year ago
846
},
曾国涛
authored
about a year ago
847
});
曾国涛
authored
about a year ago
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
return {
data: res?.data?.data,
total: res?.data?.total || 0,
};
}}
columnsState={{
persistenceKey: 'pro-table-singe-demos',
persistenceType: 'localStorage',
defaultValue: {
option: { fixed: 'right', disable: true },
},
onChange(value) {
console.log('value: ', value);
},
}}
rowKey="id"
search={{
labelWidth: 'auto',
}}
options={{
setting: {
listsHeight: 400,
},
}}
form={{}}
dateFormatter="string"
headerTitle="待开票列表"
scroll={{ x: 1400, y: 360 }}
/>
),
},
{
key: 2,
label: '开票记录',
children: (
<ProTable
columns={processedRecordColumns}
曾国涛
authored
about a year ago
885
actionRef={processedRecordRef}
曾国涛
authored
about a year ago
886
887
888
889
890
891
892
893
894
895
896
897
898
899
cardBordered
pagination={{
pageSize: 10,
}}
editable={{
type: 'multiple',
onSave: async (rowKey, data) => {
await postServiceBankStatementEditBankStatement({ data: data });
},
actionRender: (row, config, defaultDom) => [
defaultDom.save,
defaultDom.cancel,
],
}}
曾国涛
authored
about a year ago
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
search={{
labelWidth: 'auto',
defaultCollapsed: false,
optionRender: (searchConfig, formProps, dom) => [
...dom,
<Button
key="out"
onClick={() => {
const values = searchConfig?.form?.getFieldsValue();
console.log(values);
messageApi.open({
type: 'loading',
content: '正在导出文件...',
duration: 0,
});
excelExport(
'/api/service/invoice/exportInvoiceRecords',
{
...values,
statusIn: ['INVOICING', 'SUCCESS', 'FAIL'],
},
() => {
messageApi.destroy();
},
);
}}
>
导出
</Button>,
],
}}
曾国涛
authored
about a year ago
931
932
request={async (params) => {
let res = await postServiceInvoiceQueryInvoiceRecordList({
曾国涛
authored
about a year ago
933
data: {
曾国涛
authored
about a year ago
934
...params,
曾国涛
authored
about a year ago
935
statusIn: ['INVOICING', 'SUCCESS', 'FAIL'],
曾国涛
authored
about a year ago
936
},
曾国涛
authored
about a year ago
937
});
曾国涛
authored
about a year ago
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
return {
data: res?.data?.data,
total: res?.data?.total || 0,
};
}}
columnsState={{
persistenceKey: 'pro-table-singe-demos',
persistenceType: 'localStorage',
defaultValue: {
option: { fixed: 'right', disable: true },
},
onChange(value) {
console.log('value: ', value);
},
}}
rowKey="id"
options={{
setting: {
listsHeight: 400,
},
}}
form={{}}
dateFormatter="string"
headerTitle="待开票列表"
scroll={{ x: 1400, y: 360 }}
toolBarRender={() => []}
/>
),
},
{
key: 3,
969
label: '发票管理',
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
children: (
<ProTable
columns={invoicecColumnsInit()}
actionRef={invoiceActionRef}
cardBordered
pagination={{
pageSize: 10,
}}
request={async (params) => {
const res = await postServiceInvoiceQueryInvoice({
data: { ...params },
});
if (res) {
return {
data: res?.data?.data || [],
total: res?.data?.total || 0,
};
}
}}
columnsState={{
persistenceKey: 'pro-table-singe-demos',
persistenceType: 'localStorage',
defaultValue: {
option: { fixed: 'right', disable: true },
},
onChange(value) {
console.log('value: ', value);
},
}}
rowKey="id"
search={{
labelWidth: 'auto',
}}
options={{
setting: {
listsHeight: 400,
},
}}
form={{}}
dateFormatter="string"
headerTitle="发票列表"
scroll={{ x: 1400, y: 360 }}
曾国涛
authored
about a year ago
1012
1013
1014
1015
1016
1017
toolBarRender={() => [
<AddInvoiceDrawerForm
onClose={() => {
invoiceActionRef.current?.reload();
bankActionRef.current?.reload();
}}
曾国涛
authored
about a year ago
1018
key="add"
曾国涛
authored
about a year ago
1019
1020
></AddInvoiceDrawerForm>,
]}
1021
1022
/>
),
1023
1024
},
{
曾国涛
authored
about a year ago
1025
key: 4,
1026
label: '银行流水',
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
children: (
<ProTable
columns={bankStatemetColumnsInit()}
actionRef={bankActionRef}
cardBordered
pagination={{
pageSize: 10,
}}
editable={{
type: 'multiple',
onSave: async (rowKey, data) => {
await postServiceBankStatementEditBankStatement({ data: data });
},
actionRender: (row, config, defaultDom) => [
defaultDom.save,
defaultDom.cancel,
],
}}
request={async (params) => {
const res = await postServiceBankStatementQueryBankStatement({
data: { ...params },
});
if (res) {
return {
data: res?.data?.data || [],
total: res?.data?.total || 0,
};
}
}}
columnsState={{
persistenceKey: 'pro-table-singe-demos',
persistenceType: 'localStorage',
defaultValue: {
option: { fixed: 'right', disable: true },
},
onChange(value) {
console.log('value: ', value);
},
}}
rowKey="id"
search={{
labelWidth: 'auto',
}}
options={{
setting: {
listsHeight: 400,
},
}}
form={{}}
dateFormatter="string"
headerTitle="银行流水列表"
scroll={{ x: 1400, y: 360 }}
toolBarRender={() => [
<Button
key="button"
icon={<PlusOutlined />}
onClick={() => {
setBankImportModalVisible(true);
}}
type="primary"
>
导入
</Button>,
]}
/>
),
1093
1094
},
];
1095
return (
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
<div className="invoice-index">
<Tabs
defaultActiveKey="1"
items={tabsItems}
onChange={(value) => {
if (value === 1) {
invoiceActionRef.current?.reload();
} else {
bankActionRef.current?.reload();
}
1106
}}
1107
/>
1108
1109
1110
1111
{bankImportModalVisible ? (
<BankImportModal
setVisible={setBankImportModalVisible}
1112
onClose={() => {
1113
setBankImportModalVisible(false);
1114
1115
1116
invoiceActionRef.current?.reload();
bankActionRef.current?.reload();
}}
1117
1118
1119
1120
></BankImportModal>
) : (
''
)}
1121
1122
1123
1124
1125
{invoiceVerificationVisible ? (
<InvoiceVerificationModal
setVisible={setInvoiceVerificationVisible}
invoiceId={invoiceId}
1126
1127
1128
1129
onClose={() => {
invoiceActionRef.current?.reload();
bankActionRef.current?.reload();
}}
1130
1131
1132
1133
></InvoiceVerificationModal>
) : (
''
)}
曾国涛
authored
about a year ago
1134
1135
1136
1137
1138
1139
1140
1141
1142
{invoiceRecordDetailVisible ? (
<InvoiceRecordDetailModal
key="detail"
id={invoiceRecord.id}
setVisible={setInvoiceRecordDetailVisible}
/>
) : (
''
)}
1143
</div>
1144
1145
1146
1147
);
};
export default InvoicePage;