dict.data.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
  2. // 国际化
  3. const { t } = useI18n()
  4. // 表单校验
  5. export const dictDataRules = reactive({
  6. label: [required],
  7. value: [required],
  8. sort: [required]
  9. })
  10. // crudSchemas
  11. export const crudSchemas = reactive<VxeCrudSchema>({
  12. primaryKey: 'id',
  13. primaryType: null,
  14. action: true,
  15. actionWidth: '140px',
  16. searchSpan: 12,
  17. columns: [
  18. {
  19. title: '字典类型',
  20. field: 'dictType',
  21. isTable: false,
  22. isForm: false
  23. },
  24. {
  25. title: '数据标签',
  26. field: 'label',
  27. isSearch: true
  28. },
  29. {
  30. title: '数据键值',
  31. field: 'value'
  32. },
  33. // {
  34. // title: '标签类型',
  35. // field: 'colorType',
  36. // form: {
  37. // component: 'Select',
  38. // componentProps: {
  39. // options: [
  40. // {
  41. // label: 'default',
  42. // value: ''
  43. // },
  44. // {
  45. // label: 'success',
  46. // value: 'success'
  47. // },
  48. // {
  49. // label: 'info',
  50. // value: 'info'
  51. // },
  52. // {
  53. // label: 'warning',
  54. // value: 'warning'
  55. // },
  56. // {
  57. // label: 'danger',
  58. // value: 'danger'
  59. // }
  60. // ]
  61. // }
  62. // },
  63. // isTable: false
  64. // },
  65. {
  66. title: '颜色',
  67. field: 'cssClass',
  68. isTable: false,
  69. form: {
  70. component: 'ColorPicker',
  71. componentProps: {
  72. predefine: ['#ffffff', '#409eff', '#67c23a', '#e6a23c', '#f56c6c', '#909399', '#c71585']
  73. }
  74. }
  75. },
  76. {
  77. title: '显示排序',
  78. field: 'sort',
  79. isTable: false
  80. },
  81. {
  82. title: t('common.status'),
  83. field: 'status',
  84. dictType: DICT_TYPE.COMMON_STATUS,
  85. dictClass: 'number'
  86. },
  87. {
  88. title: t('form.remark'),
  89. field: 'remark',
  90. form: {
  91. component: 'Input',
  92. componentProps: {
  93. type: 'textarea',
  94. rows: 4
  95. },
  96. colProps: {
  97. span: 24
  98. }
  99. },
  100. isTable: false
  101. }
  102. ]
  103. })
  104. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)