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/components/CountView.vue |   20 ++++++----
 src/views/cockpitPage/index.vue                |   50 +++++++++++++++++++++++--
 2 files changed, 58 insertions(+), 12 deletions(-)

diff --git a/src/views/cockpitPage/components/CountView.vue b/src/views/cockpitPage/components/CountView.vue
index ca11420..9bddba0 100644
--- a/src/views/cockpitPage/components/CountView.vue
+++ b/src/views/cockpitPage/components/CountView.vue
@@ -7,7 +7,7 @@
         </div>
         <div class="value-view">
           <div class="title-margin-left">
-            <span class="value-span">
+            <span class="value-span1">
               {{ totalObject.InternalDeviceRunningAmount + "" }}
             </span>
             <span class="unit-span">鍙�</span>
@@ -20,7 +20,7 @@
         </div>
         <div class="value-view">
           <div class="title-margin-left">
-            <span class="value-span">{{
+            <span class="value-span1">{{
               totalObject.ExternalDeviceRunningAmount
             }}</span>
             <span>鍙�</span>
@@ -168,14 +168,18 @@
           // white-space: nowrap;
           display: flex;
           align-items: center;
-          .value-span {
+          .value-span1 {
             margin-top: 5px;
-            height: 100%;
-            max-width: 3em;
-            overflow: hidden;
-            white-space: nowrap;
-            text-overflow: ellipsis;
+            // height: 100%;
+            // max-width: 3em;
           }
+          // .value-span {
+          // height: 100%;
+          // max-width: 3em;
+          // overflow: hidden;
+          // white-space: nowrap;
+          // text-overflow: ellipsis;
+          // }
         }
       }
     }
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