Files
ipms-sjy/yudao-ui-admin-vue3/src/views/system/post/post.data.ts

86 lines
1.5 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'
2022-11-03 14:33:30 +08:00
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
2022-07-18 19:06:37 +08:00
import { DICT_TYPE } from '@/utils/dict'
const { t } = useI18n() // 国际化
// 表单校验
export const rules = reactive({
name: [required],
code: [required],
sort: [required]
2022-07-18 19:06:37 +08:00
})
// CrudSchema
2022-11-03 14:33:30 +08:00
const crudSchemas = reactive<VxeCrudSchema[]>([
2022-07-18 19:06:37 +08:00
{
2022-11-03 14:33:30 +08:00
title: t('common.index'),
2022-07-18 19:06:37 +08:00
field: 'id',
type: 'index',
form: {
show: false
},
detail: {
show: false
}
},
{
2022-11-03 14:33:30 +08:00
title: '岗位名称',
2022-07-18 19:06:37 +08:00
field: 'name',
search: {
show: true
}
},
{
2022-11-03 14:33:30 +08:00
title: '岗位编码',
2022-07-18 19:06:37 +08:00
field: 'code',
search: {
show: true
}
},
{
2022-11-03 14:33:30 +08:00
title: '岗位顺序',
2022-07-18 19:06:37 +08:00
field: 'sort'
},
{
2022-11-03 14:33:30 +08:00
title: t('common.status'),
2022-07-18 19:06:37 +08:00
field: 'status',
dictType: DICT_TYPE.COMMON_STATUS,
2022-11-03 14:33:30 +08:00
table: {
slots: {
default: 'status_default'
}
},
2022-07-18 19:06:37 +08:00
search: {
show: true
}
},
{
2022-11-03 14:33:30 +08:00
title: t('common.createTime'),
2022-07-18 19:06:37 +08:00
field: 'createTime',
form: {
show: false
}
},
{
2022-11-03 14:33:30 +08:00
title: t('table.action'),
2022-07-18 19:06:37 +08:00
field: 'action',
width: '240px',
2022-11-03 14:33:30 +08:00
table: {
width: '240px',
showOverflow: true,
slots: {
default: 'action_default'
}
},
2022-07-18 19:06:37 +08:00
form: {
show: false
},
detail: {
show: false
}
}
])
2022-11-03 14:33:30 +08:00
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)