fix(接口定义): 修复加载用例时点击确定报错的缺陷 (#18146)

--bug=1017070 --user=王孝刚 【接口测试】接口定义-编辑接口-TEST-加载用例-保存报错
https://www.tapd.cn/55049933/s/1248943

Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
MeterSphere Bot 2022-09-21 17:14:21 +08:00 committed by GitHub
parent 44560a4bf3
commit 679110cf59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 13 deletions

View File

@ -999,7 +999,6 @@ export default {
.ms-api-div { .ms-api-div {
overflow-y: auto; overflow-y: auto;
height: calc(100vh - 125px)
} }
/deep/ .el-main { /deep/ .el-main {

View File

@ -33,7 +33,7 @@
</el-button> </el-button>
</el-button-group> </el-button-group>
<div style="height: 40px"></div> <div v-if='currentApi.id' style="height: 40px"></div>
<template v-slot:header> <template v-slot:header>
<slot name="header"></slot> <slot name="header"></slot>
</template> </template>

View File

@ -161,7 +161,9 @@ export default {
// //
this.$nextTick(() => { this.$nextTick(() => {
if (this.$refs.testCaseDrawer) {
this.$refs.testCaseDrawer.setfullScreen(); this.$refs.testCaseDrawer.setfullScreen();
}
}); });
}, },
add(api) { add(api) {
@ -225,8 +227,10 @@ export default {
} }
} }
} }
if (this.apiCaseList && this.apiCaseList.length !== 0) {
let item = this.apiCaseList[index]; let item = this.apiCaseList[index];
this.$refs.apiCaseItem[index].saveTestCase(item, hideAlert); this.$refs.apiCaseItem[index].saveTestCase(item, hideAlert);
}
}, },
saveApiAndCase(api) { saveApiAndCase(api) {
if (api && api.url) { if (api && api.url) {
@ -489,11 +493,14 @@ export default {
this.condition.apiDefinitionId = this.api.id; this.condition.apiDefinitionId = this.api.id;
this.result = this.$post("/api/testcase/list", this.condition, response => { this.result = this.$post("/api/testcase/list", this.condition, response => {
let data = response.data; let data = response.data;
if (data) { if (data && data.length > 0) {
data.forEach(apiCase => { data.forEach(apiCase => {
this.formatCase(apiCase); this.formatCase(apiCase);
}); });
this.apiCaseList = data; this.apiCaseList = data;
} else {
this.$warning(this.$t('commons.please_add_api_case'));
return;
} }
}); });
} }

View File

@ -5,16 +5,15 @@
</template> </template>
<script> <script>
export default { export default {
name: "MsMainContainer" name: "MsMainContainer"
} }
</script> </script>
<style scoped> <style scoped>
.ms-main-container { .ms-main-container {
padding: 5px 10px; padding: 5px 10px;
height: calc(100vh - 45px); }
}
</style> </style>

View File

@ -237,6 +237,7 @@ export default {
no_corresponding: "No corresponding", no_corresponding: "No corresponding",
code_template: "code template", code_template: "code template",
api_case: "Api Case", api_case: "Api Case",
please_add_api_case: "Please add api case",
scenario_case: "Scenario Case", scenario_case: "Scenario Case",
task_center: "Task center", task_center: "Task center",
task_close: "Put away", task_close: "Put away",

View File

@ -238,6 +238,7 @@ export default {
no_corresponding: "无对应的", no_corresponding: "无对应的",
code_template: "代码模版", code_template: "代码模版",
api_case: "接口用例", api_case: "接口用例",
please_add_api_case: "请先添加接口用例",
scenario_case: "场景用例", scenario_case: "场景用例",
task_center: "任务中心", task_center: "任务中心",
task_close: "收起", task_close: "收起",

View File

@ -238,6 +238,7 @@ export default {
no_corresponding: "無對應的", no_corresponding: "無對應的",
code_template: "代碼模版", code_template: "代碼模版",
api_case: "接口用例", api_case: "接口用例",
please_add_api_case: "请先添加接口用例",
scenario_case: "場景用例", scenario_case: "場景用例",
task_center: "任務中心", task_center: "任務中心",
task_close: "收起", task_close: "收起",