From a65b1a037555489aec38dae8ef84deb127c2901e Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期二, 23 八月 2022 03:20:54 +0800 Subject: [PATCH] 修复首页数据的树结构 --- src/views/manageCenter/index.vue | 46 +++++++++++++++++++++++++++------------------- 1 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/views/manageCenter/index.vue b/src/views/manageCenter/index.vue index f72fe0a..b4893c6 100644 --- a/src/views/manageCenter/index.vue +++ b/src/views/manageCenter/index.vue @@ -15,7 +15,7 @@ <div class="products"> <div class="title">鍏ㄩ儴浜у搧</div> <div class="productList"> - <div class="productItem" v-for="(item, index) in productList" :key="index" @click="jump(item)"> + <div class="productItem" v-for="(item, index) in permissionMenuList" :key="index" @click="jump(item)"> <img :src="item.icon" alt="" /> <div class="name">{{ item.name }}</div> </div> @@ -251,6 +251,17 @@ return 0 } return parseInt((this.warningChecked / this.warningTotal) * 100) + "%" + }, + permissionMenuList() { + let user = JSON.parse(sessionStorage.getItem("userInfo")) + if (user.username == "Administrator") { + return this.productList + } + + return this.productList.filter(item => { + return user.permissions.indexOf(item.permission) >= 0 + }) + } }, data() { @@ -300,7 +311,7 @@ icon: "/images/manageCenter/search.png", openPath: "/dataView", path: "/dataView", - permission: "statisticMng" + permission: "dataViewMng" }, { @@ -308,7 +319,7 @@ icon: "/images/manageCenter/manage2.png", openPath: "/report", path: "/report", - permission: "statisticMng" + permission: "dataPushMng" }, { @@ -316,7 +327,7 @@ icon: "/images/manageCenter/manage2.png", openPath: "/video", path: "/video", - permission: "statisticMng" + permission: "videoMng" } ], cameraTree: [], @@ -483,24 +494,21 @@ if (camereReq && camereReq.success) { this.cameraTree = camereReq.data.treeMenu - // 娓呯悊娌℃湁鏉冮檺绠$悊鐨勬憚鍍忔満, 鍚庣淇鍚庡垹闄� let userInfo = JSON.parse(sessionStorage.getItem("userInfo")) - // 绠$悊鍛樻潈闄� - if (userInfo.username == "Administrator") { - return - } + if (userInfo.username != "Administrator") { + // 娓呯悊娌℃湁鏉冮檺绠$悊鐨勬憚鍍忔満, 鍚庣淇鍚庡垹闄� + let checkedCameras = userInfo.email - let checkedCameras = userInfo.email - - // basic 涓哄瓙璐︽埛榛樿鐨勭┖瀛楁,琛ㄧず鍙鐞嗙殑鎽勫儚鏈虹洰褰曚负绌� - if (checkedCameras == "basic") { - this.cameraTree = [] - } else { - let cameraIds = checkedCameras.split(",") - this.authorizedCameras = cameraIds - this.TreeDataPool.removeNoAuthorizedNode(this.cameraTree, cameraIds) - } + // basic 涓哄瓙璐︽埛榛樿鐨勭┖瀛楁,琛ㄧず鍙鐞嗙殑鎽勫儚鏈虹洰褰曚负绌� + if (checkedCameras == "basic") { + this.cameraTree = ["basic"] + } else { + let cameraIds = checkedCameras.split(",") + this.authorizedCameras = cameraIds + this.TreeDataPool.removeNoAuthorizedNode(this.cameraTree, cameraIds) + } + } let tmpTree = JSON.parse(JSON.stringify(this.cameraTree)) -- Gitblit v1.8.0