视频贴片相关
This commit is contained in:
@@ -408,6 +408,12 @@
|
||||
</template>
|
||||
</template>
|
||||
<el-empty v-else description="暂无表单配置" :image-size="80" />
|
||||
|
||||
<!-- 贴片模板编辑器(工作流包含贴片节点时显示) -->
|
||||
<PatchTemplateEditor
|
||||
v-if="currentWorkflowHasPatchLayout"
|
||||
v-model="templates"
|
||||
/>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -825,6 +831,7 @@ import SkillSelector from '/@/components/skill/NodeSkillSelector.vue';
|
||||
import ModelSelector from '/@/components/model/ModelSelector.vue';
|
||||
import SaveWorkflowDialog from './component/SaveWorkflowDialog.vue';
|
||||
import PromptSelector from './component/PromptSelector.vue';
|
||||
import PatchTemplateEditor from '/@/components/patchTemplate/PatchTemplateEditor.vue';
|
||||
import type { SkillItem } from '/@/api/settings/skill';
|
||||
import {
|
||||
downloadToFile,
|
||||
@@ -894,6 +901,7 @@ const selectedSkill = ref<SkillItem | null>(null);
|
||||
const showPromptSelector = ref(false);
|
||||
const promptContent = ref('');
|
||||
const isSaveFileEnabled = ref(false);
|
||||
const templates = ref<any[]>([]);
|
||||
const saving = ref(false);
|
||||
const leftPanelTab = ref('selected'); // 默认显示"当前选中"Tab
|
||||
const saveDialogVisible = ref(false);
|
||||
@@ -1073,6 +1081,22 @@ const currentNodeisSaveFile = computed(() => {
|
||||
});
|
||||
return isSaveFile;
|
||||
});
|
||||
// 判断当前工作流是否包含支持贴片布局的节点
|
||||
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();
|
||||
@@ -2193,6 +2217,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)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<script></script>
|
||||
@@ -30,6 +30,14 @@
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 贴片布局开关 -->
|
||||
<el-form-item v-if="nodeConfig?.patchLayout" label="贴片布局">
|
||||
<el-switch
|
||||
:model-value="selectedNode.data?.patchLayout ?? false"
|
||||
@update:model-value="emit('update:patchLayout', $event)"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 动态表单字段 -->
|
||||
<template v-if="nodeConfig?.formConfig && nodeConfig.formConfig.length > 0">
|
||||
<el-divider content-position="left">节点参数</el-divider>
|
||||
@@ -104,6 +112,7 @@ interface NodeData {
|
||||
formConfig?: any[];
|
||||
modelConfig?: any;
|
||||
skillName?: string;
|
||||
patchLayout?: boolean;
|
||||
}
|
||||
|
||||
interface ParamRef {
|
||||
@@ -115,6 +124,7 @@ interface NodeConfig {
|
||||
formConfig: any[];
|
||||
modelConfig: any[];
|
||||
skillOption: boolean;
|
||||
patchLayout: boolean;
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -135,6 +145,7 @@ const emit = defineEmits<{
|
||||
(e: 'removeField', nodeId: string, fieldName: string): void;
|
||||
(e: 'toggleOutput', nodeId: string, enabled: boolean): void;
|
||||
(e: 'addParamByValue', paramValue: string): void;
|
||||
(e: 'update:patchLayout', value: boolean): void;
|
||||
}>();
|
||||
|
||||
const updateNodeLabel = (newLabel: string) => {
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
@remove-field="handleRemoveField"
|
||||
@toggle-output="handleToggleOutput"
|
||||
@add-param-by-value="handleAddParamByValue"
|
||||
@update:patch-layout="handleTogglePatchLayout"
|
||||
/>
|
||||
|
||||
<!-- 中间:VueFlow 画布(节点库在画布内) -->
|
||||
@@ -119,6 +120,7 @@ interface NodeData {
|
||||
formConfig?: any[];
|
||||
modelConfig?: any;
|
||||
skillName?: string;
|
||||
patchLayout?: boolean;
|
||||
}
|
||||
|
||||
interface ParamRef {
|
||||
@@ -142,13 +144,14 @@ const filteredNodeLibraryGroups = computed(() => {
|
||||
|
||||
// 节点配置映射:nodeCode -> 节点配置
|
||||
const nodeConfigMap = computed(() => {
|
||||
const map = new Map<string, { formConfig: any[]; modelConfig: any[]; skillOption: boolean }>();
|
||||
const map = new Map<string, { formConfig: any[]; modelConfig: any[]; skillOption: boolean; patchLayout: boolean }>();
|
||||
nodeLibraryGroups.value.forEach((group) => {
|
||||
group.items.forEach((item) => {
|
||||
map.set(item.nodeCode, {
|
||||
formConfig: item.formConfig || [],
|
||||
modelConfig: item.modelConfig || [],
|
||||
skillOption: item.skillOption || false,
|
||||
patchLayout: item.patchLayout || false,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -436,6 +439,27 @@ const handleRemoveSkill = () => {
|
||||
ElMessage.success('技能已移除');
|
||||
};
|
||||
|
||||
// 切换贴片布局
|
||||
const handleTogglePatchLayout = (value: boolean) => {
|
||||
if (!selectedNode.value?.data) return;
|
||||
|
||||
const updatedNode: Node<NodeData> = {
|
||||
...selectedNode.value,
|
||||
data: {
|
||||
...selectedNode.value.data,
|
||||
patchLayout: value,
|
||||
},
|
||||
};
|
||||
|
||||
selectedNode.value = updatedNode;
|
||||
// 同步更新到 VueFlow 内部状态
|
||||
updateNode(updatedNode.id, updatedNode);
|
||||
const index = nodes.value.findIndex((n) => n.id === updatedNode.id);
|
||||
if (index >= 0) {
|
||||
nodes.value[index] = updatedNode;
|
||||
}
|
||||
};
|
||||
|
||||
// 删除上级参数字段
|
||||
const handleRemoveField = (nodeId: string, fieldName: string) => {
|
||||
if (!selectedNode.value?.data) return;
|
||||
@@ -662,7 +686,7 @@ const addNodeFromLibrary = (nodeCode: string, nodeName: string) => {
|
||||
id: `node-${++nodeId}`,
|
||||
type: 'default',
|
||||
position: { x: spawnX, y: spawnY },
|
||||
data: { label: nodeName, nodeCode, inputSource: null },
|
||||
data: { label: nodeName, nodeCode, inputSource: null, patchLayout: false },
|
||||
style: { background: '#fff', border: '2px solid #3b82f6', borderRadius: '8px', padding: '10px 20px' },
|
||||
},
|
||||
]);
|
||||
@@ -761,6 +785,7 @@ const loadWorkflowFromDsl = (dsl: any) => {
|
||||
formConfig: n.formConfig || null,
|
||||
modelConfig: n.modelConfig || null,
|
||||
skillName: n.skillName || null,
|
||||
patchLayout: n.patchLayout || false,
|
||||
},
|
||||
style: { background: '#fff', border: '2px solid #3b82f6', borderRadius: '8px', padding: '10px 20px' },
|
||||
};
|
||||
@@ -824,6 +849,7 @@ const confirmSaveWorkflow = async () => {
|
||||
name: n.data?.label || '',
|
||||
type: n.type || 'default',
|
||||
skillName: n.data?.skillName || null,
|
||||
patchLayout: n.data?.patchLayout || false,
|
||||
config: {
|
||||
nodeCode: n.data?.nodeCode || 'unknown',
|
||||
x: n.position?.x || 0,
|
||||
|
||||
Reference in New Issue
Block a user