ソースを参照

修改加班情况统计表,增加按项目统计2

yusm 1 ヶ月 前
コミット
44a053f8f6
1 ファイル変更231 行追加115 行削除
  1. 231 115
      fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/list.vue

+ 231 - 115
fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/list.vue

@@ -10,7 +10,7 @@
               :default-active="defaultActive"
               class="el-menu-vertical-demo"
               @select="staffs"
-              background-color="#ffffff" 
+              background-color="#ffffff"
               text-color="#666666"
               :active-text-color="themeColor"
               style="width:200px">
@@ -150,16 +150,32 @@
           <el-select v-if="(ins == 0 || ins == 3) && user.companyId == 4811" v-model="projectMainId" :placeholder="'请选择主项目'" clearable filterable size="small" @change="selectMainProject()">
             <el-option v-for="(item) in projectMainIdList" :key="item.id" :label="item.name" :value="item.id"></el-option>
           </el-select>
-  
-          <el-select v-if="!screeningCondition.project.includes(ins)" v-model="proJuctId" :placeholder="$t('defaultText.pleaseSelectSnItem')" :clearable="ins != 32" filterable size="small" @change="projectChange()" style="margin-left:10px">
+
+          <el-select v-if="!screeningCondition.project.includes(ins)  && !(ins == 6 && overtimeTabActive === 'project')" v-model="proJuctId" :placeholder="$t('defaultText.pleaseSelectSnItem')" :clearable="ins != 32" filterable size="small" @change="projectChange()" style="margin-left:10px">
             <el-option v-for="(item) in proListOvertime" :key="item.id" :label="item.projectName + (item.projectCode ? item.projectCode : '')" :value="item.id">
               <span style="float: left;color: #8492a6;">{{ item.projectCode }}</span>
               <span style="float: right;font-size: 13px;margin-left: 20px">{{ item.projectName }}</span>
             </el-option>
           </el-select>
+
+          <el-select v-if="ins == 6 && overtimeTabActive === 'project'"
+                     v-model="projectOvertimeProjectId"
+                     :placeholder="$t('defaultText.pleaseSelectSnItem')"
+                     clearable
+                     filterable
+                     size="small"
+                     @change="handleProjectOvertimeSearch"           style="margin-left:10px">
+            <el-option v-for="(item) in proListOvertime"
+                       :key="item.id"
+                       :label="item.projectName + (item.projectCode ? item.projectCode : '')"
+                       :value="item.id">
+              <span style="float: left;color: #8492a6;">{{ item.projectCode }}</span>
+              <span style="float: right;font-size: 13px;margin-left: 20px">{{ item.projectName }}</span>
+            </el-option>
+          </el-select>
         </div>
 
-        
+
         <template v-if="ins == 27">
           <el-radio-group v-model="estimatedWorkingHoursType" size="small" @change="groupChange()">
             <el-radio-button label="按项目查看"></el-radio-button>
@@ -189,9 +205,9 @@
         </el-select>
         <!-- 月份选择 v-if="ins == 14 || ins == 15 || ins == 19" -->
         <el-date-picker v-if="screeningCondition.months.includes(ins)" value-format="yyyy-MM" v-model="monthPersonnel" type="month" :placeholder="$t('Selectmonth')" :clearable="false" @change="selcts()" size="small"></el-date-picker>
-          
+
         <!-- 月份区间选择 v-if="ins == 14 || ins == 15 || ins == 19" -->
-        <el-date-picker v-if="screeningCondition.monthRange.includes(ins)" value-format="yyyy-MM" 
+        <el-date-picker v-if="screeningCondition.monthRange.includes(ins)" value-format="yyyy-MM"
           v-model="monthRange"
           type="monthrange"
           range-separator="至"
@@ -218,7 +234,7 @@
             <el-option :label="$t('state.no')" value="0"></el-option>
             <el-option :label="$t('state.yes')" value="1"></el-option>
           </el-select>
-          
+
           <!-- 地区筛选 -->
           <el-select v-if="ins == 19 || ins == 30" v-model="areaName" :placeholder="customNameChoose" @change="selcts()" clearable filterable size="small" style="margin-left:2px;width:150px">
             <el-option :label="item" :value="item" v-for="item,index in areaList" :key="index"></el-option>
