leave.data.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
  2. const { t } = useI18n() // 国际化
  3. // 表单校验
  4. export const rules = reactive({
  5. startTime: [{ required: true, message: '开始时间不能为空', trigger: 'blur' }],
  6. endTime: [{ required: true, message: '结束时间不能为空', trigger: 'blur' }],
  7. type: [{ required: true, message: '请假类型不能为空', trigger: 'change' }]
  8. })
  9. // crudSchemas
  10. const crudSchemas = reactive<VxeCrudSchema>({
  11. primaryKey: 'id',
  12. primaryType: 'id',
  13. primaryTitle: '申请编号',
  14. action: true,
  15. actionWidth: '260',
  16. searchSpan: 8,
  17. columns: [
  18. {
  19. title: t('common.status'),
  20. field: 'result',
  21. dictType: DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT,
  22. dictClass: 'number',
  23. isSearch: true,
  24. isForm: false
  25. },
  26. {
  27. title: t('common.startTimeText'),
  28. field: 'startTime',
  29. formatter: 'formatDay',
  30. table: {
  31. width: 180
  32. },
  33. detail: {
  34. dateFormat: 'YYYY-MM-DD'
  35. },
  36. form: {
  37. component: 'DatePicker'
  38. }
  39. },
  40. {
  41. title: t('common.endTimeText'),
  42. field: 'endTime',
  43. formatter: 'formatDay',
  44. table: {
  45. width: 180
  46. },
  47. detail: {
  48. dateFormat: 'YYYY-MM-DD'
  49. },
  50. form: {
  51. component: 'DatePicker'
  52. }
  53. },
  54. {
  55. title: '请假类型',
  56. field: 'type',
  57. dictType: DICT_TYPE.BPM_OA_LEAVE_TYPE,
  58. dictClass: 'number',
  59. isSearch: true
  60. },
  61. {
  62. title: '原因',
  63. field: 'reason',
  64. isSearch: true,
  65. componentProps: {
  66. type: 'textarea',
  67. rows: 4
  68. }
  69. },
  70. {
  71. title: '申请时间',
  72. field: 'createTime',
  73. formatter: 'formatDate',
  74. table: {
  75. width: 180
  76. },
  77. isSearch: true,
  78. search: {
  79. show: true,
  80. itemRender: {
  81. name: 'XDataTimePicker'
  82. }
  83. },
  84. isForm: false
  85. }
  86. ]
  87. })
  88. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)