From ff671be57f9b54f76eb6c761e9e5f5cba91880b4 Mon Sep 17 00:00:00 2001
From: weicd <weicd@yhzhg.cn>
Date: Thu, 28 Dec 2023 01:50:23 +0000
Subject: [PATCH] 任务分配数据显示保留两位小数

---
 eladmin-web-master/src/views/task/taskUser/index.vue |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/eladmin-web-master/src/views/task/taskUser/index.vue b/eladmin-web-master/src/views/task/taskUser/index.vue
index f805d9b..a6a7b59 100644
--- a/eladmin-web-master/src/views/task/taskUser/index.vue
+++ b/eladmin-web-master/src/views/task/taskUser/index.vue
@@ -97,7 +97,7 @@
               <div style="width: 35%;float: left">
                 任务名称:{{ TaskName }}
                 <p v-for="(item, index) in taskUserDetail" :key="index">
-                  {{ index }} 共消耗 {{ item }} 工时
+                  {{ index }} 共消耗 {{ item | toFixedTwo }} 工时
                 </p>
               </div>
               <div style="width: 65%;float: right">
@@ -108,7 +108,7 @@
                   :format="formatTaskProgress"
                 />
                 <br />
-                <i>任务预计时长:{{ expectedHours }}小时</i
+                <i>任务预计时长:{{ expectedHours | toFixedTwo }}小时</i
                 ><i style="margin-left: 40px"
                   >任务实际用时:{{ actualHours }}小时</i
                 >
@@ -849,6 +849,11 @@
       taskStatusOne: ''
     };
   },
+  filters: {
+    toFixedTwo(value) {
+      return parseFloat(value).toFixed(2);
+    } 
+  },
   computed: {
     ...mapGetters(["user"])
   },
@@ -1301,6 +1306,7 @@
         for (var key in this.taskUserDetail) {
           this.actualHours += this.taskUserDetail[key];
         }
+        this.actualHours = parseFloat(this.actualHours).toFixed(2);
 
         this.taskProgress = Math.round(
           (this.actualHours / this.expectedHours) * 100

--
Gitblit v1.9.3