From 27fa305bf0c3a4405366a966c28b4d32203106b8 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期二, 05 十二月 2023 16:32:46 +0800
Subject: [PATCH] 人员生产效率、物料需求统计

---
 src/views/cockpitPage/components/DeviceChart.vue |   33 +++++++++++----------------------
 1 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/src/views/cockpitPage/components/DeviceChart.vue b/src/views/cockpitPage/components/DeviceChart.vue
index faf08b0..f4ea752 100644
--- a/src/views/cockpitPage/components/DeviceChart.vue
+++ b/src/views/cockpitPage/components/DeviceChart.vue
@@ -29,52 +29,35 @@
         };
       },
     },
-    // xdata: {
-    //   type: Array,
-    //   require: true,
-    // },
-    // ydata: {
-    //   type: Array,
-    //   require: true,
-    // },
   },
   data() {
     return {
-      // chartData: {
-      //   datax: [],
-      //   datay: [],
-      // },
       startValue: 0,
       endValue: 5,
+      chartTimer: null,
     };
   },
   watch: {
     "chartData.datay"(val) {
-      console.log(val, "ddddddddddddddd");
-      this.ydata = val;
       this.startValue = 0;
       this.endValue = 5;
       this.pieChart("chart", this.chartData);
     },
   },
-  mounted() {
-    // this.pieChart("chart", this.chartData);
-  },
+  mounted() {},
   methods: {
     //鍦ㄨ亴
     pieChart(chartName, data) {
       let that = this;
+      clearInterval(this.chartTimer);
       let chartDom = this.$refs[chartName];
       if (myChart != null && myChart != "" && myChart != undefined) {
-        console.log("222222222");
         myChart.dispose(); //閿�姣�
-        myChart.resize();
       }
-      console.log(myChart, "ssssssss");
       myChart = echarts.init(chartDom);
       let option;
       let lineColor = "#35ddc74d";
-      if (this.ydata) {
+      if (data) {
         option = {
           color: ["#00FFFF", "#dcb018"],
           tooltip: {
@@ -130,6 +113,12 @@
                       return colorList[1];
                     }
                   },
+                },
+                formatter: function (value) {
+                  if (value.length > 6) {
+                    return `${value.slice(0, 4)}...`;
+                  }
+                  return value;
                 },
               },
               data: data.datax ? data.datax : [],
@@ -202,7 +191,7 @@
           ],
         };
 
-        setInterval(function () {
+        this.chartTimer = setInterval(function () {
           if (option.dataZoom[0].endValue == data.datay.length) {
             option.dataZoom[0].startValue = that.startValue;
             option.dataZoom[0].endValue = that.endValue;

--
Gitblit v1.8.0