2022-07-18 19:06:37 +08:00
|
|
|
import { reactive } from 'vue'
|
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
|
|
import { required } from '@/utils/formRules'
|
|
|
|
import { DICT_TYPE } from '@/utils/dict'
|
2022-11-22 15:10:00 +08:00
|
|
|
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
|
2022-07-18 19:06:37 +08:00
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
|
|
|
|
// 表单校验
|
|
|
|
export const rules = reactive({
|
|
|
|
category: [required],
|
|
|
|
name: [required],
|
|
|
|
key: [required],
|
|
|
|
value: [required]
|
|
|
|
})
|
|
|
|
|
|
|
|
// CrudSchema
|
2022-11-22 15:10:00 +08:00
|
|
|
const crudSchemas = reactive<VxeCrudSchema>({
|
|
|
|
primaryKey: 'id',
|
2022-11-26 23:05:29 +08:00
|
|
|
primaryType: null,
|
2022-11-22 15:10:00 +08:00
|
|
|
action: true,
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
title: '参数分类',
|
|
|
|
field: 'category'
|
2022-07-18 19:06:37 +08:00
|
|
|
},
|
2022-11-22 15:10:00 +08:00
|
|
|
{
|
|
|
|
title: '参数名称',
|
|
|
|
field: 'name',
|
|
|
|
isSearch: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '参数键名',
|
|
|
|
field: 'key',
|
|
|
|
isSearch: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '参数键值',
|
|
|
|
field: 'value'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '系统内置',
|
|
|
|
field: 'type',
|
|
|
|
dictType: DICT_TYPE.INFRA_CONFIG_TYPE,
|
|
|
|
dictClass: 'number',
|
|
|
|
isSearch: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '是否可见',
|
|
|
|
field: 'visible',
|
|
|
|
table: {
|
|
|
|
slots: {
|
|
|
|
default: 'visible_default'
|
|
|
|
}
|
2022-07-18 19:06:37 +08:00
|
|
|
},
|
2022-11-22 15:10:00 +08:00
|
|
|
form: {
|
|
|
|
component: 'RadioButton',
|
|
|
|
componentProps: {
|
|
|
|
options: [
|
|
|
|
{ label: '是', value: true },
|
|
|
|
{ label: '否', value: false }
|
|
|
|
]
|
|
|
|
}
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
},
|
2022-11-22 15:10:00 +08:00
|
|
|
{
|
|
|
|
title: t('form.remark'),
|
|
|
|
field: 'remark',
|
|
|
|
isTable: false,
|
|
|
|
form: {
|
|
|
|
component: 'Input',
|
|
|
|
componentProps: {
|
|
|
|
type: 'textarea',
|
|
|
|
rows: 4
|
|
|
|
},
|
|
|
|
colProps: {
|
|
|
|
span: 24
|
|
|
|
}
|
2022-08-02 10:19:02 +08:00
|
|
|
}
|
2022-07-18 19:06:37 +08:00
|
|
|
},
|
2022-11-22 15:10:00 +08:00
|
|
|
{
|
|
|
|
title: t('common.createTime'),
|
|
|
|
field: 'createTime',
|
|
|
|
formatter: 'formatDate',
|
|
|
|
isForm: false,
|
|
|
|
search: {
|
|
|
|
show: true,
|
|
|
|
itemRender: {
|
|
|
|
name: 'XDataTimePicker'
|
|
|
|
}
|
|
|
|
}
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
2022-11-22 15:10:00 +08:00
|
|
|
]
|
|
|
|
})
|
2022-11-26 23:05:29 +08:00
|
|
|
// TODO 星语:“创建时间”的筛选,超过 table 的边框
|
2022-11-22 15:10:00 +08:00
|
|
|
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|