From dc7ead8b25e6a3547dba14ac3fd334a9e6b2bcc1 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期二, 03 二月 2026 11:46:07 +0800
Subject: [PATCH] fix: 工单执行效率分析接口错误

---
 src/views/reportAnalysis/productionAnalysis/components/right-top.vue |   49 +++++++++++++++++++------------------------------
 1 files changed, 19 insertions(+), 30 deletions(-)

diff --git a/src/views/reportAnalysis/productionAnalysis/components/right-top.vue b/src/views/reportAnalysis/productionAnalysis/components/right-top.vue
index 9004362..e6717d1 100644
--- a/src/views/reportAnalysis/productionAnalysis/components/right-top.vue
+++ b/src/views/reportAnalysis/productionAnalysis/components/right-top.vue
@@ -2,25 +2,16 @@
   <div>
     <PanelHeader title="宸ュ崟鎵ц鏁堢巼鍒嗘瀽" />
     <div class="main-panel panel-item-customers">
-      <Echarts
-        ref="chart"
-        :chartStyle="chartStyle"
-        :grid="grid"
-        :legend="barLegend"
-        :series="chartSeries"
-        :tooltip="tooltip"
-        :xAxis="xAxis1"
-        :yAxis="yAxis1"
-        :options="{ backgroundColor: 'transparent', textStyle: { color: '#B8C8E0' } }"
-        style="height: 260px"
-      />
+      <Echarts ref="chart" :chartStyle="chartStyle" :grid="grid" :legend="barLegend" :series="chartSeries"
+        :tooltip="tooltip" :xAxis="xAxis1" :yAxis="yAxis1"
+        :options="{ backgroundColor: 'transparent', textStyle: { color: '#B8C8E0' } }" style="height: 260px" />
     </div>
   </div>
 </template>
 
 <script setup>
 import { ref, onMounted } from 'vue'
-import { qualityStatistics } from '@/api/viewIndex.js'
+import { workOrderEfficiencyAnalysis } from '@/api/viewIndex.js'
 import PanelHeader from './PanelHeader.vue'
 import Echarts from '@/components/Echarts/echarts.vue'
 
@@ -37,7 +28,6 @@
   data: ['寮�宸�', '瀹屾垚', '鑹搧鐜�'],
 }
 
-// 鏌辩姸鍥撅細寮�宸ャ�佸畬鎴愶紱鎶樼嚎鍥撅細鑹搧鐜囷紙棰滆壊 rgba(90, 216, 166, 1)锛�
 const chartSeries = ref([
   {
     name: '寮�宸�',
@@ -111,6 +101,7 @@
 const xAxis1 = ref([
   { type: 'category', axisTick: { show: false }, axisLabel: { color: '#B8C8E0' }, data: [] },
 ])
+
 const yAxis1 = [
   { type: 'value', name: '浠�', axisLabel: { color: '#B8C8E0' }, nameTextStyle: { color: '#B8C8E0' } },
   {
@@ -125,25 +116,23 @@
 ]
 
 const fetchData = () => {
-  qualityStatistics()
+  workOrderEfficiencyAnalysis()
     .then((res) => {
-      if (!res?.data?.item || !Array.isArray(res.data.item)) return
-      const items = res.data.item
-      xAxis1.value[0].data = items.map((d) => d.date)
-      // 寮�宸ワ細杩囩▼妫�楠屾暟
-      chartSeries.value[0].data = items.map((d) => Number(d.processNum) || 0)
-      // 瀹屾垚锛氬嚭鍘傛暟
-      chartSeries.value[1].data = items.map((d) => Number(d.factoryNum) || 0)
-      // 鑹搧鐜囷細鍑哄巶鏁�/杩囩▼鏁�*100锛堟棤鍗曠嫭鎺ュ彛鏃剁敤姝ゅ崰浣嶏級
-      chartSeries.value[2].data = items.map((d) => {
-        const processNum = Number(d.processNum) || 0
-        const factoryNum = Number(d.factoryNum) || 0
-        if (processNum <= 0) return 0
-        return Math.min(100, Math.round((factoryNum / processNum) * 100))
-      })
+      // 鏍规嵁浣犵殑缁撴瀯锛屾暟鎹洿鎺ュ湪 res.data 涓�
+      if (!res?.data || !Array.isArray(res.data)) return
+
+      const list = res.data
+
+      xAxis1.value[0].data = list.map((item) => item.date)
+
+      chartSeries.value[0].data = list.map((item) => Number(item.startQuantity) || 0)
+
+      chartSeries.value[1].data = list.map((item) => Number(item.finishQuantity) || 0)
+
+      chartSeries.value[2].data = list.map((item) => Number(item.yieldRate) || 0)
     })
     .catch((err) => {
-      console.error('鑾峰彇寮�宸ヤ笌鑹搧鐜囨暟鎹け璐�:', err)
+      console.error('鑾峰彇宸ュ崟鏁堢巼鏁版嵁澶辫触:', err)
     })
 }
 

--
Gitblit v1.9.3