fix (接口定义): 用例执行状态优化

This commit is contained in:
fit2-zhao 2021-10-21 14:33:14 +08:00 committed by fit2-zhao
parent 7fb0e8d7c8
commit ce1d80b77b
1 changed files with 16 additions and 39 deletions

View File

@ -185,7 +185,7 @@
:total="total"/>
</div>
<api-case-list @showExecResult="showExecResult" @refreshCase="initTable" :currentApi="selectCase" ref="caseList"
<api-case-list @showExecResult="showExecResult" @refreshCase="setRunning" :currentApi="selectCase" ref="caseList"
@stop="stop"/>
<!--批量编辑-->
<ms-batch-edit ref="batchEdit" :data-count="$refs.caseTable ? $refs.caseTable.selectDataCounts : 0"
@ -558,14 +558,7 @@ export default {
this.condition.orders.splice(index, 1);
}
}
this.enableOrderDrag = this.condition.orders.length > 0 ? false : true;
if (this.apiDefinitionId) {
this.condition.apiDefinitionId = this.apiDefinitionId;
}
this.condition.status = "";
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
this.condition.moduleIds = [];
if (this.condition.filters) {
@ -579,41 +572,13 @@ export default {
this.condition.filters = {status: ["Trash"]};
}
}
if (this.condition.filters && !this.condition.filters.status) {
this.$delete(this.condition.filters, 'status');
}
if (!this.selectAll) {
this.selectAll = false;
this.unSelection = [];
this.selectDataCounts = 0;
}
this.condition.projectId = this.projectId;
this.initCondition();
if (this.currentProtocol != null) {
this.condition.protocol = this.currentProtocol;
}
//
this.isSelectThissWeekData();
this.condition.selectThisWeedData = false;
this.condition.id = null;
if (this.selectDataRange == 'thisWeekCount') {
this.condition.selectThisWeedData = true;
} else if (this.selectDataRange != null) {
let selectParamArr = this.selectDataRange.split("single:");
if (selectParamArr.length === 2) {
this.condition.id = selectParamArr[1];
}
}
let isNext = false;
if (this.condition.projectId) {
this.result = this.$post('/api/testcase/list/' + this.currentPage + "/" + this.pageSize, this.condition, response => {
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
if (!this.selectAll) {
this.unSelection = response.data.listObject.map(s => s.id);
}
this.tableData.forEach(item => {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
@ -625,7 +590,6 @@ export default {
isNext = true;
}
});
this.$nextTick(() => {
if (this.$refs.caseTable) {
this.$refs.caseTable.clear();
@ -641,7 +605,14 @@ export default {
});
}
},
refreshStatus() {
setRunning(id) {
this.tableData.forEach(item => {
if (id && id === item.id) {
item.status = "Running";
}
});
},
initCondition() {
if (this.apiDefinitionId) {
this.condition.apiDefinitionId = this.apiDefinitionId;
}
@ -671,6 +642,9 @@ export default {
this.condition.id = selectParamArr[1];
}
}
},
refreshStatus(id) {
this.initCondition();
if (this.condition.projectId) {
this.result = this.$post('/api/testcase/list/' + this.currentPage + "/" + this.pageSize, this.condition, response => {
let isNext = false;
@ -682,6 +656,9 @@ export default {
item.lastResultId = tableData[i].lastResultId;
}
}
if (id && id === item.id) {
item.status = "Running";
}
if (item.status === 'Running') {
isNext = true;
}