form.ts 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /**
  2. * 审批流程表单配置
  3. */
  4. import { FormConfig } from '@/types/basic-form';
  5. export const APPROVAL_FORM_CONFIG: FormConfig[] = [
  6. {
  7. label: '审批流程名称:',
  8. prop: 'templateName',
  9. component: 'ElInput',
  10. componentProps: { placeholder: '请输入审批流程名称' },
  11. },
  12. {
  13. label: '审批流程描述:',
  14. prop: 'description',
  15. component: 'ElInput',
  16. componentProps: { placeholder: '请输入审批流程描述' },
  17. },
  18. ];
  19. export const APPROVAL_FORM_DATA = {
  20. templateName: '',
  21. description: '',
  22. };
  23. export const APPROVAL_FORM_RULES = {
  24. templateName: [{ required: true, message: '请输入审批流程名称', trigger: 'blur' }],
  25. };
  26. export const APPROVAL_NODE_FORM_CONFIG: FormConfig[] = [
  27. {
  28. label: '节点描述:',
  29. prop: 'nodeDescription',
  30. component: 'ElInput',
  31. componentProps: { placeholder: '请输入节点描述' },
  32. },
  33. {
  34. label: '审批人选择方式:',
  35. prop: 'approverType',
  36. component: 'ElSelect',
  37. selectOptions: [
  38. {
  39. label: '固定',
  40. value: 0,
  41. },
  42. {
  43. label: '自选',
  44. value: 1,
  45. },
  46. ],
  47. },
  48. {
  49. label: '审批方式:',
  50. prop: 'approvalType',
  51. component: 'ElSelect',
  52. selectOptions: [
  53. {
  54. label: '会签',
  55. value: 0,
  56. },
  57. {
  58. label: '或签',
  59. value: 1,
  60. },
  61. ],
  62. },
  63. {
  64. label: '审批节点顺序:',
  65. prop: 'approvalOrder',
  66. component: 'ElInputNumber',
  67. componentProps: {
  68. min: 1,
  69. },
  70. },
  71. ];
  72. export const APPROVAL_NODE_FORM_DATA = {
  73. approvalTemplateId: undefined,
  74. nodeDescription: '',
  75. approvalType: 0,
  76. approverType: 1,
  77. approvalOrder: undefined,
  78. };
  79. export const APPROVAL_NODE_FORM_RULES = {
  80. nodeDescription: [
  81. {
  82. required: true,
  83. message: '请输入节点描述',
  84. trigger: 'blur',
  85. },
  86. ],
  87. approverType: [
  88. {
  89. required: true,
  90. message: '请选择审批人选择方式',
  91. trigger: 'change',
  92. },
  93. ],
  94. approvalType: [
  95. {
  96. required: true,
  97. message: '请选择审批方式',
  98. trigger: 'change',
  99. },
  100. ],
  101. approvalOrder: [
  102. {
  103. required: true,
  104. // validator: (rule: any, value: any, callback: any, existingNumbers: number[]) => {
  105. // // 检查输入值是否与已有数组中的任何元素重复
  106. // if (value === null || value === undefined || value === '') {
  107. // callback(); // 空值校验由required规则处理
  108. // return;
  109. // }
  110. // if (existingNumbers.includes(Number(value))) {
  111. // callback(new Error('该顺序已存在,请重新输入'));
  112. // } else {
  113. // callback();
  114. // }
  115. // },
  116. message: '请输入审批节点顺序',
  117. trigger: 'blur',
  118. },
  119. ],
  120. };