notice.data.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. },
  28. {
  29. title: t('common.status'),
  30. field: 'status',
  31. dictType: DICT_TYPE.COMMON_STATUS,
  32. isSearch: true
  33. },
  34. {
  35. title: '公告内容',
  36. field: 'content',
  37. table: {
  38. type: 'html'
  39. },
  40. form: {
  41. component: 'Editor',
  42. colProps: {
  43. span: 24
  44. },
  45. componentProps: {
  46. valueHtml: ''
  47. }
  48. },
  49. isTable: false
  50. },
  51. {
  52. title: t('common.createTime'),
  53. field: 'createTime',
  54. formatter: 'formatDate',
  55. isForm: false
  56. }
  57. ]
  58. })
  59. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)