From ac830e98ca4a7d75ad86566dc129f6ba8f6d8689 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Wed, 4 May 2022 20:09:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=90=8E=E6=98=BE=E7=A4=BA=E4=B8=8A=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E9=A1=B9=E7=9B=AE=E8=B5=84=E6=BA=90=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1012979 --user=刘瑞斌 [通用功能]github#13235切换项目后还会显示之前项目已打开的报告 https://www.tapd.cn/55049933/s/1152377 Closes #13235 --- .../api/automation/report/ApiReportDetail.vue | 10 ++++++++-- .../performance/report/PerformanceReportView.vue | 11 ++++++++++- .../performance/test/EditPerformanceTest.vue | 11 ++++++++++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/frontend/src/business/components/api/automation/report/ApiReportDetail.vue b/frontend/src/business/components/api/automation/report/ApiReportDetail.vue index b5d5d9a2be..9ce9d81ae8 100644 --- a/frontend/src/business/components/api/automation/report/ApiReportDetail.vue +++ b/frontend/src/business/components/api/automation/report/ApiReportDetail.vue @@ -540,13 +540,19 @@ export default { }, exportReportReset() { this.$router.go(0); - } + }, + handleProjectChange() { + this.$router.push('/api/automation/report'); + }, }, created() { this.getReport(); + this.$EventBus.$on('projectChange', this.handleProjectChange); + }, + destroyed () { + this.$EventBus.$off('projectChange', this.handleProjectChange); }, - computed: { path() { return "/api/test/edit?id=" + this.report.testId; diff --git a/frontend/src/business/components/performance/report/PerformanceReportView.vue b/frontend/src/business/components/performance/report/PerformanceReportView.vue index bf153a60da..9f6f9afadb 100644 --- a/frontend/src/business/components/performance/report/PerformanceReportView.vue +++ b/frontend/src/business/components/performance/report/PerformanceReportView.vue @@ -491,7 +491,12 @@ export default { } } localStorage.setItem("reportRefreshTime", this.refreshTime); - } + }, + handleProjectChange() { + if (this.$route.name === 'perReportView') { + this.$router.push('/performance/report/all'); + } + }, }, created() { this.isReadOnly = !hasPermission('PROJECT_PERFORMANCE_REPORT:READ+DELETE'); @@ -500,6 +505,10 @@ export default { this.reportId = this.perReportId; } this.getReport(this.reportId); + this.$EventBus.$on('projectChange', this.handleProjectChange); + }, + destroyed () { + this.$EventBus.$off('projectChange', this.handleProjectChange); }, watch: { '$route'(to) { diff --git a/frontend/src/business/components/performance/test/EditPerformanceTest.vue b/frontend/src/business/components/performance/test/EditPerformanceTest.vue index 540f613735..8b4f4f282a 100644 --- a/frontend/src/business/components/performance/test/EditPerformanceTest.vue +++ b/frontend/src/business/components/performance/test/EditPerformanceTest.vue @@ -184,6 +184,10 @@ export default { if (hasLicense()) { this.getVersionHistory(); } + this.$EventBus.$on('projectChange', this.handleProjectChange); + }, + destroyed () { + this.$EventBus.$off('projectChange', this.handleProjectChange); }, mounted() { this.importAPITest(); @@ -619,7 +623,12 @@ export default { } } }); - } + }, + handleProjectChange() { + if (this.$route.name === 'editPerTest') { + this.$router.push('/performance/test/all'); + } + }, } };