workflow-editor 0.0.90-up-cdnTmp1 → 0.0.91-up

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/.prettierrc.json +9 -0
  2. package/index.html +13 -0
  3. package/package.json +8 -16
  4. package/packages/index.js +34 -0
  5. package/packages/plugins/formValidatorUtil.js +890 -0
  6. package/packages/plugins/index.js +8 -0
  7. package/packages/workflow-editor/index.js +14 -0
  8. package/packages/workflow-editor/src/api.js +7 -0
  9. package/packages/workflow-editor/src/assets/tab-select.png +0 -0
  10. package/packages/workflow-editor/src/assets/tab-selectWhite.png +0 -0
  11. package/packages/workflow-editor/src/assets/wf-editor-icons.js +2 -0
  12. package/packages/workflow-editor/src/constant.js +8 -0
  13. package/packages/workflow-editor/src/json-object-templates/auto-task.js +70 -0
  14. package/packages/workflow-editor/src/json-object-templates/copy-task.js +72 -0
  15. package/packages/workflow-editor/src/json-object-templates/decision.js +11 -0
  16. package/packages/workflow-editor/src/json-object-templates/end.js +14 -0
  17. package/packages/workflow-editor/src/json-object-templates/fork.js +10 -0
  18. package/packages/workflow-editor/src/json-object-templates/human-decision.js +9 -0
  19. package/packages/workflow-editor/src/json-object-templates/human-task.js +208 -0
  20. package/packages/workflow-editor/src/json-object-templates/join.js +10 -0
  21. package/packages/workflow-editor/src/json-object-templates/process.js +99 -0
  22. package/packages/workflow-editor/src/json-object-templates/start.js +13 -0
  23. package/packages/workflow-editor/src/json-object-templates/subprocess.js +31 -0
  24. package/packages/workflow-editor/src/json-object-templates/transition.js +26 -0
  25. package/packages/workflow-editor/src/main/admin-save-dialog.vue +67 -0
  26. package/packages/workflow-editor/src/main/canvas.vue +497 -0
  27. package/packages/workflow-editor/src/main/context-menu.vue +155 -0
  28. package/packages/workflow-editor/src/main/icon-svg.vue +32 -0
  29. package/packages/workflow-editor/src/main/selection-region.vue +66 -0
  30. package/packages/workflow-editor/src/main/tache-history-tooltip.vue +38 -0
  31. package/packages/workflow-editor/src/main/tache-name-input.vue +19 -0
  32. package/packages/workflow-editor/src/main/tache-subprocess-history-dialog.vue +40 -0
  33. package/packages/workflow-editor/src/main/toolbox.vue +60 -0
  34. package/packages/workflow-editor/src/main/wf-history-canvas.vue +309 -0
  35. package/packages/workflow-editor/src/process-json.js +624 -0
  36. package/packages/workflow-editor/src/process-service.js +69 -0
  37. package/packages/workflow-editor/src/properties-editors/auto-task/basic-properties.vue +81 -0
  38. package/packages/workflow-editor/src/properties-editors/auto-task/permission-settings.vue +155 -0
  39. package/packages/workflow-editor/src/properties-editors/auto-task.vue +74 -0
  40. package/packages/workflow-editor/src/properties-editors/common/additional-condition-utils.js +636 -0
  41. package/packages/workflow-editor/src/properties-editors/common/additional-condition.vue +300 -0
  42. package/packages/workflow-editor/src/properties-editors/common/auto-filled-fields-utils.js +34 -0
  43. package/packages/workflow-editor/src/properties-editors/common/auto-filled-fields.vue +268 -0
  44. package/packages/workflow-editor/src/properties-editors/common/common-notice-tool.vue +81 -0
  45. package/packages/workflow-editor/src/properties-editors/common/common-user-condition.vue +242 -0
  46. package/packages/workflow-editor/src/properties-editors/common/form-fields-utils.js +23 -0
  47. package/packages/workflow-editor/src/properties-editors/common/form-fields.vue +114 -0
  48. package/packages/workflow-editor/src/properties-editors/common/i18n-input.vue +90 -0
  49. package/packages/workflow-editor/src/properties-editors/common/i18n-set-dialog.vue +143 -0
  50. package/packages/workflow-editor/src/properties-editors/common/notice-reminder.vue +144 -0
  51. package/packages/workflow-editor/src/properties-editors/common/notice.vue +123 -0
  52. package/packages/workflow-editor/src/properties-editors/common/reminder.vue +347 -0
  53. package/packages/workflow-editor/src/properties-editors/common/select-mail-template.vue +92 -0
  54. package/packages/workflow-editor/src/properties-editors/common/standard-fields.vue +66 -0
  55. package/packages/workflow-editor/src/properties-editors/common/system-role-tree-inline.vue +354 -0
  56. package/packages/workflow-editor/src/properties-editors/common/system-role-tree.vue +68 -0
  57. package/packages/workflow-editor/src/properties-editors/common/task-title.vue +221 -0
  58. package/packages/workflow-editor/src/properties-editors/common/transactor-settings.vue +275 -0
  59. package/packages/workflow-editor/src/properties-editors/common/user-selection.vue +426 -0
  60. package/packages/workflow-editor/src/properties-editors/common/value-selection-dialog.vue +272 -0
  61. package/packages/workflow-editor/src/properties-editors/common/variables.vue +139 -0
  62. package/packages/workflow-editor/src/properties-editors/copy-task/basic-properties.vue +90 -0
  63. package/packages/workflow-editor/src/properties-editors/copy-task/permission-settings.vue +155 -0
  64. package/packages/workflow-editor/src/properties-editors/copy-task.vue +95 -0
  65. package/packages/workflow-editor/src/properties-editors/decision.vue +88 -0
  66. package/packages/workflow-editor/src/properties-editors/fork.vue +77 -0
  67. package/packages/workflow-editor/src/properties-editors/human-decision.vue +49 -0
  68. package/packages/workflow-editor/src/properties-editors/human-task/additional-condition-dialog.vue +62 -0
  69. package/packages/workflow-editor/src/properties-editors/human-task/basic-properties.vue +184 -0
  70. package/packages/workflow-editor/src/properties-editors/human-task/componentsConfigUtil.js +359 -0
  71. package/packages/workflow-editor/src/properties-editors/human-task/custom-actions.vue +256 -0
  72. package/packages/workflow-editor/src/properties-editors/human-task/editable-child-field-setting.vue +405 -0
  73. package/packages/workflow-editor/src/properties-editors/human-task/editable-child-fields.vue +257 -0
  74. package/packages/workflow-editor/src/properties-editors/human-task/editable-field-selection.vue +430 -0
  75. package/packages/workflow-editor/src/properties-editors/human-task/editable-fields.vue +206 -0
  76. package/packages/workflow-editor/src/properties-editors/human-task/events.vue +60 -0
  77. package/packages/workflow-editor/src/properties-editors/human-task/permission-settings.vue +231 -0
  78. package/packages/workflow-editor/src/properties-editors/human-task/selection-conditions.vue +499 -0
  79. package/packages/workflow-editor/src/properties-editors/human-task.vue +107 -0
  80. package/packages/workflow-editor/src/properties-editors/join.vue +49 -0
  81. package/packages/workflow-editor/src/properties-editors/process/basic-properties.vue +336 -0
  82. package/packages/workflow-editor/src/properties-editors/process/events.vue +79 -0
  83. package/packages/workflow-editor/src/properties-editors/process/notice-settings.vue +68 -0
  84. package/packages/workflow-editor/src/properties-editors/process/parameter-settings.vue +106 -0
  85. package/packages/workflow-editor/src/properties-editors/process/permission-settings.vue +28 -0
  86. package/packages/workflow-editor/src/properties-editors/process/selectPage.vue +88 -0
  87. package/packages/workflow-editor/src/properties-editors/process.vue +118 -0
  88. package/packages/workflow-editor/src/properties-editors/subprocess/basic-properties.vue +201 -0
  89. package/packages/workflow-editor/src/properties-editors/subprocess/events.vue +26 -0
  90. package/packages/workflow-editor/src/properties-editors/subprocess/field-mappings.vue +216 -0
  91. package/packages/workflow-editor/src/properties-editors/subprocess/transactor-settings.vue +66 -0
  92. package/packages/workflow-editor/src/properties-editors/subprocess.vue +80 -0
  93. package/packages/workflow-editor/src/properties-editors/transition/basic-properties.vue +53 -0
  94. package/packages/workflow-editor/src/properties-editors/transition.vue +75 -0
  95. package/packages/workflow-editor/src/properties-editors/user-condition.js +183 -0
  96. package/packages/workflow-editor/src/store/getters.js +33 -0
  97. package/packages/workflow-editor/src/store/workflow-editor.js +153 -0
  98. package/packages/workflow-editor/src/taches/auto-task.vue +99 -0
  99. package/packages/workflow-editor/src/taches/common-methods.js +21 -0
  100. package/packages/workflow-editor/src/taches/copy-task.vue +99 -0
  101. package/packages/workflow-editor/src/taches/custom-task.vue +88 -0
  102. package/packages/workflow-editor/src/taches/decision.vue +102 -0
  103. package/packages/workflow-editor/src/taches/end.vue +76 -0
  104. package/packages/workflow-editor/src/taches/fork.vue +102 -0
  105. package/packages/workflow-editor/src/taches/human-decision.vue +102 -0
  106. package/packages/workflow-editor/src/taches/human-task.vue +113 -0
  107. package/packages/workflow-editor/src/taches/join.vue +91 -0
  108. package/packages/workflow-editor/src/taches/joint.vue +177 -0
  109. package/packages/workflow-editor/src/taches/start.vue +76 -0
  110. package/packages/workflow-editor/src/taches/subprocess.vue +99 -0
  111. package/packages/workflow-editor/src/taches/tache-resizer.vue +80 -0
  112. package/packages/workflow-editor/src/transitions/broken-line.vue +91 -0
  113. package/packages/workflow-editor/src/transitions/curve-line.vue +91 -0
  114. package/packages/workflow-editor/src/transitions/right-angle-line.vue +139 -0
  115. package/packages/workflow-editor/src/transitions/straight-line.vue +26 -0
  116. package/packages/workflow-editor/src/transitions/transition.vue +249 -0
  117. package/packages/workflow-editor/src/transitions/virtual-transition.vue +43 -0
  118. package/packages/workflow-editor/src/util.js +529 -0
  119. package/packages/workflow-editor/src/workflow-editor.vue +869 -0
  120. package/packages/workflow-editor/src/workflow-history.vue +153 -0
  121. package/src/i18n/i18n.js +16 -0
  122. package/src/i18n/langs/cn.js +531 -0
  123. package/src/i18n/langs/en.js +539 -0
  124. package/vite.config.js +36 -0
  125. package/es/_virtual/_plugin-vue_export-helper.mjs +0 -9
  126. package/es/index.mjs +0 -18
  127. package/es/plugins/formValidatorUtil.mjs +0 -262
  128. package/es/plugins/index.mjs +0 -7
  129. package/es/src/i18n/i18n.mjs +0 -7
  130. package/es/src/i18n/langs/cn.mjs +0 -4
  131. package/es/src/i18n/langs/en.mjs +0 -4
  132. package/es/style.css +0 -1
  133. package/es/workflow-editor/index.mjs +0 -10
  134. package/es/workflow-editor/src/api.mjs +0 -6
  135. package/es/workflow-editor/src/assets/wf-editor-icons.mjs +0 -43
  136. package/es/workflow-editor/src/json-object-templates/auto-task.mjs +0 -7
  137. package/es/workflow-editor/src/json-object-templates/copy-task.mjs +0 -7
  138. package/es/workflow-editor/src/json-object-templates/decision.mjs +0 -7
  139. package/es/workflow-editor/src/json-object-templates/end.mjs +0 -7
  140. package/es/workflow-editor/src/json-object-templates/fork.mjs +0 -7
  141. package/es/workflow-editor/src/json-object-templates/human-decision.mjs +0 -7
  142. package/es/workflow-editor/src/json-object-templates/human-task.mjs +0 -7
  143. package/es/workflow-editor/src/json-object-templates/join.mjs +0 -7
  144. package/es/workflow-editor/src/json-object-templates/process.mjs +0 -9
  145. package/es/workflow-editor/src/json-object-templates/start.mjs +0 -7
  146. package/es/workflow-editor/src/json-object-templates/subprocess.mjs +0 -7
  147. package/es/workflow-editor/src/json-object-templates/transition.mjs +0 -6
  148. package/es/workflow-editor/src/main/admin-save-dialog.vue.mjs +0 -13
  149. package/es/workflow-editor/src/main/canvas.vue.mjs +0 -130
  150. package/es/workflow-editor/src/main/canvas.vue2.mjs +0 -4
  151. package/es/workflow-editor/src/main/context-menu.vue.mjs +0 -33
  152. package/es/workflow-editor/src/main/context-menu.vue2.mjs +0 -4
  153. package/es/workflow-editor/src/main/icon-svg.vue.mjs +0 -12
  154. package/es/workflow-editor/src/main/icon-svg.vue2.mjs +0 -4
  155. package/es/workflow-editor/src/main/selection-region.vue.mjs +0 -17
  156. package/es/workflow-editor/src/main/selection-region.vue2.mjs +0 -4
  157. package/es/workflow-editor/src/main/tache-history-tooltip.vue.mjs +0 -10
  158. package/es/workflow-editor/src/main/tache-history-tooltip.vue2.mjs +0 -4
  159. package/es/workflow-editor/src/main/tache-subprocess-history-dialog.vue.mjs +0 -11
  160. package/es/workflow-editor/src/main/tache-subprocess-history-dialog.vue2.mjs +0 -4
  161. package/es/workflow-editor/src/main/toolbox.vue.mjs +0 -16
  162. package/es/workflow-editor/src/main/toolbox.vue2.mjs +0 -4
  163. package/es/workflow-editor/src/main/wf-history-canvas.vue.mjs +0 -86
  164. package/es/workflow-editor/src/main/wf-history-canvas.vue2.mjs +0 -4
  165. package/es/workflow-editor/src/process-service.mjs +0 -20
  166. package/es/workflow-editor/src/properties-editors/auto-task/basic-properties.vue.mjs +0 -25
  167. package/es/workflow-editor/src/properties-editors/auto-task/basic-properties.vue2.mjs +0 -4
  168. package/es/workflow-editor/src/properties-editors/auto-task.vue.mjs +0 -22
  169. package/es/workflow-editor/src/properties-editors/auto-task.vue2.mjs +0 -4
  170. package/es/workflow-editor/src/properties-editors/common/additional-condition-utils.mjs +0 -125
  171. package/es/workflow-editor/src/properties-editors/common/additional-condition.vue.mjs +0 -60
  172. package/es/workflow-editor/src/properties-editors/common/auto-filled-fields-utils.mjs +0 -5
  173. package/es/workflow-editor/src/properties-editors/common/auto-filled-fields.vue.mjs +0 -72
  174. package/es/workflow-editor/src/properties-editors/common/common-notice-tool.vue.mjs +0 -18
  175. package/es/workflow-editor/src/properties-editors/common/common-user-condition.vue.mjs +0 -55
  176. package/es/workflow-editor/src/properties-editors/common/form-fields-utils.mjs +0 -14
  177. package/es/workflow-editor/src/properties-editors/common/form-fields.vue.mjs +0 -20
  178. package/es/workflow-editor/src/properties-editors/common/form-fields.vue2.mjs +0 -4
  179. package/es/workflow-editor/src/properties-editors/common/i18n-input.vue.mjs +0 -27
  180. package/es/workflow-editor/src/properties-editors/common/i18n-set-dialog.vue.mjs +0 -36
  181. package/es/workflow-editor/src/properties-editors/common/notice-reminder.vue.mjs +0 -27
  182. package/es/workflow-editor/src/properties-editors/common/notice-reminder.vue2.mjs +0 -4
  183. package/es/workflow-editor/src/properties-editors/common/notice.vue.mjs +0 -31
  184. package/es/workflow-editor/src/properties-editors/common/reminder.vue.mjs +0 -46
  185. package/es/workflow-editor/src/properties-editors/common/reminder.vue2.mjs +0 -4
  186. package/es/workflow-editor/src/properties-editors/common/select-mail-template.vue.mjs +0 -20
  187. package/es/workflow-editor/src/properties-editors/common/system-role-tree-inline.vue.mjs +0 -95
  188. package/es/workflow-editor/src/properties-editors/common/system-role-tree-inline.vue2.mjs +0 -4
  189. package/es/workflow-editor/src/properties-editors/common/system-role-tree.vue.mjs +0 -16
  190. package/es/workflow-editor/src/properties-editors/common/system-role-tree.vue2.mjs +0 -4
  191. package/es/workflow-editor/src/properties-editors/common/task-title.vue.mjs +0 -61
  192. package/es/workflow-editor/src/properties-editors/common/task-title.vue2.mjs +0 -4
  193. package/es/workflow-editor/src/properties-editors/common/task-title.vue3.mjs +0 -4
  194. package/es/workflow-editor/src/properties-editors/common/transactor-settings.vue.mjs +0 -43
  195. package/es/workflow-editor/src/properties-editors/common/user-selection.vue.mjs +0 -116
  196. package/es/workflow-editor/src/properties-editors/common/value-selection-dialog.vue.mjs +0 -60
  197. package/es/workflow-editor/src/properties-editors/common/value-selection-dialog.vue2.mjs +0 -4
  198. package/es/workflow-editor/src/properties-editors/common/variables.vue.mjs +0 -41
  199. package/es/workflow-editor/src/properties-editors/copy-task/basic-properties.vue.mjs +0 -25
  200. package/es/workflow-editor/src/properties-editors/copy-task/basic-properties.vue2.mjs +0 -4
  201. package/es/workflow-editor/src/properties-editors/copy-task/permission-settings.vue.mjs +0 -30
  202. package/es/workflow-editor/src/properties-editors/copy-task/permission-settings.vue2.mjs +0 -4
  203. package/es/workflow-editor/src/properties-editors/copy-task.vue.mjs +0 -26
  204. package/es/workflow-editor/src/properties-editors/copy-task.vue2.mjs +0 -4
  205. package/es/workflow-editor/src/properties-editors/decision.vue.mjs +0 -24
  206. package/es/workflow-editor/src/properties-editors/fork.vue.mjs +0 -21
  207. package/es/workflow-editor/src/properties-editors/human-decision.vue.mjs +0 -15
  208. package/es/workflow-editor/src/properties-editors/human-task/additional-condition-dialog.vue.mjs +0 -16
  209. package/es/workflow-editor/src/properties-editors/human-task/basic-properties.vue.mjs +0 -38
  210. package/es/workflow-editor/src/properties-editors/human-task/basic-properties.vue2.mjs +0 -4
  211. package/es/workflow-editor/src/properties-editors/human-task/componentsConfigUtil.mjs +0 -84
  212. package/es/workflow-editor/src/properties-editors/human-task/custom-actions.vue.mjs +0 -62
  213. package/es/workflow-editor/src/properties-editors/human-task/editable-child-field-setting.vue.mjs +0 -80
  214. package/es/workflow-editor/src/properties-editors/human-task/editable-child-fields.vue.mjs +0 -86
  215. package/es/workflow-editor/src/properties-editors/human-task/editable-field-selection.vue.mjs +0 -43
  216. package/es/workflow-editor/src/properties-editors/human-task/editable-field-selection.vue2.mjs +0 -4
  217. package/es/workflow-editor/src/properties-editors/human-task/editable-fields.vue.mjs +0 -67
  218. package/es/workflow-editor/src/properties-editors/human-task/events.vue.mjs +0 -18
  219. package/es/workflow-editor/src/properties-editors/human-task/permission-settings.vue.mjs +0 -33
  220. package/es/workflow-editor/src/properties-editors/human-task/permission-settings.vue2.mjs +0 -4
  221. package/es/workflow-editor/src/properties-editors/human-task/selection-conditions.vue.mjs +0 -56
  222. package/es/workflow-editor/src/properties-editors/human-task.vue.mjs +0 -28
  223. package/es/workflow-editor/src/properties-editors/human-task.vue2.mjs +0 -4
  224. package/es/workflow-editor/src/properties-editors/join.vue.mjs +0 -15
  225. package/es/workflow-editor/src/properties-editors/process/basic-properties.vue.mjs +0 -88
  226. package/es/workflow-editor/src/properties-editors/process/events.vue.mjs +0 -21
  227. package/es/workflow-editor/src/properties-editors/process/notice-settings.vue.mjs +0 -25
  228. package/es/workflow-editor/src/properties-editors/process/parameter-settings.vue.mjs +0 -17
  229. package/es/workflow-editor/src/properties-editors/process/permission-settings.vue.mjs +0 -10
  230. package/es/workflow-editor/src/properties-editors/process/selectPage.vue.mjs +0 -28
  231. package/es/workflow-editor/src/properties-editors/process.vue.mjs +0 -34
  232. package/es/workflow-editor/src/properties-editors/subprocess/basic-properties.vue.mjs +0 -64
  233. package/es/workflow-editor/src/properties-editors/subprocess/events.vue.mjs +0 -9
  234. package/es/workflow-editor/src/properties-editors/subprocess/field-mappings.vue.mjs +0 -55
  235. package/es/workflow-editor/src/properties-editors/subprocess/transactor-settings.vue.mjs +0 -20
  236. package/es/workflow-editor/src/properties-editors/subprocess.vue.mjs +0 -22
  237. package/es/workflow-editor/src/properties-editors/subprocess.vue2.mjs +0 -4
  238. package/es/workflow-editor/src/properties-editors/transition/basic-properties.vue.mjs +0 -14
  239. package/es/workflow-editor/src/properties-editors/transition.vue.mjs +0 -17
  240. package/es/workflow-editor/src/properties-editors/transition.vue2.mjs +0 -4
  241. package/es/workflow-editor/src/properties-editors/user-condition.mjs +0 -49
  242. package/es/workflow-editor/src/store/getters.mjs +0 -4
  243. package/es/workflow-editor/src/store/workflow-editor.mjs +0 -73
  244. package/es/workflow-editor/src/taches/auto-task.vue.mjs +0 -25
  245. package/es/workflow-editor/src/taches/common-methods.mjs +0 -13
  246. package/es/workflow-editor/src/taches/copy-task.vue.mjs +0 -25
  247. package/es/workflow-editor/src/taches/custom-task.vue.mjs +0 -16
  248. package/es/workflow-editor/src/taches/decision.vue.mjs +0 -25
  249. package/es/workflow-editor/src/taches/decision.vue2.mjs +0 -4
  250. package/es/workflow-editor/src/taches/end.vue.mjs +0 -14
  251. package/es/workflow-editor/src/taches/end.vue2.mjs +0 -4
  252. package/es/workflow-editor/src/taches/fork.vue.mjs +0 -25
  253. package/es/workflow-editor/src/taches/fork.vue2.mjs +0 -4
  254. package/es/workflow-editor/src/taches/human-decision.vue.mjs +0 -25
  255. package/es/workflow-editor/src/taches/human-decision.vue2.mjs +0 -4
  256. package/es/workflow-editor/src/taches/human-task.vue.mjs +0 -25
  257. package/es/workflow-editor/src/taches/join.vue.mjs +0 -16
  258. package/es/workflow-editor/src/taches/join.vue2.mjs +0 -4
  259. package/es/workflow-editor/src/taches/joint.vue.mjs +0 -54
  260. package/es/workflow-editor/src/taches/joint.vue2.mjs +0 -4
  261. package/es/workflow-editor/src/taches/start.vue.mjs +0 -14
  262. package/es/workflow-editor/src/taches/start.vue2.mjs +0 -4
  263. package/es/workflow-editor/src/taches/subprocess.vue.mjs +0 -25
  264. package/es/workflow-editor/src/taches/tache-resizer.vue.mjs +0 -30
  265. package/es/workflow-editor/src/taches/tache-resizer.vue2.mjs +0 -4
  266. package/es/workflow-editor/src/transitions/broken-line.vue.mjs +0 -32
  267. package/es/workflow-editor/src/transitions/broken-line.vue2.mjs +0 -4
  268. package/es/workflow-editor/src/transitions/curve-line.vue.mjs +0 -33
  269. package/es/workflow-editor/src/transitions/curve-line.vue2.mjs +0 -4
  270. package/es/workflow-editor/src/transitions/straight-line.vue.mjs +0 -13
  271. package/es/workflow-editor/src/transitions/transition.vue.mjs +0 -77
  272. package/es/workflow-editor/src/transitions/transition.vue2.mjs +0 -4
  273. package/es/workflow-editor/src/transitions/virtual-transition.vue.mjs +0 -17
  274. package/es/workflow-editor/src/transitions/virtual-transition.vue2.mjs +0 -4
  275. package/es/workflow-editor/src/util.mjs +0 -180
  276. package/es/workflow-editor/src/workflow-editor.vue.mjs +0 -212
  277. package/es/workflow-editor/src/workflow-editor.vue2.mjs +0 -4
  278. package/es/workflow-editor/src/workflow-history.vue.mjs +0 -35
  279. package/es/workflow-editor/src/workflow-history.vue2.mjs +0 -4
  280. /package/{es → public}/vite.svg +0 -0
