fix(性能测试): 点击再次执行时查询时间状态检测

This commit is contained in:
Captain.B 2020-08-28 17:24:24 +08:00
parent 8298781148
commit c29dd93243
1 changed files with 13 additions and 4 deletions

View File

@ -142,6 +142,10 @@ export default {
}
},
initReportTimeInfo() {
if (this.status === 'Starting') {
this.clearData();
return;
}
if (this.reportId) {
this.result = this.$get("/performance/report/content/report_time/" + this.reportId)
.then(res => {
@ -155,7 +159,7 @@ export default {
}
}).catch(() => {
this.clearData();
})
});
}
},
initWebSocket() {
@ -226,10 +230,15 @@ export default {
onMessage(e) {
this.$set(this.report, "refresh", e.data); //
this.$set(this.report, "status", 'Running');
this.status = 'Running';
this.initReportTimeInfo();
window.console.log('receive a message:', e.data);
},
onClose(e) {
if (e.code === 1005) {
// socketreport
return;
}
this.$set(this.report, "refresh", Math.random()); //
this.$set(this.report, "status", 'Completed');
this.initReportTimeInfo();
@ -262,9 +271,6 @@ export default {
});
},
beforeDestroy() {
this.websocket.close() //websocket
},
watch: {
'$route'(to) {
if (to.name === "perReportView") {
@ -295,6 +301,9 @@ export default {
});
}
} else {
console.log("close socket.");
this.websocket.close() //websocket
}
}
}