refactor: notice

This commit is contained in:
xingyu
2022-11-12 23:33:29 +08:00
parent f1445844bf
commit 301b66d30e
4 changed files with 175 additions and 216 deletions

View File

@@ -2,7 +2,7 @@ import { reactive } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
import { required } from '@/utils/formRules'
import { DICT_TYPE } from '@/utils/dict'
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
const { t } = useI18n() // 国际化
// 表单校验
@@ -12,74 +12,47 @@ export const rules = reactive({
})
// CrudSchema
const crudSchemas = reactive<CrudSchema[]>([
{
label: t('common.index'),
field: 'id',
type: 'index',
form: {
show: false
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'seq',
action: true,
columns: [
{
title: '公告标题',
field: 'title',
isSearch: true
},
detail: {
show: false
}
},
{
label: '公告标题',
field: 'title',
search: {
show: true
}
},
{
label: '公告类型',
field: 'type',
dictType: DICT_TYPE.SYSTEM_NOTICE_TYPE,
search: {
show: true
}
},
{
label: t('common.status'),
field: 'status',
dictType: DICT_TYPE.COMMON_STATUS,
search: {
show: true
{
title: '公告类型',
field: 'type',
dictType: DICT_TYPE.SYSTEM_NOTICE_TYPE,
isSearch: true
},
form: {
component: 'RadioButton'
}
},
{
label: '公告内容',
field: 'content',
form: {
component: 'Editor',
colProps: {
span: 24
},
componentProps: {
valueHtml: ''
{
title: t('common.status'),
field: 'status',
dictType: DICT_TYPE.COMMON_STATUS,
isSearch: true
},
{
title: '公告内容',
field: 'content',
form: {
component: 'Editor',
colProps: {
span: 24
},
componentProps: {
valueHtml: ''
}
}
}
},
{
label: t('common.createTime'),
field: 'createTime',
form: {
show: false
}
},
{
label: t('table.action'),
field: 'action',
width: '240px',
form: {
show: false
},
detail: {
show: false
{
title: t('common.createTime'),
field: 'createTime',
formatter: 'formatDate',
isForm: false
}
}
])
export const { allSchemas } = useCrudSchemas(crudSchemas)
]
})
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)