2022-07-18 19:06:37 +08:00
|
|
|
import { reactive } from 'vue'
|
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
|
|
import { required } from '@/utils/formRules'
|
|
|
|
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
|
|
|
|
// 表单校验
|
|
|
|
export const rules = reactive({
|
|
|
|
title: [required],
|
|
|
|
type: [required],
|
|
|
|
status: [required]
|
|
|
|
})
|
|
|
|
|
|
|
|
// CrudSchema
|
|
|
|
const crudSchemas = reactive<CrudSchema[]>([
|
|
|
|
{
|
|
|
|
label: t('common.index'),
|
|
|
|
field: 'id',
|
|
|
|
type: 'index',
|
2022-11-17 17:18:48 +08:00
|
|
|
isForm: false,
|
|
|
|
isDetail: false
|
2022-07-18 19:06:37 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '表名称',
|
|
|
|
field: 'tableName',
|
2022-11-17 17:18:48 +08:00
|
|
|
isSearch: true
|
2022-07-18 19:06:37 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '表描述',
|
|
|
|
field: 'tableComment',
|
2022-11-17 17:18:48 +08:00
|
|
|
isSearch: true
|
2022-07-18 19:06:37 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '实体',
|
|
|
|
field: 'className',
|
2022-11-17 17:18:48 +08:00
|
|
|
isSearch: true
|
2022-07-18 19:06:37 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: t('common.createTime'),
|
|
|
|
field: 'createTime',
|
2022-11-17 17:18:48 +08:00
|
|
|
isForm: false,
|
2022-08-02 10:19:02 +08:00
|
|
|
search: {
|
|
|
|
show: true,
|
|
|
|
component: 'DatePicker',
|
|
|
|
componentProps: {
|
|
|
|
type: 'datetimerange',
|
|
|
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
|
|
|
|
}
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: t('common.updateTime'),
|
|
|
|
field: 'updateTime',
|
2022-11-17 17:18:48 +08:00
|
|
|
isForm: false
|
2022-07-18 19:06:37 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: t('table.action'),
|
|
|
|
field: 'action',
|
2022-11-17 17:18:48 +08:00
|
|
|
width: '350px',
|
|
|
|
isForm: false,
|
|
|
|
isDetail: false
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
])
|
|
|
|
export const { allSchemas } = useCrudSchemas(crudSchemas)
|