修复首页对话回显中贴片模板未恢复的问题
贴片模板提交时写入 patchLayout 节点的内部 templates 字段并删除顶层, 回显恢复逻辑仅从顶层读取导致模板丢失;现优先从 nodeInputParams 中 patchLayout 节点的 templates 恢复,顶层旧位置作为兼容兜底。 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -400,8 +400,15 @@ watch(
|
||||
Object.keys(formFileNames).forEach((key) => delete formFileNames[key]);
|
||||
Object.keys(uploadingFields).forEach((key) => delete uploadingFields[key]);
|
||||
// 尝试从执行详情恢复贴片模板
|
||||
// 提交路径:templates 写入开启贴片布局的节点内部(patchLayout === true 的 node.templates),顶层已删除;
|
||||
// 回显时 detail.nodeInputParams 即提交时的 nodes,从该处优先恢复;兼容旧数据(extension / detail / flowContent 顶层)
|
||||
const patchNodes = Array.isArray(detail?.nodeInputParams)
|
||||
? (detail.nodeInputParams as any[]).filter((n: any) => n.patchLayout === true && Array.isArray(n.templates))
|
||||
: [];
|
||||
const nodeTemplates = patchNodes[0]?.templates;
|
||||
const ext = (detail as any)?.extension;
|
||||
const restoredTemplates = ext?.templates || (detail as any)?.templates || detail?.flowContent?.templates || [];
|
||||
const restoredTemplates =
|
||||
nodeTemplates || ext?.templates || (detail as any)?.templates || detail?.flowContent?.templates || [];
|
||||
templates.value = Array.isArray(restoredTemplates) ? restoredTemplates : [];
|
||||
|
||||
if (!detail?.nodeInputParams) return;
|
||||
|
||||
Reference in New Issue
Block a user