weaver-e10-builder 1.6.4 → 1.6.6
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.map +1 -1
- package/dist/commands/actionflow.js +18 -1
- package/dist/commands/actionflow.js.map +1 -1
- package/dist/commands/form-add-detail-table.js +3 -3
- package/dist/commands/form-add-detail-table.js.map +1 -1
- package/dist/commands/form-browser-definition.js +8 -8
- package/dist/commands/form-browser-definition.js.map +1 -1
- package/dist/commands/form-code.js +7 -7
- package/dist/commands/form-code.js.map +1 -1
- package/dist/commands/form-data.js +1 -1
- package/dist/commands/form-data.js.map +1 -1
- package/dist/commands/form-ebuilder-scope.js +8 -8
- package/dist/commands/form-ebuilder-scope.js.map +1 -1
- package/dist/commands/form-engine-linkage.js +12 -12
- package/dist/commands/form-engine-linkage.js.map +1 -1
- package/dist/commands/form-layout-diff.js +1 -1
- package/dist/commands/form-layout-diff.js.map +1 -1
- package/dist/commands/form-layout-edit.js +1 -1
- package/dist/commands/form-layout-edit.js.map +1 -1
- package/dist/commands/form-layout-init-reviewed.js +1 -1
- package/dist/commands/form-layout-init-reviewed.js.map +1 -1
- package/dist/commands/form-layout-init.js +2 -2
- package/dist/commands/form-layout-init.js.map +1 -1
- package/dist/commands/form-layout-template-easy.js +1 -1
- package/dist/commands/form-layout-template-easy.js.map +1 -1
- package/dist/commands/form-layout.js +4 -4
- package/dist/commands/form-layout.js.map +1 -1
- package/dist/commands/form-view.d.ts.map +1 -1
- package/dist/commands/form-view.js +1 -2
- package/dist/commands/form-view.js.map +1 -1
- package/dist/commands/form.js +3 -3
- package/dist/commands/form.js.map +1 -1
- package/dist/commands/menu-permission.d.ts +11 -0
- package/dist/commands/menu-permission.d.ts.map +1 -1
- package/dist/commands/menu-permission.js +113 -26
- package/dist/commands/menu-permission.js.map +1 -1
- package/dist/commands/menu.d.ts +16 -5
- package/dist/commands/menu.d.ts.map +1 -1
- package/dist/commands/menu.js +153 -42
- package/dist/commands/menu.js.map +1 -1
- package/dist/commands/report-admin.js +1 -1
- package/dist/commands/report-admin.js.map +1 -1
- package/dist/commands/report-query.js +1 -1
- package/dist/commands/report-query.js.map +1 -1
- package/dist/commands/report.js +1 -1
- package/dist/commands/report.js.map +1 -1
- package/dist/commands/wf-form-layout-init-reviewed.d.ts +3 -0
- package/dist/commands/wf-form-layout-init-reviewed.d.ts.map +1 -0
- package/dist/commands/wf-form-layout-init-reviewed.js +71 -0
- package/dist/commands/wf-form-layout-init-reviewed.js.map +1 -0
- package/dist/commands/wf-form.d.ts +1 -0
- package/dist/commands/wf-form.d.ts.map +1 -1
- package/dist/commands/wf-form.js +16 -16
- package/dist/commands/wf-form.js.map +1 -1
- package/dist/commands/workflow-advanced.js +1 -1
- package/dist/commands/workflow-advanced.js.map +1 -1
- package/dist/commands/workflow-basic-info.js +4 -4
- package/dist/commands/workflow-basic-info.js.map +1 -1
- package/dist/commands/workflow.js +6 -6
- package/dist/commands/workflow.js.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/services/actionflow/classified_protection_source.d.ts +10 -0
- package/dist/services/actionflow/classified_protection_source.d.ts.map +1 -0
- package/dist/services/actionflow/classified_protection_source.js +27 -0
- package/dist/services/actionflow/classified_protection_source.js.map +1 -0
- package/dist/services/actionflow/components/action_eb_add.d.ts.map +1 -1
- package/dist/services/actionflow/components/action_eb_add.js +4 -5
- package/dist/services/actionflow/components/action_eb_add.js.map +1 -1
- package/dist/services/actionflow/components/action_eb_update.d.ts.map +1 -1
- package/dist/services/actionflow/components/action_eb_update.js +13 -1
- package/dist/services/actionflow/components/action_eb_update.js.map +1 -1
- package/dist/services/actionflow/components/action_eb_update_compiler.d.ts +12 -0
- package/dist/services/actionflow/components/action_eb_update_compiler.d.ts.map +1 -1
- package/dist/services/actionflow/components/action_eb_update_compiler.js +88 -3
- package/dist/services/actionflow/components/action_eb_update_compiler.js.map +1 -1
- package/dist/services/actionflow/components/approve_create.d.ts.map +1 -1
- package/dist/services/actionflow/components/approve_create.js +6 -10
- package/dist/services/actionflow/components/approve_create.js.map +1 -1
- package/dist/services/actionflow/components/condition.d.ts.map +1 -1
- package/dist/services/actionflow/components/condition.js +3 -2
- package/dist/services/actionflow/components/condition.js.map +1 -1
- package/dist/services/actionflow/components/eb_get_data_by_id.d.ts.map +1 -1
- package/dist/services/actionflow/components/eb_get_data_by_id.js +9 -1
- package/dist/services/actionflow/components/eb_get_data_by_id.js.map +1 -1
- package/dist/services/actionflow/components/send_message.js +1 -1
- package/dist/services/actionflow/components/send_message.js.map +1 -1
- package/dist/services/actionflow/components/workflow_actions.d.ts.map +1 -1
- package/dist/services/actionflow/components/workflow_actions.js +20 -11
- package/dist/services/actionflow/components/workflow_actions.js.map +1 -1
- package/dist/services/actionflow/context_discovery.d.ts +16 -0
- package/dist/services/actionflow/context_discovery.d.ts.map +1 -0
- package/dist/services/actionflow/context_discovery.js +73 -0
- package/dist/services/actionflow/context_discovery.js.map +1 -0
- package/dist/services/actionflow/context_preflight.d.ts +0 -9
- package/dist/services/actionflow/context_preflight.d.ts.map +1 -1
- package/dist/services/actionflow/context_preflight.js +9 -60
- package/dist/services/actionflow/context_preflight.js.map +1 -1
- package/dist/services/actionflow/design_client.d.ts +4 -0
- package/dist/services/actionflow/design_client.d.ts.map +1 -1
- package/dist/services/actionflow/design_client.js +65 -0
- package/dist/services/actionflow/design_client.js.map +1 -1
- package/dist/services/actionflow/execution_setting.d.ts +11 -0
- package/dist/services/actionflow/execution_setting.d.ts.map +1 -0
- package/dist/services/actionflow/execution_setting.js +205 -0
- package/dist/services/actionflow/execution_setting.js.map +1 -0
- package/dist/services/actionflow/form_source.d.ts +9 -2
- package/dist/services/actionflow/form_source.d.ts.map +1 -1
- package/dist/services/actionflow/form_source.js +21 -6
- package/dist/services/actionflow/form_source.js.map +1 -1
- package/dist/services/actionflow/formula_service.d.ts.map +1 -1
- package/dist/services/actionflow/formula_service.js +153 -37
- package/dist/services/actionflow/formula_service.js.map +1 -1
- package/dist/services/actionflow/preflight_service.d.ts +14 -3
- package/dist/services/actionflow/preflight_service.d.ts.map +1 -1
- package/dist/services/actionflow/preflight_service.js +383 -49
- package/dist/services/actionflow/preflight_service.js.map +1 -1
- package/dist/services/actionflow/workflow_compiler.d.ts.map +1 -1
- package/dist/services/actionflow/workflow_compiler.js +154 -23
- package/dist/services/actionflow/workflow_compiler.js.map +1 -1
- package/dist/services/menu-catalog.d.ts +19 -0
- package/dist/services/menu-catalog.d.ts.map +1 -1
- package/dist/services/menu-catalog.js +31 -1
- package/dist/services/menu-catalog.js.map +1 -1
- package/dist/services/workflow-layout-init-reviewed.d.ts +35 -0
- package/dist/services/workflow-layout-init-reviewed.d.ts.map +1 -0
- package/dist/services/workflow-layout-init-reviewed.js +120 -0
- package/dist/services/workflow-layout-init-reviewed.js.map +1 -0
- package/package.json +1 -1
- package/skill-docs/SKILL.md +162 -163
- package/skill-docs/_catalog.md +1 -1
- package/skill-docs/actionflows/SKILL.md +10 -2
- package/skill-docs/actionflows/references/components/ebuilder/ActionEbUpdate.md +2 -0
- package/skill-docs/actionflows/references/components/ebuilder/EventButton.md +1 -1
- package/skill-docs/actionflows/references/components/logic/Condition.md +2 -0
- package/skill-docs/actionflows/references/components/message/SendMessage.md +2 -2
- package/skill-docs/actionflows/references/components/workflow/ApproveCommit.md +17 -17
- package/skill-docs/actionflows/references/components/workflow/ApproveCreate.md +1 -1
- package/skill-docs/actionflows/references/components/workflow/ApproveSave.md +1 -1
- package/skill-docs/actionflows/references/components/workflow/ApproveSendBack.md +17 -17
- package/skill-docs/actionflows/references/trigger_runtime_notes.md +6 -6
- package/skill-docs/references/common/ref-cli-commands.md +13 -11
- package/skill-docs/references/form/guide-browser-definition.md +73 -40
- package/skill-docs/references/form/layout/code-block/layout-css.md +41 -0
- package/skill-docs/references/form/layout/initialization.md +2 -0
- package/skill-docs/references/form/layout/layout-overview.md +8 -0
- package/skill-docs/references/form/layout/template/advanced.md +21 -0
- package/skill-docs/references/form/layout/template/easy.md +2 -0
- package/skill-docs/references/form/layout/template/flow.md +2 -0
- package/skill-docs/references/form/layout/template/template-guide.md +3 -1
- package/skill-docs/references/form/layout/workflow-layout.md +13 -1
- package/skill-docs/references/form/ref-form-fields.md +18 -4
- package/skill-docs/references/menu/system-menus.md +44 -1
- package/skill-docs/references/workflow/guide-workflow-odoc.md +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight_service.d.ts","sourceRoot":"","sources":["../../../src/services/actionflow/preflight_service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"preflight_service.d.ts","sourceRoot":"","sources":["../../../src/services/actionflow/preflight_service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AA6DtD;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAiCpF;AAED,uCAAuC;AACvC,wBAAsB,2BAA2B,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAiB9G;AAgFD,gEAAgE;AAChE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAKjF;AAOD,uEAAuE;AACvE,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAgE1H;AAgCD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C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAYhG;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAcpG;AAED,uDAAuD;AACvD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAiBtG;AAoGD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;IACrB,aAAa,CAAC,EAAE,GAAG,EAAE,CAAC;CACvB;AAED,kCAAkC;AAClC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,eAAe,CAAC,CA8iB5H"}
|
|
@@ -4,6 +4,7 @@ import * as personSource from './person_source.js';
|
|
|
4
4
|
import * as contextSource from './context_source.js';
|
|
5
5
|
import * as hrmSource from './hrm_source.js';
|
|
6
6
|
import * as documentSource from './document_source.js';
|
|
7
|
+
import * as classifiedProtectionSource from './classified_protection_source.js';
|
|
7
8
|
import * as browserSource from './browser_source.js';
|
|
8
9
|
import * as logicFlowSource from './logicflow_source.js';
|
|
9
10
|
import { completeEbuilder, pickEbuilderBrowserRow } from './ebuilder_source.js';
|
|
@@ -37,6 +38,11 @@ function buttonName(row) {
|
|
|
37
38
|
return String(row?.name ?? row?.content ?? row?.text ?? '').trim();
|
|
38
39
|
}
|
|
39
40
|
function supportsTriggerBefore(row) {
|
|
41
|
+
// 前端 eventButton/index.tsx 的简单模式只筛选 buttonKey=save/editSave,
|
|
42
|
+
// 并把它们固定映射为 buttonLocation=before;这类响应没有 needTriggerBefore。
|
|
43
|
+
const buttonKey = String(row?.buttonKey || '').trim();
|
|
44
|
+
if (buttonKey === 'save' || buttonKey === 'editSave')
|
|
45
|
+
return true;
|
|
40
46
|
const value = row?.needTriggerBefore;
|
|
41
47
|
return value === true || value === 1 || value === '1' || String(value).toLowerCase() === 'true';
|
|
42
48
|
}
|
|
@@ -555,6 +561,111 @@ function walkPlanSteps(value) {
|
|
|
555
561
|
walk(value);
|
|
556
562
|
return steps[Symbol.iterator]();
|
|
557
563
|
}
|
|
564
|
+
function fixedAssignmentValue(value) {
|
|
565
|
+
if (typeof value === 'string' || typeof value === 'number')
|
|
566
|
+
return { fixed: true, value };
|
|
567
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
568
|
+
return { fixed: false };
|
|
569
|
+
const kind = String(value.kind ?? value.assignmentKind ?? '').toLowerCase();
|
|
570
|
+
if (kind && !['fixed', 'literal'].includes(kind))
|
|
571
|
+
return { fixed: false };
|
|
572
|
+
let config = value.config;
|
|
573
|
+
if (typeof config === 'string') {
|
|
574
|
+
try {
|
|
575
|
+
config = JSON.parse(config);
|
|
576
|
+
}
|
|
577
|
+
catch {
|
|
578
|
+
config = {};
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
if (String(config?.switchType || '').toLowerCase() === 'assign')
|
|
582
|
+
return { fixed: false };
|
|
583
|
+
if (kind === 'fixed' || kind === 'literal')
|
|
584
|
+
return { fixed: true, value: value.value ?? config?.originValue };
|
|
585
|
+
if (String(value.type || '') === '1' || String(config?.switchType || '').toLowerCase() === 'fixvalue') {
|
|
586
|
+
return { fixed: true, value: config?.originValue ?? value.value ?? value.name };
|
|
587
|
+
}
|
|
588
|
+
if (value.value !== undefined && !value.type && !value.formulaType)
|
|
589
|
+
return { fixed: true, value: value.value };
|
|
590
|
+
return { fixed: false };
|
|
591
|
+
}
|
|
592
|
+
/** 对齐新建流程前端:读取密级选项,补默认密级/有效期,并校验固定密级。 */
|
|
593
|
+
export async function resolveApproveCreateClassifiedProtection(plan, client, errors, warnings) {
|
|
594
|
+
const steps = [...walkPlanSteps({ actions: plan.actions || [] })].filter((step) => step.type === 'ApproveCreate');
|
|
595
|
+
if (!steps.length)
|
|
596
|
+
return;
|
|
597
|
+
const hasExplicitValue = steps.some((step) => step.params?.secretLevel != null || step.params?.secretLevelValidity != null);
|
|
598
|
+
let config;
|
|
599
|
+
try {
|
|
600
|
+
config = await classifiedProtectionSource.getClassifiedProtectionConfig(client);
|
|
601
|
+
}
|
|
602
|
+
catch (error) {
|
|
603
|
+
const message = `新建流程密级选项查询失败:${String(error?.message || error)}`;
|
|
604
|
+
if (hasExplicitValue)
|
|
605
|
+
errors.push(`${message};无法校验已配置的密级。`);
|
|
606
|
+
else
|
|
607
|
+
warnings.push(`${message};本次不补前端默认密级。`);
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
if (!config.isOpenClassification) {
|
|
611
|
+
if (hasExplicitValue)
|
|
612
|
+
errors.push('当前租户未启用密级保护,但新建流程配置了 secretLevel/secretLevelValidity。');
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
if (!config.resourceOptionInfo.length) {
|
|
616
|
+
if (hasExplicitValue)
|
|
617
|
+
errors.push('密级保护已启用,但接口没有返回可用密级选项。');
|
|
618
|
+
else
|
|
619
|
+
warnings.push('密级保护已启用,但接口没有返回密级选项,无法按前端逻辑填入默认密级。');
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
for (const step of steps) {
|
|
623
|
+
const params = step.params ??= {};
|
|
624
|
+
const path = `ApproveCreate${step.name ? ` '${step.name}'` : ''}`;
|
|
625
|
+
let selected;
|
|
626
|
+
const rawSecret = params.secretLevel;
|
|
627
|
+
if (rawSecret == null || rawSecret === '') {
|
|
628
|
+
selected = config.resourceOptionInfo[0];
|
|
629
|
+
params.secretLevel = { kind: 'fixed', value: String(selected.id), valueType: 'string' };
|
|
630
|
+
(plan._autoResources ??= []).push({
|
|
631
|
+
path: `${path}.secretLevel`, resourceType: 'classified_protection_option',
|
|
632
|
+
value: { id: String(selected.id), name: String(selected.content || selected.name || '') },
|
|
633
|
+
reason: '按前端新建流程组件逻辑,未指定密级时默认选择 resourceOptionInfo 第一项',
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
else {
|
|
637
|
+
const literal = fixedAssignmentValue(rawSecret);
|
|
638
|
+
if (!literal.fixed) {
|
|
639
|
+
continue;
|
|
640
|
+
}
|
|
641
|
+
const wanted = String(literal.value ?? '').trim();
|
|
642
|
+
const matches = config.resourceOptionInfo.filter((option) => String(option.id) === wanted || String(option.content ?? option.name ?? '').trim() === wanted);
|
|
643
|
+
if (matches.length !== 1) {
|
|
644
|
+
errors.push(`${path}.secretLevel 固定值 '${wanted}' 未能在当前租户密级选项中唯一匹配(匹配数: ${matches.length});请提供真实选项 ID 或名称。`);
|
|
645
|
+
continue;
|
|
646
|
+
}
|
|
647
|
+
selected = matches[0];
|
|
648
|
+
params.secretLevel = { kind: 'fixed', value: String(selected.id), valueType: 'string' };
|
|
649
|
+
if (String(literal.value) !== String(selected.id)) {
|
|
650
|
+
(plan._autoResources ??= []).push({
|
|
651
|
+
path: `${path}.secretLevel`, resourceType: 'classified_protection_option',
|
|
652
|
+
value: { id: String(selected.id), name: String(selected.content || selected.name || '') },
|
|
653
|
+
reason: '将密级名称解析为当前租户真实选项 ID',
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
const validityMode = String(selected?.secretLevelValidityShowType || 'hidden');
|
|
658
|
+
if (validityMode !== 'hidden' && (params.secretLevelValidity == null || params.secretLevelValidity === '')
|
|
659
|
+
&& selected?.defaultSecretLevelValidity != null && selected.defaultSecretLevelValidity !== '') {
|
|
660
|
+
params.secretLevelValidity = { kind: 'fixed', value: String(selected.defaultSecretLevelValidity), valueType: 'string' };
|
|
661
|
+
(plan._autoResources ??= []).push({
|
|
662
|
+
path: `${path}.secretLevelValidity`, resourceType: 'classified_protection_validity',
|
|
663
|
+
value: String(selected.defaultSecretLevelValidity),
|
|
664
|
+
reason: '按前端所选密级的 defaultSecretLevelValidity 填充保密期限',
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
558
669
|
/** 把显式固定人员展开为当前租户 Browser 对象。 */
|
|
559
670
|
export async function resolveFixedPeople(plan, client) {
|
|
560
671
|
const records = [];
|
|
@@ -586,6 +697,13 @@ export async function resolveFixedPeople(plan, client) {
|
|
|
586
697
|
const raw = container[key];
|
|
587
698
|
if (raw == null)
|
|
588
699
|
continue;
|
|
700
|
+
// SendMessage.receiver 是“提醒对象”联合类型。只有人员对象需要人员 Browser;
|
|
701
|
+
// 全员、部门、分部、角色等由各自对象类型处理,不能误走 resourceData。
|
|
702
|
+
if (componentType === 'SendMessage' && key === 'receiver' && raw && typeof raw === 'object') {
|
|
703
|
+
const receiverType = String(raw.objectType || raw.targetType || raw.type || '').toLowerCase();
|
|
704
|
+
if (receiverType && !['user', 'person', 'personnel', 'resource'].includes(receiverType))
|
|
705
|
+
continue;
|
|
706
|
+
}
|
|
589
707
|
const fixedArray = raw && typeof raw === 'object' && raw.kind === 'fixed' && Array.isArray(raw.value);
|
|
590
708
|
const values = fixedArray ? raw.value : (Array.isArray(raw) ? raw : [raw]);
|
|
591
709
|
if (values.some((item) => item && typeof item === 'object' && item.type && item.config && !item.kind))
|
|
@@ -1305,13 +1423,18 @@ export async function resolveEntrustFields(plan, client, errors) {
|
|
|
1305
1423
|
}
|
|
1306
1424
|
}
|
|
1307
1425
|
}
|
|
1308
|
-
/**
|
|
1426
|
+
/** 新建、保存、提交、退回流程都按实时流程定义读取主表与明细字段,映射只接受真实字段 ID。 */
|
|
1309
1427
|
export async function resolveBizCreateFields(step, plan, client, errors, path) {
|
|
1310
1428
|
const params = (step.params || {});
|
|
1429
|
+
const componentType = String(step.type || 'ApproveCreate');
|
|
1430
|
+
const operationName = {
|
|
1431
|
+
ApproveCreate: '新建流程', ApproveSave: '保存流程',
|
|
1432
|
+
ApproveCommit: '提交流程', ApproveSendBack: '退回流程',
|
|
1433
|
+
}[componentType] || componentType;
|
|
1311
1434
|
const wfPath = Array.isArray(params.workflowPath) ? (params.workflowPath[0] || {}) : (params.workflowPath || {});
|
|
1312
1435
|
const wfId = String(wfPath.id || wfPath.createFlowId || '');
|
|
1313
1436
|
if (!wfId) {
|
|
1314
|
-
errors.push(`${path}.params.workflowPath.id 缺失 (
|
|
1437
|
+
errors.push(`${path}.params.workflowPath.id 缺失 (${operationName}必须指定目标流程)`);
|
|
1315
1438
|
return;
|
|
1316
1439
|
}
|
|
1317
1440
|
try {
|
|
@@ -1352,7 +1475,7 @@ export async function resolveBizCreateFields(step, plan, client, errors, path) {
|
|
|
1352
1475
|
wfPath.formIds = formIds;
|
|
1353
1476
|
}
|
|
1354
1477
|
if (!formIds.length) {
|
|
1355
|
-
errors.push(`${path}.params.workflowPath.formIds 缺失: getWfField 未返回目标流程主表 formId
|
|
1478
|
+
errors.push(`${path}.params.workflowPath.formIds 缺失: getWfField 未返回目标流程主表 formId,无法安全${operationName};请确认目标流程已绑定表单。`);
|
|
1356
1479
|
}
|
|
1357
1480
|
const allFieldIds = new Set(bizFields.main.map((f) => f.id));
|
|
1358
1481
|
for (const dt of bizFields.detail) {
|
|
@@ -1378,6 +1501,13 @@ export async function resolveBizCreateFields(step, plan, client, errors, path) {
|
|
|
1378
1501
|
errors.push(`${path}.params.constants['${targetFid}'] 目标字段不存在于目标流程 '${wfId}' 的表单字段中`);
|
|
1379
1502
|
}
|
|
1380
1503
|
}
|
|
1504
|
+
const formulas = params.formula || {};
|
|
1505
|
+
if (formulas && typeof formulas === 'object') {
|
|
1506
|
+
for (const targetFid of Object.keys(formulas)) {
|
|
1507
|
+
if (!allFieldIds.has(String(targetFid)))
|
|
1508
|
+
errors.push(`${path}.params.formula['${targetFid}'] 目标字段不存在于目标流程 '${wfId}' 的表单字段中`);
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1381
1511
|
for (const [di, ditem] of (params.detail || []).entries()) {
|
|
1382
1512
|
if (!ditem || typeof ditem !== 'object')
|
|
1383
1513
|
continue;
|
|
@@ -1389,6 +1519,10 @@ export async function resolveBizCreateFields(step, plan, client, errors, path) {
|
|
|
1389
1519
|
if (tid2 && !allFieldIds.has(tid2))
|
|
1390
1520
|
errors.push(`${path}.params.detail[${di}].mapping['${sk}'] 目标字段 '${tid2}' 不存在于目标流程 '${wfId}' 的表单字段中 (明细表子字段 id 必须实时查全量, 禁止推算)`);
|
|
1391
1521
|
}
|
|
1522
|
+
for (const targetFid of Object.keys(ditem.formula || {})) {
|
|
1523
|
+
if (!allFieldIds.has(String(targetFid)))
|
|
1524
|
+
errors.push(`${path}.params.detail[${di}].formula['${targetFid}'] 目标字段不存在于目标流程 '${wfId}' 的表单字段中`);
|
|
1525
|
+
}
|
|
1392
1526
|
}
|
|
1393
1527
|
}
|
|
1394
1528
|
}
|
|
@@ -1518,12 +1652,15 @@ export function checkSourceReferences(plan, eventContextFields, errors, availabl
|
|
|
1518
1652
|
}
|
|
1519
1653
|
}
|
|
1520
1654
|
}
|
|
1521
|
-
if (
|
|
1655
|
+
if (['ApproveCreate', 'ApproveSave', 'ApproveCommit', 'ApproveSendBack'].includes(String(step.type))) {
|
|
1522
1656
|
if (params && typeof params === 'object') {
|
|
1523
1657
|
checkMapping(params.mapping, `${path}.mapping`);
|
|
1658
|
+
checkReference(params.formula, `${path}.formula`);
|
|
1524
1659
|
for (const [di, det] of (params.detail || []).entries()) {
|
|
1525
|
-
if (det && typeof det === 'object')
|
|
1660
|
+
if (det && typeof det === 'object') {
|
|
1526
1661
|
checkMapping(det.mapping, `${path}.detail[${di}].mapping`);
|
|
1662
|
+
checkReference(det.formula, `${path}.detail[${di}].formula`);
|
|
1663
|
+
}
|
|
1527
1664
|
}
|
|
1528
1665
|
}
|
|
1529
1666
|
}
|
|
@@ -1789,14 +1926,112 @@ function expandLoopDataContext(step, store) {
|
|
|
1789
1926
|
if (Object.keys(expanded).length)
|
|
1790
1927
|
store.merge(expanded, 'MultipleExecution');
|
|
1791
1928
|
}
|
|
1792
|
-
/**
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1929
|
+
/**
|
|
1930
|
+
* 显式 mapping 必须带实时显示名和完整上下文。
|
|
1931
|
+
*
|
|
1932
|
+
* mapping 的旧写法把来源 paramKey 放在对象 key 上,例如:
|
|
1933
|
+
* { "paymentTerms[].paymentNote": "<目标字段ID>" }。
|
|
1934
|
+
* hydrateContextReferences 只能遍历值,无法从这个 key 上给后续编译器
|
|
1935
|
+
* 回填 _resolvedContext,导致明细分支进入 assignFlatEsbChild 时丢失
|
|
1936
|
+
* WebHook 的 Body 根。这里在预检阶段把 key 规范化为对象,并复用
|
|
1937
|
+
* getComponentContext 返回的真实字段元数据;不根据 paramKey 猜 fieldId/root。
|
|
1938
|
+
*/
|
|
1939
|
+
export function hydrateMappingLabels(plan, eventContextFields, eventContext = {}) {
|
|
1940
|
+
const runtimeFields = Object.values(eventContext || {}).filter((field) => (field && typeof field === 'object' && field.type !== 'context_group' && field.paramKey));
|
|
1941
|
+
// eventContextFields 已经经过 resolveContextGroupRoot 归一化,优先使用它,
|
|
1942
|
+
// 避免 parsePlatformContext 的原始 numeric primaryKey 覆盖 WebHook 的逻辑根 Body。
|
|
1943
|
+
const contextFields = [...(eventContextFields || []), ...runtimeFields];
|
|
1944
|
+
const fieldsByParamKey = new Map();
|
|
1945
|
+
const addField = (key, field) => {
|
|
1946
|
+
const normalized = String(key || '').trim();
|
|
1947
|
+
if (!normalized)
|
|
1948
|
+
return;
|
|
1949
|
+
const bucket = fieldsByParamKey.get(normalized) || [];
|
|
1950
|
+
if (!bucket.some((item) => String(item?.id ?? '') === String(field?.id ?? '') && String(item?.paramKey ?? '') === String(field?.paramKey ?? ''))) {
|
|
1951
|
+
bucket.push(field);
|
|
1798
1952
|
}
|
|
1799
|
-
|
|
1953
|
+
fieldsByParamKey.set(normalized, bucket);
|
|
1954
|
+
};
|
|
1955
|
+
for (const field of contextFields) {
|
|
1956
|
+
if (!field || typeof field !== 'object' || !field.paramKey)
|
|
1957
|
+
continue;
|
|
1958
|
+
const paramKey = String(field.paramKey);
|
|
1959
|
+
const root = String(field.tablePrimaryKey || field.contextGroup || '').trim();
|
|
1960
|
+
addField(paramKey, field);
|
|
1961
|
+
if (root && !paramKey.startsWith(`${root}.`))
|
|
1962
|
+
addField(`${root}.${paramKey}`, field);
|
|
1963
|
+
if (root && paramKey.startsWith(`${root}.`))
|
|
1964
|
+
addField(paramKey.slice(root.length + 1), field);
|
|
1965
|
+
}
|
|
1966
|
+
const findField = (key) => {
|
|
1967
|
+
const requested = String(key || '').trim();
|
|
1968
|
+
if (!requested)
|
|
1969
|
+
return null;
|
|
1970
|
+
const direct = fieldsByParamKey.get(requested) || [];
|
|
1971
|
+
if (direct.length === 1)
|
|
1972
|
+
return direct[0];
|
|
1973
|
+
if (direct.length > 1)
|
|
1974
|
+
return null;
|
|
1975
|
+
const stripped = requested.replace(/^(?:Params|Header|Body)\./, '');
|
|
1976
|
+
const matches = fieldsByParamKey.get(stripped) || [];
|
|
1977
|
+
return matches.length === 1 ? matches[0] : null;
|
|
1978
|
+
};
|
|
1979
|
+
const resolvedContext = (field) => {
|
|
1980
|
+
if (!field || typeof field !== 'object')
|
|
1981
|
+
return undefined;
|
|
1982
|
+
const rawField = field.raw && typeof field.raw === 'object' ? field.raw : field;
|
|
1983
|
+
const tablePrimaryKey = String(field.tablePrimaryKey || field.contextGroup || rawField.tablePrimaryKey || '').trim();
|
|
1984
|
+
const fieldId = field.id ?? rawField.id ?? rawField.paramId;
|
|
1985
|
+
if (!tablePrimaryKey || fieldId === undefined || fieldId === null || String(fieldId).trim() === '')
|
|
1986
|
+
return undefined;
|
|
1987
|
+
const paramKey = String(field.paramKey || rawField.paramKey || '').trim();
|
|
1988
|
+
return {
|
|
1989
|
+
fieldId: String(fieldId),
|
|
1990
|
+
fieldType: String(field.fieldType || field.paramType || rawField.fieldType || rawField.paramType || 'string'),
|
|
1991
|
+
label: String(field.label || field.showName || field.paramName || rawField.showName || rawField.paramName || paramKey),
|
|
1992
|
+
componentType: String(field.componentType || 'WebHookTrigger'),
|
|
1993
|
+
dimension: String(field.dimension || rawField.dimension || 'field'),
|
|
1994
|
+
tablePrimaryKey,
|
|
1995
|
+
tableName: String(field.tableName || rawField.tableName || tablePrimaryKey),
|
|
1996
|
+
tableKey: String(field.tableKey || field.contextGroup || tablePrimaryKey),
|
|
1997
|
+
parentName: String(field.parentName || rawField.parentName || ''),
|
|
1998
|
+
paramKey,
|
|
1999
|
+
multKey: String(field.multKey || rawField.multKey || ''),
|
|
2000
|
+
multName: String(field.multName || rawField.multName || ''),
|
|
2001
|
+
isMultCom: Boolean(field.isMultCom ?? rawField.isMultCom),
|
|
2002
|
+
parentComId: String(field.parentComId || rawField.parentComId || ''),
|
|
2003
|
+
comId: String(field.comId || rawField.comId || ''),
|
|
2004
|
+
rawField: { ...rawField },
|
|
2005
|
+
};
|
|
2006
|
+
};
|
|
2007
|
+
const labelOf = (field, fallback) => String(field?.label || field?.showName || field?.paramName || field?.raw?.showName || field?.raw?.paramName || fallback);
|
|
2008
|
+
const enrichTarget = (sourceKey, target) => {
|
|
2009
|
+
const requestedKey = target && typeof target === 'object' && !Array.isArray(target)
|
|
2010
|
+
? String(target.paramKey || target.key || sourceKey)
|
|
2011
|
+
: String(sourceKey);
|
|
2012
|
+
const field = findField(requestedKey);
|
|
2013
|
+
const label = labelOf(field, requestedKey);
|
|
2014
|
+
if (target && typeof target === 'object' && !Array.isArray(target)) {
|
|
2015
|
+
const declaredKind = String(target.kind || target.assignmentKind || 'context');
|
|
2016
|
+
if (declaredKind !== 'query_result') {
|
|
2017
|
+
target.paramKey ??= requestedKey;
|
|
2018
|
+
target.label ??= label;
|
|
2019
|
+
if (!target._resolvedContext && field) {
|
|
2020
|
+
const resolved = resolvedContext(field);
|
|
2021
|
+
if (resolved)
|
|
2022
|
+
target._resolvedContext = resolved;
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
return target;
|
|
2026
|
+
}
|
|
2027
|
+
if (!field)
|
|
2028
|
+
return target;
|
|
2029
|
+
const normalized = { target: String(target), paramKey: requestedKey, label };
|
|
2030
|
+
const resolved = resolvedContext(field);
|
|
2031
|
+
if (resolved)
|
|
2032
|
+
normalized._resolvedContext = resolved;
|
|
2033
|
+
return normalized;
|
|
2034
|
+
};
|
|
1800
2035
|
const hydrate = (steps) => {
|
|
1801
2036
|
for (const step of steps || []) {
|
|
1802
2037
|
if (!step || typeof step !== 'object')
|
|
@@ -1805,16 +2040,7 @@ export function hydrateMappingLabels(plan, eventContextFields) {
|
|
|
1805
2040
|
const mapping = params && typeof params === 'object' ? params.mapping : null;
|
|
1806
2041
|
if (mapping && typeof mapping === 'object') {
|
|
1807
2042
|
for (const [sourceKey, target] of Object.entries(mapping)) {
|
|
1808
|
-
|
|
1809
|
-
if (!label)
|
|
1810
|
-
continue;
|
|
1811
|
-
if (target && typeof target === 'object') {
|
|
1812
|
-
target.paramKey ??= String(sourceKey);
|
|
1813
|
-
target.label ??= label;
|
|
1814
|
-
}
|
|
1815
|
-
else {
|
|
1816
|
-
mapping[sourceKey] = { target: String(target), paramKey: String(sourceKey), label };
|
|
1817
|
-
}
|
|
2043
|
+
mapping[sourceKey] = enrichTarget(String(sourceKey), target);
|
|
1818
2044
|
}
|
|
1819
2045
|
}
|
|
1820
2046
|
if (params && typeof params === 'object') {
|
|
@@ -1822,17 +2048,7 @@ export function hydrateMappingLabels(plan, eventContextFields) {
|
|
|
1822
2048
|
if (!detail || typeof detail !== 'object' || typeof detail.mapping !== 'object')
|
|
1823
2049
|
continue;
|
|
1824
2050
|
for (const [sourceKey, target] of Object.entries(detail.mapping)) {
|
|
1825
|
-
|
|
1826
|
-
const label = labelByParamKey[sourceParamKey] || '';
|
|
1827
|
-
if (!label)
|
|
1828
|
-
continue;
|
|
1829
|
-
if (target && typeof target === 'object') {
|
|
1830
|
-
target.paramKey ??= sourceParamKey;
|
|
1831
|
-
target.label ??= label;
|
|
1832
|
-
}
|
|
1833
|
-
else {
|
|
1834
|
-
detail.mapping[sourceKey] = { target: String(target), paramKey: sourceParamKey, label };
|
|
1835
|
-
}
|
|
2051
|
+
detail.mapping[sourceKey] = enrichTarget(String(sourceKey), target);
|
|
1836
2052
|
}
|
|
1837
2053
|
}
|
|
1838
2054
|
}
|
|
@@ -1976,6 +2192,79 @@ export function syncQueryFieldsToDraft(draft, plan) {
|
|
|
1976
2192
|
for (let i = 0; i < pa.length && i < da.length; i++)
|
|
1977
2193
|
syncStep(pa[i], da[i]);
|
|
1978
2194
|
}
|
|
2195
|
+
/**
|
|
2196
|
+
* 收集计划里明确引用到指定数据源的输出字段。
|
|
2197
|
+
* 字段 ID 只从 context/query_result 引用对象读取,随后必须和实时字段接口结果匹配;
|
|
2198
|
+
* 不从展示名或 paramKey 尾段单独推导新字段。
|
|
2199
|
+
*/
|
|
2200
|
+
function referencedDataSourceFieldIds(plan, sourceStep, sourceId) {
|
|
2201
|
+
const ids = new Set();
|
|
2202
|
+
const componentType = String(sourceStep.type || '');
|
|
2203
|
+
const sourceRefs = new Set([sourceStep.ref, sourceStep.id, sourceStep.nodeId]
|
|
2204
|
+
.map((value) => String(value || '').trim()).filter(Boolean));
|
|
2205
|
+
const pending = [plan.actions || [], plan.event || {}];
|
|
2206
|
+
const seen = new WeakSet();
|
|
2207
|
+
while (pending.length) {
|
|
2208
|
+
const value = pending.pop();
|
|
2209
|
+
if (!value || typeof value !== 'object')
|
|
2210
|
+
continue;
|
|
2211
|
+
if (seen.has(value))
|
|
2212
|
+
continue;
|
|
2213
|
+
seen.add(value);
|
|
2214
|
+
if (Array.isArray(value)) {
|
|
2215
|
+
pending.push(...value);
|
|
2216
|
+
continue;
|
|
2217
|
+
}
|
|
2218
|
+
const kind = String(value.kind || value.assignmentKind || value.type || '').toLowerCase();
|
|
2219
|
+
if (kind === 'query_result') {
|
|
2220
|
+
const source = String(value.source || value.sourceRef || '').trim();
|
|
2221
|
+
const formId = String(value.formId || '').trim();
|
|
2222
|
+
if ((source && sourceRefs.has(source)) || (!source && formId === sourceId)) {
|
|
2223
|
+
const fieldId = String(value.fieldId || '').trim();
|
|
2224
|
+
if (fieldId) {
|
|
2225
|
+
// 分组查询的输出别名由 EnquiryForm.groupMessage 的真实配置决定;
|
|
2226
|
+
// 将别名反向映射到该配置中的源字段,确保源字段也进入 queryFields。
|
|
2227
|
+
const groupMessage = Array.isArray(sourceStep.params?.groupMessage) ? sourceStep.params.groupMessage : [];
|
|
2228
|
+
let isAggregateAlias = false;
|
|
2229
|
+
for (const item of groupMessage) {
|
|
2230
|
+
const field = String(item?.field || '').trim();
|
|
2231
|
+
const aggregator = String(item?.aggregator || '').trim().toLowerCase();
|
|
2232
|
+
if (field && aggregator && fieldId === `s_${aggregator}_${field}`) {
|
|
2233
|
+
ids.add(field);
|
|
2234
|
+
isAggregateAlias = true;
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
if (!isAggregateAlias)
|
|
2238
|
+
ids.add(fieldId);
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
if (kind === 'context' || kind === 'platform_context') {
|
|
2243
|
+
const key = String(value.paramKey || value.key || '').trim();
|
|
2244
|
+
if (componentType === 'DateTrigger' && key.startsWith('dataResponse.')) {
|
|
2245
|
+
const fieldId = key.slice('dataResponse.'.length).split(/[.\[\]]/)[0].trim();
|
|
2246
|
+
if (fieldId)
|
|
2247
|
+
ids.add(fieldId);
|
|
2248
|
+
}
|
|
2249
|
+
else if (sourceId) {
|
|
2250
|
+
const roots = [`${sourceId}.`, `FormData.${sourceId}.`, `FormData.${sourceId}[`, `SelectParams.${sourceId}.`];
|
|
2251
|
+
const root = roots.find((candidate) => key.startsWith(candidate));
|
|
2252
|
+
if (root) {
|
|
2253
|
+
const suffix = key.slice(root.length).split(/[.\[\]]/).filter(Boolean);
|
|
2254
|
+
const fieldId = suffix[suffix.length - 1] || '';
|
|
2255
|
+
if (fieldId)
|
|
2256
|
+
ids.add(fieldId);
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
pending.push(...Object.values(value));
|
|
2261
|
+
}
|
|
2262
|
+
return [...ids];
|
|
2263
|
+
}
|
|
2264
|
+
function canonicalQueryFieldId(value) {
|
|
2265
|
+
const id = String(value || '').trim();
|
|
2266
|
+
return id.startsWith('field_') ? id.slice('field_'.length) : id;
|
|
2267
|
+
}
|
|
1979
2268
|
/**
|
|
1980
2269
|
* 归一化 showDataSourceFields 的返回值。
|
|
1981
2270
|
*
|
|
@@ -2144,7 +2433,7 @@ export function syncBizFieldsToDraft(draft, plan) {
|
|
|
2144
2433
|
const pa = planActions[i], da = draftActions[i];
|
|
2145
2434
|
if (!pa || !da || typeof pa !== 'object' || typeof da !== 'object')
|
|
2146
2435
|
continue;
|
|
2147
|
-
if (
|
|
2436
|
+
if (!['ApproveCreate', 'ApproveSave', 'ApproveCommit', 'ApproveSendBack'].includes(String(pa.type)))
|
|
2148
2437
|
continue;
|
|
2149
2438
|
const pp = pa.params;
|
|
2150
2439
|
if (!pp || typeof pp !== 'object' || !pp._bizFields)
|
|
@@ -2332,6 +2621,7 @@ export async function preflightContext(plan, appId, client) {
|
|
|
2332
2621
|
return { valid: false, errors: ['event must be an object'], contextStore: {} };
|
|
2333
2622
|
}
|
|
2334
2623
|
await fillRequiredTriggerOperator(plan, client);
|
|
2624
|
+
await resolveApproveCreateClassifiedProtection(plan, client, errors, warnings);
|
|
2335
2625
|
await resolveFixedPeople(plan, client);
|
|
2336
2626
|
try {
|
|
2337
2627
|
await resolveFixedWorkflowInstances(plan, client);
|
|
@@ -2387,7 +2677,7 @@ export async function preflightContext(plan, appId, client) {
|
|
|
2387
2677
|
// 忽略
|
|
2388
2678
|
}
|
|
2389
2679
|
// EventButton 的 targetForm 可能只提供表单 id;先完成 targetForm 的实时归属回填,
|
|
2390
|
-
// 再按前端
|
|
2680
|
+
// 再按前端 ebuilderButton 浏览器校验真实按钮以及 before 能力。
|
|
2391
2681
|
try {
|
|
2392
2682
|
const buttonResources = await resolveEventButtonSelection(plan, client);
|
|
2393
2683
|
if (buttonResources.length)
|
|
@@ -2405,11 +2695,16 @@ export async function preflightContext(plan, appId, client) {
|
|
|
2405
2695
|
const tf = stepFormRef(step);
|
|
2406
2696
|
if (tf && tf.id) {
|
|
2407
2697
|
const formId = String(tf.id);
|
|
2408
|
-
//
|
|
2409
|
-
//
|
|
2410
|
-
|
|
2698
|
+
// 删除表单数据、更新表单数据的条件编辑器,以及数据源查询/定时触发
|
|
2699
|
+
// 组件都绑定 dataSource 字段选择器;条件左值必须和前端一样来自
|
|
2700
|
+
// /api/ebuilder/common/ds/fields,不能回退到 getEbField。
|
|
2701
|
+
const isActionEbUpdateCondition = step.type === 'ActionEbUpdate'
|
|
2702
|
+
&& String((step.params || {}).opType || 'updateData') === 'updateData';
|
|
2703
|
+
const strictConditionSource = [
|
|
2704
|
+
'ActionEbDelete', 'EnquiryForm', 'TimeBatchTrigger', 'DateTrigger',
|
|
2705
|
+
].includes(step.type) || isActionEbUpdateCondition;
|
|
2411
2706
|
const sourceProtocol = formSource.actionflowDataSourceProtocol(tf);
|
|
2412
|
-
//
|
|
2707
|
+
// 严格条件来源的字段不是普通 EB 表单字段:
|
|
2413
2708
|
// 它们必须来自 /api/ebuilder/common/ds/fields,不能先调用 getEbField。
|
|
2414
2709
|
let fields = strictConditionSource ? [] : await getFormFieldsFull(formId, client, tf);
|
|
2415
2710
|
if (!strictConditionSource)
|
|
@@ -2418,7 +2713,7 @@ export async function preflightContext(plan, appId, client) {
|
|
|
2418
2713
|
// 查询组件偶尔会只保留系统字段,筛选编辑器因此把业务字段标成“已删除”。
|
|
2419
2714
|
const params = step.params && typeof step.params === 'object' ? step.params : (step.params = {});
|
|
2420
2715
|
if (['ActionEbDelete', 'EnquiryForm', 'TimeBatchTrigger', 'DateTrigger'].includes(step.type)
|
|
2421
|
-
|| (step.type === 'ActionEbUpdate' &&
|
|
2716
|
+
|| (step.type === 'ActionEbUpdate' && String(params.opType || 'updateData') === 'updateData')) {
|
|
2422
2717
|
// EnquiryForm/条件更新的筛选条件左值必须来自数据源字段选择器,
|
|
2423
2718
|
// 而不是只用 getEbField 的表单字段对象。后者经常缺少数据源侧的
|
|
2424
2719
|
// name/formInfo/sformId,会导致设计器把条件字段显示为“已删除”
|
|
@@ -2528,20 +2823,30 @@ export async function preflightContext(plan, appId, client) {
|
|
|
2528
2823
|
if (!id)
|
|
2529
2824
|
continue;
|
|
2530
2825
|
byId.set(id, field);
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2826
|
+
const canonicalId = canonicalQueryFieldId(id);
|
|
2827
|
+
if (!byId.has(canonicalId))
|
|
2828
|
+
byId.set(canonicalId, field);
|
|
2534
2829
|
}
|
|
2535
2830
|
const requested = Array.isArray(params.queryFields) && params.queryFields.length ? params.queryFields : null;
|
|
2536
2831
|
if (requested) {
|
|
2537
|
-
params.queryFields = requested.map((field) => {
|
|
2538
|
-
const
|
|
2539
|
-
|
|
2540
|
-
|
|
2832
|
+
params.queryFields = requested.map((field, fieldIndex) => {
|
|
2833
|
+
const requestedId = String(field?.id || '');
|
|
2834
|
+
const live = byId.get(requestedId) || byId.get(canonicalQueryFieldId(requestedId));
|
|
2835
|
+
if (!live) {
|
|
2836
|
+
errors.push(`${step.type}.queryFields[${fieldIndex}].id='${requestedId}' 未匹配到 showDataSourceFields 返回的真实字段。`);
|
|
2837
|
+
return null;
|
|
2838
|
+
}
|
|
2839
|
+
// 平台返回的完整字段对象是权威值;plan 只保留显式选择,不得用简写 DTO 覆盖元数据。
|
|
2840
|
+
return { ...field, ...live, id: String(live.id) };
|
|
2841
|
+
}).filter(Boolean);
|
|
2541
2842
|
}
|
|
2542
2843
|
else if (selectable.length) {
|
|
2543
2844
|
params.queryFields = selectable;
|
|
2544
2845
|
}
|
|
2846
|
+
else if (['EnquiryForm', 'TimeBatchTrigger', 'DateTrigger'].includes(step.type)) {
|
|
2847
|
+
params.queryFields = [];
|
|
2848
|
+
errors.push(`${step.type}.queryFields: showDataSourceFields 未返回可选字段,拒绝用其他字段接口或本地默认值拼造输出字段。`);
|
|
2849
|
+
}
|
|
2545
2850
|
else {
|
|
2546
2851
|
const mainFields = fields
|
|
2547
2852
|
.filter((field) => String(field.subFormId ?? '-1') === '-1')
|
|
@@ -2556,6 +2861,23 @@ export async function preflightContext(plan, appId, client) {
|
|
|
2556
2861
|
return true;
|
|
2557
2862
|
});
|
|
2558
2863
|
}
|
|
2864
|
+
// queryFields 不只是展示配置:getComponentContext 会据此裁剪运行时上下文。
|
|
2865
|
+
// 把后续动态映射明确引用的字段并入查询集,并要求它们能在当前租户字段接口中命中。
|
|
2866
|
+
const requiredFieldIds = referencedDataSourceFieldIds(plan, step, formId);
|
|
2867
|
+
const queryFields = Array.isArray(params.queryFields) ? params.queryFields : (params.queryFields = []);
|
|
2868
|
+
const selectedIds = new Set(queryFields.map((field) => canonicalQueryFieldId(field?.id)));
|
|
2869
|
+
for (const requiredId of requiredFieldIds) {
|
|
2870
|
+
const live = byId.get(requiredId) || byId.get(canonicalQueryFieldId(requiredId));
|
|
2871
|
+
if (!live) {
|
|
2872
|
+
errors.push(`${step.type}.queryFields 缺少动态引用字段 '${requiredId}',且该字段未在当前 showDataSourceFields 返回结果中找到。`);
|
|
2873
|
+
continue;
|
|
2874
|
+
}
|
|
2875
|
+
const canonicalId = canonicalQueryFieldId(live.id);
|
|
2876
|
+
if (selectedIds.has(canonicalId))
|
|
2877
|
+
continue;
|
|
2878
|
+
queryFields.push({ ...live });
|
|
2879
|
+
selectedIds.add(canonicalId);
|
|
2880
|
+
}
|
|
2559
2881
|
}
|
|
2560
2882
|
}
|
|
2561
2883
|
}
|
|
@@ -2769,7 +3091,7 @@ export async function preflightContext(plan, appId, client) {
|
|
|
2769
3091
|
}
|
|
2770
3092
|
}
|
|
2771
3093
|
// 显式 mapping 补实时显示名
|
|
2772
|
-
hydrateMappingLabels(plan, eventContextFields);
|
|
3094
|
+
hydrateMappingLabels(plan, eventContextFields, eventContext);
|
|
2773
3095
|
hydrateWorkflowProvenanceMappings(plan, eventContextFields);
|
|
2774
3096
|
hydrateLoopCycleTimes(plan, eventContextFields);
|
|
2775
3097
|
// finalOutput 不属于 actions,但其 CustFormDetailDto.formulaValue 也可能
|
|
@@ -2783,6 +3105,18 @@ export async function preflightContext(plan, appId, client) {
|
|
|
2783
3105
|
// 逐节点查上下文 + ApproveCreate 目标字段
|
|
2784
3106
|
const walk = async (steps, branchStore, prefix) => {
|
|
2785
3107
|
for (const [index, step] of (steps || []).entries()) {
|
|
3108
|
+
// Output 是终止节点,不是可查询上下文的动作组件;分支里的 Output
|
|
3109
|
+
// 仍需把提醒内容中的上下文公式回填,但不能把它送到
|
|
3110
|
+
// getComponentContext,否则它没有 EventButton 上游元数据,会误报
|
|
3111
|
+
// triggerFlag 只能用于 EventButton。
|
|
3112
|
+
if (step?.type === 'Output') {
|
|
3113
|
+
const eventContextGroup = Object.values(branchStore.asDict()).find((value) => (value && typeof value === 'object' && value.type === 'context_group' && value.component));
|
|
3114
|
+
hydrateContextReferences([step], branchStore.asDict(), {
|
|
3115
|
+
id: 'event_1',
|
|
3116
|
+
type: String(eventContextGroup?.component || event.type || ''),
|
|
3117
|
+
});
|
|
3118
|
+
continue;
|
|
3119
|
+
}
|
|
2786
3120
|
const path = `${prefix}[${index}]`;
|
|
2787
3121
|
let result;
|
|
2788
3122
|
try {
|
|
@@ -2821,7 +3155,7 @@ export async function preflightContext(plan, appId, client) {
|
|
|
2821
3155
|
hydrateLoopSourceReferences(step, branchStore.asDict());
|
|
2822
3156
|
await walk(step.actions || [], new ContextStore(branchStore.asDict()), `${path}.actions`);
|
|
2823
3157
|
}
|
|
2824
|
-
else if (
|
|
3158
|
+
else if (['ApproveCreate', 'ApproveSave', 'ApproveCommit', 'ApproveSendBack'].includes(String(step.type))) {
|
|
2825
3159
|
await resolveBizCreateFields(step, plan, client, errors, path);
|
|
2826
3160
|
}
|
|
2827
3161
|
}
|