model.data.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import { reactive } from 'vue'
  2. import { useI18n } from '@/hooks/web/useI18n'
  3. import { required } from '@/utils/formRules'
  4. import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
  5. import { DICT_TYPE } from '@/utils/dict'
  6. const { t } = useI18n() // 国际化
  7. // 表单校验
  8. export const rules = reactive({
  9. key: [required],
  10. name: [required],
  11. category: [required],
  12. formType: [required],
  13. formId: [required],
  14. formCustomCreatePath: [required],
  15. formCustomViewPath: [required]
  16. })
  17. // CrudSchema
  18. const crudSchemas = reactive<VxeCrudSchema>({
  19. primaryKey: 'key',
  20. primaryType: null,
  21. action: true,
  22. actionWidth: '540px',
  23. columns: [
  24. {
  25. title: '流程标识',
  26. field: 'key',
  27. isSearch: true,
  28. table: {
  29. width: 120
  30. }
  31. },
  32. {
  33. title: '流程名称',
  34. field: 'name',
  35. isSearch: true,
  36. table: {
  37. width: 120,
  38. slots: {
  39. default: 'name_default'
  40. }
  41. }
  42. },
  43. {
  44. title: '流程分类',
  45. field: 'category',
  46. dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
  47. dictClass: 'number',
  48. isSearch: true
  49. },
  50. {
  51. title: '表单信息',
  52. field: 'formId',
  53. table: {
  54. width: 180,
  55. slots: {
  56. default: 'formId_default'
  57. }
  58. }
  59. },
  60. {
  61. title: '最新部署的流程定义',
  62. field: 'processDefinition',
  63. isForm: false,
  64. table: {
  65. children: [
  66. {
  67. title: '流程版本',
  68. field: 'version',
  69. slots: {
  70. default: 'version_default'
  71. },
  72. width: 80
  73. },
  74. {
  75. title: '激活状态',
  76. field: 'status',
  77. slots: {
  78. default: 'status_default'
  79. },
  80. width: 80
  81. },
  82. {
  83. title: '部署时间',
  84. field: 'processDefinition.deploymentTime',
  85. formatter: 'formatDate',
  86. width: 180
  87. }
  88. ]
  89. }
  90. },
  91. {
  92. title: t('common.createTime'),
  93. field: 'createTime',
  94. isForm: false,
  95. formatter: 'formatDate',
  96. table: {
  97. width: 180
  98. }
  99. }
  100. ]
  101. })
  102. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)