dept.data.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. phone: [
  9. {
  10. len: 11,
  11. trigger: 'blur',
  12. message: '请输入正确的手机号码'
  13. }
  14. ]
  15. })
  16. // CrudSchema
  17. const crudSchemas = reactive<VxeCrudSchema>({
  18. primaryKey: 'id',
  19. primaryType: null,
  20. action: true,
  21. columns: [
  22. {
  23. title: '上级部门',
  24. field: 'parentId',
  25. isTable: false
  26. },
  27. {
  28. title: '部门名称',
  29. field: 'name',
  30. isSearch: true,
  31. table: {
  32. treeNode: true,
  33. align: 'left'
  34. }
  35. },
  36. {
  37. title: '负责人',
  38. field: 'leaderUserId',
  39. table: {
  40. slots: {
  41. default: 'leaderUserId_default'
  42. }
  43. }
  44. },
  45. {
  46. title: '联系电话',
  47. field: 'phone'
  48. },
  49. {
  50. title: '邮箱',
  51. field: 'email',
  52. isTable: false
  53. },
  54. {
  55. title: '显示排序',
  56. field: 'sort'
  57. },
  58. {
  59. title: t('common.status'),
  60. field: 'status',
  61. dictType: DICT_TYPE.COMMON_STATUS,
  62. dictClass: 'number',
  63. isSearch: true
  64. },
  65. {
  66. title: t('common.createTime'),
  67. field: 'createTime',
  68. formatter: 'formatDate',
  69. isForm: false
  70. }
  71. ]
  72. })
  73. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)