You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

126 lines
2.4 KiB

import { h } from 'vue'
import { Tag } from 'ant-design-vue'
import type { BasicColumn, FormSchema } from '@/components/Table'
import type { SystemDict } from '@/api/system/dict/types'
export const columns: BasicColumn<SystemDict>[] = [
{
title: '字典编号',
dataIndex: 'code',
width: 180,
customRender: ({ record }) => {
const { code } = record
return h(Tag, { color: 'blue' }, () => code)
},
},
{
title: '字典名称',
dataIndex: 'dictValue',
width: 180,
},
{
title: '字典排序',
dataIndex: 'sort',
width: 50,
},
{
title: '封存',
dataIndex: 'isSealed',
width: 50,
customRender: ({ record }) => {
const { isSealed } = record
const str = isSealed === 0 ? '否' : '是'
return h(Tag, { color: 'blue' }, () => str)
},
},
]
export const searchFormSchema: FormSchema[] = [
{
label: '字典编号',
field: 'code',
component: 'Input',
colProps: { span: 6 },
},
{
label: '字典名称',
field: 'dictValue',
component: 'Input',
colProps: { span: 6 },
},
]
export function getFormSchema(): FormSchema[] {
return [
{
field: 'id',
show: false,
component: 'Input',
},
{
field: 'dictKey',
show: false,
component: 'Input',
defaultValue: '-1',
},
{
field: 'isDeleted',
show: false,
component: 'Input',
defaultValue: 0,
},
{
field: 'parentId',
show: false,
component: 'Input',
defaultValue: '0',
},
{
field: 'parentName',
show: false,
component: 'Input',
defaultValue: '顶级',
},
{
label: '字典编号',
field: 'code',
required: true,
component: 'Input',
colProps: {
span: 24,
},
},
{
label: '字典名称',
field: 'dictValue',
required: true,
component: 'Input',
},
{
label: '字典排序',
field: 'sort',
required: true,
component: 'InputNumber',
},
{
label: '封存',
field: 'isSealed',
required: true,
component: 'Switch',
defaultValue: 0,
componentProps: {
checkedChildren: '是',
unCheckedChildren: '否',
checkedValue: 1,
unCheckedValue: 0,
},
},
{
label: '字典备注',
field: 'remark',
required: false,
component: 'Input',
},
]
}