notice.data.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. title: [required],
  10. type: [required]
  11. })
  12. // CrudSchema
  13. const crudSchemas = reactive<VxeCrudSchema>({
  14. primaryKey: 'id',
  15. primaryType: 'seq',
  16. action: true,
  17. columns: [
  18. {
  19. title: '公告标题',
  20. field: 'title',
  21. isSearch: true
  22. },
  23. {
  24. title: '公告类型',
  25. field: 'type',
  26. dictType: DICT_TYPE.SYSTEM_NOTICE_TYPE,
  27. dictClass: 'number'
  28. },
  29. {
  30. title: t('common.status'),
  31. field: 'status',
  32. dictType: DICT_TYPE.COMMON_STATUS,
  33. dictClass: 'number',
  34. isSearch: true
  35. },
  36. {
  37. title: '公告内容',
  38. field: 'content',
  39. table: {
  40. type: 'html' // TODO 芋艿:详情展示,会是 html 的原始内容。要不改成直接使用富文本展示,设置个 readonly?
  41. },
  42. form: {
  43. component: 'Editor',
  44. colProps: {
  45. span: 24
  46. },
  47. componentProps: {
  48. valueHtml: ''
  49. }
  50. },
  51. isTable: false
  52. },
  53. {
  54. title: t('common.createTime'),
  55. field: 'createTime',
  56. formatter: 'formatDate',
  57. isForm: false
  58. }
  59. ]
  60. })
  61. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)