Переглянути джерело

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

wutt 5 роки тому
батько
коміт
b69af037f4

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -174,7 +174,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 totalWorkingTime += timeCalculation.getDuration();
             }
             //把总秒数转为double后换算为小时并保留两位小数
-            resultMap.put("time", new DecimalFormat("#.00").format((double) totalWorkingTime / 3600));
+            resultMap.put("time", new DecimalFormat("0.00").format((double) totalWorkingTime / 3600));
             //顺便返回该公司全部的计划
             resultMap.put("project", projectMapper.selectList(new QueryWrapper<Project>()
                     .eq("company_id", userMapper.selectById(userId).getCompanyId())));

+ 4 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TimeCalculationServiceImpl.java

@@ -55,6 +55,9 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
             timeArray[timeCalculation.getActionType() + 1] += timeCalculation.getDuration();
         }
         resultMap.put("timeDistribution", timeArray);
+        Double total = (double) (timeArray[0] + timeArray[1] + timeArray[2] + timeArray[3] +
+                timeArray[4] + timeArray[5] + timeArray[6]) / 3600;
+        resultMap.put("total", new DecimalFormat("0.00").format(total));
         httpRespMsg.data = resultMap;
         return httpRespMsg;
     }
@@ -179,7 +182,7 @@ public class TimeCalculationServiceImpl extends ServiceImpl<TimeCalculationMappe
                 dataMap.put("time", list);
                 //这里检查如果只需要一天记录的话 说明是pc端界面那个地方 那就再多计算一个当天总工作时间
                 if (dateList.size() == 1) {
-                    dataMap.put("total", new DecimalFormat("#.00").format((double) total / 3600));
+                    dataMap.put("total", new DecimalFormat("0.00").format((double) total / 3600));
                 }
                 resultList.add(dataMap);
             }

+ 41 - 11
fhKeeper/formulahousekeeper/timesheet/src/views/desktop/detail.vue

@@ -37,7 +37,7 @@
             </el-image>
           </div>
           <div class="one_card_txt">
-            <span>{{item.type}}</span>
+            <span>{{converType(item.type)}}</span>
             <div class="bottom clearfix">
               <time class="time">{{item.time}}</time>
             </div>
@@ -79,7 +79,7 @@ export default {
             this.uTime = res.data.date;
             this.timeList = res.data.timeDistribution;
             //注意目前仅第0项即行为代码为0被计入正常工作 后续可能需要修改
-            this.uHours = this.timeList[0];
+            this.uHours = res.data.total;
             this.setEcharts();
             //之后顺便再获取一下截图
             this.getScreenshot();
@@ -183,15 +183,17 @@ export default {
             radius: [30, 110],
             roseType: "area",
             data: [
-              { value: this.timeList[0], name: "编程" },
-              { value: this.timeList[1], name: "查资料" },
-              { value: this.timeList[2], name: "看文档" },
-              { value: this.timeList[3], name: "做设计" },
-              { value: this.timeList[4], name: "美工" },
-              { value: this.timeList[5], name: "运营" },
-              { value: this.timeList[6], name: "看小说" },
-              { value: this.timeList[7], name: "打游戏" },
-              { value: this.timeList[8], name: "听音乐" }
+              { value: this.timeList[0], name: "其他" },
+              { value: this.timeList[1], name: "编程" },
+              { value: this.timeList[2], name: "上网" },
+              { value: this.timeList[3], name: "文档" },
+              { value: this.timeList[4], name: "设计" },
+              { value: this.timeList[5], name: "美工" },
+              { value: this.timeList[6], name: "运营" },
+              { value: this.timeList[7], name: "看小说" },
+              { value: this.timeList[8], name: "影视娱乐" },
+              { value: this.timeList[8], name: "听音乐" },
+              { value: this.timeList[9], name: "未知" }
             ]
           }
         ]
@@ -201,6 +203,34 @@ export default {
 
     getSrcList(index) {
       return this.srcList.slice(index).concat(this.srcList.slice(0, index));
+    },
+
+    //类型枚举转换
+    converType(type) {
+      switch (type) {
+        case 0:
+          return "其他";
+        case 1:
+          return "编程";
+        case 2:
+          return "上网";
+        case 3:
+          return "文档";
+        case 4:
+          return "设计";
+        case 5:
+          return "美工";
+        case 6:
+          return "运营";
+        case 7:
+          return "看小说";
+        case 8:
+          return "影视娱乐";
+        case 9:
+          return "听音乐";
+        default:
+          return "未知";
+      }
     }
   },