group.data.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. dictData: 'number'
  44. },
  45. {
  46. label: '备注',
  47. field: 'remark',
  48. table: {
  49. show: false
  50. }
  51. },
  52. {
  53. label: t('common.createTime'),
  54. field: 'createTime',
  55. form: {
  56. show: false
  57. }
  58. },
  59. {
  60. label: t('table.action'),
  61. field: 'action',
  62. width: '240px',
  63. form: {
  64. show: false
  65. },
  66. detail: {
  67. show: false
  68. }
  69. }
  70. ])
  71. export const { allSchemas } = useCrudSchemas(crudSchemas)