From df1d5d7608b3e8cc9c45e63b648a2b8a84e03d42 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 14 Apr 2022 19:20:20 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E5=9C=BA=E6=99=AF=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/automation/ApiAutomation.vue | 160 +++++++++--------- 1 file changed, 81 insertions(+), 79 deletions(-) diff --git a/frontend/src/business/components/api/automation/ApiAutomation.vue b/frontend/src/business/components/api/automation/ApiAutomation.vue index eeaa217fbc..5a06f413b8 100644 --- a/frontend/src/business/components/api/automation/ApiAutomation.vue +++ b/frontend/src/business/components/api/automation/ApiAutomation.vue @@ -416,85 +416,87 @@ export default { } }, deleteResourceIds(array) { - array.forEach(item => { - if (item.resourceId) { - delete item.resourceId; - } - if (item.method) { - delete item.method; - } - if (item.timeout >= 0) { - delete item.timeout; - } - if (item.ctimeout >= 0) { - delete item.ctimeout; - } - if (item.rest && item.rest.length === 0) { - delete item.rest; - } - if (item.arguments && item.arguments.length === 0) { - delete item.arguments; - } - if (item.id) { - delete item.id; - } - if (!item.checkBox) { - delete item.checkBox; - } - if (!item.isBatchProcess) { - delete item.isBatchProcess; - } - if (!item.isLeaf || item.isLeaf) { - delete item.isLeaf; - } - if (item.maxThreads) { - delete item.maxThreads; - } - if (item.parentIndex) { - delete item.parentIndex - } - if (item.connectTimeout) { - delete item.connectTimeout; - } - if (item.index) { - delete item.index; - } - if (item.postSize >= 0) { - delete item.postSize; - } - if (item.preSize >= 0) { - delete item.preSize; - } - if (item.requestResult) { - delete item.requestResult; - } - if (item.responseTimeout) { - delete item.responseTimeout; - } - if (item.root) { - delete item.root; - } - if (item.ruleSize >= 0) { - delete item.ruleSize; - } - if (item.delay) { - item.delay = Number(item.delay); - } - if (item.body && item.body.kvs) { - item.body.kvs.forEach(v => { - if (v.files) { - delete v.files; - } - }) - } - if (item.body && ((item.body.binary && item.body.binary.length === 0) || (item.body.kvs && item.body.kvs.length === 0))) { - delete item.body; - } - delete item.projectId; - if (item.hashTree && item.hashTree.length > 0) { - this.deleteResourceIds(item.hashTree); - } - }) + if (array instanceof Array && array.length > 0) { + array.forEach(item => { + if (item.resourceId) { + delete item.resourceId; + } + if (item.method) { + delete item.method; + } + if (item.timeout >= 0) { + delete item.timeout; + } + if (item.ctimeout >= 0) { + delete item.ctimeout; + } + if (item.rest && item.rest.length === 0) { + delete item.rest; + } + if (item.arguments && item.arguments.length === 0) { + delete item.arguments; + } + if (item.id) { + delete item.id; + } + if (!item.checkBox) { + delete item.checkBox; + } + if (!item.isBatchProcess) { + delete item.isBatchProcess; + } + if (!item.isLeaf || item.isLeaf) { + delete item.isLeaf; + } + if (item.maxThreads) { + delete item.maxThreads; + } + if (item.parentIndex) { + delete item.parentIndex + } + if (item.connectTimeout) { + delete item.connectTimeout; + } + if (item.index) { + delete item.index; + } + if (item.postSize >= 0) { + delete item.postSize; + } + if (item.preSize >= 0) { + delete item.preSize; + } + if (item.requestResult) { + delete item.requestResult; + } + if (item.responseTimeout) { + delete item.responseTimeout; + } + if (item.root) { + delete item.root; + } + if (item.ruleSize >= 0) { + delete item.ruleSize; + } + if (item.delay) { + item.delay = Number(item.delay); + } + if (item.body && item.body.kvs) { + item.body.kvs.forEach(v => { + if (v.files) { + delete v.files; + } + }) + } + if (item.body && ((item.body.binary && item.body.binary.length === 0) || (item.body.kvs && item.body.kvs.length === 0))) { + delete item.body; + } + delete item.projectId; + if (item.hashTree && item.hashTree.length > 0) { + this.deleteResourceIds(item.hashTree); + } + }) + } }, closeConfirm(targetName) { let message = "";