dept.data.ts 1.2 KB

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