From df73916d7d753ddc55ab03cb11160e7bfdbd1d77 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Fri, 26 Feb 2021 14:18:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E5=9C=BA=E6=99=AF=E6=AD=A5=E9=AA=A4=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E6=8E=A7=E5=88=B6=E5=99=A8=E6=97=A0=E6=B3=95=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/automation/scenario/component/LoopController.vue | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/component/LoopController.vue b/frontend/src/business/components/api/automation/scenario/component/LoopController.vue index 5a33484e08..b52464f9ce 100644 --- a/frontend/src/business/components/api/automation/scenario/component/LoopController.vue +++ b/frontend/src/business/components/api/automation/scenario/component/LoopController.vue @@ -1,6 +1,6 @@ diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 78ae9e667b..c6dfaeb66e 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -221,7 +221,7 @@ import { import {parseEnvironment} from "../../definition/model/EnvironmentModel"; import {ELEMENT_TYPE, ELEMENTS} from "./Setting"; import MsApiCustomize from "./ApiCustomize"; -import {getCurrentProjectID, getUUID} from "@/common/js/utils"; +import {getCurrentProjectID, getUUID, objToStrMap, strMapToObj} from "@/common/js/utils"; import ApiEnvironmentConfig from "../../definition/components/environment/ApiEnvironmentConfig"; import MsInputTag from "./MsInputTag"; import MsRun from "./DebugRun"; @@ -901,14 +901,6 @@ export default { } }) }, - objToStrMap(obj) { - let strMap = new Map(); - for (let k of Object.keys(obj)) { - strMap.set(k, obj[k]); - } - return strMap; - }, - getApiScenario() { if (this.currentScenario.tags != undefined && !(this.currentScenario.tags instanceof Array)) { this.currentScenario.tags = JSON.parse(this.currentScenario.tags); @@ -928,7 +920,7 @@ export default { if (obj) { this.currentEnvironmentId = obj.environmentId; if (obj.environmentMap) { - this.projectEnvMap = this.objToStrMap(obj.environmentMap); + this.projectEnvMap = objToStrMap(obj.environmentMap); } else { // 兼容历史数据 this.projectEnvMap.set(getCurrentProjectID(), obj.environmentId); @@ -964,13 +956,6 @@ export default { }) } }, - strMapToObj(strMap){ - let obj= Object.create(null); - for (let[k,v] of strMap) { - obj[k] = v; - } - return obj; - }, setParameter() { this.currentScenario.stepTotal = this.scenarioDefinition.length; this.currentScenario.projectId = getCurrentProjectID(); @@ -984,7 +969,7 @@ export default { variables: this.currentScenario.variables, headers: this.currentScenario.headers, referenced: 'Created', - environmentMap: this.strMapToObj(this.projectEnvMap), + environmentMap: strMapToObj(this.projectEnvMap), hashTree: this.scenarioDefinition, projectId: this.projectId, }; diff --git a/frontend/src/business/components/api/definition/components/Run.vue b/frontend/src/business/components/api/definition/components/Run.vue index d8d6d9ae85..18331f0e80 100644 --- a/frontend/src/business/components/api/definition/components/Run.vue +++ b/frontend/src/business/components/api/definition/components/Run.vue @@ -86,7 +86,7 @@ import {getUUID, getBodyUploadFiles, getCurrentProjectID, strMapToObj} from "@/c this.$fileUpload(url, null, bodyFiles, reqObj, response => { this.runId = response.data; this.getResult(); - }, erro => { + }, error => { this.$emit('runRefresh', {}); }); } diff --git a/frontend/src/common/js/utils.js b/frontend/src/common/js/utils.js index 4faaccda89..cee140a1bd 100644 --- a/frontend/src/common/js/utils.js +++ b/frontend/src/common/js/utils.js @@ -336,3 +336,11 @@ export function strMapToObj(strMap){ } return obj; } + +export function objToStrMap(obj) { + let strMap = new Map(); + for (let k of Object.keys(obj)) { + strMap.set(k, obj[k]); + } + return strMap; +}