zhaoke 2 年之前
父節點
當前提交
34be267794
共有 2 個文件被更改,包括 17 次插入13 次删除
  1. 1 1
      src/getMenu.js
  2. 16 12
      src/views/systemSettings/views/newAuth/index.vue

+ 1 - 1
src/getMenu.js

@@ -152,7 +152,7 @@ function parseMenu (arr) {
     ? newMenus.sort((a, b) => a.meta.show_index - b.meta.show_index)
     : []
   // allMenus.map(item => {
-  //   item.children = item.children ?? item.children.sort((a, b) => a.meta.show_index - b.meta.show_index)
+  //   item.children = (item.children && item.children.length) ? item.children.sort((a, b) => a.meta.show_index - b.meta.show_index) : item.children
   // })
   allMenus.push({
     path: '/:pathMatch(.*)',

+ 16 - 12
src/views/systemSettings/views/newAuth/index.vue

@@ -95,6 +95,7 @@ import Menu from './components/menu.vue'
 import Catalogue from './components/catalogue.vue'
 import Button from './components/button.vue'
 import Table from './components/table.vue'
+import { getToken } from '@/utils/auth'
 export default {
   name: 'NewAuth',
   mixins: [pb, pf],
@@ -170,18 +171,21 @@ export default {
     //获取tree数据
     async setTreeData () {
       const keys = []
-      const result = await this.getQuery(this.queryId)
-      const treeMenu = listToTree(result, 'up_auth_id', 'auth_id')
-      const newTreeMenu = treeMenu && treeMenu.length ? treeMenu.sort((a, b) => a.show_index - b.show_index) : treeMenu
-      newTreeMenu.forEach(item => {
-        keys.push(item.auth_id)
-        item.children = item.children && item.children.length ? item.children.sort((a, b) => a.show_index - b.show_index) : item.children
-      })
-      this.expandedKeys = keys
-      this.treeDatas = _.cloneDeep(newTreeMenu)
-      this.authDataArr = result.filter(item => item.auth_type != 3)
-      this.treeData[0].children = newTreeMenu
-      this.$store.dispatch("auth/changeAuthArrs", result);
+      const { code, returnData
+      } = await this.getQueryList(SERVICE_ID.sysAuthId, { user_id: getToken('userid') })
+      if (code == 0 && returnData && returnData.length) {
+        const treeMenu = listToTree(returnData, 'up_auth_id', 'auth_id')
+        const newTreeMenu = treeMenu && treeMenu.length ? treeMenu.sort((a, b) => a.show_index - b.show_index) : treeMenu
+        newTreeMenu.forEach(item => {
+          keys.push(item.auth_id)
+          item.children = item.children && item.children.length ? item.children.sort((a, b) => a.show_index - b.show_index) : item.children
+        })
+        this.expandedKeys = keys
+        this.treeDatas = _.cloneDeep(newTreeMenu)
+        this.authDataArr = returnData.filter(item => item.auth_type != 3)
+        this.treeData[0].children = newTreeMenu
+        this.$store.dispatch("auth/changeAuthArrs", returnData);
+      }
     },
     //获取应用数据
     async getApp () {