From 18072915a3eeb8b046cc95fa625a1e5f7a8225c0 Mon Sep 17 00:00:00 2001 From: zhanghao <774378400@qq.com> Date: Mon, 6 Jul 2026 11:10:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/flow/components/NodeTitle.vue | 1 - src/views/flow/components/ParamsDrawer.vue | 1827 +---------------- .../components/params/BasicNodeParams.vue | 348 ++++ .../flow/components/params/CodeNodeParams.vue | 463 +++++ .../flow/components/params/HttpNodeParams.vue | 654 ++++++ .../components/params/SdAgentNodeParams.vue | 359 ++++ .../flow/components/params/StartParams.vue | 183 ++ src/views/flow/components/params/useQuote.js | 53 + src/views/flow/config.js | 12 +- src/views/home/index.vue | 51 +- 10 files changed, 2170 insertions(+), 1781 deletions(-) create mode 100644 src/views/flow/components/params/BasicNodeParams.vue create mode 100644 src/views/flow/components/params/CodeNodeParams.vue create mode 100644 src/views/flow/components/params/HttpNodeParams.vue create mode 100644 src/views/flow/components/params/SdAgentNodeParams.vue create mode 100644 src/views/flow/components/params/StartParams.vue create mode 100644 src/views/flow/components/params/useQuote.js diff --git a/src/views/flow/components/NodeTitle.vue b/src/views/flow/components/NodeTitle.vue index 73d1b68..82022b3 100644 --- a/src/views/flow/components/NodeTitle.vue +++ b/src/views/flow/components/NodeTitle.vue @@ -174,7 +174,6 @@ onMounted(() => { }) onUnmounted(() => { - console.log(34566) emitter.off("deleteNode"); }) diff --git a/src/views/flow/components/ParamsDrawer.vue b/src/views/flow/components/ParamsDrawer.vue index 5502a5f..7cb660d 100644 --- a/src/views/flow/components/ParamsDrawer.vue +++ b/src/views/flow/components/ParamsDrawer.vue @@ -1,1799 +1,80 @@ - \ No newline at end of file diff --git a/src/views/flow/components/params/CodeNodeParams.vue b/src/views/flow/components/params/CodeNodeParams.vue new file mode 100644 index 0000000..6443d53 --- /dev/null +++ b/src/views/flow/components/params/CodeNodeParams.vue @@ -0,0 +1,463 @@ + + + + + \ No newline at end of file diff --git a/src/views/flow/components/params/HttpNodeParams.vue b/src/views/flow/components/params/HttpNodeParams.vue new file mode 100644 index 0000000..e817440 --- /dev/null +++ b/src/views/flow/components/params/HttpNodeParams.vue @@ -0,0 +1,654 @@ + + + + + \ No newline at end of file diff --git a/src/views/flow/components/params/SdAgentNodeParams.vue b/src/views/flow/components/params/SdAgentNodeParams.vue new file mode 100644 index 0000000..f6969e6 --- /dev/null +++ b/src/views/flow/components/params/SdAgentNodeParams.vue @@ -0,0 +1,359 @@ + + + + + \ No newline at end of file diff --git a/src/views/flow/components/params/StartParams.vue b/src/views/flow/components/params/StartParams.vue new file mode 100644 index 0000000..1e49b23 --- /dev/null +++ b/src/views/flow/components/params/StartParams.vue @@ -0,0 +1,183 @@ + + + + + \ No newline at end of file diff --git a/src/views/flow/components/params/useQuote.js b/src/views/flow/components/params/useQuote.js new file mode 100644 index 0000000..385ea04 --- /dev/null +++ b/src/views/flow/components/params/useQuote.js @@ -0,0 +1,53 @@ +import { ref } from 'vue' +import { getInput } from '@/utils/flow' + +export function useQuote(nodeId) { + const quoteOptions = ref([]) + const cascaderRefs = ref([]) + + const handleTypeChange = (index, formData, type = 'default') => { + // 根据节点类型处理不同数据源 + // 这里简化为通用逻辑,具体实现需根据实际数据结构调整 + if (formData.nodeParams[index].type === 'input') { + formData.nodeParams[index].quote = '' + } else { + formData.nodeParams[index].input = '' + const option = getInput(nodeId) + if (option) quoteOptions.value = option + } + } + + const cascaderChange = (value, index, formData, field = 'nodeParams') => { + const selectedOptions = cascaderRefs.value[index]?.getCheckedNodes(true) + if (selectedOptions && selectedOptions.length) { + formData[field][index].quote = value + formData[field][index].quoteType = selectedOptions[0].data.type + } + } + + const visibleChange = (visible, index, currentQuote, formData, field = 'nodeParams') => { + if (visible) { + const option = getInput(nodeId) + if (option) { + quoteOptions.value = option + const currentValue = [...currentQuote] + if (cascaderRefs.value[index] && currentValue.length > 0) { + setTimeout(() => { + formData[field][index].quote = [] + setTimeout(() => { + formData[field][index].quote = currentValue + }, 0) + }, 0) + } + } + } + } + + return { + quoteOptions, + cascaderRefs, + handleTypeChange, + cascaderChange, + visibleChange + } +} \ No newline at end of file diff --git a/src/views/flow/config.js b/src/views/flow/config.js index 80b24bf..53d023e 100644 --- a/src/views/flow/config.js +++ b/src/views/flow/config.js @@ -307,7 +307,7 @@ export const collapseList = [ ], disabled: true, required: true }, { name: "body", type: "input", input: "", children: [ { name: 'bodyType', type: "input", input: "json", disabled: true }, - { name: 'json', type: "input", input: '{}' }, + { name: 'json', type: "input", input: '{"a": 123}' }, { name: 'formData', type: "input", input: "", children: []} ], required: true }, ], @@ -386,7 +386,15 @@ function handler(params) { action: 'ALM', nodeType: 'EDGE', nodeParams: [ - { name: "deviceId", type: "input", input: "", disabled: true } + { name: "deviceId", type: "input", input: "", disabled: true }, + { name: "x", type: "input", input: "", disabled: true }, + { name: "y", type: "input", input: "", disabled: true }, + { name: "z", type: "input", input: "", disabled: true }, + { name: "rx", type: "input", input: "", disabled: true }, + { name: "ry", type: "input", input: "", disabled: true }, + { name: "rz", type: "input", input: "", disabled: true }, + { name: "velocity", type: "input", componentType: 'number', max: 5, step: 0.1, input: 0, disabled: true }, + { name: "acceleration", type: "input", componentType: 'number', max: 5, step: 0.1, input: 0, disabled: true }, ], outputType: 'json' }, diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 3995412..983ee34 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -110,17 +110,52 @@