菜单权限修改

role1.0
fanluyan 1 year ago
parent ecddc99dea
commit e458251052

@ -299,7 +299,85 @@ export default {
methods: {
setCurrentRoute() {
console.log(this.$route.path);
this.activeIndex = this.$route.path; //
this.$nextTick(() => {
this.activeIndex = this.$route.path; //
console.log(this.activeIndex);
});
},
getMenuArr(originalArray) {
const icons = {
stritl: "el-icon-s-home",
realTimeMonitor: "el-icon-camera",
pictureRotation: "el-icon-film",
photoAlarm: "el-icon-bell",
realTimeSearch: "el-icon-search",
// ...
default: "el-icon-default", //
};
const assetManagementSubs = []; //
const systemManagementSubs = []; //
const newArray = [];
//
originalArray.forEach((item) => {
const { id, key, desc } = item;
console.log(key);
const index = key.startsWith("/") ? key.substring(1) : key; //
const icon = icons[index] || icons["default"]; // 使
if (
[
"lineInformation",
"towerInformation",
"cameraChannel",
"photographicDevice",
"devicePhotoSchedule",
].includes(index)
) {
// 线
assetManagementSubs.push({ index: "/" + index, title: desc });
} else if (
[
"userManagement",
"roleManagement",
"menuManagement",
"deviceUpgrade",
"globalTools",
"waterMark",
].includes(index)
) {
//
systemManagementSubs.push({ index: "/" + index, title: desc });
} else {
//
newArray.push({ icon, index: "/" + index, title: desc });
}
});
//
if (assetManagementSubs.length > 0) {
newArray.push({
icon: "el-icon-files",
index: "property",
title: "资产管理",
subs: assetManagementSubs,
});
}
//
if (systemManagementSubs.length > 0) {
newArray.push({
icon: "el-icon-setting", //
index: "system",
title: "系统管理",
subs: systemManagementSubs,
});
}
console.log("我是最后的", newArray);
//return newArray;
this.items = newArray;
},
},
created() {
@ -308,12 +386,10 @@ export default {
this.role = localStorage.getItem("role");
console.log("用户管理");
console.log(this.role);
// if (this.role == 0) {
// this.items = this.items;
// } else {
// this.menuList = JSON.parse(localStorage.getItem("menuPermission"));
// this.items = this.menuList;
// }
// this.menuList = JSON.parse(localStorage.getItem("menuPermission"));
// console.log(this.menuList);
// this.getMenuArr(this.menuList);
if (this.role == 0) {
this.items = this.items;
@ -324,8 +400,8 @@ export default {
} else if (this.role == 4) {
this.items = this.hnjcitems;
}
//this.activeIndex = this.items[0].index;
console.log(this.items);
// //this.activeIndex = this.items[0].index;
// console.log(this.items);
console.log(this.activeIndex);
},
};

Loading…
Cancel
Save