sensitiveWord.data.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import { reactive } from 'vue'
  2. import { useI18n } from '@/hooks/web/useI18n'
  3. import { required } from '@/utils/formRules'
  4. import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
  5. import { DICT_TYPE } from '@/utils/dict'
  6. const { t } = useI18n() // 国际化
  7. // 表单校验
  8. export const rules = reactive({
  9. name: [required],
  10. tags: [required]
  11. })
  12. // CrudSchema
  13. const crudSchemas = reactive<CrudSchema[]>([
  14. {
  15. label: t('common.index'),
  16. field: 'id',
  17. type: 'index',
  18. form: {
  19. show: false
  20. },
  21. detail: {
  22. show: false
  23. }
  24. },
  25. {
  26. label: '敏感词',
  27. field: 'name',
  28. search: {
  29. show: true
  30. }
  31. },
  32. {
  33. label: '标签',
  34. field: 'tags'
  35. },
  36. {
  37. label: t('common.status'),
  38. field: 'status',
  39. dictType: DICT_TYPE.COMMON_STATUS,
  40. dictClass: 'number',
  41. search: {
  42. show: true
  43. }
  44. },
  45. {
  46. label: '描述',
  47. field: 'description',
  48. form: {
  49. component: 'Input',
  50. componentProps: {
  51. type: 'textarea',
  52. rows: 4
  53. },
  54. colProps: {
  55. span: 24
  56. }
  57. }
  58. },
  59. {
  60. label: t('common.createTime'),
  61. field: 'createTime',
  62. form: {
  63. show: false
  64. }
  65. },
  66. {
  67. label: t('table.action'),
  68. field: 'action',
  69. width: '240px',
  70. form: {
  71. show: false
  72. },
  73. detail: {
  74. show: false
  75. }
  76. }
  77. ])
  78. export const { allSchemas } = useCrudSchemas(crudSchemas)