diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue index 5bde9fc007..58f3c0b6c0 100644 --- a/frontend/src/business/components/track/case/TestCase.vue +++ b/frontend/src/business/components/track/case/TestCase.vue @@ -107,7 +107,7 @@ } let caseId = this.$route.params.caseId; this.openRecentTestCaseEditDialog(caseId); - this.$router.push('/track/case/all'); + // this.$router.push('/track/case/all'); } else if (route.params.projectId){ this.getProjects(); this.getProjectById(route.params.projectId); @@ -205,7 +205,7 @@ this.$get('/project/get/' + id, response => { let project = response.data; this.setCurrentProject(project); - this.$router.push('/track/case/all'); + // this.$router.push('/track/case/all'); }); } if (id === 'all') { diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index 587dd54e58..b2cf1eb283 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -2,7 +2,7 @@
- @@ -295,6 +295,7 @@ methods: { open(testCase) { this.resetForm(); + this.listenGoBack(); this.operationType = 'add'; if (testCase) { //修改 @@ -346,6 +347,18 @@ } }); }, + listenGoBack() { + //监听浏览器返回操作,关闭该对话框 + if (window.history && window.history.pushState) { + history.pushState(null, null, document.URL); + window.addEventListener('popstate', this.close, false); + } + }, + close() { + //移除监听,防止监听其他页面 + window.removeEventListener('popstate', this.goBack, false); + this.dialogFormVisible = false; + }, saveCase() { this.$refs['caseFrom'].validate((valid) => { if (valid) { diff --git a/frontend/src/business/components/track/head/TrackHeaderMenus.vue b/frontend/src/business/components/track/head/TrackHeaderMenus.vue index 7ac747dd85..9e351fb219 100644 --- a/frontend/src/business/components/track/head/TrackHeaderMenus.vue +++ b/frontend/src/business/components/track/head/TrackHeaderMenus.vue @@ -8,7 +8,8 @@ {{ $t("i18n.home") }} - + @@ -23,6 +24,7 @@ + @@ -55,6 +57,8 @@ testPlanViewPath: '', isRouterAlive: true, testCaseEditPath: '', + testCaseProjectPath: '', + isProjectActivation: true, projectRecent: { title: this.$t('project.recent'), url: "/project/recent/5", @@ -84,24 +88,38 @@ } }, watch: { - '$route'(to, from) { - let path = to.path; - if (path.indexOf("/track/plan/view") >= 0) { - this.testPlanViewPath = '/track/plan/view/' + this.$route.params.planId; - this.reload(); - } - if (path.indexOf("/track/case/edit") >= 0) { - this.testCaseEditPath = '/track/case/edit/' + this.$route.params.caseId; - this.reload(); - } + '$route'(to) { + this.init(); } }, + mounted() { + this.init(); + }, methods: { reload() { this.isRouterAlive = false; this.$nextTick(function () { this.isRouterAlive = true; }); + }, + init() { + let path = this.$route.path; + if (path.indexOf("/track/case") >= 0 && !!this.$route.params.projectId) { + this.testCaseProjectPath = path; + //不激活项目菜单栏 + this.isProjectActivation = false; + this.reload(); + } else { + this.isProjectActivation = true; + } + if (path.indexOf("/track/plan/view") >= 0) { + this.testPlanViewPath = path; + this.reload(); + } + if (path.indexOf("/track/case/edit") >= 0) { + this.testCaseEditPath = path; + this.reload(); + } } } } @@ -125,4 +143,9 @@ .el-divider--horizontal { margin: 0; } + + .deactivation >>> .el-submenu__title { + border-bottom: white !important; + } + diff --git a/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue b/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue index 5b644e4314..7710c5636a 100644 --- a/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue +++ b/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue @@ -354,7 +354,6 @@ } this.testCase = item; this.initTest(); - // this.stepResultChange(); }, openTestCaseEdit(testCase) {