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 @@

操作项

- - - - + + - - - + + + + + GPS开关 + + + 开启GPS + 关闭GPS + + + + 历史图片 - 历史图片 + - 参数配置 - - 上传图片 - - - - + + + 故障信息报 - -
-
-
-

焦距调节

-
- 选择通道 - - +

焦距调节

+
+ 选择通道 + - {{ - item.alias !== null && item.alias !== "" - ? item.alias - : item.channelname - }} - - -
-
- 放大 - 缩小 + + {{ + item.alias !== null && item.alias !== "" + ? item.alias + : item.channelname + }} + + +
+
+ 放大 + 缩小 +
- @@ -197,6 +202,7 @@ import { updateTermCamera, getTermStatus, addFavorList, + setTermGPSJoggle, } from "@/utils/api/index"; export default { components: { @@ -236,6 +242,7 @@ export default { selectLineId: "", selectTowerId: "", collectFlag: false, //收藏 + btnShowList: [], }; }, @@ -250,15 +257,27 @@ export default { areaData() { return this.$store.state.currentData; }, + showButtonMap() { + return this.btnShowList.reduce((map, button) => { + map[button.key] = true; // 假设只要key存在,就显示按钮 + return map; + }, {}); + }, }, created() { this.roleUser = localStorage.getItem("role"); console.log("asdsaddddddddddddddddddddddddd", this.roleUser); + this.btnShowList = JSON.parse(localStorage.getItem("btnPermission")); + console.log(this.btnShowList); }, mounted() { this.getDateTime(); }, methods: { + //控制显示与隐藏 + showButton(key) { + return this.showButtonMap[key] || false; + }, //双击选中复制 handleDblClick(val) { // alert(val); @@ -377,6 +396,54 @@ export default { this.$store.commit("channelId", val); //将currentData保存在vuex中 this.$parent.getPhotoList(val, this.dateValue, this.areaData.id); }, + //切换gps开启关闭 + handleCommandGps(command) { + switch (command) { + case "open": //开启 + this.changeGPS(1, this.areaData.id); + break; + case "close": //关闭 + this.changeGPS(0, this.areaData.id); + break; + } + }, + changeGPS(val, cmdid) { + console.log(val, cmdid); + getTermStatus({ termId: cmdid }).then((res) => { + console.log(res); + if (res.data.isonline) { + setTermGPSJoggle({ gpsstatus: val, cmdId: cmdid }) + .then((res) => { + console.log(res); + if (val == 0) { + this.$message({ + duration: 1500, + message: "GPS已关闭", + type: "warning", + showClose: true, + }); + } else { + this.$message({ + duration: 1500, + message: "成功开启GPS", + type: "success", + showClose: true, + }); + } + }) + .catch((err) => { + console.log(err); //代码错误、请求失败捕获 + }); + } else { + this.$message({ + duration: 1500, + showClose: true, + message: "装置下线,发送指令失败", + type: "error", + }); + } + }); + }, //历史图片跳转 handlehistoryPic() { console.log(this.areaData); diff --git a/src/views/realTimeMonitor/components/siderBar.vue b/src/views/realTimeMonitor/components/siderBar.vue index 07357e0..9b4937b 100644 --- a/src/views/realTimeMonitor/components/siderBar.vue +++ b/src/views/realTimeMonitor/components/siderBar.vue @@ -183,6 +183,7 @@ export default { this.onlineNum = res.data.onlineNum; this.totalNum = res.data.totalNum; this.currentData = JSON.parse(localStorage.getItem("currentData")); + this.$nextTick(() => { this.$refs.tree.setCurrentKey(this.currentData.id); //一定要加这个选中了否则样式没有出来 }); diff --git a/src/views/system/user/components/addUser.vue b/src/views/system/user/components/addUser.vue index 7cdaf8b..17a1307 100644 --- a/src/views/system/user/components/addUser.vue +++ b/src/views/system/user/components/addUser.vue @@ -106,22 +106,15 @@ export default { this.formdata = JSON.parse(JSON.stringify(val)); }, //获取角色列表 - // getRoleListAll() { - // getRoleList() - // .then((res) => { - // console.log("获取角色列表", res.data); - // this.roleoptions = res.data.filter((role) => role.id !== 0); - // }) - // .catch((err) => {}); - // }, - // getRoleListAll() { - // getRoleList() - // .then((res) => { - // //只展示去除超管的列表 - // this.roleoptions = res.data.filter((role) => role.id !== 0); - // }) - // .catch((err) => {}); - // }, + getRoleListAll() { + getRoleList() + .then((res) => { + console.log("获取角色列表", res.data); + this.roleoptions = res.data.filter((role) => role.id !== 0); + }) + .catch((err) => {}); + }, + // 保存确定操作 submitForm() { this.$refs.formInfo.validate((valid) => { @@ -163,7 +156,7 @@ export default { display() { this.isShow = true; this.roleUser = localStorage.getItem("role"); - //this.getRoleListAll(); + this.getRoleListAll(); }, hide() { this.isShow = false; diff --git a/src/views/system/user/userManagement.vue b/src/views/system/user/userManagement.vue index 6c8b41d..362d545 100644 --- a/src/views/system/user/userManagement.vue +++ b/src/views/system/user/userManagement.vue @@ -28,17 +28,17 @@ show-overflow-tooltip prop="userName" > - + + +