@@ -0,0 +1,890 @@
1
+ import Validator from 'async-validator'
2
+ import { getI18n } from '../workflow-editor/src/util'
3
+ import { parseSubTablePermissionCondition } from 'agilebuilder-ui/src/utils/calculator/calculator-util'
4
+ function getLeafPropRule(editField, dataTypeMap) {
5
+ const rule = {}
6
+ const dataType = editField.dataType
7
+ if (dataType === 'DATE' || dataType === 'TIME') {
8
+ // 对象的值需要是毫秒值数字
9
+ // if (editField.valueType && editField.valueType === 'number') {
10
+ // // 表示值是毫秒值
11
+ // rule.type = 'number'
12
+ // }
13
+ rule.type = 'date'
14
+ packageCustomValidator(rule)
15
+ rule.message = editField.label + ' ' + getI18n().t('workflowEditorMessage.requiredAndMustBeADate')
16
+ } else if (dataType === 'INTEGER' || dataType === 'LONG') {
17
+ // rule.type = 'number'
18
+ rule.pattern = /^-?\d+$/
19
+ rule.message = editField.label + ' ' + getI18n().t('workflowEditorMessage.requiredAndMustBeAnInteger')
20
+ } else if (dataType === 'FLOAT' || dataType === 'DOUBLE') {
21
+ rule.pattern = new RegExp('^(-?\\d+)(\\.\\d+)?$')
22
+ rule.message = editField.label + ' ' + getI18n().t('workflowEditorMessage.requiredAndMustBeDecimal')
23
+ } else if (dataType === 'BOOLEAN') {
24
+ rule.type = 'boolean'
25
+ rule.message = editField.label + ' ' + getI18n().t('workflowEditorMessage.mustFill')
26
+ // 布尔型校验需要自定义,为了兼容oracle和mysql数据
27
+ packageCustomValidator(rule)
28
+ } else {
29
+ // if (entity[editField.name] || entity[editField.name] === 0) {
30
+ // if (typeof entity[editField.name] === 'number' && dataType === 'TEXT') {
31
+ // rule.type = 'number'
32
+ // }
33
+ // }
34
+ rule.message = editField.label + ' ' + getI18n().t('workflowEditorMessage.mustFill')
35
+ }
36
+ if (editField.canEdit) {
37
+ rule.required = true
38
+ // 失去焦点时触发
39
+ rule.trigger = 'blur'
40
+ }
41
+ if (editField.rowIndexes) {
42
+ // 子表时受控制的行记录下标
43
+ rule.rowIndexes = editField.rowIndexes
44
+ }
45
+ if (editField.condition) {
46
+ // 必填条件
47
+ rule.condition = editField.condition
48
+ }
49
+ dataTypeMap[editField.name] = editField.dataType
50
+ return rule
51
+ }
52
+
53
+ /**
54
+ * 布尔型和日期校验需要自定义,为了兼容oracle和mysql数据库
55
+ * @param fieldRule
56
+ */
57
+ function packageCustomValidator(fieldRule) {
58
+ if (fieldRule && fieldRule.type && fieldRule.type === 'boolean') {
59
+ fieldRule.validator = function (rule, value, callback) {
60
+ if (value === undefined || value === null) {
61
+ if (rule.required) {
62
+ return false
63
+ } else {
64
+ return true
65
+ }
66
+ } else if (typeof value === 'number' && (value === 1 || value === 0)) {
67
+ return true
68
+ } else if (typeof value === 'boolean' && (value === true || value === false)) {
69
+ return true
70
+ }
71
+ return false
72
+ }
73
+ } else if (fieldRule && fieldRule.type && fieldRule.type === 'date') {
74
+ fieldRule.validator = function (rule, value, callback) {
75
+ if (value === undefined || value === null) {
76
+ if (rule.required) {
77
+ return false
78
+ } else {
79
+ return true
80
+ }
81
+ } else {
82
+ // 验证是否是合法日期
83
+ const date = new Date(value)
84
+ return !isNaN(date.getTime())
85
+ }
86
+ }
87
+ }
88
+ }
89
+
90
+ /**
91
+ * 获得对象验证规则
92
+ * @param {*} editField 字段信息
93
+ * @param {*} rules 验证规则
94
+ */
95
+ function setObjectPropRule(editField, rules, isSql, dataTypeMap) {
96
+ const rule = {}
97
+ let prop = editField.name
98
+ if (isSql === true) {
99
+ prop = underscoreName(prop)
100
+ }
101
+ if (!rules) {
102
+ rules = {}
103
+ }
104
+ const props = prop.split('.')
105
+ for (let num = 0; num < props.length; num++) {
106
+ const subProp = props[num]
107
+ let objectRule
108
+ if (num === props.length - 1) {
109
+ // 说明是最后一个
110
+ objectRule = getEndObjectRule(rule, props, subProp)
111
+ objectRule.fields[subProp] = getLeafPropRule(editField, dataTypeMap)
112
+ } else {
113
+ let lastObjectRule
114
+ if (num === 0) {
115
+ objectRule = rules
116
+ } else {
117
+ lastObjectRule = getLastObjectRule(rule, props, props[num - 1])
118
+ objectRule = lastObjectRule.fields
119
+ }
120
+ if (!objectRule[subProp]) {
121
+ objectRule[subProp] = {
122
+ type: 'object',
123
+ required: true,
124
+ fields: {}
125
+ }
126
+ }
127
+ if (num === 0) {
128
+ rule[subProp] = objectRule[subProp]
129
+ } else {
130
+ lastObjectRule.fields[subProp] = objectRule[subProp]
131
+ }
132
+ }
133
+ }
134
+ }
135
+
136
+ function getLastObjectRule(rule, props, currentProp) {
137
+ let lastObjectdRule
138
+ for (let i = 0; i < props.length; i++) {
139
+ const subProp = props[i]
140
+ if (i === 0) {
141
+ lastObjectdRule = rule[subProp]
142
+ } else {
143
+ lastObjectdRule = lastObjectdRule.fields[props[i]]
144
+ }
145
+ if (subProp === currentProp) {
146
+ break
147
+ }
148
+ }
149
+ return lastObjectdRule
150
+ }
151
+
152
+ function getEndObjectRule(rule, props, currentProp) {
153
+ let lastObjectdRule
154
+ for (let i = 0; i < props.length; i++) {
155
+ if (i === 0) {
156
+ lastObjectdRule = rule[props[i]]
157
+ } else {
158
+ lastObjectdRule = lastObjectdRule.fields[props[i]]
159
+ }
160
+ if (i !== props.length - 1) {
161
+ const leafSubProp = props[i + 1]
162
+ if (leafSubProp === currentProp) {
163
+ break
164
+ }
165
+ }
166
+ }
167
+ return lastObjectdRule
168
+ }
169
+
170
+ /**
171
+ * 获得主表及子表验证规则
172
+ * @param {editFieldInfos} editFieldInfos 编辑字段信息集合
173
+ * @param {entity} entity 当前表单数据model
174
+ * @param {isSql} isSql 是否是sql操作流程表单,如果是字段名需要修改为下划线命名规则
175
+ */
176
+ function getValidator(editFieldInfos, entity, isSql, additionalParamMap, taskParamMap, contextParameter) {
177
+ // console.log('workflowEditor-getValidator-editFieldInfos=', editFieldInfos, 'entity=', entity, 'isSql', isSql)
178
+ if (typeof isSql === 'undefined') {
179
+ isSql = false
180
+ }
181
+ // 主表验证规则
182
+ const rules = {}
183
+ // 子表验证规则,格式为:
184
+ // {prop:
185
+ // {subField1:{required: true},
186
+ // subField2:{required: true}
187
+ // }
188
+ // }
189
+ // 子表整个表的权限
190
+ // {
191
+ // 子表表名1:{required:true/false(必填/禁止编辑),message:'xxx子表必需录入数据'},
192
+ // 子表表名2:{required:true/false(必填/禁止编辑),message:'xxx子表必需录入数据'}
193
+ // }
194
+ const dataTypeMap = {}
195
+ const totalSubRules = {}
196
+ const subRules = {}
197
+ if (editFieldInfos) {
198
+ editFieldInfos.forEach((editField) => {
199
+ const canEdit = editField.canEdit
200
+ // 必填
201
+ if (typeof canEdit !== 'undefined' && canEdit === true) {
202
+ let prop = editField.name
203
+ if (prop) {
204
+ if (isSql === true) {
205
+ prop = underscoreName(prop)
206
+ }
207
+ const condition = editField.condition
208
+ const parentFormData = null
209
+ let result = null
210
+ if (prop.indexOf('.') > 0 && prop.indexOf('$') === 0) {
211
+ // 当是子表记录时候 result设置为true 获取行记录校验条件
212
+ result = true
213
+ } else {
214
+ result = parseSubTablePermissionCondition(
215
+ condition,
216
+ dataTypeMap,
217
+ parentFormData,
218
+ entity,
219
+ additionalParamMap,
220
+ taskParamMap,
221
+ contextParameter
222
+ )
223
+ }
224
+ if (result !== undefined && result !== null && result === true) {
225
+ let rule = {}
226
+ if (prop.indexOf('.') > 0) {
227
+ if (prop.indexOf('$') === 0) {
228
+ // 表示是子表字段
229
+ setSubObjectFieldRule(editField, subRules, entity, isSql, dataTypeMap)
230
+ } else {
231
+ // 表示是主表的关联属性字段。
232
+ setMainObjectFieldRule(editField, rules, entity, isSql, dataTypeMap)
233
+ }
234
+ } else if (prop.indexOf('$') === 0) {
235
+ // 表示是子表整个表的权限
236
+ // 获得子表表名
237
+ const subTable = prop.substring(prop.indexOf('$') + 1)
238
+ totalSubRules[subTable] = {
239
+ required: true,
240
+ message: getI18n().t('workflowEditorMessage.subTableMustInputDatas', {
241
+ subTable: editField.label
242
+ })
243
+ }
244
+ } else {
245
+ // 表示是主表的直接属性
246
+ rule = getLeafPropRule(editField, dataTypeMap, entity)
247
+ rules[prop] = rule
248
+ }
249
+ }
250
+ }
251
+ }
252
+ })
253
+ }
254
+ // console.log('rules', rules, 'subRules=', subRules, 'totalSubRules=', totalSubRules)
255
+ const subRulesKeys = Object.keys(subRules)
256
+ if (subRulesKeys.length > 0 || Object.keys(totalSubRules).length > 0) {
257
+ // 表示有子表规则
258
+ return {
259
+ rules,
260
+ subRules,
261
+ totalSubRules,
262
+ dataTypeMap
263
+ }
264
+ } else {
265
+ // 表示只有主表规则
266
+ return rules
267
+ }
268
+ }
269
+
270
+ /**
271
+ * 设置主对象字段验证规则
272
+ */
273
+ function setMainObjectFieldRule(editField, rules, entity, isSql, dataTypeMap) {
274
+ // 例如:a.b.c
275
+ let prop = editField.name
276
+ if (isSql === true) {
277
+ prop = underscoreName(prop)
278
+ }
279
+ // 获得a
280
+ const mainProp = prop.substring(0, prop.indexOf('.'))
281
+ if (entity) {
282
+ if (!entity[mainProp]) {
283
+ entity[mainProp] = {}
284
+ }
285
+ const mainEntity = entity[mainProp]
286
+ // 说明这个字段是该表单的字段,才需要添加验证
287
+ // 不是该表单的字段的情况,可能是被数据表删除的字段,但是没有修改流程图表单字段权限设置导致的
288
+ // 获得b.c
289
+ const mainSubProp = prop.substring(prop.indexOf('.') + 1)
290
+ if (isNeedValidate(mainSubProp, mainEntity)) {
291
+ // 需要验证该字段,表示是表单的字段
292
+ setObjectPropRule(editField, rules, isSql, dataTypeMap)
293
+ }
294
+ }
295
+ }
296
+
297
+ /**
298
+ * 是否需要验证该属性,例如:b.c 或 a
299
+ * @param {*} mainSubProp 字段信息,例如:字段为:a.b.c,则mainSubProp应为b.c
300
+ * @param {*} mainEntity
301
+ */
302
+ function isNeedValidate(mainSubProp, mainEntity) {
303
+ // 表示由可以必填
304
+ if (mainSubProp.indexOf('.') > 0) {
305
+ let parentObject = mainEntity
306
+ const subProps = mainSubProp.split('.')
307
+ for (let num = 0; num < subProps.length - 1; num++) {
308
+ const subProp = subProps[num]
309
+ if (!parentObject || !parentObject[subProp]) {
310
+ // 当前对象不存在,不是该表单的字段,不需要验证
311
+ return false
312
+ }
313
+ // 重新给"父对象"赋值,为下次循环准备
314
+ parentObject = parentObject[subProp]
315
+ }
316
+ return true
317
+ } else {
318
+ return true
319
+ }
320
+ }
321
+
322
+ function setSubObjectFieldRule(editField, subRules, entity, isSql, dataTypeMap) {
323
+ let prop = editField.name
324
+ if (isSql === true) {
325
+ prop = underscoreName(prop)
326
+ }
327
+ // 获得主表字段名称
328
+ const mainProp = prop.substring(prop.indexOf('$') + 1, prop.indexOf('.'))
329
+ if (!entity) {
330
+ return
331
+ }
332
+ const tableData = entity[mainProp]
333
+ // V10注释, 因为在gets请求后就来获取校验,此时实体内的子表数据还没有加载完成,所以会导致没有添加上子表的数据校验规则
334
+ // if (typeof (tableData) === 'undefined' || tableData === null || tableData.length === 0) {
335
+ // // 表单中不存在该子表字段,不需要验证
336
+ // return
337
+ // }
338
+ // 获得子表字段名
339
+ const subProp = prop.substring(prop.indexOf('.') + 1)
340
+ // mainProp对应的所有子表字段验证规则信息
341
+ if (!subRules[mainProp]) {
342
+ subRules[mainProp] = {}
343
+ }
344
+ // 修改属性名为去掉$mainProp的字段名
345
+ // 此处要重新拷贝一份字段,否则会导致原字段的name信息被修改
346
+ const copyEditField = JSON.parse(JSON.stringify(editField))
347
+ copyEditField.name = subProp
348
+ if (subProp.indexOf('.') > 0) {
349
+ // 表示关联属性
350
+ if (typeof tableData !== 'undefined' && tableData === null && tableData.length === 0) {
351
+ const subEntity = tableData[0]
352
+ setMainObjectFieldRule(copyEditField, subRules[mainProp], subEntity, isSql, dataTypeMap)
353
+ }
354
+ } else {
355
+ // 表示是子表的直接属性
356
+ subRules[mainProp][subProp] = getLeafPropRule(copyEditField, dataTypeMap)
357
+ }
358
+ }
359
+
360
+ function validator(entity, validateRules, rowIndex, isSql, pageNum, pageRowIndex, isNeedField, otherParams) {
361
+ return validatorEntity(entity, validateRules, rowIndex, true, isSql, pageNum, pageRowIndex, isNeedField, otherParams)
362
+ }
363
+ /**
364
+ *
365
+ * @param {*} entity
366
+ * @param {*} validateRules
367
+ * @param {*} rowIndex
368
+ * @param {*} isShouldRepeateValdate 是否需要再次验证大写字段名
369
+ * @returns
370
+ */
371
+ function validatorEntity(
372
+ entity,
373
+ validateRules,
374
+ rowIndex,
375
+ isShouldRepeateValdate,
376
+ isSql,
377
+ pageNum,
378
+ pageRowIndex,
379
+ isNeedField,
380
+ otherParams
381
+ ) {
382
+ let result = false
383
+ const validator = new Validator(validateRules)
384
+ let fieldName
385
+ let returnAllErrors = false // 是否返回所有错误信息,默认只返回第一个错误信息
386
+ if (otherParams && otherParams.returnAllErrors !== undefined && otherParams.returnAllErrors === true) {
387
+ returnAllErrors = true
388
+ }
389
+ // returnAllErrors 模式下收集所有错误
390
+ const allErrors = []
391
+ validator.validate(
392
+ entity,
393
+ {
394
+ first: !returnAllErrors
395
+ },
396
+ (errors, fields) => {
397
+ if (errors) {
398
+ if (returnAllErrors) {
399
+ // 返回所有错误
400
+ errors.forEach((err) => {
401
+ const myResult = {
402
+ message: err.message,
403
+ field: err.field,
404
+ pageRowIndex: pageRowIndex
405
+ }
406
+ if (pageNum !== null && pageNum !== undefined && pageRowIndex !== null && pageRowIndex !== undefined) {
407
+ myResult.pageNum = pageNum
408
+ myResult.rowIndex = pageRowIndex
409
+ } else if (pageRowIndex === null || pageRowIndex === undefined) {
410
+ myResult.rowIndex = rowIndex
411
+ }
412
+ allErrors.push(myResult)
413
+ })
414
+ } else {
415
+ const message = errors[0]['message']
416
+ fieldName = errors[0]['field']
417
+ if (typeof rowIndex !== 'undefined' && rowIndex !== null) {
418
+ // 表示是子表字段验证失败
419
+ if (pageNum !== undefined && pageRowIndex !== undefined) {
420
+ // 表示子表分页时的验证提示信息
421
+ result =
422
+ getI18n().t('workflowEditorMessage.pageRecordLine', {
423
+ pageNum: pageNum,
424
+ row: pageRowIndex
425
+ }) +
426
+ ',' +
427
+ message
428
+ } else {
429
+ result =
430
+ getI18n().t('workflowEditorMessage.recordLine', {
431
+ row: rowIndex + 1
432
+ }) +
433
+ ',' +
434
+ message
435
+ }
436
+ } else {
437
+ // 表示是主表字段验证失败
438
+ result = message
439
+ }
440
+ }
441
+ } else {
442
+ result = true
443
+ }
444
+ if (!returnAllErrors && fieldName && isShouldRepeateValdate === true) {
445
+ // 将实体中字段名改为大写,然后再验证一次该字段是否已填值。因为mysql中jdbc获得实体记录字段名是小写的,但是验证规则中字段名是大写的,所以会导致字段验证失败
446
+ const reg1 = /[A-Z]+/ // 大写字母
447
+ if (
448
+ isSql !== undefined &&
449
+ isSql === true &&
450
+ reg1.test(fieldName) &&
451
+ entity[fieldName.toLowerCase()] !== undefined
452
+ ) {
453
+ const copyEntity = JSON.parse(JSON.stringify(entity))
454
+ copyEntity[fieldName.toUpperCase()] = entity[fieldName.toLowerCase()]
455
+ delete copyEntity[fieldName.toLowerCase()]
456
+ result = validatorEntity(
457
+ copyEntity,
458
+ validateRules,
459
+ rowIndex,
460
+ false,
461
+ isSql,
462
+ pageNum,
463
+ pageRowIndex,
464
+ isNeedField,
465
+ otherParams
466
+ )
467
+ }
468
+ }
469
+ }
470
+ )
471
+
472
+ if (returnAllErrors) {
473
+ return allErrors
474
+ }
475
+
476
+ if (isNeedField) {
477
+ let myResult = { msg: result, field: fieldName }
478
+ if (pageNum !== undefined && pageRowIndex !== undefined) {
479
+ myResult.pageNum = pageNum
480
+ myResult.rowIndex = pageRowIndex
481
+ } else {
482
+ myResult.rowIndex = rowIndex
483
+ }
484
+ return myResult
485
+ } else {
486
+ return result
487
+ }
488
+ }
489
+
490
+ /**
491
+ * 验证子表必填验证
492
+ * @param {*}} entity
493
+ * @param {*} subRules
494
+ * @param {*} subTablePageInfo 列表分页信息{列表编码: 每页显示多少条记录}
495
+ */
496
+ function validateSub(
497
+ entity,
498
+ subRules,
499
+ totalSubRules,
500
+ isSql,
501
+ dataTypeMap,
502
+ additionalParamMap,
503
+ taskParamMap,
504
+ contextParameter,
505
+ subTablePageInfo,
506
+ isNeedField,
507
+ otherParams
508
+ ) {
509
+ let copyTotalSubRules = {}
510
+ if (totalSubRules) {
511
+ copyTotalSubRules = JSON.parse(JSON.stringify(totalSubRules))
512
+ }
513
+ let returnAllErrors = false // 是否返回所有错误信息,默认只返回第一个错误信息
514
+ if (otherParams && otherParams.returnAllErrors !== undefined && otherParams.returnAllErrors === true) {
515
+ returnAllErrors = true
516
+ }
517
+ // returnAllErrors 模式下收集所有子表错误
518
+ const allSubErrors = []
519
+
520
+ if (subRules) {
521
+ console.log('formValidator333--subRules=', subRules)
522
+ const subProps = Object.keys(subRules)
523
+ for (let i = 0; i < subProps.length; i++) {
524
+ const prop = subProps[i]
525
+ const subFieldRule = subRules[prop]
526
+ console.log('formValidator44--subFieldRule=', subFieldRule)
527
+ // 受控制的行下标集合
528
+ const subFieldProps = Object.keys(subFieldRule)
529
+ console.log('formValidator555--subFieldProps=', subFieldProps)
530
+ let subTableData = entity[prop]
531
+ if (!subTableData) {
532
+ // 如果子表集合数据不存在
533
+ subTableData = []
534
+ }
535
+ // 验证整个子表是否已填记录,如果是必填,但是没有子记录集合,则提示
536
+ const validateResult = validateTotalSubTable(copyTotalSubRules, entity, prop)
537
+ if (validateResult !== true) {
538
+ delete copyTotalSubRules[prop]
539
+ if (returnAllErrors) {
540
+ allSubErrors.push({
541
+ message: validateResult,
542
+ listCode: prop
543
+ })
544
+ // 继续检查其他子表
545
+ continue
546
+ }
547
+ if (isNeedField) {
548
+ return { msg: validateResult, listCode: prop }
549
+ } else {
550
+ return validateResult
551
+ }
552
+ }
553
+ let pageSize
554
+ let hasAuthFields = []
555
+ if (subTablePageInfo && subTablePageInfo[prop]) {
556
+ pageSize = subTablePageInfo[prop].pageSize
557
+ hasAuthFields = subTablePageInfo[prop].fields || []
558
+ }
559
+ for (let j = 0; j < subTableData.length; j++) {
560
+ const rowData = subTableData[j]
561
+ const rowRule = packageRowRule(
562
+ subFieldProps,
563
+ subFieldRule,
564
+ subTableData[j],
565
+ dataTypeMap,
566
+ entity,
567
+ additionalParamMap,
568
+ taskParamMap,
569
+ contextParameter,
570
+ hasAuthFields
571
+ )
572
+ console.log('formValidator666--rowRule=', rowRule)
573
+ let pageNum
574
+ // 每页的记录下标,提示时使用
575
+ let pageRowIndex
576
+ if (pageSize !== undefined && pageSize > 0) {
577
+ pageNum = Math.ceil((j + 1) / pageSize)
578
+ pageRowIndex = j + 1 - (pageNum - 1) * pageSize
579
+ }
580
+ Object.keys(rowRule).forEach((field) => {
581
+ const fieldRule = rowRule[field]
582
+ if (fieldRule && fieldRule.rules) {
583
+ // 如果有rules规则,则将rules规则添加到rowRule中 ,为了统一表单和子表的校验规则传递参数方式
584
+ rowRule[field] = fieldRule.rules
585
+ }
586
+ if (fieldRule && fieldRule.beforeValidate) {
587
+ // 如果有beforeValidate方法,则执行
588
+ const beforeValidate = fieldRule.beforeValidate
589
+ if (typeof beforeValidate === 'function') {
590
+ const result = beforeValidate({
591
+ row: rowData,
592
+ parent: entity,
593
+ rowIndex: j
594
+ })
595
+ // 如果是false,表示当前规则不需要在当前行验证,
596
+ // 移除当前规则,其他行还是要根据beforeValidate的返回值判断是否需要验证
597
+ if (result === false) {
598
+ rowRule[field] = []
599
+ }
600
+ }
601
+ }
602
+ })
603
+ const validateResult = validator(rowData, rowRule, j, isSql, pageNum, pageRowIndex, isNeedField, otherParams)
604
+ if (returnAllErrors) {
605
+ // 当前行的所有错误
606
+ if (validateResult && validateResult.length > 0) {
607
+ validateResult.forEach((err) => {
608
+ if (subTablePageInfo[prop] && subTablePageInfo[prop].title) {
609
+ err.message = subTablePageInfo[prop].title + ':' + err.message
610
+ }
611
+ err.listCode = prop
612
+ allSubErrors.push(err)
613
+ })
614
+ }
615
+ } else {
616
+ if ((!isNeedField && validateResult !== true) || (isNeedField && validateResult.msg !== true)) {
617
+ // 表示验证失败,无需继续验证
618
+ if (isNeedField) {
619
+ if (subTablePageInfo[prop].title) {
620
+ // 如果有子表标题,则添加子表标题
621
+ validateResult.msg = subTablePageInfo[prop].title + ':' + validateResult.msg
622
+ }
623
+ validateResult.listCode = prop
624
+ }
625
+ return validateResult
626
+ }
627
+ }
628
+ }
629
+ }
630
+ }
631
+
632
+ for (const subTableName in copyTotalSubRules) {
633
+ const validateResult = validateTotalSubTable(copyTotalSubRules, entity, subTableName)
634
+ if (validateResult !== true) {
635
+ if (returnAllErrors) {
636
+ allSubErrors.push({
637
+ message: validateResult,
638
+ listCode: subTableName
639
+ })
640
+ continue
641
+ }
642
+ if (isNeedField) {
643
+ return { msg: validateResult, listCode: subTableName }
644
+ } else {
645
+ return validateResult
646
+ }
647
+ }
648
+ }
649
+ if (returnAllErrors) {
650
+ return allSubErrors
651
+ }
652
+ return isNeedField ? { msg: true } : true
653
+ }
654
+
655
+ function getEntityId(row) {
656
+ if (row && row.id) {
657
+ return row.id
658
+ } else if (row && row.ID) {
659
+ return row.ID
660
+ }
661
+ }
662
+
663
+ /**
664
+ * 封装行记录的验证规则
665
+ * @param {*}} subProps
666
+ * @param {*} subFieldRule
667
+ * @param {*} rowIndex
668
+ * @returns
669
+ */
670
+ function packageRowRule(
671
+ subProps,
672
+ subFieldRule,
673
+ row,
674
+ dataTypeMap,
675
+ parentFormData,
676
+ additionalParamMap,
677
+ taskParamMap,
678
+ contextParameter,
679
+ hasAuthFields
680
+ ) {
681
+ const rowId = getEntityId(row)
682
+ const rowRule = {}
683
+ for (let n = 0; n < subProps.length; n++) {
684
+ const field = subProps[n]
685
+ if (hasAuthFields.indexOf(field) < 0) {
686
+ // 如果没有权限编辑该字段,则不需要验证
687
+ continue
688
+ }
689
+ const fieldRule = subFieldRule[field]
690
+ const condition = fieldRule.condition
691
+ const result = parseSubTablePermissionCondition(
692
+ condition,
693
+ dataTypeMap,
694
+ parentFormData,
695
+ row,
696
+ additionalParamMap,
697
+ taskParamMap,
698
+ contextParameter
699
+ )
700
+ if (result !== undefined && result !== null && result === true) {
701
+ // 表示由可以必填
702
+ if (rowId === undefined) {
703
+ // 表示是新建的记录,需要验证
704
+ rowRule[field] = fieldRule
705
+ } else {
706
+ // 表示是已保存的记录,验证id是否在可修改的集合内
707
+ const rowIndexes = fieldRule.rowIndexes
708
+ if (!rowIndexes || rowIndexes.indexOf(rowId) >= 0) {
709
+ // 表示该行记录的该字段需要做必填验证
710
+ rowRule[field] = fieldRule
711
+ }
712
+ }
713
+ }
714
+ }
715
+ return rowRule
716
+ }
717
+
718
+ // 验证整个子表是否已填记录
719
+ function validateTotalSubTable(totalSubRules, entity, subTableName) {
720
+ let subTableData = entity[subTableName]
721
+ if (!subTableData) {
722
+ // 如果子表集合数据不存在
723
+ subTableData = []
724
+ }
725
+ if (
726
+ subTableData.length === 0 &&
727
+ totalSubRules &&
728
+ totalSubRules[subTableName] &&
729
+ totalSubRules[subTableName].required !== undefined &&
730
+ totalSubRules[subTableName].required === true
731
+ ) {
732
+ return totalSubRules[subTableName].message
733
+ }
734
+ return true
735
+ }
736
+ /**
737
+ *
738
+ * @param {*} entity
739
+ * @param {*} validateRules
740
+ * @param {*} isSql
741
+ * @param {*} additionalParamMap
742
+ * @param {*} taskParamMap
743
+ * @param {*} contextParameter
744
+ * @param {*} subTablePageInfo
745
+ * @param {*} isNeedField 如果为true,表示返回的是{}对象,msg: true/提示信息、field:字段名
746
+ * @returns
747
+ */
748
+ function formValidator(
749
+ entity,
750
+ validateRules,
751
+ isSql,
752
+ additionalParamMap,
753
+ taskParamMap,
754
+ contextParameter,
755
+ subTablePageInfo,
756
+ isNeedField,
757
+ otherParams
758
+ ) {
759
+ let returnAllErrors = false // 是否返回所有错误信息,默认只返回第一个错误信息
760
+ if (otherParams && otherParams.returnAllErrors !== undefined && otherParams.returnAllErrors === true) {
761
+ returnAllErrors = true
762
+ }
763
+ if (returnAllErrors) {
764
+ // 返回所有验证错误
765
+ const allErrors = []
766
+
767
+ //先验证主表字段
768
+ const mainErrors = validator(entity, validateRules, null, isSql, null, null, isNeedField, otherParams)
769
+ if (mainErrors && mainErrors.length > 0) {
770
+ allErrors.push(...mainErrors)
771
+ }
772
+
773
+ const validateRulesKeys = Object.keys(validateRules)
774
+ // 脚本控制的验证
775
+ if (
776
+ validateRulesKeys.indexOf('rules') >= 0 &&
777
+ validateRulesKeys.indexOf('subRules') >= 0 &&
778
+ validateRulesKeys.indexOf('totalSubRules') >= 0
779
+ ) {
780
+ // 表示是带有子表验证规则的
781
+ const rules = validateRules.rules
782
+ const subRules = validateRules.subRules
783
+ const totalSubRules = validateRules.totalSubRules
784
+ const dataTypeMap = validateRules.dataTypeMap
785
+
786
+ // 验证rules中的主表规则
787
+ const rulesErrors = validator(entity, rules, null, isSql, null, null, isNeedField, otherParams)
788
+ if (rulesErrors && rulesErrors.length > 0) {
789
+ allErrors.push(...rulesErrors)
790
+ }
791
+ debugger
792
+ // 3. 验证子表
793
+ if (subRules || totalSubRules) {
794
+ const subErrors = validateSub(
795
+ entity,
796
+ subRules,
797
+ totalSubRules,
798
+ isSql,
799
+ dataTypeMap,
800
+ additionalParamMap,
801
+ taskParamMap,
802
+ contextParameter,
803
+ subTablePageInfo,
804
+ isNeedField,
805
+ otherParams
806
+ )
807
+ if (subErrors && subErrors.length > 0) {
808
+ allErrors.push(...subErrors)
809
+ }
810
+ }
811
+ } else if (validateRulesKeys.indexOf('rules') >= 0) {
812
+ // 表示没有子表验证规则,但有 rules
813
+ const rules = validateRules.rules
814
+ const rulesErrors = validator(entity, rules, null, isSql, null, null, isNeedField, otherParams)
815
+ if (rulesErrors && rulesErrors.length > 0) {
816
+ allErrors.push(...rulesErrors)
817
+ }
818
+ }
819
+
820
+ return allErrors
821
+ }
822
+ // 仅返回第一个错误
823
+ // 兼容 workflowRules= { CODE:[{xxxxx}], rules:{},subRules:{}}格式的验证
824
+ let validateResult = validator(entity, validateRules, null, isSql, null, null, isNeedField, otherParams)
825
+ if ((!isNeedField && validateResult === true) || (isNeedField && validateResult.msg === true)) {
826
+ // 先验证流程编辑器配置的字段必填验证
827
+ const validateRulesKeys = Object.keys(validateRules)
828
+ // 脚本控制的验证会走下面的验证代码
829
+ if (
830
+ validateRulesKeys.indexOf('rules') >= 0 &&
831
+ validateRulesKeys.indexOf('subRules') >= 0 &&
832
+ validateRulesKeys.indexOf('totalSubRules') >= 0
833
+ ) {
834
+ // 表示是带有子表验证规则的
835
+ const rules = validateRules.rules
836
+ const subRules = validateRules.subRules
837
+ const totalSubRules = validateRules.totalSubRules
838
+ const dataTypeMap = validateRules.dataTypeMap
839
+ validateResult = validator(entity, rules, null, isSql, null, null, isNeedField)
840
+ if ((!isNeedField && validateResult === true) || (isNeedField && validateResult.msg === true)) {
841
+ if (subRules || totalSubRules) {
842
+ validateResult = validateSub(
843
+ entity,
844
+ subRules,
845
+ totalSubRules,
846
+ isSql,
847
+ dataTypeMap,
848
+ additionalParamMap,
849
+ taskParamMap,
850
+ contextParameter,
851
+ subTablePageInfo,
852
+ isNeedField,
853
+ otherParams
854
+ )
855
+ }
856
+ }
857
+ return validateResult
858
+ } else if (validateRulesKeys.indexOf('rules') >= 0) {
859
+ // 表示没有子表验证规则
860
+ const rules = validateRules.rules
861
+ return validator(entity, rules, null, isSql, null, null, isNeedField)
862
+ }
863
+ } else {
864
+ return validateResult
865
+ }
866
+ }
867
+
868
+ // 驼峰命名改为下划线命名,例如:helloWord->hello_world
869
+ function underscoreName(name) {
870
+ // if (name.indexOf('_') > 0) {
871
+ // 如果包括下划线,表示是下划线命名,需要再转换
872
+ return name
873
+ // }
874
+ // return name.replace(/([A-Z])/g, '_$1').toLowerCase()
875
+ }
876
+ // 下划线命名改为驼峰命名,例如:hello_word->helloWorld
877
+ // function camelName(name) {
878
+ // if (name.indexOf('_') < 0) {
879
+ // // 如果不包括下划线不需要转换
880
+ // return name
881
+ // }
882
+ // return name.replace(/_(\w)/g, function(all, letter) {
883
+ // return letter.toUpperCase()
884
+ // })
885
+ // }
886
+
887
+ export default {
888
+ formValidator,
889
+ getValidator
890
+ }