diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue index 3c41934..4981908 100644 --- a/src/components/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -115,14 +115,14 @@ export default { index: "/userManagement", title: "用户管理", }, - // { - // index: "/roleManagement", - // title: "角色管理", - // }, - // { - // index: "/menuManagement", - // title: "菜单功能管理", - // }, + { + index: "/roleManagement", + title: "角色管理", + }, + { + index: "/menuManagement", + title: "菜单功能管理", + }, { index: "/deviceUpgrade", title: "升级管理", @@ -139,153 +139,6 @@ export default { ], }, ], - items1: [ - { - icon: "el-icon-s-home", - index: "stritl", - title: "首页", - }, - { - icon: "el-icon-camera", - index: "/realTimeMonitor", - title: "实时监控", - }, - - { - icon: "el-icon-film", - index: "/pictureRotation", - title: "图片轮巡", - }, - { - icon: "el-icon-bell", - index: "/photoAlarm", - title: "告警处理", - }, - - { - icon: "el-icon-search", - index: "/realTimeSearch", - title: "历史图片", - }, - { - icon: "el-icon-files", - index: "/property", - title: "资产管理", - subs: [ - { - index: "/lineInformation", - title: "线路信息管理", - }, - { - index: "/towerInformation", - title: "杆塔信息管理", - }, - - { - index: "/cameraChannel", - title: "通道管理", - }, - { - index: "/photographicDevice", - title: "拍照装置管理", - }, - { - index: "/devicePhotoSchedule", - title: "拍照时间表设置", - }, - ], - }, - { - icon: "el-icon-monitor", - index: "/system", - title: "系统管理", - subs: [ - { - index: "/userManagement", - title: "用户管理", - }, - ], - }, - ], - items2: [ - { - icon: "el-icon-s-home", - index: "stritl", - title: "首页", - }, - { - icon: "el-icon-camera", - index: "/realTimeMonitor", - title: "实时监控", - }, - - { - icon: "el-icon-film", - index: "/pictureRotation", - title: "图片轮巡", - }, - { - icon: "el-icon-bell", - index: "photoAlarm", - title: "告警处理", - }, - { - icon: "el-icon-search", - index: "/realTimeSearch", - title: "历史图片", - }, - { - icon: "el-icon-files", - index: "/property", - title: "资产管理", - subs: [ - { - index: "/lineInformation", - title: "线路信息管理", - }, - { - index: "/towerInformation", - title: "杆塔信息管理", - }, - - { - index: "/photographicDevice", - title: "拍照装置管理", - }, - { - index: "/devicePhotoSchedule", - title: "拍照时间表设置", - }, - ], - }, - ], - hnjcitems: [ - { - icon: "el-icon-s-home", - index: "stritl", - title: "首页", - }, - { - icon: "el-icon-camera", - index: "/realTimeMonitor", - title: "实时监控", - }, - { - icon: "el-icon-film", - index: "/pictureRotation", - title: "图片轮巡", - }, - { - icon: "el-icon-bell", - index: "photoAlarm", - title: "告警处理", - }, - { - icon: "el-icon-search", - index: "/realTimeSearch", - title: "历史图片", - }, - ], role: "", menuList: [], }; @@ -322,8 +175,11 @@ export default { // 遍历原始数组,根据条件构建新数组 originalArray.forEach((item) => { const { id, key, desc } = item; - console.log(key); + console.log(key, desc); const index = key.startsWith("/") ? key.substring(1) : key; // 移除开头的斜杠 + // 移除desc中"-"后面的内容 + const processedDesc = desc.split("-")[0].trim(); + console.log(index, processedDesc); const icon = icons[index] || icons["default"]; // 获取图标,如果未找到则使用默认图标 if ( @@ -336,7 +192,10 @@ export default { ].includes(index) ) { // 如果包含杆塔或线路信息,则添加到资产管理子菜单 - assetManagementSubs.push({ index: "/" + index, title: desc }); + assetManagementSubs.push({ + index: "/" + index, + title: processedDesc, + }); } else if ( [ "userManagement", @@ -348,10 +207,13 @@ export default { ].includes(index) ) { // 如果包含用户列表等,则添加到系统管理子菜单 - systemManagementSubs.push({ index: "/" + index, title: desc }); + systemManagementSubs.push({ + index: "/" + index, + title: processedDesc, + }); } else { // 其他菜单项直接添加到新数组中 - newArray.push({ icon, index: "/" + index, title: desc }); + newArray.push({ icon, index: "/" + index, title: processedDesc }); } }); @@ -387,22 +249,19 @@ export default { console.log("用户管理"); console.log(this.role); - // this.menuList = JSON.parse(localStorage.getItem("menuPermission")); - // console.log(this.menuList); - // this.getMenuArr(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; - } else if (this.role == 1) { - this.items = this.items1; - } else if (this.role == 2) { - this.items = this.items2; - } else if (this.role == 4) { - this.items = this.hnjcitems; - } - // //this.activeIndex = this.items[0].index; - // console.log(this.items); - console.log(this.activeIndex); + // if (this.role == 0) { + // this.items = this.items; + // } else if (this.role == 1) { + // this.items = this.items1; + // } else if (this.role == 2) { + // this.items = this.items2; + // } else if (this.role == 4) { + // this.items = this.hnjcitems; + // } }, }; diff --git a/src/store/index.js b/src/store/index.js index 7320d97..63e1388 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -68,10 +68,17 @@ export default new Vuex.Store({ state.uid = val.uid; state.role = val.role; state.resources = val.resources; + const menuArr = val.resources + .filter((item) => item.key.includes("/")) + .sort((a, b) => a.id - b.id); + const btnArr = val.resources + .filter((item) => item.key.includes("Btn")) + .sort((a, b) => a.id - b.id); localStorage.setItem("userName", state.userName); localStorage.setItem("uid", state.uid); localStorage.setItem("role", state.role); - localStorage.setItem("menuPermission", JSON.stringify(state.resources)); + localStorage.setItem("menuPermission", JSON.stringify(menuArr)); + localStorage.setItem("btnPermission", JSON.stringify(btnArr)); }, //退出清除locastorge REMOVE_INFO(state) { diff --git a/src/views/realTimeMonitor/components/gpsButton.vue b/src/views/realTimeMonitor/components/gpsButton.vue index 6295504..3aede10 100644 --- a/src/views/realTimeMonitor/components/gpsButton.vue +++ b/src/views/realTimeMonitor/components/gpsButton.vue @@ -1,22 +1,14 @@
diff --git a/src/views/realTimeMonitor/components/parameterArea.vue b/src/views/realTimeMonitor/components/parameterArea.vue index 6ed1004..35e8c9a 100644 --- a/src/views/realTimeMonitor/components/parameterArea.vue +++ b/src/views/realTimeMonitor/components/parameterArea.vue @@ -68,32 +68,48 @@