dept.data.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
  2. const { t } = useI18n() // 国际化
  3. // 表单校验
  4. export const rules = reactive({
  5. name: [required],
  6. sort: [required],
  7. // email: [required],
  8. email: [
  9. { required: true, message: t('profile.rules.mail'), trigger: 'blur' },
  10. {
  11. type: 'email',
  12. message: t('profile.rules.truemail'),
  13. trigger: ['blur', 'change']
  14. }
  15. ],
  16. phone: [
  17. {
  18. len: 11,
  19. trigger: 'blur',
  20. message: '请输入正确的手机号码'
  21. }
  22. ]
  23. })
  24. // CrudSchema
  25. const crudSchemas = reactive<VxeCrudSchema>({
  26. primaryKey: 'id',
  27. primaryType: null,
  28. action: true,
  29. columns: [
  30. {
  31. title: '上级部门',
  32. field: 'parentId',
  33. isTable: false
  34. },
  35. {
  36. title: '部门名称',
  37. field: 'name',
  38. isSearch: true,
  39. table: {
  40. treeNode: true,
  41. align: 'left'
  42. }
  43. },
  44. {
  45. title: '负责人',
  46. field: 'leaderUserId',
  47. table: {
  48. slots: {
  49. default: 'leaderUserId_default'
  50. }
  51. }
  52. },
  53. {
  54. title: '联系电话',
  55. field: 'phone'
  56. },
  57. {
  58. title: '邮箱',
  59. field: 'email',
  60. isTable: false
  61. },
  62. {
  63. title: '显示排序',
  64. field: 'sort'
  65. },
  66. {
  67. title: t('common.status'),
  68. field: 'status',
  69. dictType: DICT_TYPE.COMMON_STATUS,
  70. dictClass: 'number',
  71. isSearch: true
  72. },
  73. {
  74. title: t('common.createTime'),
  75. field: 'createTime',
  76. formatter: 'formatDate',
  77. isForm: false
  78. }
  79. ]
  80. })
  81. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)