fix(接口定义): 默认添加一条用例

This commit is contained in:
fit2-zhao 2021-01-12 16:13:03 +08:00
parent 5d96c71d06
commit 0903d7f878
2 changed files with 18 additions and 19 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<el-card style="margin-top: 5px" @click.native="selectTestCase(apiCase,$event)"> <el-card style="margin-top: 5px" @click.native="selectTestCase(apiCase,$event)">
<el-row> <el-row>
<el-col :span="6"> <el-col :span="4">
<div class="el-step__icon is-text ms-api-col"> <div class="el-step__icon is-text ms-api-col">
<div class="el-step__icon-inner">{{ index + 1 }}</div> <div class="el-step__icon-inner">{{ index + 1 }}</div>
</div> </div>
@ -11,7 +11,7 @@
<el-option v-for="grd in priorities" :key="grd.id" :label="grd.name" :value="grd.id"/> <el-option v-for="grd in priorities" :key="grd.id" :label="grd.name" :value="grd.id"/>
</el-select> </el-select>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="12">
<i class="icon el-icon-arrow-right" :class="{'is-active': apiCase.active}" <i class="icon el-icon-arrow-right" :class="{'is-active': apiCase.active}"
@click="active(apiCase)"/> @click="active(apiCase)"/>
<el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index" <el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index"
@ -22,7 +22,6 @@
<i class="el-icon-edit" style="cursor:pointer" @click="showInput(apiCase)" v-tester/> <i class="el-icon-edit" style="cursor:pointer" @click="showInput(apiCase)" v-tester/>
</span> </span>
<label class="ms-api-label" style="padding-left: 20px; padding-right: 20px;">{{ $t('commons.tag') }}</label> <label class="ms-api-label" style="padding-left: 20px; padding-right: 20px;">{{ $t('commons.tag') }}</label>
<ms-input-tag :currentScenario="apiCase" ref="tag" style="float: right;margin-right: 215px;margin-top: -3px;" @keyup.enter.native="saveTestCase(apiCase)"/> <ms-input-tag :currentScenario="apiCase" ref="tag" style="float: right;margin-right: 215px;margin-top: -3px;" @keyup.enter.native="saveTestCase(apiCase)"/>

View File

@ -121,7 +121,7 @@
// testCaseId // testCaseId
this.testCaseId = testCaseId; this.testCaseId = testCaseId;
this.condition = {components: API_CASE_CONFIGS}; this.condition = {components: API_CASE_CONFIGS};
this.getApiTest(); this.getApiTest(true);
this.visible = true; this.visible = true;
}, },
setEnvironment(environment) { setEnvironment(environment) {
@ -145,7 +145,7 @@
this.visible = false; this.visible = false;
}, },
runRefresh(data) { runRefresh() {
this.batchLoading = false; this.batchLoading = false;
this.singleLoading = false; this.singleLoading = false;
this.singleRunId = ""; this.singleRunId = "";
@ -154,12 +154,12 @@
this.$emit('refresh'); this.$emit('refresh');
}, },
refresh(data) { refresh() {
this.getApiTest(); this.getApiTest();
this.$emit('refresh'); this.$emit('refresh');
}, },
getApiTest() { getApiTest(addCase) {
if (this.api) { if (this.api) {
this.condition.projectId = this.projectId; this.condition.projectId = this.projectId;
if (this.isCaseEdit) { if (this.isCaseEdit) {
@ -176,9 +176,9 @@
} }
} }
this.apiCaseList = response.data; this.apiCaseList = response.data;
// if (this.apiCaseList.length == 0 && !this.loaded) { if (addCase && this.apiCaseList.length == 0 && !this.loaded) {
// this.addCase(); this.addCase();
// } }
this.apiCaseList.forEach(apiCase => { this.apiCaseList.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);