@@ -235,7 +251,7 @@
           </el-select>
 
           <selectCat :subject="selUserList" :filterable="true" :searchBoxTop="'1'" :subjectId="userId" :clearable="true" :size="mini" @selectCal="selectCal" v-if="(screeningCondition.staff.includes(ins)) && user.userNameNeedTranslate == '1'"></selectCat>
-          
+
 
           <!-- 待审核筛选切换 -->
           <el-radio-group v-model="stateKey" size="small" v-if="ins == 10 && user.timeType.reportWorkflow == 1" style="margin-left:10px;margin-top:-3.33px" @change="stateKeySel">
@@ -293,7 +309,7 @@
         <el-button type="primary" @click="exportExcelByQuarter" size="mini" v-if="ins == 9 && user.companyId == 876">{{ $t('an-ji-du-dao-chu') }}</el-button>
         <el-button type="primary" @click="setWarning" size="mini" v-if="ins == 21">{{ $t('sheZhiYuJing') }}</el-button>
       </p>
-      
+
       <div v-if="ins == 31" style="width: 300px" class="tableRightBtn">
         <template v-if="!obtainMonthlyFinancialStatementsRows.lastSendTime">
           <el-button type="success" size="small" @click="confirmTheFinalDraft()" :disabled="obtainMonthlyFinancialStatementsRows.status">
@@ -479,7 +495,7 @@
                 </el-table-column>
                 <el-table-column prop="realCost" :label="$t('realCostFee')"  width="150" align="right">
                    <template slot-scope="scope">
-                        {{scope.row.realCost == null? 0:scope.row.realCost.toFixed(2)}} 
+                        {{scope.row.realCost == null? 0:scope.row.realCost.toFixed(2)}}
                         <el-link type="primary" :underline="false" @click="modRealCost(scope.row)" style="margin-left:10px;">
                           修改
                       </el-link>
@@ -527,7 +543,7 @@
                     </template>
                 </el-table-column> -->
                 <el-table-column :prop="item" :label="item"  width="100" align="right" v-for="item,index in baobiaoList" :key="index"></el-table-column>
-                
+
                 <el-table-column  :label="$t('totalcostos')"  width="100" align="right">
                   <template slot-scope="scope">
                          {{scope.row.allCost}}
@@ -607,7 +623,7 @@
             </el-table>
             <!--客户项目报表 -->
             <el-table v-if="ins == 4" border :data="list4"  key="4"
-            highlight-current-row v-loading="listLoading" :height="tableHeight" 
+            highlight-current-row v-loading="listLoading" :height="tableHeight"
              style="width: 100%;">
                 <el-table-column prop="customerName" :label="$t('customername')" ></el-table-column>
                 <el-table-column prop="projectNames" :label="$t('relatedprojects')">
@@ -658,7 +674,7 @@
             </el-table>
             <!--项目阶段汇总工时报表 -->
             <el-table v-if="ins == 5" border :data="list5" key="5"
-            highlight-current-row v-loading="listLoading" :height="tableHeight" 
+            highlight-current-row v-loading="listLoading" :height="tableHeight"
              style="width: 100%;" ref="table">
                 <el-table-column prop="projectCode" :label="user.companyId == '7030' ? '项目令号' : $t('Itemno')"  width="120" fixed ></el-table-column>
                 <el-table-column prop="projectName" :label="$t('headerTop.projectName')" width="240" fixed  >
@@ -690,7 +706,7 @@
                 </el-table-column>
             </el-table>
             <el-table v-if="ins == 12" border :data="groupWorktimeList.right" key="12"
-            highlight-current-row v-loading="listLoading" :height="tableHeight" 
+            highlight-current-row v-loading="listLoading" :height="tableHeight"
              style="width: 66%;float:right;" ref="grouptable">
                 <el-table-column :label="$t('statisticsbyproject')" header-align="center">
                   <el-table-column prop="projectCode" :label="user.companyId == '7030' ? '项目令号' : $t('Itemno')" min-width="75"></el-table-column>
@@ -703,8 +719,8 @@
                   </el-table-column>
                 </el-table-column>
             </el-table>
-            
-            
+
+
 
             <!-- 项目加班情况统计报表 -->
             <div v-if="ins == 6 || ins == 8">
@@ -859,11 +875,11 @@
               </el-table-column>
               <el-table-column prop="proportion" :label="$t('fei-xiang-mu-gong-shi-zhan-bi')" min-width="160" align="right">
               <!-- <el-table-column prop="proportion" :label="$t('publicprojecthourszan')" min-width="160" align="right"> -->
