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 @@ - - - \ 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 @@