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

---
 src/pages/analysisPower/index/App.vue |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/pages/analysisPower/index/App.vue b/src/pages/analysisPower/index/App.vue
index 688f357..a915dd9 100644
--- a/src/pages/analysisPower/index/App.vue
+++ b/src/pages/analysisPower/index/App.vue
@@ -50,7 +50,13 @@
           </div>
           <span :class="stretchStyle" @click="strethTable = !strethTable"></span>
 
-          <el-button size="small" type="primary" style="float:right" @click="openDrawer">璁剧疆</el-button>
+          <el-button
+            size="small"
+            type="primary"
+            style="float:right"
+            @click="openDrawer"
+            v-if="showSetting"
+          >璁剧疆</el-button>
         </div>
 
         <el-table
@@ -235,6 +241,20 @@
       }
 
       return ret
+    },
+    isAdmin() {
+      if (
+        sessionStorage.getItem("userInfo") &&
+        sessionStorage.getItem("userInfo") !== ""
+      ) {
+        let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username;
+        return loginName === "superadmin" || loginName === "basic";
+      }
+
+      return false;
+    },
+    showSetting() {
+      return this.isAdmin || this.buttonAuthority.indexOf("analysisPower:set") > -1
     }
   },
   data() {
@@ -249,7 +269,8 @@
       showSysInfo: false,
       drawer: false,
       formData: {},
-      strethTable: false
+      strethTable: false,
+      buttonAuthority: sessionStorage.getItem("buttonAuthoritys") || [],
     };
   },
   mounted() {

--
Gitblit v1.8.0