fix (接口定义): 用例执行刷新优化

This commit is contained in:
fit2-zhao 2021-08-20 10:17:19 +08:00 committed by fit2-zhao
parent e016c988f3
commit 769d4bc204
3 changed files with 19 additions and 7 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<el-card style="margin-top: 5px" @click.native="selectTestCase(apiCase,$event)" v-loading="loading"> <el-card style="margin-top: 5px" @click.native="selectTestCase(apiCase,$event)" v-loading="saveLoading">
<div @click="active(apiCase)" v-if="type!=='detail'"> <div @click="active(apiCase)" v-if="type!=='detail'">
<el-row> <el-row>
<el-col :span="3"> <el-col :span="3">
@ -220,6 +220,7 @@ export default {
{name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleEditBatch} {name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleEditBatch}
], ],
methodColorMap: new Map(API_METHOD_COLOUR), methodColorMap: new Map(API_METHOD_COLOUR),
saveLoading: false,
} }
}, },
props: { props: {
@ -367,9 +368,9 @@ export default {
}); });
}, },
reload() { reload() {
this.loading = true this.saveLoading = true
this.$nextTick(() => { this.$nextTick(() => {
this.loading = false this.saveLoading = false
}); });
}, },
saveCase(row, hideAlert) { saveCase(row, hideAlert) {
@ -415,6 +416,10 @@ export default {
if (!hideAlert) { if (!hideAlert) {
this.$emit('refresh'); this.$emit('refresh');
} }
//
if (this.api.source === "editCase") {
this.$store.state.currentApiCase = {refresh: "true"};
}
} }
}); });
}, },

View File

@ -184,6 +184,7 @@ export default {
}, },
add(api) { add(api) {
this.api = api; this.api = api;
this.api.source = "editCase";
this.condition = {components: API_CASE_CONFIGS}; this.condition = {components: API_CASE_CONFIGS};
this.sysAddition(); this.sysAddition();
this.visible = true; this.visible = true;
@ -262,14 +263,14 @@ export default {
this.runResult = {testId: getUUID()}; this.runResult = {testId: getUUID()};
this.$refs.apiCaseItem.runLoading = false; this.$refs.apiCaseItem.runLoading = false;
this.$success(this.$t('organization.integration.successful_operation')); this.$success(this.$t('organization.integration.successful_operation'));
this.$emit("refresh"); //this.$emit("refresh");
}, },
errorRefresh() { errorRefresh() {
this.batchLoadingIds = []; this.batchLoadingIds = [];
this.singleLoading = false; this.singleLoading = false;
this.singleRunId = ""; this.singleRunId = "";
this.$refs.apiCaseItem.runLoading = false; this.$refs.apiCaseItem.runLoading = false;
this.$emit("refresh"); //this.$emit("refresh");
}, },
refresh() { refresh() {
this.getApiTest(); this.getApiTest();
@ -414,7 +415,7 @@ export default {
this.runData.push(row.request); this.runData.push(row.request);
/*触发执行操作*/ /*触发执行操作*/
this.reportId = getUUID().substring(0, 8); this.reportId = getUUID().substring(0, 8);
this.$emit("refresh", row.id); this.$emit("refreshCase", row.id);
}, },
stop(callback) { stop(callback) {

View File

@ -162,7 +162,7 @@
:total="total"/> :total="total"/>
</div> </div>
<api-case-list @showExecResult="showExecResult" @refresh="initTable" :currentApi="selectCase" ref="caseList"/> <api-case-list @showExecResult="showExecResult" @refreshCase="initTable" :currentApi="selectCase" ref="caseList"/>
<!--批量编辑--> <!--批量编辑-->
<ms-batch-edit ref="batchEdit" :data-count="$refs.caseTable ? $refs.caseTable.selectDataCounts : 0" @batchEdit="batchEdit" :typeArr="typeArr" :value-arr="valueArr"/> <ms-batch-edit ref="batchEdit" :data-count="$refs.caseTable ? $refs.caseTable.selectDataCounts : 0" @batchEdit="batchEdit" :typeArr="typeArr" :value-arr="valueArr"/>
<!--选择环境(当创建性能测试的时候)--> <!--选择环境(当创建性能测试的时候)-->
@ -419,6 +419,12 @@ export default {
}, },
relevanceProjectId() { relevanceProjectId() {
this.initTable(); this.initTable();
},
'$store.state.currentApiCase.refresh'() {
if (this.$store.state.currentApiCase.refresh) {
this.initTable();
}
this.$store.state.currentApiCase = {};
} }
}, },
computed: { computed: {