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 @@ - - - - - 输入参数 - 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..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 @@