weaver-e10-builder 1.0.8-beta → 1.0.10-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 (261) 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 +420 -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 +175 -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 +78 -8
  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 -1592
  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 +36 -5
  26. package/dist/commands/workflow-create-workflow.js.map +1 -1
  27. package/dist/core/client.d.ts +2 -0
  28. package/dist/core/client.d.ts.map +1 -1
  29. package/dist/core/client.js +2 -0
  30. package/dist/core/client.js.map +1 -1
  31. package/dist/index.js +2 -0
  32. package/dist/index.js.map +1 -1
  33. package/dist/services/actionflow/build_workflow_draft.d.ts +20 -0
  34. package/dist/services/actionflow/build_workflow_draft.d.ts.map +1 -0
  35. package/dist/services/actionflow/build_workflow_draft.js +222 -0
  36. package/dist/services/actionflow/build_workflow_draft.js.map +1 -0
  37. package/dist/services/actionflow/calendar_mapper.d.ts +3 -0
  38. package/dist/services/actionflow/calendar_mapper.d.ts.map +1 -0
  39. package/dist/services/actionflow/calendar_mapper.js +152 -0
  40. package/dist/services/actionflow/calendar_mapper.js.map +1 -0
  41. package/dist/services/actionflow/component_registry.d.ts +13 -0
  42. package/dist/services/actionflow/component_registry.d.ts.map +1 -0
  43. package/dist/services/actionflow/component_registry.js +213 -0
  44. package/dist/services/actionflow/component_registry.js.map +1 -0
  45. package/dist/services/actionflow/components/action_eb_add.d.ts +3 -0
  46. package/dist/services/actionflow/components/action_eb_add.d.ts.map +1 -0
  47. package/dist/services/actionflow/components/action_eb_add.js +127 -0
  48. package/dist/services/actionflow/components/action_eb_add.js.map +1 -0
  49. package/dist/services/actionflow/components/action_eb_add_compiler.d.ts +4 -0
  50. package/dist/services/actionflow/components/action_eb_add_compiler.d.ts.map +1 -0
  51. package/dist/services/actionflow/components/action_eb_add_compiler.js +13 -0
  52. package/dist/services/actionflow/components/action_eb_add_compiler.js.map +1 -0
  53. package/dist/services/actionflow/components/action_eb_delete.d.ts +3 -0
  54. package/dist/services/actionflow/components/action_eb_delete.d.ts.map +1 -0
  55. package/dist/services/actionflow/components/action_eb_delete.js +69 -0
  56. package/dist/services/actionflow/components/action_eb_delete.js.map +1 -0
  57. package/dist/services/actionflow/components/action_eb_delete_compiler.d.ts +4 -0
  58. package/dist/services/actionflow/components/action_eb_delete_compiler.d.ts.map +1 -0
  59. package/dist/services/actionflow/components/action_eb_delete_compiler.js +7 -0
  60. package/dist/services/actionflow/components/action_eb_delete_compiler.js.map +1 -0
  61. package/dist/services/actionflow/components/action_eb_recover.d.ts +3 -0
  62. package/dist/services/actionflow/components/action_eb_recover.d.ts.map +1 -0
  63. package/dist/services/actionflow/components/action_eb_recover.js +28 -0
  64. package/dist/services/actionflow/components/action_eb_recover.js.map +1 -0
  65. package/dist/services/actionflow/components/action_eb_recover_compiler.d.ts +3 -0
  66. package/dist/services/actionflow/components/action_eb_recover_compiler.d.ts.map +1 -0
  67. package/dist/services/actionflow/components/action_eb_recover_compiler.js +16 -0
  68. package/dist/services/actionflow/components/action_eb_recover_compiler.js.map +1 -0
  69. package/dist/services/actionflow/components/action_eb_save_version.d.ts +3 -0
  70. package/dist/services/actionflow/components/action_eb_save_version.d.ts.map +1 -0
  71. package/dist/services/actionflow/components/action_eb_save_version.js +30 -0
  72. package/dist/services/actionflow/components/action_eb_save_version.js.map +1 -0
  73. package/dist/services/actionflow/components/action_eb_save_version_compiler.d.ts +3 -0
  74. package/dist/services/actionflow/components/action_eb_save_version_compiler.d.ts.map +1 -0
  75. package/dist/services/actionflow/components/action_eb_save_version_compiler.js +15 -0
  76. package/dist/services/actionflow/components/action_eb_save_version_compiler.js.map +1 -0
  77. package/dist/services/actionflow/components/action_eb_update.d.ts +3 -0
  78. package/dist/services/actionflow/components/action_eb_update.d.ts.map +1 -0
  79. package/dist/services/actionflow/components/action_eb_update.js +154 -0
  80. package/dist/services/actionflow/components/action_eb_update.js.map +1 -0
  81. package/dist/services/actionflow/components/action_eb_update_compiler.d.ts +16 -0
  82. package/dist/services/actionflow/components/action_eb_update_compiler.d.ts.map +1 -0
  83. package/dist/services/actionflow/components/action_eb_update_compiler.js +94 -0
  84. package/dist/services/actionflow/components/action_eb_update_compiler.js.map +1 -0
  85. package/dist/services/actionflow/components/approve_create.d.ts +3 -0
  86. package/dist/services/actionflow/components/approve_create.d.ts.map +1 -0
  87. package/dist/services/actionflow/components/approve_create.js +44 -0
  88. package/dist/services/actionflow/components/approve_create.js.map +1 -0
  89. package/dist/services/actionflow/components/approve_trigger.d.ts +5 -0
  90. package/dist/services/actionflow/components/approve_trigger.d.ts.map +1 -0
  91. package/dist/services/actionflow/components/approve_trigger.js +184 -0
  92. package/dist/services/actionflow/components/approve_trigger.js.map +1 -0
  93. package/dist/services/actionflow/components/approve_trigger_compiler.d.ts +4 -0
  94. package/dist/services/actionflow/components/approve_trigger_compiler.d.ts.map +1 -0
  95. package/dist/services/actionflow/components/approve_trigger_compiler.js +20 -0
  96. package/dist/services/actionflow/components/approve_trigger_compiler.js.map +1 -0
  97. package/dist/services/actionflow/components/condition.d.ts +3 -0
  98. package/dist/services/actionflow/components/condition.d.ts.map +1 -0
  99. package/dist/services/actionflow/components/condition.js +23 -0
  100. package/dist/services/actionflow/components/condition.js.map +1 -0
  101. package/dist/services/actionflow/components/date_trigger.d.ts +5 -0
  102. package/dist/services/actionflow/components/date_trigger.d.ts.map +1 -0
  103. package/dist/services/actionflow/components/date_trigger.js +129 -0
  104. package/dist/services/actionflow/components/date_trigger.js.map +1 -0
  105. package/dist/services/actionflow/components/document_actions.d.ts +28 -0
  106. package/dist/services/actionflow/components/document_actions.d.ts.map +1 -0
  107. package/dist/services/actionflow/components/document_actions.js +266 -0
  108. package/dist/services/actionflow/components/document_actions.js.map +1 -0
  109. package/dist/services/actionflow/components/eb_get_data_by_id.d.ts +5 -0
  110. package/dist/services/actionflow/components/eb_get_data_by_id.d.ts.map +1 -0
  111. package/dist/services/actionflow/components/eb_get_data_by_id.js +44 -0
  112. package/dist/services/actionflow/components/eb_get_data_by_id.js.map +1 -0
  113. package/dist/services/actionflow/components/enquiry_form.d.ts +5 -0
  114. package/dist/services/actionflow/components/enquiry_form.d.ts.map +1 -0
  115. package/dist/services/actionflow/components/enquiry_form.js +100 -0
  116. package/dist/services/actionflow/components/enquiry_form.js.map +1 -0
  117. package/dist/services/actionflow/components/event_form_data.d.ts +3 -0
  118. package/dist/services/actionflow/components/event_form_data.d.ts.map +1 -0
  119. package/dist/services/actionflow/components/event_form_data.js +29 -0
  120. package/dist/services/actionflow/components/event_form_data.js.map +1 -0
  121. package/dist/services/actionflow/components/hrm_actions.d.ts +7 -0
  122. package/dist/services/actionflow/components/hrm_actions.d.ts.map +1 -0
  123. package/dist/services/actionflow/components/hrm_actions.js +138 -0
  124. package/dist/services/actionflow/components/hrm_actions.js.map +1 -0
  125. package/dist/services/actionflow/components/index.d.ts +32 -0
  126. package/dist/services/actionflow/components/index.d.ts.map +1 -0
  127. package/dist/services/actionflow/components/index.js +132 -0
  128. package/dist/services/actionflow/components/index.js.map +1 -0
  129. package/dist/services/actionflow/components/logic_flow_set.d.ts +10 -0
  130. package/dist/services/actionflow/components/logic_flow_set.d.ts.map +1 -0
  131. package/dist/services/actionflow/components/logic_flow_set.js +79 -0
  132. package/dist/services/actionflow/components/logic_flow_set.js.map +1 -0
  133. package/dist/services/actionflow/components/meeting_create.d.ts +5 -0
  134. package/dist/services/actionflow/components/meeting_create.d.ts.map +1 -0
  135. package/dist/services/actionflow/components/meeting_create.js +37 -0
  136. package/dist/services/actionflow/components/meeting_create.js.map +1 -0
  137. package/dist/services/actionflow/components/multiple_execution.d.ts +5 -0
  138. package/dist/services/actionflow/components/multiple_execution.d.ts.map +1 -0
  139. package/dist/services/actionflow/components/multiple_execution.js +136 -0
  140. package/dist/services/actionflow/components/multiple_execution.js.map +1 -0
  141. package/dist/services/actionflow/components/output.d.ts +9 -0
  142. package/dist/services/actionflow/components/output.d.ts.map +1 -0
  143. package/dist/services/actionflow/components/output.js +81 -0
  144. package/dist/services/actionflow/components/output.js.map +1 -0
  145. package/dist/services/actionflow/components/schedule_create.d.ts +5 -0
  146. package/dist/services/actionflow/components/schedule_create.d.ts.map +1 -0
  147. package/dist/services/actionflow/components/schedule_create.js +42 -0
  148. package/dist/services/actionflow/components/schedule_create.js.map +1 -0
  149. package/dist/services/actionflow/components/send_message.d.ts +7 -0
  150. package/dist/services/actionflow/components/send_message.d.ts.map +1 -0
  151. package/dist/services/actionflow/components/send_message.js +200 -0
  152. package/dist/services/actionflow/components/send_message.js.map +1 -0
  153. package/dist/services/actionflow/components/simple_scheduler.d.ts +5 -0
  154. package/dist/services/actionflow/components/simple_scheduler.d.ts.map +1 -0
  155. package/dist/services/actionflow/components/simple_scheduler.js +22 -0
  156. package/dist/services/actionflow/components/simple_scheduler.js.map +1 -0
  157. package/dist/services/actionflow/components/time_batch_trigger.d.ts +5 -0
  158. package/dist/services/actionflow/components/time_batch_trigger.d.ts.map +1 -0
  159. package/dist/services/actionflow/components/time_batch_trigger.js +92 -0
  160. package/dist/services/actionflow/components/time_batch_trigger.js.map +1 -0
  161. package/dist/services/actionflow/components/workflow_actions.d.ts +26 -0
  162. package/dist/services/actionflow/components/workflow_actions.d.ts.map +1 -0
  163. package/dist/services/actionflow/components/workflow_actions.js +403 -0
  164. package/dist/services/actionflow/components/workflow_actions.js.map +1 -0
  165. package/dist/services/actionflow/context_data_builder.d.ts +9 -0
  166. package/dist/services/actionflow/context_data_builder.d.ts.map +1 -0
  167. package/dist/services/actionflow/context_data_builder.js +31 -0
  168. package/dist/services/actionflow/context_data_builder.js.map +1 -0
  169. package/dist/services/actionflow/context_preflight.d.ts +6 -0
  170. package/dist/services/actionflow/context_preflight.d.ts.map +1 -0
  171. package/dist/services/actionflow/context_preflight.js +122 -0
  172. package/dist/services/actionflow/context_preflight.js.map +1 -0
  173. package/dist/services/actionflow/context_provider.d.ts +18 -0
  174. package/dist/services/actionflow/context_provider.d.ts.map +1 -0
  175. package/dist/services/actionflow/context_provider.js +102 -0
  176. package/dist/services/actionflow/context_provider.js.map +1 -0
  177. package/dist/services/actionflow/context_source.d.ts +7 -0
  178. package/dist/services/actionflow/context_source.d.ts.map +1 -0
  179. package/dist/services/actionflow/context_source.js +10 -0
  180. package/dist/services/actionflow/context_source.js.map +1 -0
  181. package/dist/services/actionflow/design_client.d.ts +48 -0
  182. package/dist/services/actionflow/design_client.d.ts.map +1 -0
  183. package/dist/services/actionflow/design_client.js +170 -0
  184. package/dist/services/actionflow/design_client.js.map +1 -0
  185. package/dist/services/actionflow/document_source.d.ts +5 -0
  186. package/dist/services/actionflow/document_source.d.ts.map +1 -0
  187. package/dist/services/actionflow/document_source.js +5 -0
  188. package/dist/services/actionflow/document_source.js.map +1 -0
  189. package/dist/services/actionflow/enrich_approve_trigger.d.ts +12 -0
  190. package/dist/services/actionflow/enrich_approve_trigger.d.ts.map +1 -0
  191. package/dist/services/actionflow/enrich_approve_trigger.js +107 -0
  192. package/dist/services/actionflow/enrich_approve_trigger.js.map +1 -0
  193. package/dist/services/actionflow/filter_rules.d.ts +14 -0
  194. package/dist/services/actionflow/filter_rules.d.ts.map +1 -0
  195. package/dist/services/actionflow/filter_rules.js +259 -0
  196. package/dist/services/actionflow/filter_rules.js.map +1 -0
  197. package/dist/services/actionflow/form_source.d.ts +17 -0
  198. package/dist/services/actionflow/form_source.d.ts.map +1 -0
  199. package/dist/services/actionflow/form_source.js +42 -0
  200. package/dist/services/actionflow/form_source.js.map +1 -0
  201. package/dist/services/actionflow/formula_service.d.ts +51 -0
  202. package/dist/services/actionflow/formula_service.d.ts.map +1 -0
  203. package/dist/services/actionflow/formula_service.js +999 -0
  204. package/dist/services/actionflow/formula_service.js.map +1 -0
  205. package/dist/services/actionflow/generation_service.d.ts +28 -0
  206. package/dist/services/actionflow/generation_service.d.ts.map +1 -0
  207. package/dist/services/actionflow/generation_service.js +283 -0
  208. package/dist/services/actionflow/generation_service.js.map +1 -0
  209. package/dist/services/actionflow/hrm_source.d.ts +4 -0
  210. package/dist/services/actionflow/hrm_source.d.ts.map +1 -0
  211. package/dist/services/actionflow/hrm_source.js +8 -0
  212. package/dist/services/actionflow/hrm_source.js.map +1 -0
  213. package/dist/services/actionflow/id_generator.d.ts +13 -0
  214. package/dist/services/actionflow/id_generator.d.ts.map +1 -0
  215. package/dist/services/actionflow/id_generator.js +33 -0
  216. package/dist/services/actionflow/id_generator.js.map +1 -0
  217. package/dist/services/actionflow/person_source.d.ts +7 -0
  218. package/dist/services/actionflow/person_source.d.ts.map +1 -0
  219. package/dist/services/actionflow/person_source.js +34 -0
  220. package/dist/services/actionflow/person_source.js.map +1 -0
  221. package/dist/services/actionflow/preflight_service.d.ts +42 -0
  222. package/dist/services/actionflow/preflight_service.d.ts.map +1 -0
  223. package/dist/services/actionflow/preflight_service.js +1247 -0
  224. package/dist/services/actionflow/preflight_service.js.map +1 -0
  225. package/dist/services/actionflow/query_field_defaults.d.ts +3 -0
  226. package/dist/services/actionflow/query_field_defaults.d.ts.map +1 -0
  227. package/dist/services/actionflow/query_field_defaults.js +46 -0
  228. package/dist/services/actionflow/query_field_defaults.js.map +1 -0
  229. package/dist/services/actionflow/readback_verifier.d.ts +11 -0
  230. package/dist/services/actionflow/readback_verifier.d.ts.map +1 -0
  231. package/dist/services/actionflow/readback_verifier.js +252 -0
  232. package/dist/services/actionflow/readback_verifier.js.map +1 -0
  233. package/dist/services/actionflow/request.d.ts +13 -0
  234. package/dist/services/actionflow/request.d.ts.map +1 -0
  235. package/dist/services/actionflow/request.js +15 -0
  236. package/dist/services/actionflow/request.js.map +1 -0
  237. package/dist/services/actionflow/runtime_metadata.d.ts +27 -0
  238. package/dist/services/actionflow/runtime_metadata.d.ts.map +1 -0
  239. package/dist/services/actionflow/runtime_metadata.js +142 -0
  240. package/dist/services/actionflow/runtime_metadata.js.map +1 -0
  241. package/dist/services/actionflow/save_workflow_draft.d.ts +34 -0
  242. package/dist/services/actionflow/save_workflow_draft.d.ts.map +1 -0
  243. package/dist/services/actionflow/save_workflow_draft.js +449 -0
  244. package/dist/services/actionflow/save_workflow_draft.js.map +1 -0
  245. package/dist/services/actionflow/system_params.d.ts +5 -0
  246. package/dist/services/actionflow/system_params.d.ts.map +1 -0
  247. package/dist/services/actionflow/system_params.js +55 -0
  248. package/dist/services/actionflow/system_params.js.map +1 -0
  249. package/dist/services/actionflow/trigger_common.d.ts +6 -0
  250. package/dist/services/actionflow/trigger_common.d.ts.map +1 -0
  251. package/dist/services/actionflow/trigger_common.js +41 -0
  252. package/dist/services/actionflow/trigger_common.js.map +1 -0
  253. package/dist/services/actionflow/workflow_compiler.d.ts +27 -0
  254. package/dist/services/actionflow/workflow_compiler.d.ts.map +1 -0
  255. package/dist/services/actionflow/workflow_compiler.js +1804 -0
  256. package/dist/services/actionflow/workflow_compiler.js.map +1 -0
  257. package/dist/services/actionflow/workflow_source.d.ts +14 -0
  258. package/dist/services/actionflow/workflow_source.d.ts.map +1 -0
  259. package/dist/services/actionflow/workflow_source.js +86 -0
  260. package/dist/services/actionflow/workflow_source.js.map +1 -0
  261. package/package.json +1 -1
