From 09ccc2aa1361a27056afb21e38048691416f727d Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Tue, 26 Jul 2022 17:22:22 +0800
Subject: [PATCH] 修改农资累计值的小数位数为3为

---
 src/views/statistics/stock.vue |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/views/statistics/stock.vue b/src/views/statistics/stock.vue
index 0c41016..2417182 100644
--- a/src/views/statistics/stock.vue
+++ b/src/views/statistics/stock.vue
@@ -202,6 +202,12 @@
               return prev;
             }
           }, 0);
+          // sums[index] += " 公斤";
+          var x = String(sums[index]).indexOf(".")+1;//得到小数点的位置
+          var y = String(sums[index]).length - x;//小数点的位数
+          if(y>4){
+            sums[index] = sums[index].toFixed(3)
+          }
           sums[index] += " 公斤";
         } else {
           sums[index] = "N/A";

--
Gitblit v1.9.3