wenbobowen 4 years ago
parent
commit
2343edfb94
1 changed files with 22 additions and 4 deletions
  1. 22 4
      src/views/dataBigManage/index.vue

+ 22 - 4
src/views/dataBigManage/index.vue

@@ -189,7 +189,8 @@ export default {
       bizName: '业务线', // 业务线名字
       optionData: [],
       bizCode: 0,
-      isFirstDate: true
+      isFirstDate: true,
+      depyResetList: []
     }
   },
   created() {
@@ -341,6 +342,15 @@ export default {
         children: t.children && t.children.length > 0 ? this.resetDepartmentList(t.children) : null
       }))
     },
+    resetdepyPath(path, data) {
+      data.map(t => {
+        if (t.children && t.children.length > 0) {
+          this.resetdepyPath([...path, t.value], t.children)
+        } else {
+          this.depyResetList.push([...path, t.value])
+        }
+      })
+    },
     getProvence(hot = true) { // 获取组织架构
       this.efficiencyLoading = true
       this.throughputLoading = true
@@ -359,12 +369,20 @@ export default {
               // 获取id在list中的位置
               const idPos = depyList.indexOf(deptId.toString())
               // 截取当前部门的path
-              const nowdepyList = depyList.slice(idPos, depyList.length)
+              let nowdepyList = []
+              const defaultPath = depyList.slice(idPos, depyList.length)
+              // 判断是否有子层级
+              if (res1.data.deptArch.children && res1.data.deptArch.children.length > 0) {
+                this.resetdepyPath(defaultPath, res1.data.deptArch.children)
+                nowdepyList = this.depyResetList
+              } else {
+                nowdepyList = [defaultPath]
+              }
               this.params = {
                 ...this.params,
-                deptCodes: [nowdepyList]
+                deptCodes: nowdepyList
               }
-              this.changeArchitecture([nowdepyList])
+              this.changeArchitecture(nowdepyList)
             }
           })
         } else {