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() {