dept.data.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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: 'InputNumber',
  51. value: 0
  52. },
  53. {
  54. label: '状态',
  55. field: 'status',
  56. component: 'RadioButton',
  57. componentProps: {
  58. options: [
  59. {
  60. label: '开启',
  61. value: 0
  62. },
  63. {
  64. label: '关闭',
  65. value: 1
  66. }
  67. ]
  68. }
  69. }
  70. ])