Prechádzať zdrojové kódy

内外部员工权限控制

cyy 2 rokov pred
rodič
commit
2417626e39
1 zmenil súbory, kde vykonal 35 pridanie a 23 odobranie
  1. 35 23
      src/views/system/dashboard/index.vue

+ 35 - 23
src/views/system/dashboard/index.vue

@@ -172,7 +172,9 @@ export default {
     NoticeDialog
   },
   data() {
+    const { userInfo } = this.$store.getters
     return {
+      userInfo,
       idKey: 'id',
       aliasKey: 'alias',
       labelKey: 'name',
@@ -227,23 +229,13 @@ export default {
     },
     loadMenus() {
       this.swipes = [{}]
-      getMenuData().then(response => {
-        this.swipes = [
-          { image: './images/swipes/banner1.png' },
-          { image: './images/swipes/banner2.png' },
-          { image: './images/swipes/banner3.png' }
-        ]
-
-        const data = response.data
-        const listData = data.filter((d) => {
-          return d.id !== '0'
-        })
-
-        this.dashboards = TreeUtils.transformToTreeFormat(listData, {
-          idKey: this.idKey,
-          parentIdKey: this.parentIdKey,
-          childrenKey: this.childrenKey
-        })
+      this.swipes = [
+        { image: './images/swipes/banner1.png' },
+        { image: './images/swipes/banner2.png' },
+        { image: './images/swipes/banner3.png' }
+      ]
+      if (this.userInfo.employee.jiNengZhiCheng !== 'inside' && this.userInfo.employee.isSuper === 'N') {
+        this.dashboards = []
         if (this.$utils.isNotEmpty(this.dashboards)) {
           const activeDashboards = []
           this.dashboards.forEach((d) => {
@@ -251,12 +243,32 @@ export default {
           })
           this.activeDashboards = activeDashboards
         }
-        this.emptyData = !(listData.length > 0)
-      }).catch((e) => {
-        this.emptyData = true
-        this.resultType = 'error'
-        this.resultMessage = e.message
-      })
+        this.emptyData = !(this.dashboards.length > 0)
+      } else {
+        getMenuData().then(response => {
+          const data = response.data
+          const listData = data.filter((d) => {
+            return d.id !== '0'
+          })
+          this.dashboards = TreeUtils.transformToTreeFormat(listData, {
+            idKey: this.idKey,
+            parentIdKey: this.parentIdKey,
+            childrenKey: this.childrenKey
+          })
+          if (this.$utils.isNotEmpty(this.dashboards)) {
+            const activeDashboards = []
+            this.dashboards.forEach((d) => {
+              activeDashboards.push(d[this.aliasKey])
+            })
+            this.activeDashboards = activeDashboards
+          }
+          this.emptyData = !(listData.length > 0)
+        }).catch((e) => {
+          this.emptyData = true
+          this.resultType = 'error'
+          this.resultMessage = e.message
+        })
+      }
     },
     loadCountInfo() {
       getInfoCount().then(response => {