fix (接口定义): 修复另存新用例缺陷

--bug=1007392 --user=赵勇 【接口定义】-编辑接口-TEST-生成测试数据后选择”另存为新用例“失败,单击没反应 https://www.tapd.cn/55049933/s/1058509
This commit is contained in:
fit2-zhao 2021-10-25 16:19:58 +08:00 committed by fit2-zhao
parent 04bc76ff2c
commit 7a167d4454
8 changed files with 34 additions and 16 deletions

View File

@ -41,6 +41,7 @@
:api-data="currentApi"
:project-id="projectId"
@saveAsApi="editApi"
@saveAsCase="saveAsCase"
@refresh="refresh"
v-if="currentProtocol==='HTTP'"
/>
@ -50,6 +51,7 @@
:api-data="currentApi"
:project-id="projectId"
@saveAsApi="editApi"
@saveAsCase="saveAsCase"
@refresh="refresh"
v-if="currentProtocol==='TCP'"
/>
@ -59,6 +61,7 @@
:api-data="currentApi"
:project-id="projectId"
@saveAsApi="editApi"
@saveAsCase="saveAsCase"
@refresh="refresh"
v-if="currentProtocol==='SQL'"
/>
@ -68,18 +71,19 @@
:api-data="currentApi"
:project-id="projectId"
@saveAsApi="editApi"
@saveAsCase="saveAsCase"
@refresh="refresh"
v-if="currentProtocol==='DUBBO'"
/>
</div>
<div v-if="showMock && (currentProtocol === 'HTTP')" class="ms-api-div">
<!-- <mock-config :base-mock-config-data="baseMockConfigData" type="http"/>-->
<!-- <mock-config :base-mock-config-data="baseMockConfigData" type="http"/>-->
<mock-tab :base-mock-config-data="baseMockConfigData" :is-tcp="false"/>
</div>
<div v-if="showMock && (currentProtocol === 'TCP')" class="ms-api-div">
<mock-tab :base-mock-config-data="baseMockConfigData" :is-tcp="true"/>
<!-- <tcp-mock-config :base-mock-config-data="baseMockConfigData" type="tcp"/>-->
<!-- <tcp-mock-config :base-mock-config-data="baseMockConfigData" type="tcp"/>-->
</div>
<div v-if="showTestCaseList">
<!--测试用例列表-->
@ -96,6 +100,7 @@
<ms-api-case-list
:createCase="createCase"
:currentApi="api"
@reLoadCase="reLoadCase"
ref="caseList"/>
</el-card>
</template>
@ -178,6 +183,9 @@ export default {
}
},
methods: {
reLoadCase() {
this.$refs.trashCaseList.initTable();
},
sort(stepArray) {
if (stepArray) {
for (let i in stepArray) {
@ -281,17 +289,21 @@ export default {
this.loading = false
});
},
saveAsCase(api) {
this.showApiList = false;
this.showTestCaseList = true;
this.showTest = false;
this.showMock = false;
this.createCase = getUUID();
this.api = api;
this.$refs.caseList.open();
},
refreshButtonActiveClass(tabType) {
if (tabType === "testCase") {
this.showApiList = false;
this.showTestCaseList = true;
this.showTest = false;
this.showMock = false;
if (this.$store.state.currentApiCase && this.$store.state.currentApiCase.api) {
this.createCase = getUUID();
this.api = this.$store.state.currentApiCase.api;
this.$refs.caseList.open();
}
this.$store.state.currentApiCase = {case: true};
} else if (tabType === "test") {
this.showApiList = false;

View File

@ -280,9 +280,11 @@ export default {
if (requireComponent != null && JSON.stringify(esbDefinition) != '{}' && JSON.stringify(esbDefinitionResponse) != '{}') {
this.showXpackCompnent = true;
}
this.$get('/api/testcase/follow/' + this.apiCase.id, response => {
this.apiCase.follows = response.data;
});
if (this.apiCase && this.apiCase.id) {
this.$get('/api/testcase/follow/' + this.apiCase.id, response => {
this.apiCase.follows = response.data;
});
}
},
watch: {
'apiCase.selected'() {
@ -463,7 +465,7 @@ export default {
this.reload();
//
if (this.api.source === "editCase") {
this.$store.state.currentApiCase = {refresh: "true"};
this.$emit('reLoadCase');
}
if (!hideAlert) {
this.$emit('refresh');

View File

@ -33,6 +33,7 @@
@batchRun="batchRun"
@apiCaseSelected="apiCaseSelected"
@showHistory="showHistory"
@reLoadCase="reLoadCase"
:environment="environment"
:select-size="selectSize"
:is-case-edit="isCaseEdit"
@ -268,6 +269,9 @@ export default {
refresh() {
this.$emit('refresh');
},
reLoadCase(){
this.$emit('reLoadCase');
},
selectAll(isSelectAll) {
this.apiCaseList.forEach(item => {
this.$set(item, 'selected', isSelectAll);

View File

@ -194,7 +194,7 @@
</div>
<api-case-list @showExecResult="showExecResult" @refreshCase="setRunning" :currentApi="selectCase" ref="caseList"
@stop="stop"/>
@stop="stop" @reLoadCase="initTable"/>
<!--批量编辑-->
<ms-batch-edit ref="batchEdit" :data-count="$refs.caseTable ? $refs.caseTable.selectDataCounts : 0"
@batchEdit="batchEdit" :typeArr="typeArr" :value-arr="valueArr"/>

View File

@ -166,7 +166,7 @@ export default {
},
saveAsCase() {
//
this.$store.state.currentApiCase = {case: getUUID(), api: this.api};
this.$emit('saveAsCase', this.api);
},
saveAsApi() {
let data = {};

View File

@ -204,7 +204,7 @@ export default {
},
saveAsCase() {
//
this.$store.state.currentApiCase = {case: getUUID(), api: this.api};
this.$emit('saveAsCase', this.api);
},
saveAsApi() {
let data = {};

View File

@ -164,7 +164,7 @@ export default {
return bodyUploadFiles;
},
saveAsCase() {
this.$store.state.currentApiCase = {case: getUUID(), api: this.api};
this.$emit('saveAsCase', this.api);
},
saveAsApi() {
let data = {};

View File

@ -195,7 +195,7 @@ export default {
return bodyUploadFiles;
},
saveAsCase() {
this.$store.state.currentApiCase = {case: getUUID(), api: this.api};
this.$emit('saveAsCase', this.api);
},
saveAsApi() {
let data = {};