恢复贴片相关

This commit is contained in:
2026-07-06 16:49:06 +08:00
parent 4391189e0c
commit cce0bc6448
4 changed files with 28 additions and 17 deletions
+23 -13
View File
@@ -412,6 +412,12 @@
</template>
</template>
<el-empty v-else description="暂无表单配置" :image-size="80" />
<!-- 贴片模板编辑器(工作流包含贴片节点时显示) -->
<PatchTemplateEditor
v-if="currentWorkflowHasPatchLayout"
v-model="templates"
/>
</el-form>
</div>
</div>
@@ -1092,6 +1098,22 @@ const currentNodePatchLayout = computed(() => {
});
return patchLayout;
});
// 判断当前工作流是否包含支持贴片布局的节点
const currentWorkflowHasPatchLayout = computed(() => {
const nodes = currentWorkflowForCreation.value?.nodeInputParams || [];
if (!nodes.length || !nodeLibraryGroups.value.length) return false;
return nodes.some((node: any) => {
if (!node.nodeCode) return false;
for (const group of nodeLibraryGroups.value) {
for (const item of group.items || []) {
if (item.nodeCode === node.nodeCode && item.patchLayout) {
return true;
}
}
}
return false;
});
});
// 获取当前节点的模型类型
const currentNodeModelType = computed(() => {
const currentNodeCode = String(formState.nodeCode || '').trim();
@@ -1363,7 +1385,6 @@ const workflowDsl = computed(() => ({
outputConfig: Array.isArray(n.properties?.outputConfig) ? n.properties.outputConfig : null,
isSaveFile: n.properties?.isSaveFileEnabled ?? null,
patchLayout: n.properties?.patchLayoutEnabled ?? null,
templates: n.properties?.templates ?? null,
promptContent: n.properties?.promptContent || '',
outputResult: null,
})),
@@ -2214,6 +2235,7 @@ const sendMessage = async () => {
flowName: currentWorkflowForCreation.value.flowName || currentWorkflowForCreation.value.flowTemplateName, // 工作流名称
fileUrl: fileUrls, // 添加文件 URL 数组
resultUrl: currentWorkflowForCreation.value.resultUrl || '', // 添加结果节点 URL
templates: templates.value,
};
// 5. 调用执行接口(不再使用 FormData,直接传 JSON
@@ -3474,8 +3496,6 @@ watch(
// 恢复贴片布局状态
patchLayoutEnabled.value = e?.properties?.patchLayoutEnabled === true;
// 恢复贴片模板数据
templates.value = e?.properties?.templates || [];
// 初始化所有表单字段(基础 + 模型)- 只设置还没有值的字段
allFormFields.value.forEach((fieldItem) => {
@@ -3560,7 +3580,6 @@ const applySelected = () => {
'promptContent',
'isSaveFileEnabled',
patchLayoutEnabled,
templates,
'width',
'height',
];
@@ -3628,12 +3647,6 @@ const applySelected = () => {
// 保存贴片布局状态
p.patchLayoutEnabled = patchLayoutEnabled.value;
// 保存贴片模板数据
if (templates.value.length > 0) {
p.templates = templates.value;
} else {
delete p.templates;
}
// 不再保存基础字段到根级别,所有字段都通过 formConfig 保存
@@ -4060,7 +4073,6 @@ const loadWorkflowFromDsl = (dsl: any) => {
// 加载提示词和保存文件配置
isSaveFileEnabled: n.isSaveFile ?? false,
patchLayoutEnabled: n.patchLayout ?? false,
templates: n.templates || [],
promptContent: n.promptContent || '',
},
};
@@ -4123,7 +4135,6 @@ watch(selectedElement, (newElement) => {
patchLayoutEnabled.value = newElement.properties.patchLayoutEnabled === true;
// 从节点属性中恢复贴片模板数据
templates.value = newElement.properties.templates || [];
} else {
// 如果不是节点或没有选中元素,清空状态
selectedModel.value = '';
@@ -4132,7 +4143,6 @@ watch(selectedElement, (newElement) => {
promptContent.value = '';
isSaveFileEnabled.value = false;
patchLayoutEnabled.value = false;
templates.value = [];
}
});