finance.data.tsx
17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
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
266
267
268
269
270
271
272
273
274
275
276
277
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
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
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
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
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
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
import { FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
import { FolderAddOutlined, FilePptOutlined, EyeOutlined } from '@ant-design/icons-vue';
import { size } from 'lodash-es';
import { view } from '@/utils/pdfShow';
import { ref } from 'vue';
import { queryNoOptions } from '/@/api/project/order';
import { useOrderStoreWithOut } from '/@/store/modules/order';
import { useOrderInfo } from '/@/hooks/component/order';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();
const innerNoOptions = ref([]);
const projectNoOptions = ref([]);
const orderStore = useOrderStoreWithOut();
const {
customerCode,
productionDepartment,
} = useOrderInfo(orderStore);
// 声明一个全局变量来保存回调函数
let viewRichTextCallback: ((richTextId: any) => void) | null = null;
// 设置回调函数的方法
export function setViewRichTextCallback(callback: ((richTextId: any) => void) | null) {
viewRichTextCallback = callback;
}
// 直接调用回调函数的方法
function callViewRichText(richTextId: any) {
if (viewRichTextCallback) {
// 显示加载提示
createMessage.loading({ content: '正在加载扣款原因详情...', duration: 0, key: 'richTextLoading' });
// 调用回调函数
viewRichTextCallback(richTextId);
} else {
console.error('查看回调函数未设置');
}
}
export const searchFormSchema: FormSchema[] = [
{
field: 'invoiceNo',
label: 'invoice单号',
component: 'Input',
colProps: { span: 8 },
},
{
field: 'checkNo',
label: 'checkNo单号',
component: 'Input',
colProps: { span: 8 },
},
{
field: 'invoiceStatus',
label: 'invoice状态',
component: 'Select',
colProps: { span: 8 },
componentProps: {
options: [
{ label: '未创建', value: -1 },
{ label: '未收款(已创建未提交审核)', value: 0 },
{ label: '待收款(审核通过,未手动确认)', value: 10 },
{ label: '已收款(手动确认)', value: 40 },
],
},
},
{
field: 'checkNoStatus',
label: 'checkNo状态',
component: 'Select',
colProps: { span: 8 },
componentProps: {
options: [
{ label: '未创建', value: -1 },
{ label: '未付款(已创建未提交审核)', value: 0 },
{ label: '待付款(审核通过,未手动确认)', value: 10 },
{ label: '已付款(手动确认)', value: 40 },
],
},
},
{
field: 'customerCode',
label: '客户编码',
component: 'Select',
colProps: { span: 8 },
componentProps: {
options: customerCode,
showSearch: true,
mode: 'multiple',
},
},
{
field: 'projectNo',
label: '项目号',
component: 'Select',
colProps: { span: 8 },
componentProps: {
options: projectNoOptions,
showSearch: true,
mode: 'multiple',
onSearch: async (value: any) => {
projectNoOptions.value = await queryNoOptions('projectNo', value);
},
// onSearch: async (value: any) => {
// projectNoOptions.value = await queryNoOptions('projectNo', value);
// },
},
},
{
field: 'productionDepartment',
label: '生产科',
component: 'Select',
colProps: { span: 8 },
componentProps: {
mode: 'multiple',
options: productionDepartment,
showSearch: true,
},
},
{
field: 'innerNo',
label: '内部编号',
component: 'Select',
colProps: { span: 8 },
componentProps: {
options: innerNoOptions,
showSearch: true,
mode: 'multiple',
onSearch: async (value: any) => {
innerNoOptions.value = await queryNoOptions('innerNo', value);
},
},
},
{
field: 'invoiceStartTime',
label: 'invoice创建时间',
component: 'DatePicker',
colProps: { span: 8 },
labelWidth: 150,
},
{
field: 'invoiceEndTime',
label: 'invoice结束时间',
component: 'DatePicker',
colProps: { span: 8 },
labelWidth: 150,
},
{
field: 'checkStartTime',
label: 'checkNo创建时间',
component: 'DatePicker',
colProps: { span: 8 },
labelWidth: 150,
},
{
field: 'checkEndTime',
label: 'checkNo结束时间',
component: 'DatePicker',
colProps: { span: 8 },
labelWidth: 150,
},
{
field: 'createStartTime',
label: '订单创建时间',
component: 'DatePicker',
colProps: { span: 8 },
labelWidth: 150,
},
{
field: 'createEndTime',
label: '订单结束时间',
component: 'DatePicker',
colProps: { span: 8 },
labelWidth: 150,
},
{
field: 'productionDepartmentConsignStartTime',
label: '生产科拖货开始时间',
component: 'DatePicker',
colProps: { span: 8 },
labelWidth: 150,
},
{
field: 'productionDepartmentConsignEndTime',
label: '生产科拖货结束时间',
component: 'DatePicker',
colProps: { span: 8 },
labelWidth: 150,
},
{
field: 'orderHodStartTime',
label: 'HOD开始时间',
component: 'DatePicker',
colProps: { span: 8 },
labelWidth: 150,
},
{
field: 'orderHodEndTime',
label: 'HOD结束时间',
component: 'DatePicker',
colProps: { span: 8 },
labelWidth: 150,
},
];
export const columns: BasicColumn[] = [
{
title: '客户编码',
dataIndex: 'customerCode',
width: 100,
fixed: 'left',
},
{
title: '项目号',
dataIndex: 'projectNo',
width: 100,
fixed: 'left',
},
{
title: '生产科',
dataIndex: 'productionDepartment',
width: 70,
fixed: 'left',
},
{
title: '内部编码',
dataIndex: 'innerNo',
width: 100,
fixed: 'left',
},
{
title: '订单图片',
width: 80,
dataIndex: 'picUrl',
fixed: 'left',
},
{
title: '数量',
width: 70,
dataIndex: 'orderCount',
fixed: 'left',
},
{
title: 'Model(REFERENCE)',
width: 140,
dataIndex: 'modeleLo',
fixed: 'left',
},
{
title: '生产科拖货时间',
width: 150,
dataIndex: 'productionDepartmentConsignTime',
customRender: (column) => {
return formatDate(column.record?.productionDepartmentConsignTime);
},
},
{
title: '订单上HOD时间',
width: 150,
dataIndex: 'orderHodTime',
customRender: (column) => {
return formatDate(column.record?.orderHodTime);
},
},
{
title: '客户单价$',
width: 150,
dataIndex: 'customerPrice',
customRender: (column) => {
return column.record.customerPrice?.toFixed(2);
},
},
{
title: '客户总价$',
width: 150,
dataIndex: 'customerTotalPrice',
customRender: (column) => {
return column.record.customerTotalPrice?.toFixed(2);
},
},
{
title: 'Invoice编号',
dataIndex: 'invoiceNo',
width: 180,
customRender: (column) => {
return <span style="color: red;">{column.record?.invoiceNo}</span>;
},
},
{
title: '报关单',
dataIndex: 'invoiceBgUrl',
width: 80,
customRender: (column) => {
const bgUrl = column.record.invoiceBgUrl;
if (bgUrl == undefined) {
return;
}
return <FilePptOutlined style="font-size:25px" onClick={() => view(bgUrl)} />;
},
},
{
title: '必须回款日期',
dataIndex: 'invoiceBackRefundDate',
width: 120,
},
{
title: '发生扣款金额$',
dataIndex: 'invoiceDeductAmount',
width: 120,
customRender: (column) => {
return column.record.invoiceDeductAmount?.toFixed(2);
},
},
{
title: '上传扣款单',
dataIndex: 'invoiceDeductUrl',
width: 80,
customRender: (column) => {
const deductUrl = column.record.invoiceDeductUrl;
if (deductUrl == undefined || !deductUrl) {
return;
}
// return <FilePptOutlined style="font-size:25px" onClick={() => window.open(deductUrl[0])} />;
return <FilePptOutlined style="font-size:25px" />;
},
},
{
title: '扣款单状态',
dataIndex: 'invoiceDeductUrlStatus',
width: 120,
customRender: (column) => {
if(column.record.invoiceDeductUrlStatus == 0){
return '待审核'
}else if(column.record.invoiceDeductUrlStatus == 10){
return '已通过'
}else if(column.record.invoiceDeductUrlStatus == 20){
return '已驳回'
}
},
},
{
title: '扣款原因',
dataIndex: 'invoiceRichTextId',
width: 120,
customRender: ({ record }) => {
// 如果存在invoiceRichTextId,显示查看按钮
if (record.invoiceRichTextId) {
return (
<a onClick={() => callViewRichText(record.invoiceRichTextId)}>
<EyeOutlined style="margin-right: 5px" />
查看
</a>
);
}
},
},
{
title: '实际应收金额$',
dataIndex: 'invoiceActualReceivableAmount',
width: 120,
customRender: (column) => {
return column.record.invoiceActualReceivableAmount?.toFixed(2);
},
},
{
title: '实际收款金额1$',
dataIndex: 'invoiceActualPayedAmount1',
width: 120,
customRender: (column) => {
return column.record.invoiceActualPayedAmount1?.toFixed(2);
},
},
{
title: '实际收款金额2$',
dataIndex: 'invoiceActualPayedAmount2',
width: 120,
customRender: (column) => {
return column.record.invoiceActualPayedAmount2?.toFixed(2);
},
},
{
title: '实际收款金额3$',
dataIndex: 'invoiceActualPayedAmount3',
width: 120,
customRender: (column) => {
return column.record.invoiceActualPayedAmount3?.toFixed(2);
},
},
{
title: '其他费用$',
dataIndex: 'invoiceOtherAmount',
width: 120,
customRender: (column) => {
return column.record.invoiceOtherAmount?.toFixed(2);
},
},
{
title: 'invoice备注',
dataIndex: 'invoiceNotes',
width: 200,
},
{
title: 'INVOICE状态',
dataIndex: 'invoiceStatus',
width: 120,
customRender: (column) => {
let statusText='';
let statusColor='blank';
if (column.record.invoiceStatus == null || column.record.invoiceStatus == undefined) {
statusText='未创建';
} else if (column.record.invoiceStatus == 0) {
statusText= '未收款';
} else if (column.record.invoiceStatus == 10) {
statusText= '待收款';
statusColor='red';
}else if (column.record.invoiceStatus == 40) {
statusText= '已收款';
statusColor='green';
}
return <span style={{color:statusColor}}>{statusText}</span>
},
},
{
title: 'Action',
key: 'action', // 对应 #bodyCell 中的 column.key
width: 280,
},
{
title: '生产科单价¥',
dataIndex: 'productionDepartmentPrice',
width: 120,
customRender: (column) => {
return column.record.productionDepartmentPrice?.toFixed(2);
},
},
{
title: '生产科总价¥',
dataIndex: 'productionDepartmentTotalPrice',
width: 120,
customRender: (column) => {
return column.record.productionDepartmentTotalPrice?.toFixed(2);
},
},
{
title: 'CheckNo编号',
dataIndex: 'checkNo',
width: 120,
customRender: (column) => {
return <span style="color: red;">{column.record?.checkNo}</span>;
},
},
{
title: '生产科应付款日期',
dataIndex: 'checkPayedDate',
width: 140,
},
{
title: '生产科扣款金额¥',
dataIndex: 'checkDeductAmount',
width: 160,
customRender: (column) => {
return column.record.checkDeductAmount?.toFixed(2);
},
},
{
title: '扣款责任部门',
dataIndex: 'checkDeductDept',
width: 120,
},
{
title: '上传扣款单',
dataIndex: 'checkDeductUrl',
width: 120,
customRender: (column) => {
const deductUrl = column.record.checkDeductUrl;
if (deductUrl == undefined || !deductUrl) {
return;
}
return <FilePptOutlined style="font-size:25px" />;
},
},
{
title: '扣款单状态',
dataIndex: 'checkDeductUrlStatus',
width: 120,
customRender: (column) => {
if(column.record.checkDeductUrlStatus == 0){
return '待审核'
}else if(column.record.checkDeductUrlStatus == 10){
return '已通过'
}else if(column.record.checkDeductUrlStatus == 20){
return '已驳回'
}
},
},
{
title: '扣款原因',
dataIndex: 'checkRichTextId',
width: 120,
customRender: ({ record }) => {
// 如果存在checkRichTextId,显示查看按钮
if (record.checkRichTextId) {
return (
<a onClick={() => callViewRichText(record.checkRichTextId)}>
<EyeOutlined style="margin-right: 5px" />
查看
</a>
);
}
},
},
{
title: '生产科实际应付金额¥',
dataIndex: 'checkActualPayedAmount',
width: 180,
customRender: (column) => {
return column.record.checkActualPayedAmount?.toFixed(2);
},
},
{
title: '生产科发票上传',
dataIndex: 'checkInvoiceUrl',
width: 80,
customRender: (column) => {
const deductUrl = column.record.checkInvoiceUrl;
if (deductUrl == undefined) {
return;
}
return <FilePptOutlined style="font-size:25px" />;
},
},
{
title: '实际付款金额1¥',
dataIndex: 'checkActualPayedAmount1',
width: 160,
customRender: (column) => {
return column.record.checkActualPayedAmount1?.toFixed(2);
},
},
{
title: '实际付款金额2¥',
dataIndex: 'checkActualPayedAmount2',
width: 160,
customRender: (column) => {
return column.record.checkActualPayedAmount2?.toFixed(2);
},
},
{
title: '实际付款金额3¥',
dataIndex: 'checkActualPayedAmount3',
width: 160,
customRender: (column) => {
return column.record.checkActualPayedAmount3?.toFixed(2);
},
},
{
title: '生产科发票审核',
dataIndex: 'checkDepartmentInvoiceStatus',
width: 120,
customRender: (column) => {
if (column.record.checkDepartmentInvoiceStatus == 0) {
return '待审核';
} else if (column.record.checkDepartmentInvoiceStatus == 10) {
return '审核通过';
} else if (column.record.checkDepartmentInvoiceStatus == 20) {
return '审核驳回';
}
},
},
{
title: '生产科对账单号备注',
dataIndex: 'checkNotes',
width: 200,
},
{
title: 'CHECKNO状态',
dataIndex: 'checkPayStatus',
width: 120,
customRender: (column) => {
let statusText='';
let statusColor='blank';
if (column.record.checkPayStatus == null || column.record.checkPayStatus == undefined) {
statusText='未创建';
} else if (column.record.checkPayStatus == 0) {
statusText='未付款';
} else if (column.record.checkPayStatus == 10) {
statusText='待付款';
statusColor='red';
}else if (column.record.checkPayStatus == 40) {
statusText='已付款';
statusColor='green';
}
return <span style={{color:statusColor}}>{statusText}</span>
},
},
{
title: 'Action',
key: 'action2', // 对应 #bodyCell 中的 column.key
width: 280,
},
];
function formatDate(input: string): string {
// 创建一个 Date 对象
const date = new Date(input);
// 获取年月日
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,所以要加 1
const day = String(date.getDate()).padStart(2, '0');
// 返回格式化后的日期字符串
return `${year}-${month}-${day}`;
}
// 处理富文本查看API请求
export async function handleViewRichText(id: string) {
if (!id) {
return null;
}
// createMessage.loading({ content: '正在获取数据...', key: 'richTextLoading', duration: 0 });
try {
// 使用正确的API路径和POST请求
const res = await defHttp.post(
{
url: '/order/erp/quest/queryRichText_by_id',
data: { id },
},
{ errorMessageMode: 'none' }
);
if (res) {
// 如果响应中包含data字段,使用该字段内容
let formattedData = res;
// 确保必要的字段存在
formattedData.id = formattedData.id || id;
formattedData.title = formattedData.title || '扣款原因详情';
// 处理内容字段,可能是richText或contentText
if (!formattedData.contentText && formattedData.richText) {
formattedData.contentText = formattedData.richText;
}
if (formattedData.questType) {
formattedData.questType = formattedData.questType;
}
return formattedData;
} else {
return null;
}
} catch (error) {
return null;
}
}
// 简化版富文本查看函数(作为后备方案)
export async function handleViewRichTextSimple(id: string) {
// 返回一个基本的模拟数据
return {
id: id,
title: '问题原因被删除或者不存在',
contentText: `<p>问题原因被删除或者不存在</p>`,
createTime: new Date().toISOString()
};
}