From 8c1820e1a60cae5316fee5a9a070bc080acbcaa1 Mon Sep 17 00:00:00 2001 From: zhanghao <774378400@qq.com> Date: Tue, 14 Apr 2026 17:22:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=8A=82=E7=82=B9=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/flow/components/NodeState.vue | 307 +++++++++--------- src/views/flow/components/ParamsDrawer.vue | 24 +- src/views/flow/config.js | 4 +- src/views/flow/nodes/common/serviceNode.vue | 6 +- src/views/flow/nodes/common/startNode.vue | 10 +- src/views/flow/nodes/function/codeNode.vue | 6 +- src/views/flow/nodes/function/currentLoop.vue | 10 +- src/views/flow/nodes/function/httpNode.vue | 8 +- src/views/flow/nodes/function/sleep.vue | 15 +- src/views/flow/nodes/function/switch.vue | 6 +- vite.config.js | 6 +- 11 files changed, 220 insertions(+), 182 deletions(-) diff --git a/src/views/flow/components/NodeState.vue b/src/views/flow/components/NodeState.vue index 6cc7929..572c702 100644 --- a/src/views/flow/components/NodeState.vue +++ b/src/views/flow/components/NodeState.vue @@ -1,151 +1,158 @@ - - - - - - - - - - - - {{ getStateText() }} - - {{ popoverVisible ? '隐藏结果' : '展示结果' }} - - - - - - - 输入 - - - - - - 输出 - - - - - - - - - - \ No newline at end of file diff --git a/src/views/flow/components/ParamsDrawer.vue b/src/views/flow/components/ParamsDrawer.vue index f4a2f9b..86831a9 100644 --- a/src/views/flow/components/ParamsDrawer.vue +++ b/src/views/flow/components/ParamsDrawer.vue @@ -889,7 +889,7 @@ @visible-change=" (visible) => visibleChange(visible, index, property.quote) " - @change="(value) => cascaderChange(value, index)" + @change="(value) => cascaderChange(value, index, 'httpBody')" /> @@ -955,6 +955,8 @@ const confirm = async () => { ElMessage.error('JSON中存在错误,请修正后再保存!'); return; } + } else { + } const nodeParams = [] nodeParams.push({ name: "config", type: "input", input: "", children: httpNodeData.value.config, disabled: true, required: true }) @@ -1065,6 +1067,9 @@ const addFormItem = (e, type) => { } else if (type === 'nodeParams' || type === 'outputParams') { obj.input = '' } + if (!formData[type]) { + formData[type] = []; + } formData[type].push(obj); }; @@ -1086,10 +1091,15 @@ const handleTypeChange = (index) => { }; const cascaderRefs = ref([]); -const cascaderChange = (value, index) => { +const cascaderChange = (value, index, type = 'default') => { const selectedOptions = cascaderRefs.value[index].getCheckedNodes(true); - formData.nodeParams[index].quote = value; - formData.nodeParams[index].quoteType = selectedOptions[0].data.type; + if (type === 'default') { + formData.nodeParams[index].quote = value; + formData.nodeParams[index].quoteType = selectedOptions[0].data.type; + } else { + formData.nodeParams.find(item => item.name === 'body').children.find(child => child.name === 'formData').children[index].quote = value; + formData.nodeParams.find(item => item.name === 'body').children.find(child => child.name === 'formData').children[index].quoteType = selectedOptions[0].data.type; + } }; const visibleChange = (value, index, quote) => { @@ -1240,8 +1250,14 @@ const httpNodeData = ref({ const addHttpNodeFormItem = (e, type) => { e.stopPropagation(); if (type === 'body') { + if (!httpNodeData.value.body.formData) { + httpNodeData.value.body.formData = []; + } httpNodeData.value.body.formData.push({ name: "", type: "input", input: ""}); } else { + if (!httpNodeData.value[type]) { + httpNodeData.value[type] = []; + } httpNodeData.value[type].push({ name: "", type: "input", input: ""}); } }; diff --git a/src/views/flow/config.js b/src/views/flow/config.js index ca410bc..f6d0b46 100644 --- a/src/views/flow/config.js +++ b/src/views/flow/config.js @@ -307,9 +307,7 @@ export const collapseList = [ { name: "body", type: "input", input: "", children: [ { name: 'bodyType', type: "input", input: "json", disabled: true }, { name: 'json', type: "input", input: '{}' }, - { name: 'formData', type: "input", input: "", children: [ - { name: "", type: "input", input: ""} - ]} + { name: 'formData', type: "input", input: "", children: []} ], required: true }, ], outputType: 'json', diff --git a/src/views/flow/nodes/common/serviceNode.vue b/src/views/flow/nodes/common/serviceNode.vue index 4038cec..0a29d39 100644 --- a/src/views/flow/nodes/common/serviceNode.vue +++ b/src/views/flow/nodes/common/serviceNode.vue @@ -1,6 +1,6 @@ - + @@ -73,6 +73,7 @@ const setNodeName = (name) => { } const nodeOperatingStatus = ref("NORMAL"); +const runtimes = ref(0); const inputJsonData = ref({}); const outputJsonData = ref({}); const errorInfoData = ref(''); @@ -82,6 +83,9 @@ onMounted(() => { emitter.on("changeNodeState", (data) => { if (data.nodeId === props.model.id) { nodeOperatingStatus.value = data.status; + if (data.endTime && data.startTime) { + runtimes.value = data.endTime - data.startTime; + } let inputData = {}; let output = {}; errorInfoData.value = data?.message || '' diff --git a/src/views/flow/nodes/common/startNode.vue b/src/views/flow/nodes/common/startNode.vue index 9b0ea6f..060382a 100644 --- a/src/views/flow/nodes/common/startNode.vue +++ b/src/views/flow/nodes/common/startNode.vue @@ -1,7 +1,7 @@ - + @@ -23,9 +23,7 @@