@@ -930,12 +930,15 @@ export function registerFormCommands(program) {
930
930
  type: 'Date', title: df.fieldName,
931
931
  placeholder: placeholderFromFormat(dtFmt),
932
932
  earlyDate: false, lateDate: false,
933
- earlyType: 'currentDay', lateType: 'currentDay',
934
933
  format: dtFmt,
934
+ hasDisplayFormat: true,
935
+ minuteStep: 1,
935
936
  isSystemDate: false,
936
937
  timePanelStyle: { type: 'system' },
937
938
  isDefault: dtHasDefault,
938
- ...(dtHasDefault ? { defaultExtend: { date: { type: 'current' }, time: { customValue: '00:00', type: 'custom' } } } : {}),
939
+ ...(dtHasDefault
940
+ ? { defaultExtend: { date: { type: 'current' }, time: { customValue: '00:00', type: 'custom' } } }
941
+ : { defaultExtend: { date: { type: 'custom' } } }),
939
942
  ...(dtMinTargetId ? { min: { type: 'dateField', checkValue: String(dtMinTargetId) }, earlyDate: true } : {}),
940
943
  ...(dtMaxTargetId ? { max: { type: 'dateField', checkValue: String(dtMaxTargetId) }, lateDate: true } : {}),
941
944
  formTableId: dtDetail?.formTableId || '',
@@ -2466,6 +2469,176 @@ export function registerFormCommands(program) {
2466
2469
  }
2467
2470
  }
