Commit f6d550cb by 李少勇

处理路由报错问题

parent e476c783
...@@ -297,33 +297,36 @@ export default { ...@@ -297,33 +297,36 @@ export default {
return newObj; return newObj;
}, },
setDefaultTabs() { setDefaultTabs() {
// 页签拷贝
this.defaultTabList.forEach((item, index) => {
let newItem = this.deepCloneObj(item);
if (item.path == "/home") {
newItem["width"] = this.homeTagWidth;
newItem["hidden"] = false;
}
this.tabList.push(newItem);
});
// 处理刷新页签不显示问题 // 处理刷新页签不显示问题
let curRoute = this.$route let curRoute = this.$route
let flag = this.defaultTabList.some((item) => { let flag = this.defaultTabList.some((item) => {
return item.path == curRoute.path return item.path == curRoute.path
}) })
if (curRoute.meta.keepAlive && !flag) { if (curRoute.meta.keepAlive && !flag) {
this.defaultTabList.push({ this.tabList.push({
name: curRoute.name, name: curRoute.name,
path: curRoute.fullPath, path: curRoute.fullPath,
text: curRoute.meta.title || 'no-title', text: curRoute.meta.title || 'no-title',
hidden: false, hidden: false,
routePath: curRoute.path, routePath: curRoute.path,
routeName: curRoute.name routeName: curRoute.name,
route: curRoute
}) })
} }
// 页签拷贝 this.tabList.map((ite, index) => {
this.defaultTabList.forEach((item, index) => { if (ite.path != "/home") {
let newItem = this.deepCloneObj(item);
if (item.path == "/home") {
newItem["width"] = this.homeTagWidth;
newItem["hidden"] = false;
}
this.tabList.push(newItem);
if (item.path != "/home") {
this.calcTagsWidth(index, "+", true); this.calcTagsWidth(index, "+", true);
} }
}); })
this.$store.commit("setTagsArry", this.tabList); this.$store.commit("setTagsArry", this.tabList);
}, },
calcTagsWidth(index, calc, callback) { calcTagsWidth(index, calc, callback) {
......
...@@ -581,8 +581,10 @@ export default { ...@@ -581,8 +581,10 @@ export default {
let orgObj = this.header.orgList.find(item => item.id === param) let orgObj = this.header.orgList.find(item => item.id === param)
let roleObj = this.header.roleTypeList.find(item => item.key === this.header.curRole.id+"") let roleObj = this.header.roleTypeList.find(item => item.key === this.header.curRole.id+"")
this.initRoleList(orgObj); this.initRoleList(orgObj);
if(this.header.roleList && this.header.roleList.length>0 && ((orgObj.departmentNumber==="1000" && roleObj.value!=="HEAD") if(this.header.roleList &&
||(orgObj.departmentNumber!=="1000" && roleObj.value==="HEAD"))){ this.header.roleList.length>0 &&
((orgObj.departmentNumber==="1000" && roleObj && roleObj.value!=="HEAD") || (orgObj.departmentNumber!=="1000" && (roleObj && roleObj.value==="HEAD")))
){
this.changeRoles(this.header.roleList[0].id); this.changeRoles(this.header.roleList[0].id);
sessionStorage.setItem('curRole', JSON.stringify(this.header.roleList[0])); sessionStorage.setItem('curRole', JSON.stringify(this.header.roleList[0]));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment