From f14f98a263141d2f8ec0079866a758cc7a1c38d1 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期一, 22 八月 2022 03:20:29 +0800 Subject: [PATCH] 添加用户删除功能 --- src/views/manageCenter/index.vue | 56 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 48 insertions(+), 8 deletions(-) diff --git a/src/views/manageCenter/index.vue b/src/views/manageCenter/index.vue index 61c89a1..f72fe0a 100644 --- a/src/views/manageCenter/index.vue +++ b/src/views/manageCenter/index.vue @@ -250,7 +250,7 @@ if (this.warningChecked == 0 || this.warningTotal == 0) { return 0 } - return parseInt(this.warningChecked / this.warningTotal) * 100 + "%" + return parseInt((this.warningChecked / this.warningTotal) * 100) + "%" } }, data() { @@ -295,12 +295,27 @@ path: "/search", permission: "statisticMng" }, + { + name: "缁熻鍒嗘瀽", + icon: "/images/manageCenter/search.png", + openPath: "/dataView", + path: "/dataView", + permission: "statisticMng" + }, { name: "鎺ㄩ�佺鐞�", icon: "/images/manageCenter/manage2.png", openPath: "/report", path: "/report", + permission: "statisticMng" + }, + + { + name: "瀹炴椂鐩戞帶", + icon: "/images/manageCenter/manage2.png", + openPath: "/video", + path: "/video", permission: "statisticMng" } ], @@ -442,17 +457,18 @@ solvedTotal: 0, warningTotal: 0, warningChecked: 0, - warningSolved: 0 + warningSolved: 0, + authorizedCameras: [] } }, created() { this.getInfo() }, - mounted() { + async mounted() { + await this.getCameras() this.searchHandler() this.initBar() this.initPie() - this.getCameras() }, methods: { async getCameras() { @@ -466,9 +482,32 @@ let camereReq = await getLocalCameraTree({ clusterId: clusterId }) if (camereReq && camereReq.success) { this.cameraTree = camereReq.data.treeMenu - let tmpTree = JSON.parse(JSON.stringify(camereReq.data.treeMenu)) + + // 娓呯悊娌℃湁鏉冮檺绠$悊鐨勬憚鍍忔満, 鍚庣淇鍚庡垹闄� + let userInfo = JSON.parse(sessionStorage.getItem("userInfo")) + + // 绠$悊鍛樻潈闄� + if (userInfo.username == "Administrator") { + return + } + + let checkedCameras = userInfo.email + + // basic 涓哄瓙璐︽埛榛樿鐨勭┖瀛楁,琛ㄧず鍙鐞嗙殑鎽勫儚鏈虹洰褰曚负绌� + if (checkedCameras == "basic") { + this.cameraTree = [] + } else { + let cameraIds = checkedCameras.split(",") + this.authorizedCameras = cameraIds + this.TreeDataPool.removeNoAuthorizedNode(this.cameraTree, cameraIds) + } + + let tmpTree = JSON.parse(JSON.stringify(this.cameraTree)) + for (let i = 0; i < tmpTree.length; i++) this.clearNode(tmpTree[i]) this.menuTree = tmpTree + + console.log(this.cameraTree) } }, clearNode(tree) { @@ -489,7 +528,7 @@ let orgNodeIds = [] if (this.selectedOrg == "") { - return orgNodeIds + return this.authorizedCameras } function findNode(node) { @@ -552,6 +591,7 @@ let decodeResult = JSON.parse(decodeString) decodeResult = [] if (decodeResult) { + console.log("decodeResult", decodeResult) decodeResult.forEach((element) => { this.solvedTotal = this.solvedTotal + element.doc_count this.tableDataList.push({ date: element.key_as_string, count: element.doc_count }) @@ -692,9 +732,9 @@ return item == route.permission }) if (val) { - if (route.path === "/search") { + if (route.path === "/search" || route.path === "/dataView") { const { href } = this.$router.resolve({ - path: "/search" + path: route.path }) window.open(href, "_blank") return -- Gitblit v1.8.0