fix(接口测试): 修复启用禁用不生效问题

--bug=1009405 --user=赵勇 [github #8973]在接口自动化功能项,场景步骤里面的禁用按钮,点击禁用之后,状态无法保存。 https://www.tapd.cn/55049933/s/1091784
This commit is contained in:
fit2-zhao 2022-01-14 11:28:41 +08:00 committed by fit2-zhao
parent 25be141c04
commit 2330f82931
2 changed files with 11 additions and 0 deletions

View File

@ -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());

View File

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