From 82e848227557dcb1202ac0f0fd4d22142372e7da Mon Sep 17 00:00:00 2001 From: renpy Date: Tue, 29 Aug 2023 11:37:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=97=A0=E6=B3=95=E5=9C=A8?= =?UTF-8?q?=20web=20=E5=92=8C=20alarm=E9=97=B4=E5=88=87=E6=8D=A2(=E5=9C=A8?= =?UTF-8?q?=20Alarm=20=E4=B8=8B=E9=9D=A2=E6=93=8D=E4=BD=9C=E4=B8=80?= =?UTF-8?q?=E4=BC=9A=E5=86=8D=E7=82=B9=E5=87=BB=20WEB=20=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E8=B7=B3=E8=BD=AC)=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 --- src/components/menu/CustomTopMenu.vue | 11 +++++++++-- src/views/abnormalAlarm/RouteView.vue | 28 +++++++++++++-------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/components/menu/CustomTopMenu.vue b/src/components/menu/CustomTopMenu.vue index e163433..8c8b133 100644 --- a/src/components/menu/CustomTopMenu.vue +++ b/src/components/menu/CustomTopMenu.vue @@ -41,8 +41,15 @@ export default { methods: { onMenuSelect({ key }) { const childPath = this.getChildrenPath(this.menuItems.find(menu => menu.name === key)) - if (key == "abnormal-alarm" || key == "istatistics") { - const selectedKeys = window.sessionStorage.getItem('currMenu') + if (key == "abnormal-alarm" ) { + const selectedKeys = window.sessionStorage.getItem('currMenu_alarm') + if (selectedKeys) { + this.$router.push(selectedKeys) + } else { + this.$router.push(childPath) + } + } else if (key == "istatistics") { + const selectedKeys = window.sessionStorage.getItem('currMenu_web') if (selectedKeys) { this.$router.push(selectedKeys) } else { diff --git a/src/views/abnormalAlarm/RouteView.vue b/src/views/abnormalAlarm/RouteView.vue index e9abe4f..4b80b9b 100644 --- a/src/views/abnormalAlarm/RouteView.vue +++ b/src/views/abnormalAlarm/RouteView.vue @@ -108,7 +108,7 @@ export default { // 将从缓存中取出openKeys // const openKeys = window.sessionStorage.getItem('openKeys') // console.log(openKeys); - const selectedKeys = window.sessionStorage.getItem('currMenu') + const selectedKeys = window.sessionStorage.getItem('currMenu_alarm') if (selectedKeys) { // this.defaultSelectedKeys.push(selectedKeys) this.currSlecteKey.push(selectedKeys) @@ -128,23 +128,23 @@ export default { // this.openKeys = JSON.parse(openKeys) // } }, - watch: { - "$route": { - handler: function (val, oldVal) { - this.currSlecteKey=[] - console.log(val); - this.currSlecteKey.push(val.path) - window.sessionStorage.setItem('currMenu', val.path) - }, - deep:true, - immediate:true - } - }, + // watch: { + // "$route": { + // handler: function (val, oldVal) { + // this.currSlecteKey=[] + // console.log(val); + // this.currSlecteKey.push(val.path) + // window.sessionStorage.setItem('currMenu', val.path) + // }, + // deep:true, + // immediate:true + // } + // }, methods: { // 点击菜单,路由跳转,注意的是当点击MenuItem才会触发此函数 menuClick({ item, key, keyPath }) { this.currSlecteKey =[] - window.sessionStorage.setItem('currMenu', key) + window.sessionStorage.setItem('currMenu_alarm', key) // var parentPath = item._props.parentMenu._props.eventKey; // var parentTitle = parentPath.substring(parentPath.lastIndexOf("/") + 1, parentPath.length) // var par = {"type": "q"}