From 00ec5af9784585ebc2dab13d56c0bfedc8693fee Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 05 二月 2026 11:58:21 +0800
Subject: [PATCH] fix: 生产核算分析修改对接接口

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

diff --git a/src/views/reportAnalysis/productionAnalysis/components/right-top.vue b/src/views/reportAnalysis/productionAnalysis/components/right-top.vue
index 9004362..d3a9eb9 100644
--- a/src/views/reportAnalysis/productionAnalysis/components/right-top.vue
+++ b/src/views/reportAnalysis/productionAnalysis/components/right-top.vue
@@ -2,6 +2,9 @@
   <div>
     <PanelHeader title="宸ュ崟鎵ц鏁堢巼鍒嗘瀽" />
     <div class="main-panel panel-item-customers">
+      <div class="filters-row">
+        <DateTypeSwitch v-model="dateType" @change="handleDateTypeChange" />
+      </div>
       <Echarts
         ref="chart"
         :chartStyle="chartStyle"
@@ -20,13 +23,16 @@
 
 <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'
+import DateTypeSwitch from './DateTypeSwitch.vue'
+
+const dateType = ref(1) // 1=鍛� 2=鏈� 3=瀛e害
 
 const chartStyle = {
   width: '100%',
-  height: '160%',
+  height: '140%',
 }
 
 const grid = { left: '3%', right: '4%', bottom: '3%', top: '10%', containLabel: true }
@@ -37,7 +43,6 @@
   data: ['寮�宸�', '瀹屾垚', '鑹搧鐜�'],
 }
 
-// 鏌辩姸鍥撅細寮�宸ャ�佸畬鎴愶紱鎶樼嚎鍥撅細鑹搧鐜囷紙棰滆壊 rgba(90, 216, 166, 1)锛�
 const chartSeries = ref([
   {
     name: '寮�宸�',
@@ -111,6 +116,7 @@
 const xAxis1 = ref([
   { type: 'category', axisTick: { show: false }, axisLabel: { color: '#B8C8E0' }, data: [] },
 ])
+
 const yAxis1 = [
   { type: 'value', name: '浠�', axisLabel: { color: '#B8C8E0' }, nameTextStyle: { color: '#B8C8E0' } },
   {
@@ -124,26 +130,25 @@
   },
 ]
 
+const handleDateTypeChange = () => {
+  fetchData()
+}
+
 const fetchData = () => {
-  qualityStatistics()
+  workOrderEfficiencyAnalysis({ dateType: dateType.value })
     .then((res) => {
-      if (!res?.data?.item || !Array.isArray(res.data.item)) return
-      const items = res.data.item
+      if (res.code !== 200 || !Array.isArray(res.data)) return
+      const items = res.data
       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))
-      })
+      // 寮�宸�
+      chartSeries.value[0].data = items.map((d) => Number(d.startQuantity) || 0)
+      // 瀹屾垚
+      chartSeries.value[1].data = items.map((d) => Number(d.finishQuantity) || 0)
+      // 鑹搧鐜�
+      chartSeries.value[2].data = items.map((d) => Math.min(100, parseFloat(d.yieldRate) || 0))
     })
     .catch((err) => {
-      console.error('鑾峰彇寮�宸ヤ笌鑹搧鐜囨暟鎹け璐�:', err)
+      console.error('鑾峰彇宸ュ崟鎵ц鏁堢巼鍒嗘瀽澶辫触:', err)
     })
 }
 
@@ -159,6 +164,14 @@
   gap: 20px;
 }
 
+.filters-row {
+  display: flex;
+  justify-content: flex-end;
+  align-items: center;
+  gap: 12px;
+  margin-bottom: 10px;
+}
+
 .panel-item-customers {
   border: 1px solid #1a58b0;
   padding: 18px;

--
Gitblit v1.9.3