|
|
@@ -1,7 +1,13 @@
|
|
1
|
1
|
import type { FormSchemaGetter } from '#/adapter/form';
|
|
2
|
2
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
|
3
|
3
|
|
|
|
4
|
+import { DictEnum } from '@vben/constants';
|
|
|
5
|
+
|
|
|
6
|
+import { stationInfoList } from '#/api/system/infoEntry/stationInfo/stationInfo';
|
|
|
7
|
+import { getSingleImageUploadConfig } from '#/components/upload';
|
|
|
8
|
+// import { uploadFile } from '#/api/upload';
|
|
4
|
9
|
import { getDictOptions } from '#/utils/dict';
|
|
|
10
|
+import { renderDict } from '#/utils/render';
|
|
5
|
11
|
|
|
6
|
12
|
// 字典标识常量
|
|
7
|
13
|
const DICT_KEYS = {
|
|
|
@@ -128,16 +134,16 @@ export const tableColumns: VxeGridProps['columns'] = [
|
|
128
|
134
|
title: '有效日期',
|
|
129
|
135
|
minWidth: 120,
|
|
130
|
136
|
},
|
|
131
|
|
- {
|
|
132
|
|
- field: 'storageLocationCode',
|
|
133
|
|
- title: '存放处',
|
|
134
|
|
- minWidth: 100,
|
|
135
|
|
- formatter: (params: { cellValue: string; column: any; row: any }) => {
|
|
136
|
|
- const options = getStorageLocations();
|
|
137
|
|
- const option = options.find((item) => item.value === params.cellValue);
|
|
138
|
|
- return option ? option.label : params.cellValue;
|
|
139
|
|
- },
|
|
140
|
|
- },
|
|
|
137
|
+ // {
|
|
|
138
|
+ // field: 'storageLocationCode',
|
|
|
139
|
+ // title: '存放处',
|
|
|
140
|
+ // minWidth: 100,
|
|
|
141
|
+ // formatter: (params: { cellValue: string; column: any; row: any }) => {
|
|
|
142
|
+ // const options = getStorageLocations();
|
|
|
143
|
+ // const option = options.find((item) => item.value === params.cellValue);
|
|
|
144
|
+ // return option ? option.label : params.cellValue;
|
|
|
145
|
+ // },
|
|
|
146
|
+ // },
|
|
141
|
147
|
{
|
|
142
|
148
|
field: 'renewalRequirements',
|
|
143
|
149
|
title: '更换要求',
|
|
|
@@ -163,12 +169,17 @@ export const tableColumns: VxeGridProps['columns'] = [
|
|
163
|
169
|
field: 'statusCode',
|
|
164
|
170
|
title: '状态',
|
|
165
|
171
|
minWidth: 100,
|
|
166
|
|
- formatter: (params: { cellValue: string; column: any; row: any }) => {
|
|
167
|
|
- const options = getStatusOptions();
|
|
168
|
|
- const option = options.find((item) => item.value === params.cellValue);
|
|
169
|
|
- const color = params.cellValue === '1' ? 'success' : 'danger';
|
|
170
|
|
- return `<el-tag type="${color}">${option ? option.label : params.cellValue}</el-tag>`;
|
|
|
172
|
+ slots: {
|
|
|
173
|
+ default: ({ row }) => {
|
|
|
174
|
+ return renderDict(row.statusCode, DictEnum.SYS_DISABLED_STATUS);
|
|
|
175
|
+ },
|
|
171
|
176
|
},
|
|
|
177
|
+ // formatter: (params: { cellValue: string; column: any; row: any }) => {
|
|
|
178
|
+ // const options = getStatusOptions();
|
|
|
179
|
+ // const option = options.find((item) => item.value === params.cellValue);
|
|
|
180
|
+ // const color = params.cellValue === '1' ? 'success' : 'danger';
|
|
|
181
|
+ // return `<el-tag type="${color}">${option ? option.label : params.cellValue}</el-tag>`;
|
|
|
182
|
+ // },
|
|
172
|
183
|
},
|
|
173
|
184
|
{
|
|
174
|
185
|
field: 'action',
|
|
|
@@ -189,12 +200,22 @@ export const drawerFormSchema: FormSchemaGetter = () => [
|
|
189
|
200
|
fieldName: 'id',
|
|
190
|
201
|
},
|
|
191
|
202
|
{
|
|
192
|
|
- component: 'Input',
|
|
|
203
|
+ component: 'ApiSelect',
|
|
193
|
204
|
fieldName: 'stationName',
|
|
194
|
205
|
label: '油站',
|
|
195
|
206
|
componentProps: {
|
|
196
|
207
|
placeholder: '请输入油站名称',
|
|
197
|
208
|
maxlength: 100,
|
|
|
209
|
+ api: async () => {
|
|
|
210
|
+ const resp = await stationInfoList({});
|
|
|
211
|
+ const data = resp.rows || [];
|
|
|
212
|
+ return Array.isArray(data)
|
|
|
213
|
+ ? data.map((item: any) => ({
|
|
|
214
|
+ label: item.stationName,
|
|
|
215
|
+ value: item.id,
|
|
|
216
|
+ }))
|
|
|
217
|
+ : [];
|
|
|
218
|
+ },
|
|
198
|
219
|
},
|
|
199
|
220
|
rules: 'required',
|
|
200
|
221
|
},
|
|
|
@@ -317,15 +338,50 @@ export const drawerFormSchema: FormSchemaGetter = () => [
|
|
317
|
338
|
label: '下次换证日期',
|
|
318
|
339
|
},
|
|
319
|
340
|
{
|
|
320
|
|
- component: 'Upload',
|
|
|
341
|
+ component: 'Input',
|
|
321
|
342
|
fieldName: 'certificateScanPath',
|
|
322
|
343
|
label: '证件扫描件',
|
|
323
|
|
- // 注意:该组件的详细实现已在idphoto-drawer.vue中通过插槽自定义
|
|
324
|
|
- // 这里仅保留基本配置,实际渲染由插槽控制
|
|
325
|
|
- componentProps: {
|
|
326
|
|
- // 基础配置
|
|
327
|
|
- action: '#',
|
|
328
|
|
- multiple: true,
|
|
|
344
|
+ dependencies: {
|
|
|
345
|
+ show: () => false,
|
|
|
346
|
+ triggerFields: [''],
|
|
|
347
|
+ },
|
|
|
348
|
+ },
|
|
|
349
|
+ {
|
|
|
350
|
+ component: 'Upload',
|
|
|
351
|
+ fieldName: 'certificateScanPathUrl',
|
|
|
352
|
+ label: '证件扫描件',
|
|
|
353
|
+ componentProps: (row: any) => {
|
|
|
354
|
+ return {
|
|
|
355
|
+ ...getSingleImageUploadConfig(),
|
|
|
356
|
+ onSuccess: (res: any) => {
|
|
|
357
|
+ if (res.code === 200) {
|
|
|
358
|
+ row.certificateScanPath = res.data.fileName;
|
|
|
359
|
+ // form.setFieldValue('certificateScanPath', res.data.fileName);
|
|
|
360
|
+ row.certificateScanPathUrl = [res.data.url].map((url) => ({ url }));
|
|
|
361
|
+ return res.data;
|
|
|
362
|
+ }
|
|
|
363
|
+ // return Promise.reject(res);
|
|
|
364
|
+ },
|
|
|
365
|
+ };
|
|
|
366
|
+ },
|
|
|
367
|
+
|
|
|
368
|
+ // 更多属性见:https://ant.design/components/upload-cn
|
|
|
369
|
+ // accept: '.png,.jpg,.jpeg',
|
|
|
370
|
+ // // 自动携带认证信息
|
|
|
371
|
+ // customRequest: uploadFile,
|
|
|
372
|
+ // disabled: false,
|
|
|
373
|
+ // maxCount: 1,
|
|
|
374
|
+ // // 单位:MB
|
|
|
375
|
+ // maxSize: 2,
|
|
|
376
|
+ // multiple: false,
|
|
|
377
|
+ // showUploadList: true,
|
|
|
378
|
+ // // 上传列表的内建样式,支持四种基本样式 text, picture, picture-card 和 picture-circle
|
|
|
379
|
+ // listType: 'picture-card',
|
|
|
380
|
+
|
|
|
381
|
+ renderComponentContent: () => {
|
|
|
382
|
+ return {
|
|
|
383
|
+ default: () => '点击上传',
|
|
|
384
|
+ };
|
|
329
|
385
|
},
|
|
330
|
386
|
},
|
|
331
|
387
|
{
|