-                
+
               </el-table-column>
             </el-table>
             </div>
-            
+
             <!-- 工时成本预警表 -->
             <el-table v-if="ins == 7" key="7" border :data="baseCostList" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;">
             <!-- 当前总预算,已发生工时成本,xxx成本预算,xxx已发生成本,xxx已发生占比, yyy成本预算,yyy已发生成本,yyy已发生占比。 -->
@@ -1042,7 +1058,7 @@
                   </template>
                 </el-table-column>
             </el-table>
-            
+
             <!-- 人员月度工时表 -->
             <el-table v-if="ins == 14"  key="14" border :data="monthlyPersonnelList" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;">
                 <el-table-column align="center" prop="name" :label="$t('ren-yuan')" min-width="150">
@@ -1090,7 +1106,7 @@
                   <template slot-scope="scope">
                     <div>
                       <el-button
-                      type="primary" 
+                      type="primary"
                       v-if="scope.row.whether == 0 && scope.row.workingTime > 0"
                       size="mini"
                       @click="fillWorkingHours(scope.row)">{{ $t('buZuGongShi') }}</el-button>
@@ -1345,11 +1361,11 @@
               <el-table-column align="center" prop="residueTime" :label="$t('shengYuGongShiH')" width="150"></el-table-column>
             </el-table>
             <div class="packetConsumption" v-if="ins == 24" :style="`height:${tabPosition == 0 ? tableHeight : tableHeight + 50}px`" v-loading="listLoading">
-              <el-tabs v-model="tabsType" :tab-position="'left'" @tab-click="handleClick" 
+              <el-tabs v-model="tabsType" :tab-position="'left'" @tab-click="handleClick"
               :style="`height: 100%;width: 100%;margin-right: 20px`">
                 <el-tab-pane name="all" label="分组耗用表">
-                  <PackTables :datas="{ 
-                    type: tabsType, 
+                  <PackTables :datas="{
+                    type: tabsType,
                     tabPosition: tabPosition,
                     list: isbeCustomReport.consumptionSchedule,
                     height: tableHeight,
@@ -1452,7 +1468,7 @@
                 <EchartsEchar :options="groupConsumptionOption"></EchartsEchar>
               </div> -->
             </div>
-            
+
 
             <!-- 项目耗用进度表 -->
             <el-table  v-if="ins == 25" :key="25" border :data="isbeCustomReport.consumptionScheduleTwo" highlight-current-row v-loading="listLoading" :height="(+tableHeight) - 1" style="width: 100%;" >
@@ -1470,7 +1486,7 @@
                   <div class="participatingEmployee">
                     <div v-for="(item,index) in scope.row.teamLeader" :key="index">
                       <span v-if="user.userNameNeedTranslate == '1'">
-                        <TranslationOpenDataText type='userName' :openid='item.name'></TranslationOpenDataText> 
+                        <TranslationOpenDataText type='userName' :openid='item.name'></TranslationOpenDataText>
                       </span>
                       <span v-if="user.userNameNeedTranslate != '1'">
                         {{item.name}}
@@ -1485,7 +1501,7 @@
                   <div class="participatingEmployee">
                     <div v-for="(item,index) in scope.row.userProgress" :key="index">
                       <span v-if="user.userNameNeedTranslate == '1'">
-                        <TranslationOpenDataText type='userName' :openid='item.userName'></TranslationOpenDataText> 
+                        <TranslationOpenDataText type='userName' :openid='item.userName'></TranslationOpenDataText>
                         {{item.progress}}
                       </span>
                       <span v-if="user.userNameNeedTranslate != '1'">
@@ -1782,7 +1798,7 @@
               <el-table-column prop="sumTime" label="合计" align="center" width="120"></el-table-column>
             </el-table>
           </template>
-          
+
         <!--工具条-->
         <el-col :span="24" class="toolbar" v-if="ins != 6 && ins != 20 && ins != 21 && tabPosition==0 && tabsType == 'all' && ins != 31 && ins != 32 && ins != 33">
           <el-pagination
@@ -1810,12 +1826,12 @@
 
         </div>
     </div>
-    
+
   </div>
   </div>
     <!--新增界面-->
         <el-dialog :title="title" show-summary v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth" width="1000px">
-            <el-table border :data="childrenList" 
+            <el-table border :data="childrenList"
             highlight-current-row v-loading="listLoading" height="400"
              style="width: 100%;">
                 <el-table-column prop="projectNames" :label="$t('relatedprojects')">
