From d5ce6ee29702b84944727b47adea6650062ad777 Mon Sep 17 00:00:00 2001 From: zhanghao <774378400@qq.com> Date: Wed, 1 Jul 2026 15:05:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20flow=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 +- src/api/device/flow.js | 8 + src/views/flow/components/NodeTitle.vue | 1 - src/views/flow/components/ParamsDrawer.vue | 1823 +---------------- .../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 +- 11 files changed, 2134 insertions(+), 1774 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/.env.development b/.env.development index 9ddffd1..b051a37 100644 --- a/.env.development +++ b/.env.development @@ -7,8 +7,8 @@ VITE_APP_ENV = 'development' # 招商车研物联网平台/开发环境 VITE_APP_BASE_API = '/dev-api' -VITE_API_URL = http://192.168.0.201:13080 -VITE_WS_URL = ws://192.168.0.201:13080/ws +VITE_API_URL = http://192.168.1.201:13080 +VITE_WS_URL = ws://192.168.1.201:13080/ws # explanation VITE_INSPECTION_TYPE = "inspection" \ No newline at end of file diff --git a/src/api/device/flow.js b/src/api/device/flow.js index d6f7e5d..f309674 100644 --- a/src/api/device/flow.js +++ b/src/api/device/flow.js @@ -60,4 +60,12 @@ export function flowStop(instId) { url: `/flow/stop/${instId}`, method: 'post' }) +} + +export function getArmStatus(params) { + return request({ + url: '/api/arm/getPose', + method: 'get', + params: params + }) } \ No newline at end of file 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 e1066f2..7cb660d 100644 --- a/src/views/flow/components/ParamsDrawer.vue +++ b/src/views/flow/components/ParamsDrawer.vue @@ -1,1795 +1,80 @@ - - - - - 输入参数 - addFormItem(e, 'nodeParams')" - class="addFormItem" - > - - - - - deleteTopLevelItem(path, 'inputParams')" - /> - - - - - - - - - - 输入参数 - addFormItem(e, 'nodeParams')" - class="addFormItem" - > - - - - - - - - - - - - - - - - - - - - - - - - visibleChange(visible, index, property.quote) - " - @change="(value) => cascaderChange(value, index)" - /> - - - - - - - - - - - 输出参数 - addFormItem(e, 'outputParams')" - class="addFormItem" - > - - - - - - deleteTopLevelItem(path, 'outputParams')" - /> - - - - - - - - - - - 输入参数 - - - - - - - - - - - - - - - - - - - - - - - - - - - visibleChange(visible, index, property.quote) - " - @change="(value) => cascaderChange(value, index)" - /> - - - - - - - - - - - - - - - - 输出参数 - - - - - - addFormItem(e, 'outputParams')" - class="addFormItem" - > - - - - - - deleteTopLevelItem(path, 'outputParams')" - /> - - - - - - - - - - - - - 请求配置 - - - - - - - - - - - - - - - - - - - - - - - - - - visibleChange(visible, index, property.quote) - " - @change="(value) => cascaderChange(value, index)" - /> - - - - - - - - - Header配置 - addHttpNodeFormItem(e, 'headers')" - class="addFormItem" - > - - - - - - - - - - - - - - - - - - - - - - - visibleChange(visible, index, property.quote) - " - @change="(value) => cascaderChange(value, index)" - /> - - - - - - - - - - Param配置 - addHttpNodeFormItem(e, 'params')" - class="addFormItem" - > - - - - - - - - - - - - - - - - - - - - - - - visibleChange(visible, index, property.quote) - " - @change="(value) => cascaderChange(value, index)" - /> - - - - - - - - - - Body配置 - addHttpNodeFormItem(e, 'body')" - class="addFormItem" - v-if="httpNodeData.body.type === 'form-data'" - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - visibleChange(visible, index, property.quote, 'httpBody') - " - @change="(value) => cascaderChange(value, index, 'httpBody')" - /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - visibleChange(visible, index, property.quote) - " - @change="(value) => cascaderChange(value, index, 'sdAgentConfig')" - /> - - - - - - 是否调用TTS接口 - - - - TTS参数设置 - - - - - - - - - - - - - - - - - - - visibleChange(visible, index, property.quote) - " - @change="(value) => cascaderChange(value, index, 'sdAgentTts')" - /> - - - - - - - - - - 输出参数 - - - - - - addSdAgentItem(e)" - class="addFormItem" - > - - - - - - deleteSdAgentItem(path, 'outputParams')" - /> - - - - - - + - \ 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 @@ + + + + + + 输入参数 + + + + + + + + + + + + + + + + + + + + + + + + + + + visibleChange(visible, index, property.quote) + " + @change="(value) => cascaderChange(value, index)" + /> + + + + + + + + + + + + + + + + 输出参数 + + + + + + addFormItem(e, 'outputParams')" + class="addFormItem" + > + + + + + + deleteTopLevelItem(path, 'outputParams')" + /> + + + + + + + + + + \ 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 @@ + + + + + + 请求配置 + + + + + + + + + + + + + + + + + + + + + + + + + + visibleChange(visible, index, property.quote) + " @change="(value) => cascaderChange(value, index)" /> + + + + + + + + + Header配置 + addHttpNodeFormItem(e, 'headers')" + class="addFormItem"> + + + + + + + + + + + + + + + + + + + + + + + + + visibleChange(visible, index, property.quote) + " @change="(value) => cascaderChange(value, index)" /> + + + + + + + + + + Param配置 + addHttpNodeFormItem(e, 'params')" + class="addFormItem"> + + + + + + + + + + + + + + + + + + + + + + + + + visibleChange(visible, index, property.quote) + " @change="(value) => cascaderChange(value, index)" /> + + + + + + + + + + Body配置 + addHttpNodeFormItem(e, 'body')" + class="addFormItem" + v-if="httpNodeData?.body?.type === 'form-data'" + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + visibleChange(visible, index, property.quote, 'httpBody') + " + @change="(value) => cascaderChange(value, index, 'httpBody')" + /> + + + + + + + + + + + + + + + \ 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + visibleChange(visible, index, property.quote) + " @change="(value) => cascaderChange(value, index, 'sdAgentConfig')" /> + + + + + + 是否调用TTS接口 + + + + TTS参数设置 + + + + + + + + + + + + + + + + + + + visibleChange(visible, index, property.quote) + " @change="(value) => cascaderChange(value, index, 'sdAgentTts')" /> + + + + + + + + + + 输出参数 + + + + + + addSdAgentItem(e)" class="addFormItem"> + + + + + + + + deleteSdAgentItem(path, 'outputParams')" /> + + + + + + + + + + \ 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 @@ + + + + + 输入参数 + addFormItem(e, 'inputParams')" class="addFormItem"> + + + + + + + deleteTopLevelItem(path, 'inputParams')" /> + + + + + + + + \ 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..8813871 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', input: 0, disabled: true }, + { name: "acceleration", type: "input", componentType: 'number', input: 0, disabled: true }, ], outputType: 'json' },