From 2661e2fed477e94f5f048ef3fc8aec40acef01d0 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 05 二月 2026 11:37:34 +0800
Subject: [PATCH] feat: 首页工序数据生产统计明细、质量统计接口对接

---
 src/components/Echarts/echarts.vue |   51 +++++++++++++++++++++++++++------------------------
 1 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/src/components/Echarts/echarts.vue b/src/components/Echarts/echarts.vue
index 0e07163..54a6c39 100644
--- a/src/components/Echarts/echarts.vue
+++ b/src/components/Echarts/echarts.vue
@@ -9,7 +9,7 @@
 import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue'
 import * as echarts from 'echarts'
 
-const emit = defineEmits(['finished'])
+const emit = defineEmits(['finished', 'click'])
 
 // Props
 const props = defineProps({
@@ -26,7 +26,7 @@
   },
   dataset: {
     type: Object,
-    default: () => {}
+    default: () => { }
   },
   xAxis: {
     type: Array,
@@ -82,10 +82,10 @@
     type: Object,
     default: () => ({})
   },
-	option: {
-		type: Object,
-		default: () => ({})
-	},
+  option: {
+    type: Object,
+    default: () => ({})
+  },
 })
 
 import { watch } from 'vue'
@@ -128,6 +128,9 @@
   chartInstance = echarts.init(chartRef.value)
   finishedHandler = () => emit('finished')
   chartInstance.on('finished', finishedHandler)
+  chartInstance.on('click', (params) => {
+    emit('click', params)
+  })
   renderChart()
   // setOption 鍚庤ˉ涓�娆� resize锛岀‘淇濋灞忓昂瀵告纭�
   nextTick(() => {
@@ -137,8 +140,8 @@
 
 // Methods
 function generateChart(option) {
-  const copiedOption = option 
-  
+  const copiedOption = option
+
   if (copiedOption.series && copiedOption.series.length > 0) {
     copiedOption.series.forEach((s, index) => {
       if (s.type === 'line' && props.lineColors.length) {
@@ -152,7 +155,7 @@
       }
     })
   }
-  
+
   chartInstance.setOption(copiedOption)
 }
 
@@ -170,7 +173,7 @@
     tooltip: props.tooltip,
     visualMap: Object.keys(props.visualMap).length ? props.visualMap : undefined,
   }
-  
+
   chartInstance.clear()
   generateChart(option)
 }
@@ -202,19 +205,19 @@
 
 // Watch all reactive props that affect the chart
 watch(
-    () => [props.xAxis, props.yAxis, props.series, props.legend, props.tooltip, props.visualMap],
-    () => {
-      // 濡傛灉棣栧睆杩樻病鍒濆鍖栨垚鍔燂紝绛夊緟瀹瑰櫒 ready 鍚庡啀娓叉煋
-      if (!chartInstance) {
-        initChartWhenReady()
-        return
-      }
-      renderChart()
-      // 鏁版嵁鍙樺寲鍚庤ˉ涓�娆� resize锛岄伩鍏嶅竷灞�鍙樺寲瀵艰嚧鐨勫亸绉�
-      nextTick(() => {
-        if (chartInstance) chartInstance.resize()
-      })
-    },
-    { deep: true, immediate: true }
+  () => [props.xAxis, props.yAxis, props.series, props.legend, props.tooltip, props.visualMap],
+  () => {
+    // 濡傛灉棣栧睆杩樻病鍒濆鍖栨垚鍔燂紝绛夊緟瀹瑰櫒 ready 鍚庡啀娓叉煋
+    if (!chartInstance) {
+      initChartWhenReady()
+      return
+    }
+    renderChart()
+    // 鏁版嵁鍙樺寲鍚庤ˉ涓�娆� resize锛岄伩鍏嶅竷灞�鍙樺寲瀵艰嚧鐨勫亸绉�
+    nextTick(() => {
+      if (chartInstance) chartInstance.resize()
+    })
+  },
+  { deep: true, immediate: true }
 )
 </script>
\ No newline at end of file

--
Gitblit v1.9.3