@@ -1895,7 +1911,7 @@
                     </template>
                 </el-table-column>
                 <el-table-column prop="expenseType" :label="$t('ppertype')"  >
-                  
+
                 </el-table-column> -->
                 <el-table-column prop="expenseType" :label="$t('costtype')"></el-table-column>
                 <el-table-column prop="invoiceType" :label="$t('ppertype')" v-if="this.user.timeType.easyExpense==0">
@@ -1937,7 +1953,7 @@
                       <span v-else>-</span>
                     </template>
                 </el-table-column> -->
-               
+
             </el-table>
         </el-dialog>
 
@@ -2074,7 +2090,7 @@
                 <el-table-column align="center" prop="finishDate" :label="$t('wanChengRiQi')" min-width="150"></el-table-column>
               </el-table>
             </div>
-        
+
             <div class="pagingData">
               <el-pagination
                   @size-change="usertaskSizeChange"
@@ -2095,7 +2111,7 @@
           <div class="">
             <div style="width: 100%;text-align:center;margin-bottom:20px;">{{ $t('heXiaoGongShiShu') }}:{{ writeOffOperationTransitionData.overtimeHours }} {{ $t('time.hour') }}</div>
             <div>
-              <el-select v-model="writeOffOperationTransitionData.writeOffReason" filterable allow-create default-first-option :placeholder="$t('qingShuRuHeXiaoYuanYing')" 
+              <el-select v-model="writeOffOperationTransitionData.writeOffReason" filterable allow-create default-first-option :placeholder="$t('qingShuRuHeXiaoYuanYing')"
               style="width: 100%;">
                 <el-option
                   v-for="item in writeOffOperationTransitionData.options"
@@ -2289,8 +2305,10 @@ export default {
       ins: 10000,
       user: JSON.parse(sessionStorage.user),
       overTimeList: [], // 项目加班情况统计列表
+      projectOverTimeList: [], // 项目加班情况统计列表
       proList: [],
       proJuctId: '',
+      projectOvertimeProjectId: '',
       projectMainId: '',
       projectMainIdList: [],
       createDate: '2020-01-01',
@@ -2492,7 +2510,14 @@ export default {
     };
   },
   computed: {},
-  watch: {},
+  watch: {
+    projectOvertimeProjectId(newVal) {
+      // 当项目统计tab的项目筛选条件改变时,重新获取数据
+      if (this.ins === 6 && this.overtimeTabActive === 'project') {
+        this.getProjectOvertimeData();
+      }
+    }
+  },
   created() {
     let height = window.innerHeight;
     this.tableHeight = height - 170;
@@ -2540,21 +2565,21 @@ export default {
           return intPartFormat + floatPart
       },
       decimalPoint(value) {
-        var f = parseFloat(value);  
-        if (isNaN(f)) {  
-            return false;  
-        }  
-        var f = Math.round(f*100)/100;  
-        var s = f.toString();  
-        var rs = s.indexOf('.');  
-        if (rs < 0) {  
-            rs = s.length;  
-            s += '.';  
+        var f = parseFloat(value);
+        if (isNaN(f)) {
+            return false;
+        }
+        var f = Math.round(f*100)/100;
+        var s = f.toString();
+        var rs = s.indexOf('.');
+        if (rs < 0) {
+            rs = s.length;
+            s += '.';
         }  15
-        while (s.length <= rs + 1) {  
-            s += '0';  
-        }  
-        return s;  
+        while (s.length <= rs + 1) {
+            s += '0';
+        }
+        return s;
       },
       categoryListName(value, label) {
         let str = '-'
@@ -2598,15 +2623,21 @@ export default {
           });
       });
     },
