fix: 停止接口用例执行时同时停止用例列表加载状态

This commit is contained in:
shiziyuan9527 2021-08-26 17:28:03 +08:00 committed by 刘瑞斌
parent 8c077c0b58
commit 7459bad9e7
3 changed files with 22 additions and 8 deletions

View File

@ -82,7 +82,7 @@
<ms-tip-button @click="singleRun(apiCase)" :tip="$t('api_test.run')" icon="el-icon-video-play" <ms-tip-button @click="singleRun(apiCase)" :tip="$t('api_test.run')" icon="el-icon-video-play"
class="run-button" size="mini" :disabled="!apiCase.id" circle v-if="!loading"/> class="run-button" size="mini" :disabled="!apiCase.id" circle v-if="!loading"/>
<el-tooltip :content="$t('report.stop_btn')" placement="top" :enterable="false" v-else> <el-tooltip :content="$t('report.stop_btn')" placement="top" :enterable="false" v-else>
<el-button :disabled="!apiCase.id" @click.once="stop" size="mini" style="color:white;padding: 0;width: 28px;height: 28px;" class="stop-btn" circle> <el-button :disabled="!apiCase.id" @click.once="stop(apiCase)" size="mini" style="color:white;padding: 0;width: 28px;height: 28px;" class="stop-btn" circle>
<div style="transform: scale(0.72)"> <div style="transform: scale(0.72)">
<span style="margin-left: -3.5px;font-weight: bold">STOP</span> <span style="margin-left: -3.5px;font-weight: bold">STOP</span>
</div> </div>
@ -303,8 +303,8 @@ export default {
this.saveTestCase(data); this.saveTestCase(data);
this.$emit('singleRun', data); this.$emit('singleRun', data);
}, },
stop() { stop(data) {
this.$emit('stop'); this.$emit('stop', data.id);
}, },
copyCase(data) { copyCase(data) {
if (data && data.request) { if (data && data.request) {

View File

@ -424,12 +424,13 @@ export default {
this.$emit("refreshCase", row.id); this.$emit("refreshCase", row.id);
}, },
stop(callback) { stop(id) {
let url = "/api/automation/stop/" + this.reportId; let url = "/api/automation/stop/" + this.reportId;
this.$get(url, () => { this.$get(url, () => {
if (callback) { // if (callback) {
callback(); // callback();
} // }
this.$emit("stop", id);
this.singleLoading = false; this.singleLoading = false;
this.$success(this.$t('report.test_stop_success')); this.$success(this.$t('report.test_stop_success'));
}); });

View File

@ -162,7 +162,7 @@
:total="total"/> :total="total"/>
</div> </div>
<api-case-list @showExecResult="showExecResult" @refreshCase="initTable" :currentApi="selectCase" ref="caseList"/> <api-case-list @showExecResult="showExecResult" @refreshCase="initTable" :currentApi="selectCase" ref="caseList" @stop="stop"/>
<!--批量编辑--> <!--批量编辑-->
<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"/>
<!--选择环境(当创建性能测试的时候)--> <!--选择环境(当创建性能测试的时候)-->
@ -927,6 +927,19 @@ export default {
} }
return returnObj; return returnObj;
}, },
stop(id) {
for (let item of this.tableData) {
if (id && id === item.id) {
//
this.$get('/api/testcase/get/' + id, res => {
if (res) {
item.status = res.data.status;
}
})
break;
}
}
},
createPerformance(row, environment) { createPerformance(row, environment) {
/** /**
* 思路调用后台创建性能测试的方法把当前案例的hashTree在后台转化为jmx并文件创建性能测试 * 思路调用后台创建性能测试的方法把当前案例的hashTree在后台转化为jmx并文件创建性能测试