weaver-e10-builder 1.0.7-beta → 1.0.9-beta

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/dist/commands/actionflow.d.ts +7 -0
  2. package/dist/commands/actionflow.d.ts.map +1 -0
  3. package/dist/commands/actionflow.js +105 -0
  4. package/dist/commands/actionflow.js.map +1 -0
  5. package/dist/commands/auth.js +1 -1
  6. package/dist/commands/auth.js.map +1 -1
  7. package/dist/commands/form-list.d.ts.map +1 -1
  8. package/dist/commands/form-list.js +18 -9
  9. package/dist/commands/form-list.js.map +1 -1
  10. package/dist/commands/form-native.d.ts +0 -14
  11. package/dist/commands/form-native.d.ts.map +1 -1
  12. package/dist/commands/form-native.js +398 -72
  13. package/dist/commands/form-native.js.map +1 -1
  14. package/dist/commands/form.d.ts.map +1 -1
  15. package/dist/commands/form.js +5 -2
  16. package/dist/commands/form.js.map +1 -1
  17. package/dist/commands/wf-form.d.ts.map +1 -1
  18. package/dist/commands/wf-form.js +872 -42
  19. package/dist/commands/wf-form.js.map +1 -1
  20. package/dist/commands/workflow-action.d.ts +11 -0
  21. package/dist/commands/workflow-action.d.ts.map +1 -1
  22. package/dist/commands/workflow-action.js +13 -1586
  23. package/dist/commands/workflow-action.js.map +1 -1
  24. package/dist/commands/workflow-create-workflow.d.ts.map +1 -1
  25. package/dist/commands/workflow-create-workflow.js +111 -30
  26. package/dist/commands/workflow-create-workflow.js.map +1 -1
  27. package/dist/commands/workflow-node-robot.js +1 -1
  28. package/dist/commands/workflow-node-robot.js.map +1 -1
  29. package/dist/commands/workflow-node-validate.d.ts.map +1 -1
  30. package/dist/commands/workflow-node-validate.js +56 -45
  31. package/dist/commands/workflow-node-validate.js.map +1 -1
  32. package/dist/commands/workflow-numbering.d.ts.map +1 -1
  33. package/dist/commands/workflow-numbering.js +98 -2
  34. package/dist/commands/workflow-numbering.js.map +1 -1
  35. package/dist/commands/workflow-operator-sign.d.ts +3 -0
  36. package/dist/commands/workflow-operator-sign.d.ts.map +1 -0
  37. package/dist/commands/workflow-operator-sign.js +118 -0
  38. package/dist/commands/workflow-operator-sign.js.map +1 -0
  39. package/dist/commands/workflow.d.ts.map +1 -1
  40. package/dist/commands/workflow.js +83 -6
  41. package/dist/commands/workflow.js.map +1 -1
  42. package/dist/core/client.d.ts +2 -0
  43. package/dist/core/client.d.ts.map +1 -1
  44. package/dist/core/client.js +2 -0
  45. package/dist/core/client.js.map +1 -1
  46. package/dist/index.js +4 -0
  47. package/dist/index.js.map +1 -1
  48. package/dist/services/actionflow/build_workflow_draft.d.ts +20 -0
  49. package/dist/services/actionflow/build_workflow_draft.d.ts.map +1 -0
  50. package/dist/services/actionflow/build_workflow_draft.js +222 -0
  51. package/dist/services/actionflow/build_workflow_draft.js.map +1 -0
  52. package/dist/services/actionflow/calendar_mapper.d.ts +3 -0
  53. package/dist/services/actionflow/calendar_mapper.d.ts.map +1 -0
  54. package/dist/services/actionflow/calendar_mapper.js +152 -0
  55. package/dist/services/actionflow/calendar_mapper.js.map +1 -0
  56. package/dist/services/actionflow/component_registry.d.ts +13 -0
  57. package/dist/services/actionflow/component_registry.d.ts.map +1 -0
  58. package/dist/services/actionflow/component_registry.js +213 -0
  59. package/dist/services/actionflow/component_registry.js.map +1 -0
  60. package/dist/services/actionflow/components/action_eb_add.d.ts +3 -0
  61. package/dist/services/actionflow/components/action_eb_add.d.ts.map +1 -0
  62. package/dist/services/actionflow/components/action_eb_add.js +127 -0
  63. package/dist/services/actionflow/components/action_eb_add.js.map +1 -0
  64. package/dist/services/actionflow/components/action_eb_add_compiler.d.ts +4 -0
  65. package/dist/services/actionflow/components/action_eb_add_compiler.d.ts.map +1 -0
  66. package/dist/services/actionflow/components/action_eb_add_compiler.js +13 -0
  67. package/dist/services/actionflow/components/action_eb_add_compiler.js.map +1 -0
  68. package/dist/services/actionflow/components/action_eb_delete.d.ts +3 -0
  69. package/dist/services/actionflow/components/action_eb_delete.d.ts.map +1 -0
  70. package/dist/services/actionflow/components/action_eb_delete.js +69 -0
  71. package/dist/services/actionflow/components/action_eb_delete.js.map +1 -0
  72. package/dist/services/actionflow/components/action_eb_delete_compiler.d.ts +4 -0
  73. package/dist/services/actionflow/components/action_eb_delete_compiler.d.ts.map +1 -0
  74. package/dist/services/actionflow/components/action_eb_delete_compiler.js +7 -0
  75. package/dist/services/actionflow/components/action_eb_delete_compiler.js.map +1 -0
  76. package/dist/services/actionflow/components/action_eb_recover.d.ts +3 -0
  77. package/dist/services/actionflow/components/action_eb_recover.d.ts.map +1 -0
  78. package/dist/services/actionflow/components/action_eb_recover.js +28 -0
  79. package/dist/services/actionflow/components/action_eb_recover.js.map +1 -0
  80. package/dist/services/actionflow/components/action_eb_recover_compiler.d.ts +3 -0
  81. package/dist/services/actionflow/components/action_eb_recover_compiler.d.ts.map +1 -0
  82. package/dist/services/actionflow/components/action_eb_recover_compiler.js +16 -0
  83. package/dist/services/actionflow/components/action_eb_recover_compiler.js.map +1 -0
  84. package/dist/services/actionflow/components/action_eb_save_version.d.ts +3 -0
  85. package/dist/services/actionflow/components/action_eb_save_version.d.ts.map +1 -0
  86. package/dist/services/actionflow/components/action_eb_save_version.js +30 -0
  87. package/dist/services/actionflow/components/action_eb_save_version.js.map +1 -0
  88. package/dist/services/actionflow/components/action_eb_save_version_compiler.d.ts +3 -0
  89. package/dist/services/actionflow/components/action_eb_save_version_compiler.d.ts.map +1 -0
  90. package/dist/services/actionflow/components/action_eb_save_version_compiler.js +15 -0
  91. package/dist/services/actionflow/components/action_eb_save_version_compiler.js.map +1 -0
  92. package/dist/services/actionflow/components/action_eb_update.d.ts +3 -0
  93. package/dist/services/actionflow/components/action_eb_update.d.ts.map +1 -0
  94. package/dist/services/actionflow/components/action_eb_update.js +154 -0
  95. package/dist/services/actionflow/components/action_eb_update.js.map +1 -0
  96. package/dist/services/actionflow/components/action_eb_update_compiler.d.ts +16 -0
  97. package/dist/services/actionflow/components/action_eb_update_compiler.d.ts.map +1 -0
  98. package/dist/services/actionflow/components/action_eb_update_compiler.js +94 -0
  99. package/dist/services/actionflow/components/action_eb_update_compiler.js.map +1 -0
  100. package/dist/services/actionflow/components/approve_create.d.ts +3 -0
  101. package/dist/services/actionflow/components/approve_create.d.ts.map +1 -0
  102. package/dist/services/actionflow/components/approve_create.js +44 -0
  103. package/dist/services/actionflow/components/approve_create.js.map +1 -0
  104. package/dist/services/actionflow/components/approve_trigger.d.ts +5 -0
  105. package/dist/services/actionflow/components/approve_trigger.d.ts.map +1 -0
  106. package/dist/services/actionflow/components/approve_trigger.js +184 -0
  107. package/dist/services/actionflow/components/approve_trigger.js.map +1 -0
  108. package/dist/services/actionflow/components/approve_trigger_compiler.d.ts +4 -0
  109. package/dist/services/actionflow/components/approve_trigger_compiler.d.ts.map +1 -0
  110. package/dist/services/actionflow/components/approve_trigger_compiler.js +20 -0
  111. package/dist/services/actionflow/components/approve_trigger_compiler.js.map +1 -0
  112. package/dist/services/actionflow/components/condition.d.ts +3 -0
  113. package/dist/services/actionflow/components/condition.d.ts.map +1 -0
  114. package/dist/services/actionflow/components/condition.js +23 -0
  115. package/dist/services/actionflow/components/condition.js.map +1 -0
  116. package/dist/services/actionflow/components/date_trigger.d.ts +5 -0
  117. package/dist/services/actionflow/components/date_trigger.d.ts.map +1 -0
  118. package/dist/services/actionflow/components/date_trigger.js +129 -0
  119. package/dist/services/actionflow/components/date_trigger.js.map +1 -0
  120. package/dist/services/actionflow/components/document_actions.d.ts +28 -0
  121. package/dist/services/actionflow/components/document_actions.d.ts.map +1 -0
  122. package/dist/services/actionflow/components/document_actions.js +266 -0
  123. package/dist/services/actionflow/components/document_actions.js.map +1 -0
  124. package/dist/services/actionflow/components/eb_get_data_by_id.d.ts +5 -0
  125. package/dist/services/actionflow/components/eb_get_data_by_id.d.ts.map +1 -0
  126. package/dist/services/actionflow/components/eb_get_data_by_id.js +44 -0
  127. package/dist/services/actionflow/components/eb_get_data_by_id.js.map +1 -0
  128. package/dist/services/actionflow/components/enquiry_form.d.ts +5 -0
  129. package/dist/services/actionflow/components/enquiry_form.d.ts.map +1 -0
  130. package/dist/services/actionflow/components/enquiry_form.js +100 -0
  131. package/dist/services/actionflow/components/enquiry_form.js.map +1 -0
  132. package/dist/services/actionflow/components/event_form_data.d.ts +3 -0
  133. package/dist/services/actionflow/components/event_form_data.d.ts.map +1 -0
  134. package/dist/services/actionflow/components/event_form_data.js +29 -0
  135. package/dist/services/actionflow/components/event_form_data.js.map +1 -0
  136. package/dist/services/actionflow/components/hrm_actions.d.ts +7 -0
  137. package/dist/services/actionflow/components/hrm_actions.d.ts.map +1 -0
  138. package/dist/services/actionflow/components/hrm_actions.js +138 -0
  139. package/dist/services/actionflow/components/hrm_actions.js.map +1 -0
  140. package/dist/services/actionflow/components/index.d.ts +32 -0
  141. package/dist/services/actionflow/components/index.d.ts.map +1 -0
  142. package/dist/services/actionflow/components/index.js +132 -0
  143. package/dist/services/actionflow/components/index.js.map +1 -0
  144. package/dist/services/actionflow/components/logic_flow_set.d.ts +10 -0
  145. package/dist/services/actionflow/components/logic_flow_set.d.ts.map +1 -0
  146. package/dist/services/actionflow/components/logic_flow_set.js +79 -0
  147. package/dist/services/actionflow/components/logic_flow_set.js.map +1 -0
  148. package/dist/services/actionflow/components/meeting_create.d.ts +5 -0
  149. package/dist/services/actionflow/components/meeting_create.d.ts.map +1 -0
  150. package/dist/services/actionflow/components/meeting_create.js +37 -0
  151. package/dist/services/actionflow/components/meeting_create.js.map +1 -0
  152. package/dist/services/actionflow/components/multiple_execution.d.ts +5 -0
  153. package/dist/services/actionflow/components/multiple_execution.d.ts.map +1 -0
  154. package/dist/services/actionflow/components/multiple_execution.js +136 -0
  155. package/dist/services/actionflow/components/multiple_execution.js.map +1 -0
  156. package/dist/services/actionflow/components/output.d.ts +9 -0
  157. package/dist/services/actionflow/components/output.d.ts.map +1 -0
  158. package/dist/services/actionflow/components/output.js +81 -0
  159. package/dist/services/actionflow/components/output.js.map +1 -0
  160. package/dist/services/actionflow/components/schedule_create.d.ts +5 -0
  161. package/dist/services/actionflow/components/schedule_create.d.ts.map +1 -0
  162. package/dist/services/actionflow/components/schedule_create.js +42 -0
  163. package/dist/services/actionflow/components/schedule_create.js.map +1 -0
  164. package/dist/services/actionflow/components/send_message.d.ts +7 -0
  165. package/dist/services/actionflow/components/send_message.d.ts.map +1 -0
  166. package/dist/services/actionflow/components/send_message.js +200 -0
  167. package/dist/services/actionflow/components/send_message.js.map +1 -0
  168. package/dist/services/actionflow/components/simple_scheduler.d.ts +5 -0
  169. package/dist/services/actionflow/components/simple_scheduler.d.ts.map +1 -0
  170. package/dist/services/actionflow/components/simple_scheduler.js +22 -0
  171. package/dist/services/actionflow/components/simple_scheduler.js.map +1 -0
  172. package/dist/services/actionflow/components/time_batch_trigger.d.ts +5 -0
  173. package/dist/services/actionflow/components/time_batch_trigger.d.ts.map +1 -0
  174. package/dist/services/actionflow/components/time_batch_trigger.js +92 -0
  175. package/dist/services/actionflow/components/time_batch_trigger.js.map +1 -0
  176. package/dist/services/actionflow/components/workflow_actions.d.ts +26 -0
  177. package/dist/services/actionflow/components/workflow_actions.d.ts.map +1 -0
  178. package/dist/services/actionflow/components/workflow_actions.js +403 -0
  179. package/dist/services/actionflow/components/workflow_actions.js.map +1 -0
  180. package/dist/services/actionflow/context_data_builder.d.ts +9 -0
  181. package/dist/services/actionflow/context_data_builder.d.ts.map +1 -0
  182. package/dist/services/actionflow/context_data_builder.js +31 -0
  183. package/dist/services/actionflow/context_data_builder.js.map +1 -0
  184. package/dist/services/actionflow/context_preflight.d.ts +6 -0
  185. package/dist/services/actionflow/context_preflight.d.ts.map +1 -0
  186. package/dist/services/actionflow/context_preflight.js +122 -0
  187. package/dist/services/actionflow/context_preflight.js.map +1 -0
  188. package/dist/services/actionflow/context_provider.d.ts +18 -0
  189. package/dist/services/actionflow/context_provider.d.ts.map +1 -0
  190. package/dist/services/actionflow/context_provider.js +102 -0
  191. package/dist/services/actionflow/context_provider.js.map +1 -0
  192. package/dist/services/actionflow/context_source.d.ts +7 -0
  193. package/dist/services/actionflow/context_source.d.ts.map +1 -0
  194. package/dist/services/actionflow/context_source.js +10 -0
  195. package/dist/services/actionflow/context_source.js.map +1 -0
  196. package/dist/services/actionflow/design_client.d.ts +48 -0
  197. package/dist/services/actionflow/design_client.d.ts.map +1 -0
  198. package/dist/services/actionflow/design_client.js +170 -0
  199. package/dist/services/actionflow/design_client.js.map +1 -0
  200. package/dist/services/actionflow/document_source.d.ts +5 -0
  201. package/dist/services/actionflow/document_source.d.ts.map +1 -0
  202. package/dist/services/actionflow/document_source.js +5 -0
  203. package/dist/services/actionflow/document_source.js.map +1 -0
  204. package/dist/services/actionflow/enrich_approve_trigger.d.ts +12 -0
  205. package/dist/services/actionflow/enrich_approve_trigger.d.ts.map +1 -0
  206. package/dist/services/actionflow/enrich_approve_trigger.js +107 -0
  207. package/dist/services/actionflow/enrich_approve_trigger.js.map +1 -0
  208. package/dist/services/actionflow/filter_rules.d.ts +14 -0
  209. package/dist/services/actionflow/filter_rules.d.ts.map +1 -0
  210. package/dist/services/actionflow/filter_rules.js +259 -0
  211. package/dist/services/actionflow/filter_rules.js.map +1 -0
  212. package/dist/services/actionflow/form_source.d.ts +17 -0
  213. package/dist/services/actionflow/form_source.d.ts.map +1 -0
  214. package/dist/services/actionflow/form_source.js +42 -0
  215. package/dist/services/actionflow/form_source.js.map +1 -0
  216. package/dist/services/actionflow/formula_service.d.ts +51 -0
  217. package/dist/services/actionflow/formula_service.d.ts.map +1 -0
  218. package/dist/services/actionflow/formula_service.js +999 -0
  219. package/dist/services/actionflow/formula_service.js.map +1 -0
  220. package/dist/services/actionflow/generation_service.d.ts +28 -0
  221. package/dist/services/actionflow/generation_service.d.ts.map +1 -0
  222. package/dist/services/actionflow/generation_service.js +283 -0
  223. package/dist/services/actionflow/generation_service.js.map +1 -0
  224. package/dist/services/actionflow/hrm_source.d.ts +4 -0
  225. package/dist/services/actionflow/hrm_source.d.ts.map +1 -0
  226. package/dist/services/actionflow/hrm_source.js +8 -0
  227. package/dist/services/actionflow/hrm_source.js.map +1 -0
  228. package/dist/services/actionflow/id_generator.d.ts +13 -0
  229. package/dist/services/actionflow/id_generator.d.ts.map +1 -0
  230. package/dist/services/actionflow/id_generator.js +33 -0
  231. package/dist/services/actionflow/id_generator.js.map +1 -0
  232. package/dist/services/actionflow/person_source.d.ts +7 -0
  233. package/dist/services/actionflow/person_source.d.ts.map +1 -0
  234. package/dist/services/actionflow/person_source.js +34 -0
  235. package/dist/services/actionflow/person_source.js.map +1 -0
  236. package/dist/services/actionflow/preflight_service.d.ts +42 -0
  237. package/dist/services/actionflow/preflight_service.d.ts.map +1 -0
  238. package/dist/services/actionflow/preflight_service.js +1247 -0
  239. package/dist/services/actionflow/preflight_service.js.map +1 -0
  240. package/dist/services/actionflow/query_field_defaults.d.ts +3 -0
  241. package/dist/services/actionflow/query_field_defaults.d.ts.map +1 -0
  242. package/dist/services/actionflow/query_field_defaults.js +46 -0
  243. package/dist/services/actionflow/query_field_defaults.js.map +1 -0
  244. package/dist/services/actionflow/readback_verifier.d.ts +11 -0
  245. package/dist/services/actionflow/readback_verifier.d.ts.map +1 -0
  246. package/dist/services/actionflow/readback_verifier.js +252 -0
  247. package/dist/services/actionflow/readback_verifier.js.map +1 -0
  248. package/dist/services/actionflow/request.d.ts +13 -0
  249. package/dist/services/actionflow/request.d.ts.map +1 -0
  250. package/dist/services/actionflow/request.js +15 -0
  251. package/dist/services/actionflow/request.js.map +1 -0
  252. package/dist/services/actionflow/runtime_metadata.d.ts +27 -0
  253. package/dist/services/actionflow/runtime_metadata.d.ts.map +1 -0
  254. package/dist/services/actionflow/runtime_metadata.js +142 -0
  255. package/dist/services/actionflow/runtime_metadata.js.map +1 -0
  256. package/dist/services/actionflow/save_workflow_draft.d.ts +34 -0
  257. package/dist/services/actionflow/save_workflow_draft.d.ts.map +1 -0
  258. package/dist/services/actionflow/save_workflow_draft.js +449 -0
  259. package/dist/services/actionflow/save_workflow_draft.js.map +1 -0
  260. package/dist/services/actionflow/system_params.d.ts +5 -0
  261. package/dist/services/actionflow/system_params.d.ts.map +1 -0
  262. package/dist/services/actionflow/system_params.js +55 -0
  263. package/dist/services/actionflow/system_params.js.map +1 -0
  264. package/dist/services/actionflow/trigger_common.d.ts +6 -0
  265. package/dist/services/actionflow/trigger_common.d.ts.map +1 -0
  266. package/dist/services/actionflow/trigger_common.js +41 -0
  267. package/dist/services/actionflow/trigger_common.js.map +1 -0
  268. package/dist/services/actionflow/workflow_compiler.d.ts +27 -0
  269. package/dist/services/actionflow/workflow_compiler.d.ts.map +1 -0
  270. package/dist/services/actionflow/workflow_compiler.js +1804 -0
  271. package/dist/services/actionflow/workflow_compiler.js.map +1 -0
  272. package/dist/services/actionflow/workflow_source.d.ts +14 -0
  273. package/dist/services/actionflow/workflow_source.d.ts.map +1 -0
  274. package/dist/services/actionflow/workflow_source.js +86 -0
  275. package/dist/services/actionflow/workflow_source.js.map +1 -0
  276. package/dist/services/workflow-initiator.d.ts +15 -0
  277. package/dist/services/workflow-initiator.d.ts.map +1 -0
  278. package/dist/services/workflow-initiator.js +77 -0
  279. package/dist/services/workflow-initiator.js.map +1 -0
  280. package/package.json +1 -1
