sensitiveWord.data.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { reactive } from 'vue'
  2. import { useI18n } from '@/hooks/web/useI18n'
  3. import { required } from '@/utils/formRules'
  4. import { DICT_TYPE } from '@/utils/dict'
  5. import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
  6. const { t } = useI18n() // 国际化
  7. // 表单校验
  8. export const rules = reactive({
  9. name: [required],
  10. tags: [required]
  11. })
  12. // CrudSchema
  13. const crudSchemas = reactive<VxeCrudSchema>({
  14. primaryKey: 'id',
  15. primaryType: 'seq',
  16. primaryTitle: '敏感词编号', // TODO 星语:如果长度超过 4 个字符,会导致表格列宽度不够,需要优化
  17. action: true,
  18. columns: [
  19. {
  20. title: '敏感词',
  21. field: 'name',
  22. isSearch: true
  23. },
  24. {
  25. title: '标签',
  26. field: 'tags', // TODO 星语:如果是数组的话,是不是使用 el tag 展示呀?
  27. table: {
  28. slots: {
  29. default: 'tags_default'
  30. }
  31. }
  32. },
  33. {
  34. title: t('common.status'),
  35. field: 'status',
  36. dictType: DICT_TYPE.COMMON_STATUS,
  37. dictClass: 'number',
  38. isSearch: true
  39. },
  40. {
  41. title: '描述',
  42. field: 'description',
  43. form: {
  44. component: 'Input',
  45. componentProps: {
  46. type: 'textarea',
  47. rows: 4
  48. },
  49. colProps: {
  50. span: 24
  51. }
  52. }
  53. },
  54. {
  55. title: t('common.createTime'),
  56. field: 'createTime',
  57. formatter: 'formatDate',
  58. isForm: false
  59. }
  60. ]
  61. })
  62. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)