|
@@ -74,7 +74,7 @@
|
|
|
>
|
|
|
<div id="menuDrag" v-if="menuType === '2'" class="menuDrag"></div>
|
|
|
<el-menu
|
|
|
- :default-active="menuData.length > 1 ? '1' : '0-0'"
|
|
|
+ :default-active="defaultActiveIndex"
|
|
|
:collapse="menuType === '1'"
|
|
|
class="el-menu-vertical-demo icore-menu icore-menu-level1"
|
|
|
v-for="(item, index) in menuData"
|
|
@@ -865,6 +865,7 @@ export default {
|
|
|
styleControll: false,
|
|
|
dutyId: "",
|
|
|
appId: '',
|
|
|
+ defaultActiveIndex: ''
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -985,6 +986,10 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ selectedMenu: function(menuId){
|
|
|
+ var currentMenu = this.getMenuIndexByMenuId(this.menuData, null, menuId);
|
|
|
+ currentMenu && window.top.localStorage.setItem("currentMenuIndex", currentMenu.menuIndex);
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
let that = this;
|
|
@@ -1539,7 +1544,10 @@ export default {
|
|
|
this.init(token);
|
|
|
}
|
|
|
// 打开设为主页的菜单
|
|
|
- that.openMainPage();
|
|
|
+ // that.openMainPage();
|
|
|
+
|
|
|
+ // 自动打开上一次访问页面
|
|
|
+ that.autoOpenLatestPage();
|
|
|
}
|
|
|
|
|
|
if (routerFlag > 0 || routerFlagP > 0) {
|
|
@@ -1745,6 +1753,7 @@ export default {
|
|
|
menuLabel: "首页",
|
|
|
},
|
|
|
];
|
|
|
+ window.top.localStorage.setItem("currentMenuIndex","");
|
|
|
}
|
|
|
}
|
|
|
that.tabsData = temp;
|
|
@@ -1791,6 +1800,9 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
// console.log('目录', that.selectedMenu, that.tabsData)
|
|
|
+ // 左侧菜单点击切换的时候需要重新加载页面
|
|
|
+ that.menuTabIndex = that.getTabIndex(menuData.menuId);
|
|
|
+ $("#menuTabId iframe").eq(that.menuTabIndex).length && $("#menuTabId iframe").eq(that.menuTabIndex)[0].contentWindow.location.reload(true);
|
|
|
},
|
|
|
// 是否合部都不是菜单就不用显示
|
|
|
allNoMenu(items) {
|
|
@@ -2402,6 +2414,41 @@ export default {
|
|
|
}
|
|
|
return list;
|
|
|
},
|
|
|
+ getMenuIndexByMenuId(tree, index, menuId) {
|
|
|
+ if (!!tree && tree.length !== 0) {
|
|
|
+ for (let i = 0; i < tree.length; i++) {
|
|
|
+ let menuIndex = index ? (index + "-" + i.toString()) : i.toString();
|
|
|
+ if (tree[i].menuId == menuId){
|
|
|
+ tree[i]["menuIndex"] = menuIndex;
|
|
|
+ return tree[i];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (
|
|
|
+ tree[i].hasOwnProperty("children") &&
|
|
|
+ tree[i].children !== null &&
|
|
|
+ tree[i].children.length > 0
|
|
|
+ ) {
|
|
|
+ var result = this.getMenuIndexByMenuId(tree[i].children, menuIndex, menuId);
|
|
|
+ if(result){
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ autoOpenLatestPage() {
|
|
|
+ var that = this;
|
|
|
+ var currentMenuIndex = window.top.localStorage.getItem("currentMenuIndex");
|
|
|
+ let menuList = window.top.document.getElementsByClassName("el-menu-item");
|
|
|
+ for (let i = 0; i < menuList.length; i++) {
|
|
|
+ if(menuList[i].__vue__.index === currentMenuIndex){
|
|
|
+ setTimeout(function(){
|
|
|
+ that.defaultActiveIndex = currentMenuIndex;
|
|
|
+ menuList[i].click();
|
|
|
+ }, 20);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
// 打开设为主页菜单页面
|
|
|
openMainPage() {
|
|
|
this.mainPageList = this.getMainPage(this.menuData);
|