From d59d4b5fcac23d805631fbf1e317083fb0dc6800 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Fri, 2 Apr 2021 14:41:44 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=9C=BA=E6=99=AF=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E8=B0=83=E8=AF=95=E5=89=8D=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automation/scenario/EditApiScenario.vue | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 2e8e673dae..c294314450 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -784,16 +784,16 @@ }, runDebug() { /*触发执行操作*/ - let sign = this.$refs.envPopover.checkEnv(this.isFullUrl); - if (!sign) { - return; - } - this.$refs['currentScenario'].validate((valid) => { if (valid) { - Promise.all([ - this.editScenario()]).then(val => { - if (val) { + let definition = JSON.parse(JSON.stringify(this.currentScenario)); + definition.hashTree = this.scenarioDefinition; + this.getEnv(JSON.stringify(definition)).then(() => { + let sign = this.$refs.envPopover.checkEnv(this.isFullUrl); + if (!sign) { + return; + } + this.editScenario().then(() => { this.debugData = { id: this.currentScenario.id, name: this.currentScenario.name, @@ -806,8 +806,8 @@ hashTree: this.scenarioDefinition }; this.reportId = getUUID().substring(0, 8); - } - }); + }) + }) } }) }, @@ -976,12 +976,15 @@ }); }, getEnv(definition) { - this.$post("/api/automation/getApiScenarioEnv", {definition: definition}, res => { - if (res.data) { - this.projectIds = new Set(res.data.projectIds); - this.isFullUrl = res.data.fullUrl; - } - }) + return new Promise((resolve) => { + this.$post("/api/automation/getApiScenarioEnv", {definition: definition}, res => { + if (res.data) { + this.projectIds = new Set(res.data.projectIds); + this.isFullUrl = res.data.fullUrl; + } + resolve(); + }) + }); }, getApiScenario() { this.loading = true;