ShiShiYiBan/yudao-ui-admin-vue3/src/views/system/post/post.data.ts

65 lines
1.2 KiB
TypeScript
Raw Normal View History

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-10 17:40:42 +08:00
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
2022-07-18 19:06:37 +08:00
const { t } = useI18n() // 国际化
// 表单校验
export const rules = reactive({
name: [required],
code: [required],
sort: [required]
2022-07-18 19:06:37 +08:00
})
// CrudSchema
2022-11-12 15:52:43 +08:00
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'seq',
action: true,
columns: [
{
title: '岗位名称',
field: 'name',
search: {
show: true
}
2022-07-18 19:06:37 +08:00
},
2022-11-12 15:52:43 +08:00
{
title: '岗位编码',
field: 'code',
search: {
show: true
2022-11-03 14:33:30 +08:00
}
},
2022-11-12 15:52:43 +08:00
{
title: '岗位顺序',
field: 'sort'
},
{
title: t('common.status'),
field: 'status',
dictType: DICT_TYPE.COMMON_STATUS,
search: {
show: true
2022-11-03 14:33:30 +08:00
}
},
2022-11-12 15:52:43 +08:00
{
title: '备注',
field: 'remark',
table: {
show: false
}
2022-07-18 19:06:37 +08:00
},
2022-11-12 15:52:43 +08:00
{
title: t('common.createTime'),
field: 'createTime',
formatter: 'formatDate',
form: {
show: false
}
2022-07-18 19:06:37 +08:00
}
2022-11-12 15:52:43 +08:00
]
})
2022-11-03 14:33:30 +08:00
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)