@@ -90,7 +90,9 @@ export function registerWorkflowCommands(program) {
90
90
  .argument('<formObjId>', '表单 objId')
91
91
  .argument('<name>', '流程名称')
92
92
  .argument('[desc]', '流程描述', '')
93
+ .option('--workflow-type <type>', '工作流类型:名称(如"公文审批")或 ID(默认 -1=其它)', '-1')
93
94
  .option('--no-menu', '不自动添加发起菜单(默认建流程后自动加,指向表单新建页)')
95
+ .option('--no-auto-layout', '跳过建后自动排版节点(默认建完跑 auto-layout)')
94
96
  .action(async (appId, formObjId, name, desc, cmdOpts) => {
95
97
  const opts = program.opts();
96
98
  const auth = await AuthSession.fromOptions(opts);
@@ -106,6 +108,18 @@ export function registerWorkflowCommands(program) {
106
108
  process.exit(1);
107
109
  }
108
110
  console.error(` objId ${formObjId} -> formId ${realFormId}`);
111
+ // 工作流类型:认 ID(如 -1=其它)或名称(如"公文审批")。名称走 workflowPathTypeBrowser 解析。
112
+ // eb 流程也有流程类型概念,只是默认 -1(其它)。
113
+ let workflowType = cmdOpts.workflowType || '-1';
114
+ if (workflowType !== '-1' && !/^-?\d+$/.test(workflowType)) {
115
+ const tRes = await client.post(`${baseUrl}/api/workflow/pathdef/common/browser/complete/workflowPathTypeBrowser`, { browserMultiple: false, belongType: 1, showAddBtn: true, checkDetachable: true, newly: 1, searchValue: workflowType });
116
+ const types = tRes?.data?.data || [];
117
+ const hit = types.find((t) => t.name === workflowType || t.content === workflowType) || (types.length === 1 ? types[0] : null);
118
+ if (!hit)
119
+ throw new Error(`工作流类型 "${workflowType}" 未找到(可用: ${types.map((t) => t.name).join(', ')} 或 -1=其它)`);
120
+ workflowType = String(hit.id);
121
+ console.error(` 工作流类型: ${hit.name} (${workflowType})`);
122
+ }
109
123
  // Create workflow
110
124
  const ts = Date.now();
111
125
  const payload = {
@@ -113,7 +127,7 @@ export function registerWorkflowCommands(program) {
113
127
  createClient: '0', ebFormId: realFormId, createPcShow: ['0'], wfSymbol: '',
114
128
  orderId: '0.0', moduleCard: 0, createType: '0', workflowName: name,
115
129
  workflowDesc: desc, relateForm: '4', isLock: '0', isFree: '0',
116
- addDefaultHide: 0, createPcShowCustom: '', workflowType: '-1', id: '0',
130
+ addDefaultHide: 0, createPcShowCustom: '', workflowType, id: '0',
117
131
  workflowNameMultiLang: { tablefiled: 'wfp_base.workflowname', targetId: String(ts), needReplaceTargetId: true },
118
132
  createMobileShowCustom: '', status: '1', createMobileShow: ['0'],
119
133
  formMode: '0', formId: 0, relateFormMode: '0', workflowId: -1,
@@ -179,6 +193,17 @@ export function registerWorkflowCommands(program) {
179
193
  catch {
180
194
  console.error(' 警告: 无法自动设置发起权限,请手动设置');
181
195
  }
196
+ // 流程节点自动排版(建好即布局,避免节点堆叠在原点;与工作流程 create-workflow 对齐)。
197
+ if (cmdOpts.autoLayout) {
198
+ try {
199
+ const { autoLayoutWorkflow } = await import('../services/workflow-layout.js');
200
+ await autoLayoutWorkflow({ client, baseUrl, workflowId });
201
+ console.error(' 节点已自动排版(auto-layout)');
202
+ }
203
+ catch (e) {
204
+ console.error(` 警告: 自动排版失败: ${e.message}(可用 workflow auto-layout <wf> 手动重排)`);
205
+ }
206
+ }
182
207
  const workflowUrl = `${baseUrl}/sp/workflow/flowpage/create/${workflowId}`;
183
208
  // Auto-add 发起 menu (LAYOUT → form create page, triggers bound workflow)
184
209
  let menuId = null;
@@ -256,7 +281,7 @@ export function registerWorkflowCommands(program) {
256
281
  const baseUrl = auth.getBaseUrl();
257
282
  const body = {
258
283
  isTemplate: 0,
259
- belongType: parseInt(cmdOpts.belong) || 1,
284
+ belongType: cmdOpts.belong !== undefined && cmdOpts.belong !== '' ? parseInt(cmdOpts.belong) : 1,
260
285
  current: parseInt(cmdOpts.pageNo) || 1,
261
286
  pageSize: parseInt(cmdOpts.pageSize) || 20,
262
287
  searchParams: {
@@ -2324,18 +2349,70 @@ export function registerWorkflowCommands(program) {
2324
2349
  const fieldName = parsed.fieldName || '';
2325
2350
  const value = String(parsed.value);
2326
2351
  const nodeName = parsed.nodeName || '节点';
2327
- const trigger = parsed.trigger || 'pre';
2352
+ const client = new ApiClient(auth);
2353
+ const baseUrl = auth.getBaseUrl();
2354
+ // 触发时机(抓包确认):正向离开=after+["1"] / 退回到达=pre+["2"]。
2355
+ // trigger 值:pre(到达) / after 或 leave(正向离开) / back-arrive(退回到达) / delete / save / revert / pause / cancel
2356
+ // trigger 含 '-' 时为时机别名,拆出 triggerType + executeTime;其余直接当 triggerType,executeTime 默认 ["1"]。
2357
+ const rawTrigger = parsed.trigger || 'pre';
2358
+ let triggerType = rawTrigger;
2359
+ let executeTime = ['1'];
2360
+ if (rawTrigger === 'leave' || rawTrigger === 'after') {
2361
+ triggerType = 'after';
2362
+ executeTime = ['1'];
2363
+ }
2364
+ else if (rawTrigger === 'back-arrive' || rawTrigger === 'back') {
2365
+ triggerType = 'pre';
2366
+ executeTime = ['2'];
2367
+ }
2368
+ else if (Array.isArray(parsed.executeTime))
2369
+ executeTime = parsed.executeTime;
2370
+ // Select/SelectMultiple 字段常量赋值 customValue 必须存选项 valueKey:
2371
+ // 流程表单 Select valueKey=序号(0/1/2);eb 表 Select valueKey=雪花id(=selectionId)。
2372
+ // 存选项名会导致设计器打开值空、actionName 值部分被清。
2373
+ // 两类表单字段读取接口不同,需兼容:先 workflow 接口(流程表单),读不到再 eb 接口(eb 表关联流程)。
2374
+ // formId 从 getDisplayLayoutForm 反查(流程表单=formId,eb 表=关联 eb 表 formId)。
2375
+ let customValue = value;
2376
+ try {
2377
+ const dl = await client.get(`${baseUrl}/api/bs/workflow/pathdef/nodeLayout/getDisplayLayoutForm?workflowId=${wf}&nodeId=${nodeId}`);
2378
+ const fid = String(dl?.data?.formId || '');
2379
+ if (fid && parsed.fieldId) {
2380
+ let f = {};
2381
+ // ① workflow 接口(流程表单 Select,valueKey=0/1/2)
2382
+ try {
2383
+ const gf = await client.post(`${baseUrl}/api/workflow/core/form/field/manage/getFormField`, { module: 'workflow', formTableField: { formField: { id: parsed.fieldId, form: { id: fid } } } }, { ebbusinessid: fid });
2384
+ f = gf?.data || {};
2385
+ }
2386
+ catch { /* try eb */ }
2387
+ // ② workflow 接口读不到 options(eb 流程字段在 eb 表)→ eb 接口(valueKey=雪花id)
2388
+ // eb 接口需 customParam:{objId}(用 formId 当 objId 即可读到 options,抓包确认)
2389
+ if (!Array.isArray(f.options) || f.options.length === 0) {
2390
+ try {
2391
+ const gf2 = await client.post(`${baseUrl}/api/ebuilder/form/form/field/manage/getFormField`, { module: 'ebuilderform', customParam: { objId: fid }, formTableField: { formField: { id: parsed.fieldId, form: { id: fid } } } }, { ebbusinessid: fid });
2392
+ f = gf2?.data || {};
2393
+ }
2394
+ catch { /* 保持 */ }
2395
+ }
2396
+ if (/select/i.test(String(f.type || f.componentKey || ''))) {
2397
+ const opts = Array.isArray(f.options) ? f.options : [];
2398
+ const hit = opts.find((o) => o.name === value);
2399
+ if (hit)
2400
+ customValue = String(hit.valueKey);
2401
+ }
2402
+ }
2403
+ }
2404
+ catch { /* 解析失败保持原值(非 Select 或字段读不到) */ }
2328
2405
  payload = {
2329
2406
  workflowId: wf, objId: nodeId, triggerType: 'all',
2330
2407
  data: [{
2331
2408
  id: tempIdNeg(),
2332
2409
  actionName: `${fieldName} = ${value}`.trim(),
2333
- executeTime: ['1'], open: true, async: 0, actionType: 0,
2334
- dateRuleStr: '', triggerType: trigger, order: 0,
2410
+ executeTime: executeTime, open: true, async: 0, actionType: 0,
2411
+ dateRuleStr: '', triggerType: triggerType, order: 0,
2335
2412
  targetValue: parsed.fieldId,
2336
2413
  firstValue: 'custom',
2337
2414
  operatorValue: '', secondValue: '',
2338
- customValue: value,
2415
+ customValue,
2339
2416
  dateRule: [], isCreate: false,
2340
2417
  }],
2341
2418
  isNodeFlag: '1', objName: nodeName,