fix: 接口用例添加步骤没反应 (#1810)

This commit is contained in:
metersphere-bot 2021-04-01 19:21:17 +08:00 committed by 刘瑞斌
parent e8b0b2b162
commit d63ea666cc
1 changed files with 7 additions and 4 deletions

View File

@ -162,8 +162,8 @@
this.condition.projectId = this.projectId; this.condition.projectId = this.projectId;
this.condition.apiDefinitionId = this.api.id; this.condition.apiDefinitionId = this.api.id;
this.$post("/api/testcase/list", this.condition, response => { this.$post("/api/testcase/list", this.condition, response => {
this.apiCaseList = response.data; let data = response.data;
this.apiCaseList.forEach(apiCase => { data.forEach(apiCase => {
if (apiCase.tags && apiCase.tags.length > 0) { if (apiCase.tags && apiCase.tags.length > 0) {
apiCase.tags = JSON.parse(apiCase.tags); apiCase.tags = JSON.parse(apiCase.tags);
this.$set(apiCase, 'selected', false); this.$set(apiCase, 'selected', false);
@ -175,6 +175,7 @@
apiCase.request.hashTree = []; apiCase.request.hashTree = [];
} }
}) })
this.apiCaseList = data;
this.addCase(); this.addCase();
}); });
}, },
@ -224,10 +225,11 @@
} }
this.result = this.$post("/api/testcase/list", this.condition, response => { this.result = this.$post("/api/testcase/list", this.condition, response => {
let data = [];
if (response.data) { if (response.data) {
this.apiCaseList = response.data; data = response.data;
} }
this.apiCaseList.forEach(apiCase => { data.forEach(apiCase => {
if (apiCase.tags && apiCase.tags.length > 0) { if (apiCase.tags && apiCase.tags.length > 0) {
apiCase.tags = JSON.parse(apiCase.tags); apiCase.tags = JSON.parse(apiCase.tags);
this.$set(apiCase, 'selected', false); this.$set(apiCase, 'selected', false);
@ -240,6 +242,7 @@
} }
}) })
this.apiCaseList = data;
if (!this.useEnvironment && this.apiCaseList[0] && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) { if (!this.useEnvironment && this.apiCaseList[0] && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) {
this.useEnvironment = this.apiCaseList[0].request.useEnvironment; this.useEnvironment = this.apiCaseList[0].request.useEnvironment;
this.environment = this.useEnvironment; this.environment = this.useEnvironment;