13 changed files with 134 additions and 128 deletions
@ -0,0 +1,61 @@ |
|||
import dayjs from 'dayjs' |
|||
import utc from 'dayjs/plugin/utc' |
|||
import type { BasicColumn, FormSchema } from '@/components/Table' |
|||
|
|||
// 初始化 UTC 插件
|
|||
dayjs.extend(utc) |
|||
|
|||
export const columns: BasicColumn[] = [ |
|||
{ |
|||
title: '集团序号', |
|||
dataIndex: 'num', |
|||
width: 120, |
|||
}, |
|||
{ |
|||
title: '集团名称', |
|||
dataIndex: 'name', |
|||
width: 260, |
|||
}, |
|||
{ |
|||
title: '集团简称', |
|||
dataIndex: 'shortName', |
|||
width: 60, |
|||
}, |
|||
{ |
|||
title: '创建时间', |
|||
dataIndex: 'createTime', |
|||
width: 180, |
|||
// 推荐的新写法(Ant Design Vue 2.2+)
|
|||
customRender: ({ text }) => { |
|||
// 假设 text 是 UTC 时间(如 "2025-05-28T17:02:44")
|
|||
return dayjs.utc(text).local().format('YYYY-MM-DD HH:mm:ss') |
|||
}, |
|||
}, |
|||
] |
|||
|
|||
export const formSchema: FormSchema[] = [ |
|||
{ |
|||
label: '编号', |
|||
field: 'id', |
|||
show: false, |
|||
component: 'Input', |
|||
}, |
|||
{ |
|||
label: '集团序号', |
|||
field: 'num', |
|||
required: true, |
|||
component: 'Input', |
|||
}, |
|||
{ |
|||
label: '集团名称', |
|||
field: 'name', |
|||
required: true, |
|||
component: 'Input', |
|||
}, |
|||
{ |
|||
label: '集团简称', |
|||
field: 'shortName', |
|||
required: true, |
|||
component: 'Input', |
|||
}, |
|||
] |
@ -1,79 +0,0 @@ |
|||
import type { BasicColumn, FormSchema } from '@/components/Table' |
|||
import { useRender } from '@/components/Table' |
|||
import { DICT_TYPE, getDictOptions } from '@/utils/dict' |
|||
|
|||
export const columns: BasicColumn[] = [ |
|||
{ |
|||
title: '集团名称', |
|||
dataIndex: 'name', |
|||
width: 260, |
|||
}, |
|||
{ |
|||
title: '集团简称', |
|||
dataIndex: 'shortName', // 注意:后端是 shortName,不是 short!
|
|||
width: 60, |
|||
}, |
|||
{ |
|||
title: '状态', |
|||
dataIndex: 'status', |
|||
width: 180, |
|||
customRender: ({ text }) => { |
|||
return useRender.renderDict(text, DICT_TYPE.COMMON_STATUS) |
|||
}, |
|||
}, |
|||
{ |
|||
title: '创建时间', |
|||
dataIndex: 'createTime', |
|||
width: 180, |
|||
customRender: ({ text }) => { |
|||
return useRender.renderDate(text) |
|||
}, |
|||
}, |
|||
] |
|||
|
|||
export const searchFormSchema: FormSchema[] = [ |
|||
{ |
|||
label: '集团名称', |
|||
field: 'name', |
|||
component: 'Input', |
|||
colProps: { span: 8 }, |
|||
}, |
|||
{ |
|||
label: '状态', |
|||
field: 'status', |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: getDictOptions(DICT_TYPE.COMMON_STATUS), |
|||
}, |
|||
colProps: { span: 8 }, |
|||
}, |
|||
] |
|||
|
|||
export const formSchema: FormSchema[] = [ |
|||
{ |
|||
label: '编号', |
|||
field: 'id', |
|||
show: false, |
|||
component: 'Input', |
|||
}, |
|||
{ |
|||
label: '集团名称', |
|||
field: 'name', |
|||
required: true, |
|||
component: 'Input', |
|||
}, |
|||
{ |
|||
label: '集团简称', |
|||
field: 'shortName', // 注意:后端是 shortName,不是 short!
|
|||
required: true, |
|||
component: 'Input', |
|||
}, |
|||
{ |
|||
label: '集团状态', |
|||
field: 'status', |
|||
component: 'Select', |
|||
componentProps: { |
|||
options: getDictOptions(DICT_TYPE.COMMON_STATUS), |
|||
}, |
|||
}, |
|||
] |
Loading…
Reference in new issue