notice.data.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
  6. const { t } = useI18n() // 国际化
  7. // 表单校验
  8. export const rules = reactive({
  9. title: [required],
  10. type: [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: 'title',
  28. search: {
  29. show: true
  30. }
  31. },
  32. {
  33. label: '公告类型',
  34. field: 'type',
  35. dictType: DICT_TYPE.SYSTEM_NOTICE_TYPE,
  36. search: {
  37. show: true
  38. }
  39. },
  40. {
  41. label: t('common.status'),
  42. field: 'status',
  43. dictType: DICT_TYPE.COMMON_STATUS,
  44. search: {
  45. show: true
  46. },
  47. form: {
  48. component: 'RadioButton'
  49. }
  50. },
  51. {
  52. label: '公告内容',
  53. field: 'content',
  54. form: {
  55. component: 'Editor',
  56. colProps: {
  57. span: 24
  58. },
  59. componentProps: {
  60. valueHtml: ''
  61. }
  62. }
  63. },
  64. {
  65. label: t('common.createTime'),
  66. field: 'createTime',
  67. form: {
  68. show: false
  69. }
  70. },
  71. {
  72. label: t('table.action'),
  73. field: 'action',
  74. width: '240px',
  75. form: {
  76. show: false
  77. },
  78. detail: {
  79. show: false
  80. }
  81. }
  82. ])
  83. export const { allSchemas } = useCrudSchemas(crudSchemas)