From 62ec1f19c3444695e21f1fe97472261ce3082075 Mon Sep 17 00:00:00 2001
From: liuying <1427574514@qq.com>
Date: 周一, 11 11月 2024 13:39:59 +0800
Subject: [PATCH] 大屏

---
 yiqi_screen/src/components/ProductionStatistics.vue |  166 ++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 134 insertions(+), 32 deletions(-)

diff --git a/yiqi_screen/src/components/ProductionStatistics.vue b/yiqi_screen/src/components/ProductionStatistics.vue
index 82ab84c..dbf822c 100644
--- a/yiqi_screen/src/components/ProductionStatistics.vue
+++ b/yiqi_screen/src/components/ProductionStatistics.vue
@@ -1,8 +1,10 @@
 <template>
-  <div class="box-container" id="echarts4"></div>
+  <!-- 鏈彮/鏈湀浜ч噺缁熻 -->
+  <div class="box-container box4" id="echarts4"></div>
+  
 </template>
-      
-      <script>
+
+<script>
 let timer = null;
 export default {
   props: {
@@ -22,44 +24,109 @@
   },
   watch: {
     produceStatisData(val) {
-        this.$set(this.option.series[1], "data", [
-          { value: val.currentMonthProduceNum },
-          { value: val.currentMonthPlanNum - val.currentMonthProduceNum },
-        ]);
-        this.$set(this.option.series[0], "data", [
-          { value: val.currentShiftProduceNum },
-          { value: val.currentShiftPlanNum - val.currentShiftProduceNum },
-        ]);
-        this.myChart.setOption(this.option);
-        this.hignLightPie();
+      // 娴嬭瘯鐢細
+      val.currentShiftProduceNum = 300;
+      val.currentShiftPlanNum = 300;
+      // 褰撳墠鐝粍瀹為檯鐢熶骇鏁伴噺 currentShiftProduceNum
+      // 褰撳墠鐝粍璁″垝鐢熶骇鏁伴噺 currentShiftPlanNum
+      var num1 = val.currentShiftProduceNum; //瀹為檯鐢熶骇鏁伴噺
+      var num2 = val.currentShiftPlanNum - val.currentShiftProduceNum; //璁″垝鐢熶骇鏁伴噺
+      if (val.currentShiftPlanNum == 0) {
+        //鍒嗘瘝涓�0 鏄剧ず0%
+        num1 = 0;
+        num2 = 10;
+      }
+
+
+      
+      this.$set(this.option.series[0], "data", [
+        // { value: 1 },  //瀹為檯鐢熶骇鏁伴噺 1/ (9+1) = 10%
+        // { value: 9 },
+        { value: num1,
+         }, //瀹為檯鐢熶骇鏁伴噺
+        { value: num2 },
+      ]);
+      var num3 = val.currentMonthProduceNum;
+      var num4 = val.currentMonthPlanNum - val.currentMonthProduceNum;
+      if (val.currentMonthPlanNum == 0) {
+        //鍒嗘瘝涓�0 鏄剧ず0%
+        num3 = 0;
+        num4 = 10;
+      }
+      this.$set(this.option.series[1], "data", [
+        { value: num3 },
+        { value: num4 },
+      ]);
+
+      this.myChart.setOption(this.option);
+      this.hignLightPie();
     },
   },
   mounted() {
     this.myChart = this.$echarts.init(document.getElementById("echarts4"));
     this.option = {
-      color: ["#00f6fe", "#c4c3d6"],
+      color: ["#00f6fe", "transparent"],
+         // 鎻掑叆鑳屾櫙鍥�
+         graphic: [
+        {
+          type: "image",
+          id: "background1",
+          left: "11px", // 鏍规嵁鐜舰鍥剧殑浣嶇疆璋冩暣
+          top: "59.5px", // 鏍规嵁鐜舰鍥剧殑浣嶇疆璋冩暣
+          z: -10,
+          bounding: "raw",
+          origin: [0, 0],
+          style: {
+            image: require(`@/assets/images/quan.png`), // 绗竴涓幆褰㈠浘鐨勮儗鏅浘鐗囪矾寰�
+            width: 100,
+            height: 100,
+            opacity: 1,
+          },
+        },
+        {
+          type: "image",
+          id: "background2",
+          left: "130px", // 鏍规嵁鐜舰鍥剧殑浣嶇疆璋冩暣
+          top: "59.5px", // 鏍规嵁鐜舰鍥剧殑浣嶇疆璋冩暣
+          z: -10,
+          bounding: "raw",
+          origin: [0, 0],
+          style: {
+            image: require(`@/assets/images/quan.png`), // 绗竴涓幆褰㈠浘鐨勮儗鏅浘鐗囪矾寰�
+            width: 100,
+            height: 100,
+            opacity: 1,
+          },
+        },
+      ],
       series: [
         {
           name: "Access From",
           type: "pie",
-          radius: ["25%", "40%"],
+          // padAngle: 5, //鐜笌鐜箣闂寸殑闂撮殭
+          radius: ["30%", "37%"], //鐜彉缁�
           center: ["26%", "47%"],
-          avoidLabelOverlap: false,
+          silent: true,clockwise: true,
+          // avoidLabelOverlap: false,
           label: {
             show: false,
             position: "center",
-            formatter: `{d}%`,
+            formatter: function (params) {
+              return Math.floor(params.percent) + '%'; // 鍥涜垗浜斿叆鍒版暣鏁�
+            },
             color: "#fff",
             fontSize: 12,
           },
-
           emphasis: {
+            //楗煎浘涓棿鐨勫瓧浣撳ぇ灏�
             scale: false,
             label: {
               show: true,
-              fontSize: 24,
+              fontSize: 22,
+              color: "#19d8d0",
               fontWeight: "normal",
             },
+         
           },
           labelLine: {
             show: false,
@@ -74,13 +141,17 @@
         {
           name: "Access From",
           type: "pie",
-          radius: ["25%", "40%"],
+          // padAngle: 5, //鐜笌鐜箣闂寸殑闂撮殭
+          // radius: ["25%", "40%"],
+          radius: ["30%", "37%"], //鐜彉缁�
           center: ["74%", "47%"],
-          avoidLabelOverlap: false,
+          // avoidLabelOverlap: false,
           label: {
             show: false,
             position: "center",
-            formatter: `{d}%`,
+            formatter: function (params) {
+              return Math.floor(params.percent) + '%'; // 鍥涜垗浜斿叆鍒版暣鏁�
+            },
             color: "#fff",
             fontSize: 12,
           },
@@ -93,7 +164,8 @@
             scale: false,
             label: {
               show: true,
-              fontSize: 24,
+              fontSize: 22,
+              color: "#19d8d0",
               fontWeight: "normal",
             },
           },
@@ -105,10 +177,10 @@
       ],
     };
     this.myChart.setOption(this.option);
-    const that=this
-    window.addEventListener('resize',()=>{
+    const that = this;
+    window.addEventListener("resize", () => {
       that.myChart.resize();
-    })
+    });
     // this.getData();
     this.defineEvent();
     // this.selectPie();
@@ -198,9 +270,39 @@
   },
 };
 </script>
-      
-      <style>
-      #echarts4{
-        transform: scaleY(2);
-      }
-</style>
\ No newline at end of file
+
+<style>
+#echarts4 {
+  transform: scaleY(2);
+}
+
+.box4::before{
+    position: absolute;
+    background-size: 100% 100%;
+    background-repeat: no-repeat;
+    content: "";
+    width: 95px;
+    height: 47px;
+    z-index: -1;
+    top: 86px;
+    left: 13px;
+    transform: scaleY(2);
+    border: 1px solid #074d95;
+    border-radius: 100%;
+}
+
+.box4::after{
+  position: absolute;
+    background-size: 100% 100%;
+    background-repeat: no-repeat;
+    content: "";
+    width: 95px;
+    height: 47px;
+    z-index: -1;
+    top: 86px;
+    left: 132px;
+    transform: scaleY(2);
+    border: 1px solid #074d95;
+    border-radius: 100%;
+}
+</style>

--
Gitblit v1.9.3