-    // 处理按项目统计的加班数据
-    processProjectOvertimeData() {
-      // 按项目分组统计
+    //处理按项目统计的加班数据
+    processProjectOvertimeData(data) {
+      if (!data || !Array.isArray(data)) {
+        this.projectOvertimeList = [];
+        return;
+      }
+
+      //按项目分组统计
       const projectMap = new Map();
 
-      this.overTimeList.forEach(item => {
-        const key = item.projectCode || item.projectName;
+      data.forEach(item => {
+        const key = item.projectId;
         if (!projectMap.has(key)) {
           projectMap.set(key, {
+            projectId: item.projectId,
             projectCode: item.projectCode,
             projectName: item.projectName,
             workingTime: 0,
@@ -2615,16 +2646,19 @@ export default {
           });
         }
 
-        const projectItem = projectMap.get(key);
-        projectItem.workingTime += item.workingTime || 0;
-        projectItem.overtimeHours += item.overtimeHours || 0;
-        projectItem.cost += item.cost || 0;
+        const project = projectMap.get(key);
+        project.workingTime += item.workingTime || 0;
+        project.overtimeHours += item.overtimeHours || 0;
+        project.cost += item.cost || 0;
       });
 
-      // 转换为数组并按项目代码排序
-      this.projectOvertimeList = Array.from(projectMap.values()).sort((a, b) => {
-        return (a.projectCode || a.projectName).localeCompare(b.projectCode || b.projectName);
-      });
+      //转换为数组并更新到 projectOvertimeList
+      this.projectOvertimeList = Array.from(projectMap.values()).map(item => ({
+        ...item,
+        workingTime: parseFloat(item.workingTime.toFixed(1)),
+        overtimeHours: parseFloat(item.overtimeHours.toFixed(1)),
+        cost: parseFloat(item.cost.toFixed(2))
+      }));
     },
     expensesSummaries(param) {
       const { columns, data } = param;
@@ -2693,7 +2727,7 @@ export default {
       if(this.permissions.reportOvertime || this.permissions.reportAllOvertime) {this.ssl(6);this.defaultActive = '1-8';return} else
       if(this.permissions.reportTimely || this.permissions.reportAllTimely) {this.ssl(9);this.defaultActive = '1-10';return} else
       if(this.permissions.reportAllGroup || this.permissions.reportGroup) {this.ssl(12);this.defaultActive = '1-13';return} else
-      if(this.permissions.reportAuditRate) {this.ssl(10);this.defaultActive = '1-11';return} else 
+      if(this.permissions.reportAuditRate) {this.ssl(10);this.defaultActive = '1-11';return} else
       if(this.permissions.reportPersonnel || this.permissions.reportResponsible) {this.ssl(11);this.defaultActive = '1-12';return} else
       if(this.permissions.reportMonthlyPersonnel || this.permissions.reportResponsiblePersonnel) {this.ssl(14);this.defaultActive = '1-15';return} else
       if(this.permissions.reportAllDepartmentParticipation || this.permissions.reportResponsibleDepartmentParticipation) {this.ssl(15);this.defaultActive = '1-16';return} else
@@ -2816,7 +2850,7 @@ export default {
         }
       });
     },
-    
+
     getUserList() {
       console.log(this.shuzArr[this.ins])
       this.http.post('/user/getUserListByRole', {
@@ -2880,7 +2914,7 @@ export default {
                 for(var i in arr) {
                     if(arr[i].id == -1 || arr[i].id == 0) {
                         arr.splice(i,1)
-                    }    
+                    }
                 }
                 return arr;
             },
@@ -2915,7 +2949,7 @@ export default {
           } else {
             sums[index] = 'N/A';
           }
-          
+
         });
         this.$nextTick(()=>{ this.$refs.tab.doLayout()})
         return sums;
@@ -2968,14 +3002,47 @@ export default {
             });
         });
     },
