From a2ebd9a92a375b0b6898d532d3fee782b5fd8f49 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@iotlink.com>
Date: 星期四, 15 十月 2020 19:22:57 +0800
Subject: [PATCH] 修复权限设置

---
 src/components/LeftNav.vue |   47 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/src/components/LeftNav.vue b/src/components/LeftNav.vue
index 86e0a7c..1fb7a61 100644
--- a/src/components/LeftNav.vue
+++ b/src/components/LeftNav.vue
@@ -151,9 +151,12 @@
             </el-submenu>
           </el-menu>
         </el-tab-pane>
-        <el-tab-pane label="闆嗙兢" name="cluster" :style="`height:${height - 56}px;`" v-if="showCluster">
-          
-        </el-tab-pane>
+        <el-tab-pane
+          label="闆嗙兢"
+          name="cluster"
+          :style="`height:${height - 56}px;`"
+          v-if="showCluster"
+        ></el-tab-pane>
         <el-tab-pane
           label="鏁版嵁鏍�"
           name="dataStack"
@@ -290,13 +293,32 @@
       return true;
     },
     showCam() {
-      return this.appName === "Camera" || this.appName === "Search";
+      debugger
+      return this.appName === "Camera" || (this.appName === "Search" && this.buttonAuthority.indexOf("search:camera") >= 0);
     },
     showCluster() {
-      return this.appName === "Cluster"
+      return this.appName === "Cluster";
     },
+    // 鏁版嵁鏍堥厤缃繀椤绘樉绀恒�� 妫�绱㈤�氳繃鏉冮檺鎺у埗鏄剧ず, 鏈畨瑁呮暟鎹爤涔熶笉鏄剧ず
     showDataStack() {
-      return this.appName === "DataStack" || this.appName === "Search";
+      if (this.appName === "DataStack") {
+        return true;
+      }
+
+      if (this.appName === "Search") {
+        // 鏈畨瑁呮暟鎹爤閰嶇疆
+        if (this.installedApps.indexOf("dataStack") >= 0) {
+          if (this.isAdmin) {
+            return true;
+          }
+
+          if (this.buttonAuthority.indexOf("search:stack") >= 0) {
+            return true;
+          }
+        }
+      }
+
+      return false;
     },
     showLock() {
       return this.edit;
@@ -329,6 +351,7 @@
       dataStack: "videoMonitor:dataStack",
       activeIndexVideo: "",
       buttonAuthority: sessionStorage.getItem("buttonAuthoritys") || [],
+      installedApps: sessionStorage.getItem("apps") || [],
       loginName: JSON.parse(sessionStorage.getItem("userInfo")).username || "鐢ㄦ埛鍚�",
       searchTypeOptions: [
         {
@@ -565,11 +588,11 @@
               promiseArr.push(createCamera(camera));
             }
             let _this = this;
-            Promise.allSettled(promiseArr).then(res=>{
-              res.forEach(item=>{
-                if(item.status === 'fulfilled'){
+            Promise.allSettled(promiseArr).then(res => {
+              res.forEach(item => {
+                if (item.status === 'fulfilled') {
                   succeed++;
-                }else{
+                } else {
                   failed++;
                 }
               });
@@ -579,10 +602,10 @@
                 message: "鎿嶄綔瀹屾垚, 瀵煎叆鎴愬姛:" + succeed + "涓� 澶辫触:" + failed + "涓�"
               })
               _this.TreeDataPool.fetchTreeData();
-            }).catch(e=>{
+            }).catch(e => {
               console.log(e)
             });
-            
+
           }
         } catch (e) {
           this.menuLoading = false

--
Gitblit v1.8.0