浏览代码

2022.7.31 任务分组报表

ggooalice 2 年之前
父节点
当前提交
3c0d370053
共有 1 个文件被更改,包括 59 次插入18 次删除
  1. 59 18
      fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/list.vue

+ 59 - 18
fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/list.vue

@@ -731,7 +731,7 @@ export default {
 
       personnelList: [], //'人员工时统计表'
       groupWorktimeList: [], //任务分组工时表
-      groupWorktimeAll: []
+      groupWorktimeAll: [],
     };
   },
   computed: {},
@@ -990,7 +990,8 @@ export default {
                 } else if(this.ins == 11) {
                     this.getPersonnelList()
                 }else if(this.ins == 12){
-                    this.getGroupWorktimeList('picks')
+                    this.getGroupWorktimeList()
+                    this.getGroupWorktimeAll()
                 }
             },
       exportExcel() {
@@ -1460,14 +1461,14 @@ export default {
           })
         })
     },
-    getGroupWorktimeList(sel){
+    getGroupWorktimeList(){
       let parameter = {
         startDate: this.rangeDatas[0],
         endDate: this.rangeDatas[1],
         pageIndex: this.page,
         pageSize: this.size
       }
-      if(this.proJuctId && sel == 'selcts'){
+      if(this.proJuctId){
         parameter.projectId = this.proJuctId
       }
       this.listLoading = true
@@ -1476,20 +1477,22 @@ export default {
           this.listLoading = false
           if(res.code == 'ok'){
             this.groupWorktimeList = []
-            this.total = res.data.total
-            // this.groupWorktimeList = res.data.records
-            if(sel == 'picks'){
-              this.groupWorktimeAll = res.data.records
-            }
             let list = res.data.records
-            for(let i in this.groupWorktimeAll){
+            this.groupWorktimeAll.length > res.data.total ? this.total = this.groupWorktimeAll.length : this.total = res.data.total
+            let forlength = 0
+            if(this.groupWorktimeAll.length - this.size*(this.page-1) < list.length){
+              forlength = list.length
+            }else{
+              forlength = this.groupWorktimeAll.length - this.size*(this.page-1) > this.size ? this.size : this.groupWorktimeAll.length - this.size*(this.page-1)
+            }
+            for(let i=0; i<forlength; i++){
               let item = {
-                leftgroupName: this.groupWorktimeAll[i].groupName,
-                leftworkingTime: this.groupWorktimeAll[i].workingTime,
-                rightprojectCode: i < list.length ? list[i].projectCode : null,
-                rightprojectName: i < list.length ? list[i].projectName : null,
-                rightgroupName: i < list.length ? list[i].groupName : null,
-                rightworkingTime: i < list.length ? list[i].workingTime : null
+                leftgroupName: this.groupWorktimeAll[i + this.size*(this.page - 1)] ? this.groupWorktimeAll[i + this.size*(this.page - 1)].groupName : null,
+                leftworkingTime: this.groupWorktimeAll[i + this.size*(this.page - 1)] ? this.groupWorktimeAll[i + this.size*(this.page - 1)].workingTime : null,
+                rightprojectCode: list[i] ? list[i].projectCode : null,
+                rightprojectName: list[i] ? list[i].projectName : null,
+                rightgroupName: list[i] ? list[i].groupName : null,
+                rightworkingTime: list[i] ? list[i].workingTime : null
               }
               this.groupWorktimeList.push(item)
             }
@@ -1508,6 +1511,43 @@ export default {
           })
         })
     },
+    getGroupWorktimeAll(){
+      let parameter = {
+        startDate: this.rangeDatas[0],
+        endDate: this.rangeDatas[1],
+        pageIndex: 1,
+        pageSize: 9999
+      }
+      this.http.post('/project/getTimeCostByGroup',parameter,
+        res => {
+          if(res.code == 'ok'){
+              this.groupWorktimeAll = []
+              let allList = JSON.parse(JSON.stringify(res.data.records))
+              for(let m in allList){
+                let isin = false
+                for(let n in this.groupWorktimeAll){
+                  if(this.groupWorktimeAll[n].groupName == allList[m].groupName){
+                    isin = true
+                    this.groupWorktimeAll[n].workingTime = this.groupWorktimeAll[n].workingTime + allList[m].workingTime
+                  }
+                }
+                if(!isin){
+                  this.groupWorktimeAll.push(allList[m])
+                }
+              }
+          }else {
+            this.$message({
+              message: res.msg,
+              type: 'error'
+            })
+          }
+        },err => {
+          this.$message({
+            message: err,
+            type: 'error'
+          })
+        })
+    },
 
     budgetFilter(emList,eId){
                 let emItem = emList.filter((em)=>{
@@ -1678,7 +1718,8 @@ export default {
       }
       if(this.ins == 12){
         this.proJuctId = ''
-        this.getGroupWorktimeList('picks')
+        this.getGroupWorktimeList()
+        this.getGroupWorktimeAll()
       }
     },
     // 日期
@@ -1694,7 +1735,7 @@ export default {
     },
     selcts(e) {
       if(this.ins == 12){
-        this.getGroupWorktimeList('selcts')
+        this.getGroupWorktimeList()
       }else{
       if(e == 9){
         this.userId = null