Преглед изворни кода

驾驶舱-保留小数位2

wanglt пре 5 месеци
родитељ
комит
97cc9bf972

+ 3 - 3
ygtx-gxt/src/main/resources/mapper/gxt/GxtRepairOrderMapper.xml

@@ -591,7 +591,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN (
         SELECT
         rop.user_id,
-        SUM( TIMESTAMPDIFF( MINUTE, e.accept_time, f.process_time ) / 60 ) + SUM( TIMESTAMPDIFF( MINUTE, f.process_time, g.complete_time ) / 60 ) AS wxgs
+        SUM( TIMESTAMPDIFF( MINUTE, ro.accept_time, ro.real_start_time ) / 60 ) + SUM( TIMESTAMPDIFF( MINUTE, ro.real_start_time, ro.real_end_time ) / 60 ) AS wxgs
         FROM
         gxt_repair_order_person rop
         LEFT JOIN gxt_repair_order ro ON rop.order_id = ro.id
@@ -607,7 +607,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN (
         SELECT
         rop.user_id,
-        SUM( TIMESTAMPDIFF( MINUTE, e.accept_time, f.process_time ) / 60 ) + SUM( TIMESTAMPDIFF( MINUTE, f.process_time, g.complete_time ) / 60 ) AS wxgs_last
+        SUM( TIMESTAMPDIFF( MINUTE, ro.accept_time, ro.real_start_time ) / 60 ) + SUM( TIMESTAMPDIFF( MINUTE, ro.real_start_time, ro.real_end_time ) / 60 ) AS wxgs_last
         FROM
         gxt_repair_order_person rop
         LEFT JOIN gxt_repair_order ro ON rop.order_id = ro.id
@@ -623,7 +623,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN (
         SELECT
         wop.user_id,
-        SUM( TIMESTAMPDIFF( MINUTE, h.process_time, i.complete_time ) / 60 ) AS wbgs
+        SUM( TIMESTAMPDIFF( MINUTE, wo.real_start_time, wo.real_end_time ) / 60 ) AS wbgs
         FROM
         gxt_work_order_person wop
         LEFT JOIN gxt_work_order wo ON wop.order_id = wo.id

+ 11 - 2
ygtx-ui/src/views/index4.vue

@@ -377,7 +377,7 @@
               </div>
             </div>
             <div class="card-content">
-              <div class="data-value">{{ homePageData.wbgs }}</div>
+              <div class="data-value">{{ formatWorkValue(homePageData.wbgs) }}</div>
               <div class="data-description" :style="{ color: getTextColor(homePageData.wbjsy) }">
                 <i v-if="homePageData.wbjsy > 0" class="fa fa-arrow-up" style="margin-right: 4px;"></i>
                 <i v-else-if="homePageData.wbjsy < 0" class="fa fa-arrow-down" style="margin-right: 4px;"></i>
@@ -395,7 +395,7 @@
               </div>
             </div>
             <div class="card-content">
-              <div class="data-value">{{ homePageData.score }}</div>
+              <div class="data-value">{{ formatWorkValue(homePageData.score) }}</div>
               <div class="data-description" :style="{ color: getTextColor(homePageData.wxjsy) }">
                 <i v-if="homePageData.wxjsy > 0" class="fa fa-arrow-up" style="margin-right: 4px;"></i>
                 <i v-else-if="homePageData.wxjsy < 0" class="fa fa-arrow-down" style="margin-right: 4px;"></i>
@@ -1372,6 +1372,15 @@ export default {
       if (cellValue == null || cellValue === '') return '--'; // 处理空值
       return parseFloat(cellValue).toFixed(2); // 保留两位小数
     },
+    // 格式化工时和工分显示,0显示为0,小数位超过两位时四舍五入
+    formatWorkValue(value) {
+      if (value == null || value === '') return '--'; // 处理空值
+      const num = parseFloat(value);
+      // 四舍五入保留两位小数
+      const rounded = num.toFixed(2);
+      // 去掉不必要的末尾0
+      return parseFloat(rounded).toString();
+    },
     handleExport() {
       this.download("gxt/order/exportHomePageOrderList", this.queryParams, `homePageOrderList_${new Date().getTime()}.xlsx`);
     },