diff --git a/src/utils/flow.js b/src/utils/flow.js index ddcced4..fb1372f 100644 --- a/src/utils/flow.js +++ b/src/utils/flow.js @@ -294,4 +294,53 @@ export const filterEmptyName = (obj) => { // 基础类型直接返回 return obj; +} + +/** + * 将原始表单配置数组 转换为 目标对象格式 + * @param {Array} source - 原始数据数组 + * @returns {Object} 转换后的目标格式对象 + */ +export const transformHttpNodeData = (source) => { + // 初始化结果对象 + const result = {}; + + // 遍历每一个顶级节点 + source.forEach(item => { + const { name, children } = item; + if (!name) return; // 过滤无name的无效节点 + + // 处理普通节点(config/headers/params):直接取 children 数组 + if (name !== 'body') { + result[name] = children || []; + return; + } + + // 专门处理 body 节点(特殊结构) + if (name === 'body') { + const bodyObj = { + type: '', + json: '', + formData: [] + }; + + // 遍历body的子项,赋值到对应字段 + children?.forEach(child => { + const childName = child.name; + if (childName === 'bodyType') { + bodyObj.type = child.input; + } + if (childName === 'json') { + bodyObj.json = child.input; + } + if (childName === 'formData') { + bodyObj.formData = child.children || []; + } + }); + + result.body = bodyObj; + } + }); + + return result; } \ No newline at end of file diff --git a/src/views/flow/components/NodeTitle.vue b/src/views/flow/components/NodeTitle.vue index 9ef336c..2d47b0d 100644 --- a/src/views/flow/components/NodeTitle.vue +++ b/src/views/flow/components/NodeTitle.vue @@ -6,9 +6,7 @@
{{ nodeName }} - +
@@ -213,6 +211,7 @@ const imageUrl = () => { .el-input { margin-left: 12px; + width: 120px; } .input_name_select { diff --git a/src/views/flow/components/ParamsDrawer.vue b/src/views/flow/components/ParamsDrawer.vue index 9fa8067..f4a2f9b 100644 --- a/src/views/flow/components/ParamsDrawer.vue +++ b/src/views/flow/components/ParamsDrawer.vue @@ -4,7 +4,9 @@ custom-class="custom-drawer-header" class="no-header-margin" :title="props.data.properties?.name || '参数配置'" - :before-close="handleClose" + :close-on-click-modal="false" + :close-on-press-escape="false" + :show-close="false" >
@@ -169,6 +171,7 @@ :icon="Minus" circle size="small" + :disabled="property?.disabled || false" @click="handleDelete(index)" class="deleteBtn" /> @@ -343,6 +346,7 @@ circle size="small" @click="handleDelete(index)" + :disabled="property?.disabled || false" class="deleteBtn" /> @@ -541,7 +545,7 @@ +
@@ -656,9 +667,9 @@ +
@@ -762,6 +780,7 @@ size="small" @click="(e) => addHttpNodeFormItem(e, 'body')" class="addFormItem" + v-if="httpNodeData.body.type === 'form-data'" > @@ -775,12 +794,12 @@
-
+
+
@@ -884,8 +910,7 @@
@@ -893,9 +918,9 @@ - - \ No newline at end of file