非子流程节点表单展示补 valueSource,修复子流程生成次数回显
- http/form/其它 presetOption 节点勾选表单展示的字段保存时补 valueSource={nodeId:开始节点id, fieldName},与子流程契约统一
- model 节点勾选字段按 path 补 valueSource,回显时清除指向开始节点的引用防误删
- 修复 sub_flow 节点 outputConfig 为空时参数面板(含生成次数)无法回显:回显逻辑改为节点库有 presetOption 定义即构建参数,值从开始节点运行表单反查
This commit is contained in:
@@ -232,13 +232,31 @@ export function collectExposedFields(params: any, prefix = ''): ExposedField[] {
|
||||
}
|
||||
|
||||
// 按暴露清单的 path 反解,把对应叶子 def 的 runtimeShow 置 true(加载时还原勾选)
|
||||
export function restoreRuntimeShow(params: any, fields: ExposedField[] | null | undefined): void {
|
||||
// startNodeId:勾选「表单展示」的字段保存时带 valueSource 指向开始节点(后端契约);
|
||||
// 回显时该 valueSource 无编辑器引用语义,清除避免 ModelField 误判引用/误删
|
||||
export function restoreRuntimeShow(params: any, fields: ExposedField[] | null | undefined, startNodeId = ''): void {
|
||||
if (!params || typeof params !== 'object' || !Array.isArray(fields) || fields.length === 0) return;
|
||||
for (const f of fields) {
|
||||
if (!f || typeof f.path !== 'string') continue;
|
||||
const cur = resolvePath(params, f.path);
|
||||
if (cur && typeof cur === 'object' && !Array.isArray(cur)) {
|
||||
cur.runtimeShow = true;
|
||||
if (startNodeId && cur.valueSource && typeof cur.valueSource === 'object' && cur.valueSource.nodeId === startNodeId) {
|
||||
delete cur.valueSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 勾选「表单展示」的字段:保存前按后端契约补 valueSource={nodeId:开始节点id, fieldName:path},
|
||||
// 标记字段值来自主工作流开始节点(首页表单)。startNodeId 为空(无开始节点)时跳过。
|
||||
export function attachFormFieldValueSources(params: any, fields: ExposedField[] | null | undefined, startNodeId = ''): void {
|
||||
if (!params || typeof params !== 'object' || !Array.isArray(fields) || fields.length === 0 || !startNodeId) return;
|
||||
for (const f of fields) {
|
||||
if (!f || typeof f.path !== 'string') continue;
|
||||
const cur = resolvePath(params, f.path);
|
||||
if (cur && typeof cur === 'object' && !Array.isArray(cur)) {
|
||||
cur.valueSource = { nodeId: startNodeId, fieldName: f.path };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user