Pārlūkot izejas kodu

fix: department tree

Casper Dai 2 gadi atpakaļ
vecāks
revīzija
406324cc76
1 mainītis faili ar 9 papildinājumiem un 7 dzēšanām
  1. 9 7
      src/api/user.js

+ 9 - 7
src/api/user.js

@@ -314,12 +314,12 @@ export function getDepartments () {
 }
 
 export function getDepartmentTree () {
-  if (store.getters.isTenantAdmin) {
+  if (store.getters.isTopGroup) {
     return getDepartments().then(({ data }) => {
       return {
         data: [{
           path: store.getters.tenant,
-          name: '我的部门',
+          name: store.getters.tenantName || '我的部门',
           children: data
         }]
       }
@@ -330,11 +330,13 @@ export function getDepartmentTree () {
     method: 'GET'
   }).then(({ data }) => {
     return {
-      data: [{
-        path: store.getters.org,
-        name: '我的部门',
-        children: data || []
-      }]
+      data: Array.isArray(data)
+        ? [{
+          path: store.getters.org,
+          name: '我的部门',
+          children: []
+        }]
+        : [data]
     }
   })
 }