2468
2471
  });
2472
+ // ─── FIELD-GROUP(字段分组,对齐 wf-form group / form native field-group)──────────
2473
+ // eb 表建后加分组(form create 的 fields.json group 是建表时一次性带;已建表用本命令)。
2474
+ // 三步(module=ebuilderform,apid=appId,customParam={appId,objId}):
2475
+ // ① saveFieldGroup 建分组 → data.group.id + refFieldId(layout Collapse id)
2476
+ // ② updateFormFieldGroup 分配字段(fieldList)
2477
+ // ③ initLayout 手动 Collapse config{id:refFieldId,componentKey:Fold,type:Collapse,
2478
+ // dataKey:f_refFieldId,children:[分组字段]} + generateCollapse:true
2479
+ // 兼容 FLOW(手动 Collapse)+ EXCEL(generateCollapse 也生效)。
2480
+ // 去重:saveFieldGroup 不幂等,重跑会建重复分组;先 getFieldGroupPage 读现有分组按名复用。
2481
+ form.command('group')
2482
+ .description('字段分组(建分组/分配字段/布局 Collapse 折叠,对齐 wf-form group)。给已建好的 eb 表加分组')
2483
+ .argument('<objId>', '表单 objId')
2484
+ .argument('<appId>', '应用 appId')
2485
+ .requiredOption('--groups <json>', '分组定义 JSON:{"分组名":["字段名或fieldId",...]},可 @文件路径')
2486
+ .option('--required', '同时设分组内字段必填(re-init 时一起带上,防丢)')
2487
+ .action(async (objId, appId, o) => {
2488
+ const opts = program.opts();
2489
+ const auth = await AuthSession.fromOptions(opts);
2490
+ if (!auth)
2491
+ process.exit(1);
2492
+ const client = new ApiClient(auth);
2493
+ const baseUrl = auth.getBaseUrl();
2494
+ // eb 表 layout/field-manage 接口认 formId(≠objId):从应用表单列表按 objId 解析 formId
2495
+ let formId = '';
2496
+ try {
2497
+ const listRes = await client.get(`${baseUrl}/api/bs/ebuilder/form/obj/getList/${encodeURIComponent(appId)}?apid=${encodeURIComponent(appId)}`);
2498
+ const hit = (listRes?.data || []).find((f) => String(f.id) === String(objId));
2499
+ formId = hit?.formId || '';
2500
+ }
2501
+ catch { /* 忽略,下面报错 */ }
2502
+ if (!formId)
2503
+ throw new Error(`无法从应用 ${appId} 解析 objId=${objId} 的 formId(表单不存在或已删除)`);
2504
+ const ebb = { ebbusinessid: formId };
2505
+ const apidQ = `?apid=${encodeURIComponent(appId)}`;
2506
+ const customParam = { appId, objId };
2507
+ try {
2508
+ let raw = o.groups;
2509
+ if (raw.startsWith('@')) {
2510
+ if (!existsSync(raw.slice(1)))
2511
+ throw new Error(`文件不存在: ${raw.slice(1)}`);
2512
+ raw = readFileSync(raw.slice(1), 'utf-8');
2513
+ }
2514
+ const groupsMap = JSON.parse(raw);
2515
+ const entries = Object.entries(groupsMap || {});
2516
+ if (!entries.length)
2517
+ throw new Error('--groups 为空');
2518
+ // 读现有分组(去重):getFieldGroupPage 返回字段带 formField.group,按 groupName 复用
2519
+ const existing = new Map();
2520
+ try {
2521
+ const gr = await client.post(`${baseUrl}/api/ebuilder/form/form/field/manage/getFieldGroupPage${apidQ}`, { pageNo: 1, pageSize: 100, module: 'ebuilderform', formFieldSearchEntity: { formId }, customParam: {} }, ebb);
2522
+ for (const f of (gr?.data?.pageDatas?.result || [])) {
2523
+ const g = f?.formField?.group;
2524
+ if (g?.id && g?.groupName && !existing.has(g.groupName)) {
2525
+ existing.set(g.groupName, { groupId: String(g.id), refFieldId: String(BigInt(g.id) - 1n) });
2526
+ }
2527
+ }
2528
+ }
2529
+ catch { /* 忽略,按无现有处理 */ }
2530
+ // getConfig 解析字段名→id
2531
+ const preLayout = await client.post(`${baseUrl}/api/ebuilder/form/builder/getFormLayout`, {
2532
+ formId, module: 'ebuilderform', customParam: {}, formTableIdList: [],
2533
+ designerParam: { onlyLayout: false, convert: false }, form: { id: formId },
2534
+ }, ebb);
2535
+ const layoutId = preLayout?.data?.formLayout?.id || '';
2536
+ const layoutMultiId = preLayout?.data?.formLayout?.multipleLayoutId || '';
2537
+ const layoutName = preLayout?.data?.formLayoutMultiple?.name || preLayout?.data?.formLayout?.name || '';
2538
+ const layoutType = preLayout?.data?.formLayoutMultiple?.layoutType || 'EXCEL';
2539
+ if (!layoutId)
2540
+ throw new Error('无法获取 layoutId');
2541
+ const cfgRes = await client.post(`${baseUrl}/api/ebuilder/form/form/view/relate/getConfig`, {
2542
+ formId, module: 'ebuilderform', apiModule: 'ebuilder/form', layoutId,
2543
+ customParam: { terminal: '', objId: formId }, initMode: 5, groupFieldIds: [],
2544
+ designerParam: { sourceModule: 'ebuilderform' },
2545
+ }, ebb);
2546
+ if (cfgRes?.code !== 200 || !cfgRes?.status)
2547
+ throw new Error(`getConfig 失败: ${cfgRes?.msg}`);
2548
+ const allConfigs = cfgRes?.data?.configs || [];
2549
+ const byName = new Map();
2550
+ const walk = (arr) => { for (const c of arr) {
2551
+ if (c.name)
2552
+ byName.set(String(c.name), c);
2553
+ if (c.id)
2554
+ byName.set(String(c.id), c);
2555
+ if (c.children?.length)
2556
+ walk(c.children);
2557
+ } };
2558
+ walk(allConfigs);
2559
+ // ① 建组(去重:同名复用)+ ② 分配字段
2560
+ const created = [];
2561
+ for (const [gname, refs] of entries) {
2562
+ let groupId, refFieldId;
2563
+ const ex = existing.get(gname);
2564
+ if (ex) {
2565
+ groupId = ex.groupId;
2566
+ refFieldId = ex.refFieldId;
2567
+ console.error(` 分组复用: ${gname} groupId=${groupId} refFieldId=${refFieldId}`);
2568
+ }
2569
+ else {
2570
+ const sr = await client.post(`${baseUrl}/api/ebuilder/form/form/field/manage/saveFieldGroup${apidQ}`, { module: 'ebuilderform', formFieldGroup: { groupName: gname, formId }, customParam }, ebb);
2571
+ if (sr?.code !== 200 || !sr?.status)
2572
+ throw new Error(`建分组「${gname}」失败: ${sr?.msg || '未知错误'}`);
2573
+ const g = sr?.data?.group || {};
2574
+ groupId = String(g.id || '');
2575
+ refFieldId = String(g.refFieldId || '');
2576
+ console.error(` 分组已建: ${gname} groupId=${groupId} refFieldId=${refFieldId}`);
2577
+ }
2578
+ const fieldIds = [];
2579
+ const missing = [];
2580
+ for (const ref of refs || []) {
2581
+ const f = byName.get(String(ref));
2582
+ if (f)
2583
+ fieldIds.push(String(f.id));
2584
+ else
2585
+ missing.push(String(ref));
2586
+ }
2587
+ if (missing.length)
2588
+ console.error(` ⚠ 分组「${gname}」未找到字段: ${missing.join(', ')}`);
2589
+ if (fieldIds.length) {
2590
+ const ur = await client.post(`${baseUrl}/api/ebuilder/form/form/field/manage/updateFormFieldGroup${apidQ}`, { module: 'ebuilderform', formFieldGroup: { id: groupId }, form: { id: formId }, fieldList: fieldIds.map((id) => ({ id })), customParam }, ebb);
2591
+ if (ur?.code !== 200 || !ur?.status)
2592
+ console.error(` ⚠ 分组「${gname}」分配字段失败: ${ur?.msg || '未知错误'}`);
2593
+ else
2594
+ console.error(` 已分配: ${gname} ← ${fieldIds.length} 字段`);
2595
+ }
2596
+ created.push({ name: gname, groupId, refFieldId, fieldIds });
2597
+ }
2598
+ // ③ 布局:对齐 form-create.ts EXCEL 分组路径——平铺 configs + 分组字段前置重排
2599
+ // (分组字段 → 系统字段 → 未分组字段)+ generateCollapse:true + groupFieldIds=[],
2600
+ // 平台据 saveFieldGroup/updateFormFieldGroup 记录自动包 Collapse(eb 表 EXCEL 实测唯一生效方式)。
2601
+ const cfgRes2 = await client.post(`${baseUrl}/api/ebuilder/form/form/view/relate/getConfig`, {
2602
+ formId, module: 'ebuilderform', apiModule: 'ebuilder/form', layoutId,
2603
+ customParam: { terminal: '', objId: formId }, initMode: 5, groupFieldIds: [],
2604
+ designerParam: { sourceModule: 'ebuilderform' },
2605
+ }, ebb);
2606
+ const rawCfgs = cfgRes2?.data?.configs || [];
2607
+ const groupFieldIdSet = new Set(created.flatMap((g) => g.fieldIds));
2608
+ const ordered = [
2609
+ ...rawCfgs.filter((c) => groupFieldIdSet.has(String(c.id))),
2610
+ ...rawCfgs.filter((c) => c.system),
2611
+ ...rawCfgs.filter((c) => !groupFieldIdSet.has(String(c.id)) && !c.system),
2612
+ ];
2613
+ const finalConfigs = ordered.map((c) => {
2614
+ const isBusiness = !c.system && c.type !== 'DetailTable' && c.componentKey !== 'DataTable';
2615
+ const out = { ...c, display: c.system ? c.display : true, show: c.system ? c.show : true };
2616
+ if (isBusiness) {
2617
+ out.readOnly = false;
2618
+ out.disableEdit = false;
2619
+ if (o.required === true)
2620
+ out.required = true;
2621
+ }
2622
+ return out;
2623
+ });
2624
+ await client.post(`${baseUrl}/api/ebuilder/form/form/view/relate/initLayout${apidQ}`, {
2625
+ formId, module: 'ebuilderform', apiModule: 'ebuilder/form', layoutId,
2626
+ generateCollapse: true, styleTemplateId: layoutType === 'FLOW' ? '820000000000000001' : '700000000000000008', styleTemplateType: 1,
2627
+ configs: finalConfigs, addLayout: false, ecodeType: ['js', 'css'], initMode: '5',
2628
+ groupFieldIds: [],
2629
+ customParam: { terminal: '', objId: formId },
2630
+ formLayoutMultiple: { isSys: true, id: layoutMultiId, name: layoutName, terminalType: 'PC', layoutType },
2631
+ designerParam: { onlyLayout: false },
2632
+ }, ebb);
2633
+ console.log(opts.json
2634
+ ? JSON.stringify({ success: true, formId, groups: created.map((g) => ({ name: g.name, groupId: g.groupId, refFieldId: g.refFieldId, fieldCount: g.fieldIds.length, reused: existing.has(g.name) })) }, null, 2)
2635
+ : `字段分组完成: ${created.length} 个分组(布局已重建,generateCollapse 自动渲染)`);
2636
+ }
2637
+ catch (e) {
2638
+ console.error(`字段分组失败: ${e.message}`);
2639
+ process.exitCode = 1;
2640
+ }
2641
+ });
2469
2642
  return form;
2470
2643
  }
2471
2644
  //# sourceMappingURL=form.js.map