Pārlūkot izejas kodu

修复6750 人员管理看板切换部门没反应

zhonghuizhen 4 mēneši atpakaļ
vecāks
revīzija
9f3b1e1908

+ 12 - 10
src/views/component/selectPositions.vue

@@ -40,17 +40,19 @@ export default {
     }
   },
   watch: {
-    selection(val) {
-      if (!val) {
-        return
-      }
-      this.$emit('handleFunc', {
-        selection: this.selection,
-        selectionDept: this.selectionDept,
-        filterDept: this.filterDept
-      })
+  selection(val) {
+    if (val) {
+      // 根据新选的val重新查找对应的部门
+      this.selectionDept = this.$store.getters.deptList.find((i) => i.positionId === val) || {}
     }
-  },
+    console.log('选中部门', val,this.selectionDept, this.filterDept)
+    this.$emit('handleFunc', {
+      selection: val,
+      selectionDept: this.selectionDept,
+      filterDept: this.filterDept
+    })
+  }
+},
   mounted() {
     this.getPositionList()
   },

+ 21 - 8
src/views/peopleManages/taskStatistics/index.vue

@@ -854,7 +854,8 @@ export default {
       this.allView()
     }
   },
-  mounted() {},
+  mounted() {
+  },
   beforeDestroy() {
     if (this.interval) {
       clearInterval(this.interval)
@@ -1192,7 +1193,6 @@ export default {
     getPositionPeopleIds(positionId) {
       const { userList } = this.$store.getters
       // return userList.filter(user => user.positionId.indexOf(positionId) > -1)
-
       return userList.filter(
         (user) =>
           user.positionId.indexOf(positionId) > -1 &&
@@ -1204,8 +1204,12 @@ export default {
     },
     // 根据部门和时间获取考试统计数据
     async getExamStatisticsData() {
-      if (this.positionsIdArr.length) {
-        const users = this.getPositionPeopleIds(this.positionsIdArr[0])
+      
+      //if (this.positionsIdArr.length) {
+        let users = this.getPositionPeopleIds(this.positionsIdArr[0])
+        if(this.depth3){
+          users = this.getPositionPeopleIds(this.depth3)
+        }
         const userIds = users.map((user) => user.userId)
         const renyuan =
           userIds.map((i) => `'${i}'`).join(',') !== ''
@@ -1275,7 +1279,7 @@ export default {
         this.optionExamStatisticsConfig.series[2].data = resultData.map(
           (item) => item.passRate
         )
-      }
+      //}
     },
     // 根据部门和时间获取培训统计数据
     async getTrainingStatisticsData() {
@@ -1284,9 +1288,14 @@ export default {
         params.startTime = this.startDate
         params.endTime = this.endDate
       }
-      if (this.positionsIdArr.length) {
-        params.deptId = this.positionsIdArr[0]
+      if (this.depth3) {
+        params.deptId = this.depth3
+      }else{
+         if (this.positionsIdArr.length) {
+          params.deptId = this.positionsIdArr[0]
+        }
       }
+     
       const { data } = await getUserStatisticList(params)
       data.sort((a, b) => {
         return a.id_ - b.id_
@@ -1314,7 +1323,11 @@ export default {
     handleFunc(e) {
       // console.log(e, 'eeeeeeeeee')
       const { selection, selectionDept, filterDept } = e
-      this.depth3 = filterDept.filter((i) => i.depth === 3)[0].positionId
+      if (selection) {
+        this.depth3 = selection
+      }else{
+        this.depth3 = filterDept.filter((i) => i.depth === 3)[0].positionId
+      }
       this.sqlPositionsDatasIni = filterDept
       const arr = selectionDept.path.split('.')
       const selArr =