dept.data.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import { required } from '@/utils/formRules'
  2. import { reactive } from 'vue'
  3. import { FormSchema } from '@/types/form'
  4. // 表单校验
  5. export const rules = reactive({
  6. name: [required],
  7. sort: [required],
  8. email: [required],
  9. phone: [
  10. {
  11. pattern:
  12. /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/,
  13. trigger: 'blur',
  14. message: '请输入正确的手机号码'
  15. }
  16. ]
  17. })
  18. export const modelSchema = reactive<FormSchema[]>([
  19. {
  20. label: '上级部门',
  21. field: 'parentId',
  22. component: 'Input'
  23. },
  24. {
  25. label: '部门名称',
  26. field: 'name',
  27. component: 'Input',
  28. formItemProps: {
  29. rules: [required]
  30. }
  31. },
  32. {
  33. label: '负责人',
  34. field: 'leaderUserId',
  35. component: 'Input'
  36. },
  37. {
  38. label: '联系电话',
  39. field: 'phone',
  40. component: 'Input'
  41. },
  42. {
  43. label: '邮箱',
  44. field: 'email',
  45. component: 'Input'
  46. },
  47. {
  48. label: '显示排序',
  49. field: 'sort',
  50. component: 'Input'
  51. },
  52. {
  53. label: '状态',
  54. field: 'status',
  55. component: 'RadioButton',
  56. componentProps: {
  57. options: [
  58. {
  59. label: '开启',
  60. value: 0
  61. },
  62. {
  63. label: '关闭',
  64. value: 1
  65. }
  66. ]
  67. }
  68. }
  69. ])