diff --git a/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoad.vue b/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoad.vue index 433feddc02..72cc27b936 100644 --- a/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoad.vue +++ b/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoad.vue @@ -63,9 +63,9 @@ export default { }, methods: { refresh() { - this.selectNodeIds = []; + this.selectProjectId = ''; this.selectParentNodes = []; - this.$refs.testCaseLoadRelevance.search(); + this.$refs.testPlanLoadCaseList.initTable(); this.getNodeTreeByPlanId(); }, initData() { diff --git a/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoadCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoadCaseList.vue index b099b6095a..027a0ef270 100644 --- a/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoadCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoadCaseList.vue @@ -143,7 +143,8 @@ export default { {text: 'Error', value: 'Error'} ], reportId: '', - loading: false + loading: false, + statusScheduler: null } }, props: { @@ -156,6 +157,7 @@ export default { }, created() { this.initTable(); + this.refreshStatus(); }, watch: { selectProjectId() { @@ -179,6 +181,16 @@ export default { this.tableData = data.listObject; }) }, + refreshStatus() { + this.refreshScheduler = setInterval(() => { + let arr = this.tableData.filter(data => data.status !== 'Completed' && data.status !== 'Error'); + if (arr.length > 0) { + this.initTable(); + } else { + clearInterval(this.refreshScheduler); + } + }, 4000); + }, handleSelectAll(selection) { if (selection.length > 0) { this.tableData.forEach(item => { @@ -220,17 +232,29 @@ export default { }) }, handleRunBatch() { - + this.selectRows.forEach(loadCase => { + this.run(loadCase); + }) }, run(loadCase) { this.$post('/test/plan/load/case/run', { id: loadCase.loadCaseId, testPlanLoadId: loadCase.id, triggerMode: 'MANUAL' - }, response => { - let reportId = response.data; + }).then(() => { + this.$notify({ + title: loadCase.caseName, + message: '正在执行....', + type: 'success' + }); this.initTable(); + }).catch(() => { + this.$notify.error({ + title: loadCase.caseName, + message: '用例执行错误,请单独调试该用例!' + }); }) + this.refreshStatus(); }, handleDelete(loadCase) { this.result = this.$get('/test/plan/load/case/delete/' + loadCase.id, () => { @@ -268,8 +292,16 @@ export default { // this.initTable(); } }) + }, + cancelRefresh() { + if (this.refreshScheduler) { + clearInterval(this.refreshScheduler); + } } - } + }, + beforeDestroy() { + this.cancelRefresh(); + }, }