columns.tsx
9.39 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
import { UTag } from '@uj/ui';
import type { TableProps } from 'antd';
import type { PolicyConfirmRow } from '../../tools/policyTableData';
const storeInfoHeaderStyle: React.CSSProperties = {
background: '#EEF2FF',
color: '#3730A3',
fontWeight: 600,
fontSize: 13,
};
const bizPolicyHeaderStyle: React.CSSProperties = {
background: '#ECFDF5',
color: '#047857',
fontWeight: 600,
fontSize: 13,
};
const costHeaderStyle: React.CSSProperties = {
background: '#FFF7ED',
color: '#C2410C',
fontWeight: 600,
fontSize: 13,
};
const cellStyle: React.CSSProperties = {
fontSize: 12.5,
color: '#374151',
padding: '10px 12px',
};
function SceneTag({ text }: { text: string }) {
return (
<UTag
color="processing"
bordered={false}
title={text}
style={{
fontSize: 12,
maxWidth: '100%',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
>
{text}
</UTag>
);
}
function CategoryTag({ text }: { text: string }) {
return (
<UTag
color="success"
bordered={false}
title={text}
style={{
fontSize: 12,
maxWidth: '100%',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
>
{text}
</UTag>
);
}
/** 金额列渲染(加粗深灰) */
function MoneyCell({ value }: { value: string }) {
return <span style={{ fontWeight: 600, color: '#1F2937' }}>{value}</span>;
}
/** 激励费列(数值加粗) */
function FeeValueCell({ value }: { value: string }) {
return <span style={{ fontWeight: 600, color: '#1F2937' }}>{value}</span>;
}
export function buildPolicyColumns(): TableProps<PolicyConfirmRow>['columns'] {
return [
// ------------- 第一组:门店信息(4 列) -------------
{
title: '门店信息',
align: 'center',
children: [
{
title: '门店名称',
dataIndex: 'storeName',
key: 'storeName',
width: 200,
onHeaderCell: () => ({ style: storeInfoHeaderStyle }),
onCell: () => ({ style: cellStyle }),
render: (v) => <span style={{ color: '#1A202C', fontWeight: 500 }}>{v}</span>,
},
{
title: '门店商户号',
dataIndex: 'storeMerchantNo',
key: 'storeMerchantNo',
width: 130,
align: 'center',
onHeaderCell: () => ({ style: storeInfoHeaderStyle }),
onCell: () => ({ style: cellStyle }),
render: (v) => <a style={{ color: '#2563EB', fontSize: 12.5 }}>{v}</a>,
},
{
title: '业务场景',
dataIndex: 'businessScene',
key: 'businessScene',
width: 130,
align: 'center',
onHeaderCell: () => ({ style: storeInfoHeaderStyle }),
onCell: () => ({ style: cellStyle }),
render: (v: string) => <SceneTag text={v} />,
},
{
title: '产品分类',
dataIndex: 'productCategory',
key: 'productCategory',
width: 280,
align: 'center',
onHeaderCell: () => ({ style: storeInfoHeaderStyle }),
onCell: () => ({
style: {
...cellStyle,
// 确保 tableLayout=fixed 下,Tag 内容超长时单元格不会溢出到右侧列
overflow: 'hidden',
whiteSpace: 'nowrap',
},
}),
render: (v: string) => <CategoryTag text={v} />,
},
],
},
// ------------- 第二组:商务政策(14 列) -------------
{
title: '商务政策',
align: 'center',
children: [
// 管理层市场费 1
{
title: '管理层市场费1计算模式',
dataIndex: 'mgmtFee1Mode',
key: 'mgmtFee1Mode',
width: 150,
align: 'center',
onHeaderCell: () => ({ style: bizPolicyHeaderStyle }),
onCell: () => ({ style: cellStyle }),
},
{
title: '管理层市场费1计算方式',
dataIndex: 'mgmtFee1CalcMethod',
key: 'mgmtFee1CalcMethod',
width: 150,
align: 'center',
onHeaderCell: () => ({ style: bizPolicyHeaderStyle }),
onCell: () => ({ style: cellStyle }),
},
{
title: '管理层市场费1',
dataIndex: 'mgmtFee1Value',
key: 'mgmtFee1Value',
width: 130,
align: 'center',
onHeaderCell: () => ({ style: bizPolicyHeaderStyle }),
onCell: () => ({ style: cellStyle }),
render: (v) => <FeeValueCell value={v as string} />,
},
// 管理层市场费 2
{
title: '管理层市场费2计算模式',
dataIndex: 'mgmtFee2Mode',
key: 'mgmtFee2Mode',
width: 150,
align: 'center',
onHeaderCell: () => ({ style: bizPolicyHeaderStyle }),
onCell: () => ({ style: cellStyle }),
},
{
title: '管理层市场费2计算方式',
dataIndex: 'mgmtFee2CalcMethod',
key: 'mgmtFee2CalcMethod',
width: 150,
align: 'center',
onHeaderCell: () => ({ style: bizPolicyHeaderStyle }),
onCell: () => ({ style: cellStyle }),
},
{
title: '管理层市场费2',
dataIndex: 'mgmtFee2Value',
key: 'mgmtFee2Value',
width: 130,
align: 'center',
onHeaderCell: () => ({ style: bizPolicyHeaderStyle }),
onCell: () => ({ style: cellStyle }),
render: (v) => <FeeValueCell value={v as string} />,
},
// 一线阳光 1
{
title: '一线阳光是否开启线上积分',
dataIndex: 'sunshineOnlinePoints',
key: 'sunshineOnlinePoints',
width: 170,
align: 'center',
onHeaderCell: () => ({ style: bizPolicyHeaderStyle }),
onCell: () => ({ style: cellStyle }),
},
{
title: '一线阳光计算模式',
dataIndex: 'sunshineCalcMode',
key: 'sunshineCalcMode',
width: 140,
align: 'center',
onHeaderCell: () => ({ style: bizPolicyHeaderStyle }),
onCell: () => ({ style: cellStyle }),
},
{
title: '一线阳光计算方式',
dataIndex: 'sunshineCalcMethod',
key: 'sunshineCalcMethod',
width: 140,
align: 'center',
onHeaderCell: () => ({ style: bizPolicyHeaderStyle }),
onCell: () => ({ style: cellStyle }),
},
{
title: '一线阳光激励费',
dataIndex: 'sunshineValue',
key: 'sunshineValue',
width: 140,
align: 'center',
onHeaderCell: () => ({ style: bizPolicyHeaderStyle }),
onCell: () => ({ style: cellStyle }),
render: (v) => <FeeValueCell value={v as string} />,
},
// 一线阳光 2
{
title: '一线阳光2是否开启线上积分',
dataIndex: 'sunshine2OnlinePoints',
key: 'sunshine2OnlinePoints',
width: 180,
align: 'center',
onHeaderCell: () => ({ style: bizPolicyHeaderStyle }),
onCell: () => ({ style: cellStyle }),
},
{
title: '一线阳光2计算模式',
dataIndex: 'sunshine2CalcMode',
key: 'sunshine2CalcMode',
width: 150,
align: 'center',
onHeaderCell: () => ({ style: bizPolicyHeaderStyle }),
onCell: () => ({ style: cellStyle }),
},
{
title: '一线阳光2计算方式',
dataIndex: 'sunshine2CalcMethod',
key: 'sunshine2CalcMethod',
width: 150,
align: 'center',
onHeaderCell: () => ({ style: bizPolicyHeaderStyle }),
onCell: () => ({ style: cellStyle }),
},
{
title: '一线阳光2激励费',
dataIndex: 'sunshine2Value',
key: 'sunshine2Value',
width: 150,
align: 'center',
onHeaderCell: () => ({ style: bizPolicyHeaderStyle }),
onCell: () => ({ style: cellStyle }),
render: (v) => <FeeValueCell value={v as string} />,
},
],
},
// ------------- 第三组:运营成本(3 列) -------------
{
title: '运营成本',
align: 'center',
children: [
{
title: '装修、设备总投入',
dataIndex: 'costDecoration',
key: 'costDecoration',
width: 160,
align: 'center',
onHeaderCell: () => ({ style: costHeaderStyle }),
onCell: () => ({ style: cellStyle }),
render: (v) => <MoneyCell value={v as string} />,
},
{
title: '当月产生(房租、水电、耗材等)',
dataIndex: 'costMonthly',
key: 'costMonthly',
width: 220,
align: 'center',
onHeaderCell: () => ({ style: costHeaderStyle }),
onCell: () => ({ style: cellStyle }),
render: (v) => <MoneyCell value={v as string} />,
},
{
title: '人工成本',
dataIndex: 'costLabor',
key: 'costLabor',
width: 140,
align: 'center',
onHeaderCell: () => ({ style: costHeaderStyle }),
onCell: () => ({ style: cellStyle }),
render: (v) => <MoneyCell value={v as string} />,
},
],
},
];
}