From 6d040980c2b178241841ef335d4f70cbdb467d4b Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期三, 06 十二月 2023 17:16:33 +0800
Subject: [PATCH] 增加计算加工数和生产数的方法

---
 src/views/cockpitPage/index.vue |   50 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/src/views/cockpitPage/index.vue b/src/views/cockpitPage/index.vue
index 88ad270..91a94dc 100644
--- a/src/views/cockpitPage/index.vue
+++ b/src/views/cockpitPage/index.vue
@@ -204,13 +204,18 @@
     },
     // 宸︿腑鏁版嵁缁熻鍊�
     setLeftBlock3(data) {
+      console.log(this.setNumbers(data?.OutPlanProductionAmount ?? 0));
       this.totalObject = {
         InternalDeviceRunningAmount: data?.InternalDeviceRunningAmount ?? 0,
         ExternalDeviceRunningAmount: data?.ExternalDeviceRunningAmount ?? 0,
-        OutPlanProductionAmount: data?.OutPlanProductionAmount ?? 0,
-        PlanProductionAmount: data?.PlanProductionAmount ?? 0,
-        RealExternalProductionAmount: data?.RealExternalProductionAmount ?? 0,
-        RealProductionAmount: data?.RealProductionAmount ?? 0,
+        OutPlanProductionAmount: this.setNumbers(
+          data?.OutPlanProductionAmount ?? 0
+        ),
+        PlanProductionAmount: this.setNumbers(data?.PlanProductionAmount ?? 0),
+        RealExternalProductionAmount: this.setNumbers(
+          data?.RealExternalProductionAmount ?? 0
+        ),
+        RealProductionAmount: this.setNumbers(data?.RealProductionAmount ?? 0),
       };
     },
     // 璁㈠崟瀹屾垚姣旂巼
@@ -300,6 +305,43 @@
         this.barChartData.datay2.push(parseFloat(item.Defective));
       });
     },
+
+    // 璁$畻鍔犲伐鏁� 鐢熶骇鏁�
+    setNumbers(val) {
+      if (val > 1000 && val < 10000) {
+        let count = (val / 1000).toFixed(1);
+        return count.toString() + "鍗�";
+      } else if (val >= 10000 && val < 100000) {
+        let count1 = (val / 10000).toFixed(1);
+        return count1.toString() + "涓�";
+      } else if (val >= 100000 && val < 1000000) {
+        let count1 = (val / 100000).toFixed(1);
+        return count1.toString() + "鍗佷竾";
+      } else if (val >= 1000000 && val < 10000000) {
+        let count1 = (val / 1000000).toFixed(1);
+        return count1.toString() + "鐧句竾";
+      } else if (val >= 10000000 && val < 100000000) {
+        let count1 = (val / 10000000).toFixed(1);
+        return count1.toString() + "鍗冧竾";
+      } else if (val >= 100000000 && val < 1000000000) {
+        let count1 = (val / 100000000).toFixed(1);
+        return count1.toString() + "浜�";
+      } else if (val >= 1000000000 && val < 10000000000) {
+        let count1 = (val / 1000000000).toFixed(1);
+        return count1.toString() + "鍗佷嚎";
+      } else if (val >= 10000000000 && val < 100000000000) {
+        let count1 = (val / 10000000000).toFixed(1);
+        return count1.toString() + "鐧句嚎";
+      } else if (val >= 100000000000 && val < 1000000000000) {
+        let count1 = (val / 100000000000).toFixed(1);
+        return count1.toString() + "鍗冧嚎";
+      } else if (val >= 1000000000000) {
+        let count1 = (val / 1000000000000).toFixed(1);
+        return count1.toString() + "涓囦嚎";
+      } else {
+        return val;
+      }
+    },
   },
 };
 </script>

--
Gitblit v1.8.0