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 13:34:17 +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],
|
|
|
|
tags: [required]
|
|
|
|
})
|
|
|
|
|
|
|
|
// CrudSchema
|
2022-11-22 13:34:17 +08:00
|
|
|
const crudSchemas = reactive<VxeCrudSchema>({
|
|
|
|
primaryKey: 'id',
|
|
|
|
primaryType: 'seq',
|
2022-11-28 16:50:53 +08:00
|
|
|
primaryTitle: '敏感词编号',
|
2022-11-22 13:34:17 +08:00
|
|
|
action: true,
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
title: '敏感词',
|
|
|
|
field: 'name',
|
|
|
|
isSearch: true
|
2022-07-18 19:06:37 +08:00
|
|
|
},
|
2022-11-22 13:34:17 +08:00
|
|
|
{
|
|
|
|
title: '标签',
|
2022-11-28 16:50:53 +08:00
|
|
|
field: 'tags',
|
2022-11-22 13:34:17 +08:00
|
|
|
table: {
|
|
|
|
slots: {
|
|
|
|
default: 'tags_default'
|
|
|
|
}
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
},
|
2022-11-22 13:34:17 +08:00
|
|
|
{
|
|
|
|
title: t('common.status'),
|
|
|
|
field: 'status',
|
|
|
|
dictType: DICT_TYPE.COMMON_STATUS,
|
|
|
|
dictClass: 'number',
|
|
|
|
isSearch: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '描述',
|
|
|
|
field: 'description',
|
|
|
|
form: {
|
|
|
|
component: 'Input',
|
|
|
|
componentProps: {
|
|
|
|
type: 'textarea',
|
|
|
|
rows: 4
|
|
|
|
},
|
|
|
|
colProps: {
|
|
|
|
span: 24
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: t('common.createTime'),
|
|
|
|
field: 'createTime',
|
|
|
|
formatter: 'formatDate',
|
|
|
|
isForm: false
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
2022-11-22 13:34:17 +08:00
|
|
|
]
|
|
|
|
})
|
|
|
|
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|