tenantPackage.data.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import { reactive } from 'vue'
  2. import { required } from '@/utils/formRules'
  3. import { useI18n } from '@/hooks/web/useI18n'
  4. import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
  5. import { DICT_TYPE } from '@/utils/dict'
  6. const { t } = useI18n() // 国际化
  7. // 表单校验
  8. export const rules = reactive({
  9. name: [required],
  10. id: [required],
  11. type: [required],
  12. remark: [required],
  13. status: [required],
  14. menuIds: [required]
  15. })
  16. // CrudSchema
  17. const crudSchemas = reactive<CrudSchema[]>([
  18. {
  19. label: t('common.index'),
  20. field: 'id',
  21. type: 'index',
  22. form: {
  23. show: false
  24. },
  25. detail: {
  26. show: false
  27. }
  28. },
  29. {
  30. label: '套餐名称',
  31. field: 'name',
  32. search: {
  33. show: true
  34. }
  35. },
  36. {
  37. label: t('common.status'),
  38. field: 'status',
  39. dictType: DICT_TYPE.COMMON_STATUS,
  40. dictClass: 'number',
  41. search: {
  42. show: true
  43. }
  44. },
  45. {
  46. label: '菜单权限',
  47. field: 'menuIds',
  48. table: {
  49. show: false
  50. }
  51. },
  52. {
  53. label: t('form.remark'),
  54. field: 'remark',
  55. form: {
  56. component: 'Input',
  57. componentProps: {
  58. type: 'textarea',
  59. rows: 4
  60. },
  61. colProps: {
  62. span: 24
  63. }
  64. },
  65. table: {
  66. show: false
  67. }
  68. },
  69. {
  70. label: '创建时间',
  71. field: 'createTime',
  72. form: {
  73. show: false
  74. }
  75. },
  76. {
  77. label: t('table.action'),
  78. field: 'action',
  79. width: '240px',
  80. form: {
  81. show: false
  82. },
  83. detail: {
  84. show: false
  85. }
  86. }
  87. ])
  88. export const { allSchemas } = useCrudSchemas(crudSchemas)