group.data.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { reactive } from 'vue'
  2. import { useI18n } from '@/hooks/web/useI18n'
  3. import { required } from '@/utils/formRules'
  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. })
  11. // CrudSchema
  12. const crudSchemas = reactive<CrudSchema[]>([
  13. {
  14. label: t('common.index'),
  15. field: 'id',
  16. type: 'index',
  17. form: {
  18. show: false
  19. },
  20. detail: {
  21. show: false
  22. }
  23. },
  24. {
  25. label: '组名',
  26. field: 'name',
  27. search: {
  28. show: true
  29. }
  30. },
  31. {
  32. label: '成员',
  33. field: 'memberUserIds'
  34. },
  35. {
  36. label: '描述',
  37. field: 'description'
  38. },
  39. {
  40. label: t('common.status'),
  41. field: 'status',
  42. dictType: DICT_TYPE.COMMON_STATUS
  43. },
  44. {
  45. label: '备注',
  46. field: 'remark',
  47. table: {
  48. show: false
  49. }
  50. },
  51. {
  52. label: t('common.createTime'),
  53. field: 'createTime',
  54. form: {
  55. show: false
  56. }
  57. },
  58. {
  59. label: t('table.action'),
  60. field: 'action',
  61. width: '240px',
  62. form: {
  63. show: false
  64. },
  65. detail: {
  66. show: false
  67. }
  68. }
  69. ])
  70. export const { allSchemas } = useCrudSchemas(crudSchemas)