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.
- package/dist/commands/actionflow.d.ts +7 -0
- package/dist/commands/actionflow.d.ts.map +1 -0
- package/dist/commands/actionflow.js +105 -0
- package/dist/commands/actionflow.js.map +1 -0
- package/dist/commands/auth.js +1 -1
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/form-list.d.ts.map +1 -1
- package/dist/commands/form-list.js +18 -9
- package/dist/commands/form-list.js.map +1 -1
- package/dist/commands/form-native.d.ts +0 -14
- package/dist/commands/form-native.d.ts.map +1 -1
- package/dist/commands/form-native.js +420 -72
- package/dist/commands/form-native.js.map +1 -1
- package/dist/commands/form.d.ts.map +1 -1
- package/dist/commands/form.js +175 -2
- package/dist/commands/form.js.map +1 -1
- package/dist/commands/wf-form.d.ts.map +1 -1
- package/dist/commands/wf-form.js +78 -8
- package/dist/commands/wf-form.js.map +1 -1
- package/dist/commands/workflow-action.d.ts +11 -0
- package/dist/commands/workflow-action.d.ts.map +1 -1
- package/dist/commands/workflow-action.js +13 -1592
- package/dist/commands/workflow-action.js.map +1 -1
- package/dist/commands/workflow-create-workflow.d.ts.map +1 -1
- package/dist/commands/workflow-create-workflow.js +36 -5
- package/dist/commands/workflow-create-workflow.js.map +1 -1
- package/dist/core/client.d.ts +2 -0
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/client.js +2 -0
- package/dist/core/client.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/services/actionflow/build_workflow_draft.d.ts +20 -0
- package/dist/services/actionflow/build_workflow_draft.d.ts.map +1 -0
- package/dist/services/actionflow/build_workflow_draft.js +222 -0
- package/dist/services/actionflow/build_workflow_draft.js.map +1 -0
- package/dist/services/actionflow/calendar_mapper.d.ts +3 -0
- package/dist/services/actionflow/calendar_mapper.d.ts.map +1 -0
- package/dist/services/actionflow/calendar_mapper.js +152 -0
- package/dist/services/actionflow/calendar_mapper.js.map +1 -0
- package/dist/services/actionflow/component_registry.d.ts +13 -0
- package/dist/services/actionflow/component_registry.d.ts.map +1 -0
- package/dist/services/actionflow/component_registry.js +213 -0
- package/dist/services/actionflow/component_registry.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_add.d.ts +3 -0
- package/dist/services/actionflow/components/action_eb_add.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_add.js +127 -0
- package/dist/services/actionflow/components/action_eb_add.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_add_compiler.d.ts +4 -0
- package/dist/services/actionflow/components/action_eb_add_compiler.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_add_compiler.js +13 -0
- package/dist/services/actionflow/components/action_eb_add_compiler.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_delete.d.ts +3 -0
- package/dist/services/actionflow/components/action_eb_delete.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_delete.js +69 -0
- package/dist/services/actionflow/components/action_eb_delete.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_delete_compiler.d.ts +4 -0
- package/dist/services/actionflow/components/action_eb_delete_compiler.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_delete_compiler.js +7 -0
- package/dist/services/actionflow/components/action_eb_delete_compiler.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_recover.d.ts +3 -0
- package/dist/services/actionflow/components/action_eb_recover.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_recover.js +28 -0
- package/dist/services/actionflow/components/action_eb_recover.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_recover_compiler.d.ts +3 -0
- package/dist/services/actionflow/components/action_eb_recover_compiler.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_recover_compiler.js +16 -0
- package/dist/services/actionflow/components/action_eb_recover_compiler.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_save_version.d.ts +3 -0
- package/dist/services/actionflow/components/action_eb_save_version.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_save_version.js +30 -0
- package/dist/services/actionflow/components/action_eb_save_version.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_save_version_compiler.d.ts +3 -0
- package/dist/services/actionflow/components/action_eb_save_version_compiler.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_save_version_compiler.js +15 -0
- package/dist/services/actionflow/components/action_eb_save_version_compiler.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_update.d.ts +3 -0
- package/dist/services/actionflow/components/action_eb_update.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_update.js +154 -0
- package/dist/services/actionflow/components/action_eb_update.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_update_compiler.d.ts +16 -0
- package/dist/services/actionflow/components/action_eb_update_compiler.d.ts.map +1 -0
- package/dist/services/actionflow/components/action_eb_update_compiler.js +94 -0
- package/dist/services/actionflow/components/action_eb_update_compiler.js.map +1 -0
- package/dist/services/actionflow/components/approve_create.d.ts +3 -0
- package/dist/services/actionflow/components/approve_create.d.ts.map +1 -0
- package/dist/services/actionflow/components/approve_create.js +44 -0
- package/dist/services/actionflow/components/approve_create.js.map +1 -0
- package/dist/services/actionflow/components/approve_trigger.d.ts +5 -0
- package/dist/services/actionflow/components/approve_trigger.d.ts.map +1 -0
- package/dist/services/actionflow/components/approve_trigger.js +184 -0
- package/dist/services/actionflow/components/approve_trigger.js.map +1 -0
- package/dist/services/actionflow/components/approve_trigger_compiler.d.ts +4 -0
- package/dist/services/actionflow/components/approve_trigger_compiler.d.ts.map +1 -0
- package/dist/services/actionflow/components/approve_trigger_compiler.js +20 -0
- package/dist/services/actionflow/components/approve_trigger_compiler.js.map +1 -0
- package/dist/services/actionflow/components/condition.d.ts +3 -0
- package/dist/services/actionflow/components/condition.d.ts.map +1 -0
- package/dist/services/actionflow/components/condition.js +23 -0
- package/dist/services/actionflow/components/condition.js.map +1 -0
- package/dist/services/actionflow/components/date_trigger.d.ts +5 -0
- package/dist/services/actionflow/components/date_trigger.d.ts.map +1 -0
- package/dist/services/actionflow/components/date_trigger.js +129 -0
- package/dist/services/actionflow/components/date_trigger.js.map +1 -0
- package/dist/services/actionflow/components/document_actions.d.ts +28 -0
- package/dist/services/actionflow/components/document_actions.d.ts.map +1 -0
- package/dist/services/actionflow/components/document_actions.js +266 -0
- package/dist/services/actionflow/components/document_actions.js.map +1 -0
- package/dist/services/actionflow/components/eb_get_data_by_id.d.ts +5 -0
- package/dist/services/actionflow/components/eb_get_data_by_id.d.ts.map +1 -0
- package/dist/services/actionflow/components/eb_get_data_by_id.js +44 -0
- package/dist/services/actionflow/components/eb_get_data_by_id.js.map +1 -0
- package/dist/services/actionflow/components/enquiry_form.d.ts +5 -0
- package/dist/services/actionflow/components/enquiry_form.d.ts.map +1 -0
- package/dist/services/actionflow/components/enquiry_form.js +100 -0
- package/dist/services/actionflow/components/enquiry_form.js.map +1 -0
- package/dist/services/actionflow/components/event_form_data.d.ts +3 -0
- package/dist/services/actionflow/components/event_form_data.d.ts.map +1 -0
- package/dist/services/actionflow/components/event_form_data.js +29 -0
- package/dist/services/actionflow/components/event_form_data.js.map +1 -0
- package/dist/services/actionflow/components/hrm_actions.d.ts +7 -0
- package/dist/services/actionflow/components/hrm_actions.d.ts.map +1 -0
- package/dist/services/actionflow/components/hrm_actions.js +138 -0
- package/dist/services/actionflow/components/hrm_actions.js.map +1 -0
- package/dist/services/actionflow/components/index.d.ts +32 -0
- package/dist/services/actionflow/components/index.d.ts.map +1 -0
- package/dist/services/actionflow/components/index.js +132 -0
- package/dist/services/actionflow/components/index.js.map +1 -0
- package/dist/services/actionflow/components/logic_flow_set.d.ts +10 -0
- package/dist/services/actionflow/components/logic_flow_set.d.ts.map +1 -0
- package/dist/services/actionflow/components/logic_flow_set.js +79 -0
- package/dist/services/actionflow/components/logic_flow_set.js.map +1 -0
- package/dist/services/actionflow/components/meeting_create.d.ts +5 -0
- package/dist/services/actionflow/components/meeting_create.d.ts.map +1 -0
- package/dist/services/actionflow/components/meeting_create.js +37 -0
- package/dist/services/actionflow/components/meeting_create.js.map +1 -0
- package/dist/services/actionflow/components/multiple_execution.d.ts +5 -0
- package/dist/services/actionflow/components/multiple_execution.d.ts.map +1 -0
- package/dist/services/actionflow/components/multiple_execution.js +136 -0
- package/dist/services/actionflow/components/multiple_execution.js.map +1 -0
- package/dist/services/actionflow/components/output.d.ts +9 -0
- package/dist/services/actionflow/components/output.d.ts.map +1 -0
- package/dist/services/actionflow/components/output.js +81 -0
- package/dist/services/actionflow/components/output.js.map +1 -0
- package/dist/services/actionflow/components/schedule_create.d.ts +5 -0
- package/dist/services/actionflow/components/schedule_create.d.ts.map +1 -0
- package/dist/services/actionflow/components/schedule_create.js +42 -0
- package/dist/services/actionflow/components/schedule_create.js.map +1 -0
- package/dist/services/actionflow/components/send_message.d.ts +7 -0
- package/dist/services/actionflow/components/send_message.d.ts.map +1 -0
- package/dist/services/actionflow/components/send_message.js +200 -0
- package/dist/services/actionflow/components/send_message.js.map +1 -0
- package/dist/services/actionflow/components/simple_scheduler.d.ts +5 -0
- package/dist/services/actionflow/components/simple_scheduler.d.ts.map +1 -0
- package/dist/services/actionflow/components/simple_scheduler.js +22 -0
- package/dist/services/actionflow/components/simple_scheduler.js.map +1 -0
- package/dist/services/actionflow/components/time_batch_trigger.d.ts +5 -0
- package/dist/services/actionflow/components/time_batch_trigger.d.ts.map +1 -0
- package/dist/services/actionflow/components/time_batch_trigger.js +92 -0
- package/dist/services/actionflow/components/time_batch_trigger.js.map +1 -0
- package/dist/services/actionflow/components/workflow_actions.d.ts +26 -0
- package/dist/services/actionflow/components/workflow_actions.d.ts.map +1 -0
- package/dist/services/actionflow/components/workflow_actions.js +403 -0
- package/dist/services/actionflow/components/workflow_actions.js.map +1 -0
- package/dist/services/actionflow/context_data_builder.d.ts +9 -0
- package/dist/services/actionflow/context_data_builder.d.ts.map +1 -0
- package/dist/services/actionflow/context_data_builder.js +31 -0
- package/dist/services/actionflow/context_data_builder.js.map +1 -0
- package/dist/services/actionflow/context_preflight.d.ts +6 -0
- package/dist/services/actionflow/context_preflight.d.ts.map +1 -0
- package/dist/services/actionflow/context_preflight.js +122 -0
- package/dist/services/actionflow/context_preflight.js.map +1 -0
- package/dist/services/actionflow/context_provider.d.ts +18 -0
- package/dist/services/actionflow/context_provider.d.ts.map +1 -0
- package/dist/services/actionflow/context_provider.js +102 -0
- package/dist/services/actionflow/context_provider.js.map +1 -0
- package/dist/services/actionflow/context_source.d.ts +7 -0
- package/dist/services/actionflow/context_source.d.ts.map +1 -0
- package/dist/services/actionflow/context_source.js +10 -0
- package/dist/services/actionflow/context_source.js.map +1 -0
- package/dist/services/actionflow/design_client.d.ts +48 -0
- package/dist/services/actionflow/design_client.d.ts.map +1 -0
- package/dist/services/actionflow/design_client.js +170 -0
- package/dist/services/actionflow/design_client.js.map +1 -0
- package/dist/services/actionflow/document_source.d.ts +5 -0
- package/dist/services/actionflow/document_source.d.ts.map +1 -0
- package/dist/services/actionflow/document_source.js +5 -0
- package/dist/services/actionflow/document_source.js.map +1 -0
- package/dist/services/actionflow/enrich_approve_trigger.d.ts +12 -0
- package/dist/services/actionflow/enrich_approve_trigger.d.ts.map +1 -0
- package/dist/services/actionflow/enrich_approve_trigger.js +107 -0
- package/dist/services/actionflow/enrich_approve_trigger.js.map +1 -0
- package/dist/services/actionflow/filter_rules.d.ts +14 -0
- package/dist/services/actionflow/filter_rules.d.ts.map +1 -0
- package/dist/services/actionflow/filter_rules.js +259 -0
- package/dist/services/actionflow/filter_rules.js.map +1 -0
- package/dist/services/actionflow/form_source.d.ts +17 -0
- package/dist/services/actionflow/form_source.d.ts.map +1 -0
- package/dist/services/actionflow/form_source.js +42 -0
- package/dist/services/actionflow/form_source.js.map +1 -0
- package/dist/services/actionflow/formula_service.d.ts +51 -0
- package/dist/services/actionflow/formula_service.d.ts.map +1 -0
- package/dist/services/actionflow/formula_service.js +999 -0
- package/dist/services/actionflow/formula_service.js.map +1 -0
- package/dist/services/actionflow/generation_service.d.ts +28 -0
- package/dist/services/actionflow/generation_service.d.ts.map +1 -0
- package/dist/services/actionflow/generation_service.js +283 -0
- package/dist/services/actionflow/generation_service.js.map +1 -0
- package/dist/services/actionflow/hrm_source.d.ts +4 -0
- package/dist/services/actionflow/hrm_source.d.ts.map +1 -0
- package/dist/services/actionflow/hrm_source.js +8 -0
- package/dist/services/actionflow/hrm_source.js.map +1 -0
- package/dist/services/actionflow/id_generator.d.ts +13 -0
- package/dist/services/actionflow/id_generator.d.ts.map +1 -0
- package/dist/services/actionflow/id_generator.js +33 -0
- package/dist/services/actionflow/id_generator.js.map +1 -0
- package/dist/services/actionflow/person_source.d.ts +7 -0
- package/dist/services/actionflow/person_source.d.ts.map +1 -0
- package/dist/services/actionflow/person_source.js +34 -0
- package/dist/services/actionflow/person_source.js.map +1 -0
- package/dist/services/actionflow/preflight_service.d.ts +42 -0
- package/dist/services/actionflow/preflight_service.d.ts.map +1 -0
- package/dist/services/actionflow/preflight_service.js +1247 -0
- package/dist/services/actionflow/preflight_service.js.map +1 -0
- package/dist/services/actionflow/query_field_defaults.d.ts +3 -0
- package/dist/services/actionflow/query_field_defaults.d.ts.map +1 -0
- package/dist/services/actionflow/query_field_defaults.js +46 -0
- package/dist/services/actionflow/query_field_defaults.js.map +1 -0
- package/dist/services/actionflow/readback_verifier.d.ts +11 -0
- package/dist/services/actionflow/readback_verifier.d.ts.map +1 -0
- package/dist/services/actionflow/readback_verifier.js +252 -0
- package/dist/services/actionflow/readback_verifier.js.map +1 -0
- package/dist/services/actionflow/request.d.ts +13 -0
- package/dist/services/actionflow/request.d.ts.map +1 -0
- package/dist/services/actionflow/request.js +15 -0
- package/dist/services/actionflow/request.js.map +1 -0
- package/dist/services/actionflow/runtime_metadata.d.ts +27 -0
- package/dist/services/actionflow/runtime_metadata.d.ts.map +1 -0
- package/dist/services/actionflow/runtime_metadata.js +142 -0
- package/dist/services/actionflow/runtime_metadata.js.map +1 -0
- package/dist/services/actionflow/save_workflow_draft.d.ts +34 -0
- package/dist/services/actionflow/save_workflow_draft.d.ts.map +1 -0
- package/dist/services/actionflow/save_workflow_draft.js +449 -0
- package/dist/services/actionflow/save_workflow_draft.js.map +1 -0
- package/dist/services/actionflow/system_params.d.ts +5 -0
- package/dist/services/actionflow/system_params.d.ts.map +1 -0
- package/dist/services/actionflow/system_params.js +55 -0
- package/dist/services/actionflow/system_params.js.map +1 -0
- package/dist/services/actionflow/trigger_common.d.ts +6 -0
- package/dist/services/actionflow/trigger_common.d.ts.map +1 -0
- package/dist/services/actionflow/trigger_common.js +41 -0
- package/dist/services/actionflow/trigger_common.js.map +1 -0
- package/dist/services/actionflow/workflow_compiler.d.ts +27 -0
- package/dist/services/actionflow/workflow_compiler.d.ts.map +1 -0
- package/dist/services/actionflow/workflow_compiler.js +1804 -0
- package/dist/services/actionflow/workflow_compiler.js.map +1 -0
- package/dist/services/actionflow/workflow_source.d.ts +14 -0
- package/dist/services/actionflow/workflow_source.d.ts.map +1 -0
- package/dist/services/actionflow/workflow_source.js +86 -0
- package/dist/services/actionflow/workflow_source.js.map +1 -0
- package/package.json +1 -1
package/dist/commands/form.js
CHANGED
|
@@ -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
|
|
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
|