diff --git a/src/views/statistics/RouteView.vue b/src/views/statistics/RouteView.vue index a85618f..92abfa9 100644 --- a/src/views/statistics/RouteView.vue +++ b/src/views/statistics/RouteView.vue @@ -104,22 +104,27 @@ export default { console.log("路由信息",this.menus); // this.initDefaultKeys(this.menus[0]) // 将从缓存中取出openKeys - const openKeys = window.sessionStorage.getItem('openKeys') + // const openKeys = window.sessionStorage.getItem('openKeys') const selectedKeys = window.sessionStorage.getItem('currMenu') if (selectedKeys) { - this.defaultSelectedKeys.push(selectedKeys) - } else { - - this.initDefaultKeys(this.menus[0]) - } - if (openKeys) { - // 存在即赋值 - this.defaultOpenKeys = JSON.parse(openKeys) - } - if (openKeys) { - // 存在即赋值 - this.openKeys = JSON.parse(openKeys) + this.defaultSelectedKeys.push(selectedKeys) + } else { + this.initDefaultKeys(this.menus[0]) } + console.log(this.menus); + this.menus.forEach(item => { + if (item.name!=="istatistics-data") { + this.defaultOpenKeys.push(item.path) + } + }) + // if (openKeys) { + // // 存在即赋值 + // this.defaultOpenKeys = JSON.parse(openKeys) + // } + // if (openKeys) { + // // 存在即赋值 + // this.openKeys = JSON.parse(openKeys) + // } }, methods: { // 点击菜单,路由跳转,注意的是当点击MenuItem才会触发此函数 @@ -135,17 +140,24 @@ export default { }, initDefaultKeys(data) { this.defaultOpenKeys.push(data.path) - data.children.some((f) => { - if (f.children) { - // 第一个节点展开 - this.defaultOpenKeys.push(f.path) - this.initDefaultKeys(f.children[0]) - } else { - // 选中 - this.defaultSelectedKeys.push(f.path) - return true + // if (data.children) { + if (data.name!=="istatistics-StateOfHealth-alerts") { + + data.children.some((f) => { + if (f.children) { + // 第一个节点展开 + this.defaultOpenKeys.push(f.path) + this.initDefaultKeys(f.children[0]) + } else { + // 选中 + this.defaultSelectedKeys.push(f.path) + return true + } + }) } - }) + // } else { + // this.defaultOpenKeys.push(data.path) + // } }, onOpenChange(openKeys) { // 将当前打开的父级菜单存入缓存中