+
+    handleProjectOvertimeSearch() {
+      this.getProjectOvertimeData();
+    },
+    processFilteredProjectOvertimeData(filteredList) {
+      // 按项目分组统计
+      const projectMap = new Map();
+
+      filteredList.forEach(item => {
+        const key = item.projectId;
+        if (!projectMap.has(key)) {
+          projectMap.set(key, {
+            projectId: item.projectId,
+            projectCode: item.projectCode,
+            projectName: item.projectName,
+            workingTime: 0,
+            overtimeHours: 0,
+            cost: 0
+          });
+        }
+
+        const projectItem = projectMap.get(key);
+        projectItem.workingTime += item.workingTime || 0;
+        projectItem.overtimeHours += item.overtimeHours || 0;
+        projectItem.cost += item.cost || 0;
+      });
+
+      // 转换为数组并按项目代码排序
+      this.projectOvertimeList = Array.from(projectMap.values());
+    },
     expandRow(row, index) {
       this.title = this.$t('ke-hu')+':'+row.customerName;
         this.childrenList = row.children;
         this.addFormVisible = true;
       },
     handleOvertimeTabClick(tab) {
-      if (tab.name === 'project' && this.projectOvertimeList.length === 0) {
-        this.processProjectOvertimeData();
+      if (tab.name === 'detail') {
+        this.getOvertimeDetailData();
+      } else if (tab.name === 'project') {
+        //每次切换到项目统计tab都重新获取完整的统计数据
+        this.getProjectOvertimeData();
       }
     },
             //分页
@@ -3044,7 +3111,7 @@ export default {
                     this.getProjectInAndOut();
                 } else if (this.ins == 4) {
                     this.getcusProjectList()
-                    
+
                 } else if (this.ins == 5) {
                     this.getProjectStages();
                 } else if (this.ins == 6) {
@@ -3141,7 +3208,7 @@ export default {
         var url = "/project";
         var fName = "";
         var sl = {}
-        if (this.ins == 0) {  
+        if (this.ins == 0) {
           fName = this.$t('projectreport') + '.xlsx';
           url += "/exportProject";
           if(this.user.companyId == 4811) {
@@ -3451,7 +3518,7 @@ export default {
                     a.remove();
                     this.exportLoading = false
                     this.byQuarterDialog  = false
-                    
+
                 } else {
                     this.$message({
                     message: res.msg,
@@ -3518,7 +3585,7 @@ export default {
       res => {
           if (res.code == "ok") {
               this.efficentList = res.data;
-              this.listLoading = false; 
+              this.listLoading = false;
           } else {
               this.$message({
               message: res.msg,
@@ -3587,7 +3654,7 @@ export default {
               }
               this.fTEDataList = res.data.resultList;
               this.total = res.data.total;
-              this.listLoading = false; 
+              this.listLoading = false;
           } else {
               this.$message({
               message: res.msg,
@@ -3634,7 +3701,7 @@ export default {
               }
               this.fTEPlanDataList = res.data.resultList;
               this.total = res.data.total;
-              this.listLoading = false; 
+              this.listLoading = false;
           } else {
               this.$message({
               message: res.msg,
@@ -3714,7 +3781,7 @@ export default {
             if (res.code == "ok") {
                 this.personnelList = res.data.result;
                 this.total = res.data.total;
-                this.listLoading = false; 
+                this.listLoading = false;
             } else {
                 this.$message({
                 message: res.msg,
@@ -3741,7 +3808,7 @@ export default {
             if (res.code == "ok") {
                 this.list4 = res.data.records;
                 this.total = res.data.total;
-                this.listLoading = false; 
+                this.listLoading = false;
             } else {
                 this.$message({
                 message: res.msg,
@@ -3769,7 +3836,7 @@ export default {
                 this.list3 = res.data.records;
                 this.list3HeadList = res.data.mainTypeList;
                 this.total = res.data.total;
-                this.listLoading = false; 
+                this.listLoading = false;
             } else {
                 this.$message({
                 message: res.msg,
@@ -3951,7 +4018,21 @@ export default {
             });
         });
     },
-    overTime() {
+    overTime(){
+      if (this.overtimeTabActive === 'detail') {
+        this.getOvertimeDetailData();
+      } else if (this.overtimeTabActive === 'project') {
+        this.getProjectOvertimeData();
+        // // 如果已经有明细数据,可以直接处理项目统计数据
+        // if (this.overTimeList && this.overTimeList.length > 0) {
+        //   this.handleProjectOvertimeSearch();
+        // } else {
+        //   // 否则获取项目统计数据
+        //   this.getProjectOvertimeData();
+        // }
+      }
+    },
+    getOvertimeDetailData() {
       this.listLoading = true;
       var obj = {
         projectId: this.proJuctId,
@@ -3991,12 +4072,6 @@ export default {
                   }
                   return item.writeOffValue == 0 ? { ...item, ...obj } : { ...item }
                 })
-              //清空项目统计数据,下次切换tab时重新计算
-              this.projectOvertimeList = [];
-              //如果当前是项目统计tab,则处理数据
-              if (this.overtimeTabActive === 'project') {
-                this.processProjectOvertimeData();
-              }
             } else {
                 this.$message({
                 message: res.msg,
@@ -4010,7 +4085,48 @@ export default {
                 type: "error"
             });
         });
-    }, 
+    },
+    getProjectOvertimeData() {
+      this.listLoading = true;
+      var obj = {
+        projectId: this.projectOvertimeProjectId, // 使用项目统计专用的项目ID
+        startDate: this.rangeDatas[0],
+        endDate: this.rangeDatas[1],
+      }
+
+      // 项目统计不需要人员和核销状态筛选,但需要部门筛选
+      if(this.departmentIdArray.length != 0 && this.departmentIdArray[0] != ''){
+        let deptid = []
+        if(this.user.userNameNeedTranslate != '1') {
+          for(let i in this.departmentIdArray){
+            deptid.push(this.departmentIdArray[i][this.departmentIdArray[i].length - 1])
+          }
+        } else {
+          deptid = this.departmentIdArray
+        }
+        obj.departmentId = deptid
+      }
+
+      this.http.post('/project/getOvertimeList', obj,
+          res => {
+            if (res.code == "ok") {
+              this.listLoading = false
+              // 处理按项目统计数据
+              this.processProjectOvertimeData(res.data);
+            } else {
+              this.$message({
+                message: res.msg,
+                type: "error"
+              });
+            }
+          },
+          error => {
+            this.$message({
+              message: error,
+              type: "error"
+            });
+          });
+    },
     tableSort({column, prop, order}){
         if(prop == 'userName'){
             this.sortOrder = order
@@ -4018,7 +4134,7 @@ export default {
             this.getETF()
         }
     },
-    getAllProjectCost() { 
+    getAllProjectCost() {
       this.listLoading = true;
       this.http.post('/project/getAllProjectCost', {
                     pageIndex: this.page,
@@ -4031,7 +4147,7 @@ export default {
                 this.total = res.data.total;
                 this.baobiaoList = res.data.expenseMainTypeList
                 this.$forceUpdate()
-                this.listLoading = false; 
+                this.listLoading = false;
             } else {
                 this.$message({
                 message: res.msg,
@@ -4094,7 +4210,7 @@ export default {
                   this.rowspan(this.listArr3,this.listPosition3,'groupId')
                 }
                 this.total = res.data.total;
-                this.listLoading = false; 
+                this.listLoading = false;
             } else {
                 this.$message({
                 message: res.msg,
@@ -4150,7 +4266,7 @@ export default {
     },
     //获取项目阶段的汇总工时
     getProjectStages(e) {
-      
+
       this.listLoading = true;
       let parameter = {
         pageIndex: this.page,
@@ -4180,7 +4296,7 @@ export default {
                 if(!e){
                   this.firstStages = res.data.stages;
                 }
-                this.listLoading = false; 
+                this.listLoading = false;
                 this.$nextTick(()=>{this.$refs.table.doLayout()})
             } else {
                 this.$message({
@@ -4357,7 +4473,7 @@ export default {
           if(res.code == 'ok'){
             this.total = res.data.total
             this.groupWorktimeList.right = res.data.records
-            
+
           }else {
             this.$message({
               message: res.msg,
@@ -4386,7 +4502,7 @@ export default {
           if(res.code == 'ok'){
               this.groupTotal = res.data.total
               this.groupWorktimeList.left = res.data.records
-              
+
           }else {
             this.$message({
               message: res.msg,
@@ -4433,7 +4549,7 @@ export default {
       }
     },
 
-    
+
     getProjectList() {
       this.listLoading = true;
       this.http.post('/project/getProjectPage', {
@@ -4447,7 +4563,7 @@ export default {
                 this.list0 = res.data.records;
                 this.total = res.data.total;
                 this.proList = res.data.records
-                this.listLoading = false; 
+                this.listLoading = false;
             } else {
                 this.$message({
                 message: res.msg,
@@ -4682,7 +4798,7 @@ export default {
               this.rowspan(this.listArr1,this.listPosition1,'project_code')
               this.rowspan(this.listArr2,this.listPosition2,'project_name')
               this.total = res.data.total;
-              this.listLoading = false; 
+              this.listLoading = false;
             } else {
                 this.$message({
                 message: res.msg,
@@ -4760,11 +4876,11 @@ export default {
       }else if(this.ins == 15){
         this.getDepartmentsInvolved()
       }else if(this.ins == 6){
-        if (this.overtimeTabActive === 'detail') {
+        // if (this.overtimeTabActive === 'detail') {
           this.overTime();
-        } else {
-          this.processProjectOvertimeData();
-        }
+        // } else {
+        //   this.processProjectOvertimeData();
+        // }
       }else{
       if(e == 9){
         console.log(this.departmentIdArray);
@@ -4993,7 +5109,7 @@ export default {
 
         return false
       }
-      
+
       return ''
     },
     // 获取项目分类
@@ -5061,7 +5177,7 @@ export default {
       }else{
         value=this.userTaskUserId
       }
-      this.userTasklistLoading = true; 
+      this.userTasklistLoading = true;
       let parameter = {
         pageIndex: this.userTaskPage,
         pageSize: this.userTaskSize,
@@ -5074,7 +5190,7 @@ export default {
             if (res.code == "ok") {
                 this.userTaskTotal = res.data.total;
                 this.userTaskData = res.data.records
-                this.userTasklistLoading = false; 
+                this.userTasklistLoading = false;
             } else {
                 this.$message({
                 message: res.msg,
@@ -5106,7 +5222,7 @@ export default {
             if (res.code == "ok") {
                 this.total = res.data.total;
                 this.taskCompletedData = res.data.records
-                this.listLoading = false; 
+                this.listLoading = false;
             } else {
                 this.$message({
                 message: res.msg,
@@ -5141,7 +5257,7 @@ export default {
       this.listLoading = true
       let { data } = await this.postData('/project/groupExpendProcessList', {
         ...parameter
-      }) 
+      })
       this.resetMerge()
       this.rowspan(this.listArr1, this.listPosition1, 'projectId', data.record)
       this.rowspan(this.listArr2, this.listPosition2, 'currentStageName', data.record, 'projectId')
@@ -5164,7 +5280,7 @@ export default {
       this.listLoading = true
       let { data } = await this.postData('/project/projectExpendProcessList', {
         ...parameter
-      }) 
+      })
       this.isbeCustomReport.consumptionScheduleTwo = data.record
       this.total = data.total
       this.listLoading = false
@@ -5292,7 +5408,7 @@ export default {
       this.proJuctId = ''
       this.getProjectListOvertime()
       this.projectChange()
-    }, 
+    },
     getProjectMainIdList() {
       this.postData('/project/getAllMainProject', {}).then((res) => {
         this.projectMainIdList = res.data || []
@@ -5372,7 +5488,7 @@ export default {
           })
         })
       })
-      
+
     },
     immediateVisableCli() {
       this.immediateDateValue = JSON.parse(JSON.stringify(this.obtainMonthlyFinancialStatementsRows.timesheetDate))
@@ -5454,7 +5570,7 @@ export default {
         '按人员查看': 1,
       }[this.timelyTaskHoursRadio]
       this.timelyReportingOfTaskHoursLoading = true
-      this.postData(`/report/getReportRateOfTask`, { ...sl }).then(res => { 
+      this.postData(`/report/getReportRateOfTask`, { ...sl }).then(res => {
         this.timelyReportingOfTaskHoursList = res.data || []
       }).finally(() => {
         this.timelyReportingOfTaskHoursLoading = false
@@ -5467,7 +5583,7 @@ export default {
       sl.projectId = this.proJuctId
       sl.ymonth = this.selectYmonth;
       this.manufacturingCostLoading = true
-      this.postData(`/report/getProduceTimeReport`, { ...sl }).then(res => { 
+      this.postData(`/report/getProduceTimeReport`, { ...sl }).then(res => {
         this.manufacturingCost = res.data || []
       }).finally(() => {
         this.manufacturingCostLoading = false
@@ -5483,7 +5599,7 @@ export default {
         endDate: this.rangeDatas[1],
       }
       this.workPackageOrderNumberLoading = true
-      this.postData(`/project/getWorkOrderNumStatistics`, { ...sl }).then(res => { 
+      this.postData(`/project/getWorkOrderNumStatistics`, { ...sl }).then(res => {
         // this.workPackageOrderNumber = res.data || []
         this.workPackageOrderNumber = res.data
         this.total = res.data.totalCount
@@ -5491,7 +5607,7 @@ export default {
         this.workPackageOrderNumberLoading = false
       })
     },
-    
+
     // 任务工时填报及时表开始合并
     timelyFormForFillingInTaskHoursSpanMethod({ row, column, rowIndex }) {
       const theFirstColumn = {
@@ -5721,11 +5837,11 @@ export default {
 .pu_bu_t {
   color: #20A0F7;
   cursor: pointer;
-  display: block; 
-  float: right; 
-  position: 
-  relative; 
-  top: -20px; 
+  display: block;
+  float: right;
+  position:
+  relative;
+  top: -20px;
   right: 63px;
 }
 .pu_table {