tableConfig.tsx
4.1 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
import type { DataTableColumnsType } from '@/components';
import type { Contract, Sunshine } from '@/api';
import { UImage } from '@uj/ui';
import {
CONTRACT_FLOW_STATUSES,
CONTRACT_ORGS,
CONTRACT_SOURCES,
CONTRACT_TYPES,
OA_FLOW_STATUSES,
OA_PAYMENT_STATUSES,
optionLabel,
PAYMENT_METHODS,
PAYMENT_STATUSES,
SIGNER_TYPES,
YES_NO_OPTIONS,
} from './operationOptions';
/** 运营管理表格列的唯一配置位置;页面只负责数据和操作。 */
const cell = (v: unknown) => (v === undefined || v === null || v === '' ? '-' : String(v));
/**
* 对齐源 contract/index.vue 的高频列;字典类暂以接口返回值直出(后端口径待真机核对)。
*
* 长文本列(车架号 / 车型 / 合同编号 / 评估单编号 / 合同模版)只给更宽的 width;
* 省略 + hover 完整提示由 DataTable 默认处理(纯文本单行省略、超长自动 tip),这里不再逐列配 line。
* 车型是 render 拼接串、无 dataIndex,tip 取 render 结果本身,完整可见。
*/
export const CONTRACT_COLUMNS: DataTableColumnsType<Contract> = [
{
title: '车辆照片',
dataIndex: 'vehicleImgUrl',
width: 138,
render: (value) =>
typeof value === 'string' && value ? (
<UImage src={value} width={96} height={54} alt="车辆" />
) : (
'-'
),
},
{ title: '车牌号', dataIndex: 'licensePlate', render: cell },
{ title: '车架号', dataIndex: 'vin', width: 200, render: cell },
{
title: '车型',
width: 280,
render: (_, row) =>
[row.carBrand, row.carSeriesName, row.carTypeName].filter(Boolean).join(' ') || '-',
},
{ title: '签约时间', dataIndex: 'signTime', render: cell },
{ title: '评估单编号', dataIndex: 'evalOrderNo', width: 200, render: cell },
{
title: '合同类型',
dataIndex: 'electronicContractType',
render: (value) => optionLabel(CONTRACT_TYPES, value),
},
{ title: '合同模版', dataIndex: 'docTemplateName', width: 200, render: cell },
{
title: '合同流转状态',
dataIndex: 'electronicContractStatus',
render: (value) => optionLabel(CONTRACT_FLOW_STATUSES, value),
},
{ title: '驻店人员', dataIndex: 'createdBy', render: cell },
{
title: '支付方式',
dataIndex: 'paymentType',
render: (value) => optionLabel(PAYMENT_STATUSES, value),
},
{
title: '支付状态',
dataIndex: 'oaFlowPaymentStatus',
render: (value) => optionLabel(OA_PAYMENT_STATUSES, value),
},
{ title: '企微审批单号', dataIndex: 'lastOaFlowCode', render: cell },
{
title: '企微审批状态',
dataIndex: 'oaFlowStatus',
render: (value) => optionLabel(OA_FLOW_STATUSES, value),
},
{ title: '车主姓名', dataIndex: 'previousOwnerName', render: cell },
{ title: '车主联系方式', dataIndex: 'previousOwnerPhone', render: cell },
{
title: '是否拆分付款',
dataIndex: 'splitPay',
render: (value) => optionLabel(YES_NO_OPTIONS, value),
},
{
title: '合同来源',
dataIndex: 'source',
render: (value) => optionLabel(CONTRACT_SOURCES, value),
},
{
title: '付款方式',
dataIndex: 'paymentMethod',
render: (value) => optionLabel(PAYMENT_METHODS, value),
},
{
title: '签署人类型',
dataIndex: 'signerType',
render: (value) => optionLabel(SIGNER_TYPES, value),
},
{
title: '内部主体',
dataIndex: 'contractOrg',
render: (value) => optionLabel(CONTRACT_ORGS, value),
},
];
/** 源 constants.js vehicleCategoryOpt:carType 存 confId,列表按字典翻译。 */
const CAR_TYPE_LABEL: Record<string, string> = { '1': '置换车', '2': '报废车' };
export const SUNSHINE_COLUMNS: DataTableColumnsType<Sunshine> = [
{ title: '4S门店', dataIndex: 'sellerMerchantName' },
{
title: '车辆类型',
dataIndex: 'carType',
render: (value) => {
const v = String(value ?? '');
return CAR_TYPE_LABEL[v] || v || '-';
},
},
{
title: '激励价格',
dataIndex: 'sunlightInspiresPrice',
render: (value) => (value === undefined ? '-' : `¥${String(value)}`),
},
{ title: '录入时间', dataIndex: 'createdDate' },
];