From 2330f8293118db0a0c659c1f10c844f284243fc4 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 14 Jan 2022 11:28:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=AF=E7=94=A8=E7=A6=81=E7=94=A8=E4=B8=8D?= =?UTF-8?q?=E7=94=9F=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1009405 --user=赵勇 [github #8973]在接口自动化功能项,场景步骤里面的禁用按钮,点击禁用之后,状态无法保存。 https://www.tapd.cn/55049933/s/1091784 --- .../io/metersphere/api/service/ApiAutomationService.java | 8 ++++++++ .../scenario/component/ApiScenarioComponent.vue | 3 +++ 2 files changed, 11 insertions(+) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 1de0328ba0..5ec75b216a 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -681,11 +681,15 @@ public class ApiAutomationService { if (element != null && StringUtils.equalsIgnoreCase(element.getString("type"), "scenario")) { ApiScenarioDTO scenarioWithBLOBs = extApiScenarioMapper.selectById(element.getString("id")); if (scenarioWithBLOBs != null && StringUtils.isNotEmpty(scenarioWithBLOBs.getScenarioDefinition())) { + boolean enable = element.getBoolean("enable"); + boolean environmentEnable = element.getBoolean("environmentEnable"); if (StringUtils.equalsIgnoreCase(element.getString("referenced"), "REF")) { element = JSON.parseObject(scenarioWithBLOBs.getScenarioDefinition()); element.put("referenced", "REF"); } element.put("num", scenarioWithBLOBs.getNum()); + element.put("enable", enable); + element.put("environmentEnable", environmentEnable); element.put("versionName", scenarioWithBLOBs.getVersionName()); element.put("versionEnable", scenarioWithBLOBs.getVersionEnable()); hashTree.set(i, element); @@ -702,10 +706,14 @@ public class ApiAutomationService { if (element != null && StringUtils.equalsIgnoreCase(element.getString("type"), "scenario")) { ApiScenarioDTO scenarioWithBLOBs = extApiScenarioMapper.selectById(element.getString("id")); if (scenarioWithBLOBs != null && StringUtils.isNotEmpty(scenarioWithBLOBs.getScenarioDefinition())) { + boolean enable = element.getBoolean("enable"); + boolean environmentEnable = element.getBoolean("environmentEnable"); if (StringUtils.equalsIgnoreCase(element.getString("referenced"), "REF")) { element = JSON.parseObject(scenarioWithBLOBs.getScenarioDefinition()); element.put("referenced", "REF"); } + element.put("enable", enable); + element.put("environmentEnable", environmentEnable); element.put("num", scenarioWithBLOBs.getNum()); element.put("versionName", scenarioWithBLOBs.getVersionName()); element.put("versionEnable", scenarioWithBLOBs.getVersionEnable()); diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue index 983abd6ee2..c6d55f7af0 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue @@ -126,6 +126,9 @@ export default { if (!this.scenario.projectId) { this.scenario.projectId = getCurrentProjectID(); } + if (this.scenario.id && this.scenario.referenced === 'REF' && !this.scenario.loaded && this.scenario.hashTree) { + this.setDisabled(this.scenario.hashTree, this.scenario.projectId); + } }, components: {ApiBaseComponent, MsSqlBasisParameters, MsTcpBasisParameters, MsDubboBasisParameters, MsApiRequestForm}, data() {