config.data.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
  2. const { t } = useI18n() // 国际化
  3. // 表单校验
  4. export const rules = reactive({
  5. category: [required],
  6. name: [required],
  7. key: [required],
  8. value: [required]
  9. })
  10. // CrudSchema
  11. const crudSchemas = reactive<VxeCrudSchema>({
  12. primaryKey: 'id',
  13. primaryType: null,
  14. action: true,
  15. columns: [
  16. {
  17. title: '参数分类',
  18. field: 'category'
  19. },
  20. {
  21. title: '参数名称',
  22. field: 'name',
  23. isSearch: true
  24. },
  25. {
  26. title: '参数键名',
  27. field: 'key',
  28. isSearch: true
  29. },
  30. {
  31. title: '参数键值',
  32. field: 'value'
  33. },
  34. {
  35. title: '系统内置',
  36. field: 'type',
  37. dictType: DICT_TYPE.INFRA_CONFIG_TYPE,
  38. dictClass: 'number',
  39. isSearch: true
  40. },
  41. {
  42. title: '是否可见',
  43. field: 'visible',
  44. table: {
  45. slots: {
  46. default: 'visible_default'
  47. }
  48. },
  49. form: {
  50. component: 'RadioButton',
  51. componentProps: {
  52. options: [
  53. { label: '是', value: true },
  54. { label: '否', value: false }
  55. ]
  56. }
  57. }
  58. },
  59. {
  60. title: t('form.remark'),
  61. field: 'remark',
  62. isTable: false,
  63. form: {
  64. component: 'Input',
  65. componentProps: {
  66. type: 'textarea',
  67. rows: 4
  68. },
  69. colProps: {
  70. span: 24
  71. }
  72. }
  73. },
  74. {
  75. title: t('common.createTime'),
  76. field: 'createTime',
  77. formatter: 'formatDate',
  78. isForm: false,
  79. search: {
  80. show: true,
  81. itemRender: {
  82. name: 'XDataTimePicker'
  83. }
  84. }
  85. }
  86. ]
  87. })
  88. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)