zhangzengfei
2022-08-23 a65b1a037555489aec38dae8ef84deb127c2901e
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))