diff --git a/src/utils/flow.js b/src/utils/flow.js index 1df5bab..f76f4b1 100644 --- a/src/utils/flow.js +++ b/src/utils/flow.js @@ -13,45 +13,42 @@ export const getInput = (nodeId, isStrict = true) => { if (flag) { const arr = [] + const filterNodes = ['sleep', 'stopLoop', 'subEnd', 'subStart', 'branch', 'end'] data.nodes.forEach(item => { if (item.id === nodeId) { return } - if (item.properties.inputParams) { - const obj = { - value: item.id, - label: item.properties.name, - type: 'input', - children: [] - } - const optionData = transformTree(item.properties.inputParams, obj.children, 'input') - obj.children.push(optionData) - arr.push(obj) - } - if (item.properties.nodeParams) { - const obj = { - value: item.id, - label: item.properties.name + '(输入)', - type: 'input', - children: [] - } - const optionData = transformTree(item.properties.nodeParams, obj.children, 'input') - obj.children.push(optionData) - arr.push(obj) + if (filterNodes.includes(item.type)) { + return } - if (item.properties.outputParams) { - const obj = { + const obj = { value: item.id, - label: item.properties.name + '(输出)', - type: 'output', - children: [] + label: item.properties.name, + children: [{ + value: 'input', + label: '输入', + type: 'input', + children: [] + }, { + value: 'output', + label: '输出', + type: 'output', + children: [] + }] } - const optionData = transformTree(item.properties.outputParams, obj.children, 'output') - obj.children.push(optionData) - arr.push(obj) + + if (item.properties.inputParams) { + transformTree(item.properties.inputParams, obj.children[0].children, 'input') } + if (item.properties.nodeParams) { + transformTree(item.properties.nodeParams, obj.children[0].children, 'input') + } + if (item.properties.outputParams) { + transformTree(item.properties.outputParams, obj.children[1].children, 'output') + } + arr.push(obj) }) return arr } diff --git a/src/views/flow/components/TestRun.vue b/src/views/flow/components/TestRun.vue index fc3dbab..02cd342 100644 --- a/src/views/flow/components/TestRun.vue +++ b/src/views/flow/components/TestRun.vue @@ -1,143 +1,143 @@ - - \ No newline at end of file diff --git a/src/views/flow/config.js b/src/views/flow/config.js index eef8b4d..38e98f2 100644 --- a/src/views/flow/config.js +++ b/src/views/flow/config.js @@ -19,11 +19,6 @@ import audioSvg from './icon/audio.svg' import { v4 as randomUUID } from 'uuid' -import { useFlowStore } from "@/store/modules/flow"; - -const flowStore = useFlowStore(); - - export const lfConfig = { idGenerator: () => { // 生成标准UUID并移除连字符 @@ -308,7 +303,7 @@ export const collapseList = [ name: "单次对话语料", type: "serviceNode", desc: "测试语料-单次对话语料处理", - action: 'VI_CORPUS_WAKE', + action: 'VI_CORPUS_SINGLE', outputType: 'json', nodeParams: [{ name: 'testCorpus', type: "input", input: "", disabled: true }], outputParams: [{ name: 'audioPath', type: 'string', desc: '语音路径', disabled: true}] diff --git a/src/views/flow/nodes/common/serviceNode.vue b/src/views/flow/nodes/common/serviceNode.vue index 84ad000..dab8b6c 100644 --- a/src/views/flow/nodes/common/serviceNode.vue +++ b/src/views/flow/nodes/common/serviceNode.vue @@ -93,9 +93,10 @@ @@ -217,7 +218,6 @@ const setNodeProperties = async () => { if (result && flag) { const data = toRaw(formData); - console.log('data', data) const properties = lf.getProperties(props.model.id); lf.setProperties(props.model.id, { ...properties, @@ -234,11 +234,28 @@ const nodeOperatingStatus = ref("NORMAL"); const inputJsonData = ref({}); const outputJsonData = ref({}); -const visibleChange = (value) => { +const visibleChange = (value, index, quote) => { if (value) { const option = getInput(props.model.id); if (option) { quoteOptions.value = option; + const currentValue = [...quote]; + // 强制级联选择器重新处理选中值与选项的匹配 + if (cascaderRefs.value[index]) { + // 等待DOM更新后再设置值,确保新options已生效 + setTimeout(() => { + // 如果当前有选中值,重新设置一次以触发重新匹配 + if (currentValue.length) { + formData.nodeParams[index].quote = []; + // 确保响应式更新 + setTimeout(() => { + formData.nodeParams[index].quote = currentValue; + }, 0); + } + // 手动触发级联选择器的重新渲染 + // cascaderRefs.value[index].updatePopper(); + }, 0); + } } } }; diff --git a/src/views/flow/nodes/function/loop.vue b/src/views/flow/nodes/function/loop.vue index 9510cf5..75da23c 100644 --- a/src/views/flow/nodes/function/loop.vue +++ b/src/views/flow/nodes/function/loop.vue @@ -1,55 +1,115 @@ \ No newline at end of file +