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/views/index.vue                |  361 +++++++++++++++++++++++++++++---------------
 src/components/Echarts/echarts.vue |   51 +++---
 src/api/viewIndex.js               |   25 +-
 3 files changed, 275 insertions(+), 162 deletions(-)

diff --git a/src/api/viewIndex.js b/src/api/viewIndex.js
index 3caced7..8b5d144 100644
--- a/src/api/viewIndex.js
+++ b/src/api/viewIndex.js
@@ -1,12 +1,21 @@
 // 棣栭〉鎺ュ彛
 import request from "@/utils/request";
 
-//  宸ュ崟鎵ц鏁堢巼鍒嗘瀽
-export const workOrderEfficiencyAnalysis = (query) => {
+//  宸ュ簭鏁版嵁鐢熶骇缁熻鏄庣粏
+export const processDataProductionStatistics = (params) => {
   return request({
-    url: "/home/workOrderEfficiencyAnalysis",
+    url: "/home/processDataProductionStatistics",
     method: "get",
-    params: query,
+    params,
+  });
+};
+
+//  璐ㄩ噺缁熻
+export const qualityInspectionStatistics = (params) => {
+  return request({
+    url: "/home/qualityInspectionStatistics",
+    method: "get",
+    params,
   });
 };
 
@@ -109,14 +118,6 @@
   });
 };
 
-// 鐢熶骇鏍哥畻鍒嗘瀽锛坉ateType: 1鍛� 2鏈� 3瀛e害锛�
-export const productionAccountingAnalysis = (params) => {
-  return request({
-    url: "/home/productionAccountingAnalysis",
-    method: "get",
-    params,
-  });
-};
 // 鐢熶骇鏍哥畻鍒嗘瀽
 export const productionAccountingAnalysis = (query) => {
   return request({
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
diff --git a/src/views/index.vue b/src/views/index.vue
index 7968b2e..5c16ed4 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -37,11 +37,11 @@
           <div class="data-num">
             <div>
               <div class="data-desc">鏈湀閿�鍞/鍏�</div>
-              <div class="data-value">{{businessInfo.monthSaleMoney}}</div>
+              <div class="data-value">{{ businessInfo.monthSaleMoney }}</div>
             </div>
             <div>
               <div class="data-desc">鏈紑绁ㄩ噾棰�/鍏�</div>
-              <div class="data-value">{{businessInfo.monthSaleHaveMoney}}</div>
+              <div class="data-value">{{ businessInfo.monthSaleHaveMoney }}</div>
             </div>
           </div>
 
@@ -51,11 +51,11 @@
           <div class="data-num">
             <div>
               <div class="data-desc">鏈湀閲囪喘棰�/鍏�</div>
-              <div class="data-value">{{businessInfo.monthPurchaseMoney}}</div>
+              <div class="data-value">{{ businessInfo.monthPurchaseMoney }}</div>
             </div>
             <div>
               <div class="data-desc">寰呬粯娆鹃噾棰�/鍏�</div>
-              <div class="data-value">{{businessInfo.monthPurchaseHaveMoney}}</div>
+              <div class="data-value">{{ businessInfo.monthPurchaseHaveMoney }}</div>
             </div>
           </div>
         </div>
@@ -64,11 +64,11 @@
           <div class="data-num">
             <div>
               <div class="data-desc">褰撳墠搴撳瓨鎬婚噺/浠�</div>
-              <div class="data-value">{{businessInfo.inventoryNum}}</div>
+              <div class="data-value">{{ businessInfo.inventoryNum }}</div>
             </div>
             <div>
               <div class="data-desc">浠婃棩鍏ュ簱/浠�</div>
-              <div class="data-value">{{businessInfo.todayInventoryNum}}</div>
+              <div class="data-value">{{ businessInfo.todayInventoryNum }}</div>
             </div>
           </div>
         </div>
@@ -80,11 +80,11 @@
           <li v-for="item in todoList" :key="item.id">
             <div style="display: flex;flex-direction: column;justify-content: space-between;width: 100%;gap: 20px">
               <div style="display: flex;justify-content: space-between;align-items: center;">
-                <div class="todo-title">寰呭姙缂栧彿锛歿{item.approveId}}</div>
-                <div class="todo-division">閮ㄩ棬锛歿{item.approveDeptName}}</div>
-                <div class="todo-time">{{item.approveTime}}</div>
+                <div class="todo-title">寰呭姙缂栧彿锛歿{ item.approveId }}</div>
+                <div class="todo-division">閮ㄩ棬锛歿{ item.approveDeptName }}</div>
+                <div class="todo-time">{{ item.approveTime }}</div>
               </div>
-              <div class="todo-division">寰呭姙浜嬬敱锛歿{item.approveReason}}</div>
+              <div class="todo-division">寰呭姙浜嬬敱锛歿{ item.approveReason }}</div>
             </div>
           </li>
         </ul>
@@ -97,24 +97,22 @@
       <div class="main-panel process-panel">
         <div class="process-panel__header">
           <div class="section-title">宸ュ簭鏁版嵁鐢熶骇缁熻鏄庣粏</div>
-          <el-radio-group v-model="processRange" size="small" @change="refreshProcessStats">
-            <el-radio-button :value="'week'">鎸夊懆</el-radio-button>
-            <el-radio-button :value="'month'">鎸夋湀</el-radio-button>
-            <el-radio-button :value="'quarter'">鎸夊搴�</el-radio-button>
-          </el-radio-group>
+          <div style="display: flex; gap: 10px; align-items: center;">
+            <el-button type="primary" size="small" plain icon="Filter" @click="openProcessDialog">閫夋嫨宸ュ簭</el-button>
+            <el-button type="info" size="small" plain icon="Refresh" @click="resetProcessFilter">閲嶇疆</el-button>
+            <el-radio-group v-model="processRange" size="small" @change="refreshProcessStats">
+              <el-radio-button :value="1">鏃�</el-radio-button>
+              <el-radio-button :value="2">鍛�</el-radio-button>
+              <el-radio-button :value="3">鏈�</el-radio-button>
+            </el-radio-group>
+          </div>
         </div>
 
         <div class="process-panel__body">
           <div class="process-panel__chart">
-            <Echarts
-                :chartStyle="{ width: '100%', height: '100%' }"
-                :grid="processGrid"
-                :series="processSeries"
-                :tooltip="processTooltip"
-                :xAxis="processXAxis"
-                :yAxis="processYAxis"
-                style="height: 100%"
-            />
+            <Echarts :chartStyle="{ width: '100%', height: '100%' }" :grid="processGrid" :series="processSeries"
+              :tooltip="processTooltip" :xAxis="processXAxis" :yAxis="processYAxis" style="height: 100%"
+              @click="handleChartClick" />
           </div>
 
           <div class="process-panel__aside">
@@ -134,48 +132,70 @@
 
             <div class="process-card">
               <div class="process-card__label">绱鎬绘姇鍏�</div>
-              <div class="process-card__value">{{ formatAmount(processAside.totalInput) }}<span class="unit">涓囧厓</span></div>
+              <div class="process-card__value">{{ formatAmount(processAside.totalInput) }}<span class="unit">鍏�</span>
+              </div>
             </div>
             <div class="process-card">
               <div class="process-card__label">绱鎬绘姤搴�</div>
-              <div class="process-card__value">{{ formatAmount(processAside.totalScrap) }}<span class="unit">涓囧厓</span></div>
+              <div class="process-card__value">{{ formatAmount(processAside.totalScrap) }}<span class="unit">鍏�</span>
+              </div>
             </div>
             <div class="process-card">
               <div class="process-card__label">绱鎬讳骇鍑�</div>
-              <div class="process-card__value">{{ formatAmount(processAside.totalOutput) }}<span class="unit">涓囧厓</span></div>
+              <div class="process-card__value">{{ formatAmount(processAside.totalOutput) }}<span class="unit">鍏�</span>
+              </div>
             </div>
           </div>
         </div>
       </div>
     </div>
+
+    <!-- 宸ュ簭閫夋嫨寮圭獥 -->
+    <el-dialog v-model="processDialogVisible" title="閫夋嫨宸ュ簭" width="500px" append-to-body>
+      <div class="process-selection-wrapper">
+        <el-checkbox-group v-model="tempProcessIds">
+          <div class="process-grid">
+            <el-checkbox v-for="item in processOptions" :key="item.id" :label="item.id" border>
+              {{ item.name }}
+            </el-checkbox>
+          </div>
+        </el-checkbox-group>
+      </div>
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="processDialogVisible = false">鍙栨秷</el-button>
+          <el-button type="primary" @click="handleProcessDialogConfirm">纭</el-button>
+        </span>
+      </template>
+    </el-dialog>
     <!-- 涓儴妯悜涓ゆ爮 -->
     <div class="dashboard-row">
       <div class="main-panel">
         <div class="section-title">瀹㈡埛鍚堝悓閲戦鍒嗘瀽</div>
         <div class="contract-summary">
           <div class="contract-info">
-            <img src="../assets/images/khtitle.png" alt="" style="width: 42px"/>
+            <img src="../assets/images/khtitle.png" alt="" style="width: 42px" />
             <div class="contract-card">
               <div class="contract-name">鎬诲悎鍚岄噾棰�(鍏�)</div>
               <div class="contract-meta">
-                <div class="main-amount">{{sum}}</div>
-                <div>鍛ㄥ悓姣�: <span class="up">{{yny}}% </span> 鏃ョ幆姣�: <span class="up">{{chain}}% </span></div>
+                <div class="main-amount">{{ sum }}</div>
+                <div>鍛ㄥ悓姣�: <span class="up">{{ yny }}% </span> 鏃ョ幆姣�: <span class="up">{{ chain }}% </span></div>
               </div>
             </div>
           </div>
         </div>
-        <div style="display: flex;align-items: center;gap: 20px;justify-content: space-evenly;height: 180px;margin-top: 20px">
+        <div
+          style="display: flex;align-items: center;gap: 20px;justify-content: space-evenly;height: 180px;margin-top: 20px">
           <div>
-            <Echarts ref="chart" :legend="pieLegend" :chartStyle="chartStylePie"
-                     :series="materialPieSeries"
-                     :tooltip="pieTooltip"></Echarts>
+            <Echarts ref="chart" :legend="pieLegend" :chartStyle="chartStylePie" :series="materialPieSeries"
+              :tooltip="pieTooltip"></Echarts>
           </div>
           <ul class="contract-list">
             <li v-for="item in materialPieSeries[0].data" :key="item.name">
               <div style="display: flex;align-items: center;justify-content: space-between;width: 100%">
-                <div class="line" :style="{color: item.itemStyle.color}">鈼弡{item.name}}</div>
-                <div style="width: 70px">{{item.rate}}%</div>
-                <div>锟{item.value}}</div>
+                <div class="line" :style="{ color: item.itemStyle.color }">鈼弡{ item.name }}</div>
+                <div style="width: 70px">{{ item.rate }}%</div>
+                <div>锟{ item.value }}</div>
               </div>
             </li>
           </ul>
@@ -190,51 +210,35 @@
           <!--						<el-radio-button label="鎸夊搴�" :value="3" />-->
           <!--					</el-radio-group>-->
         </div>
-        <Echarts ref="chart"
-                 :color="barColors2"
-                 :chartStyle="chartStyle"
-                 :grid="grid"
-                 :series="barSeries"
-                 :tooltip="tooltip"
-                 :xAxis="xAxis"
-                 :yAxis="yAxis"
-                 style="height: 260px"></Echarts>
+        <Echarts ref="chart" :color="barColors2" :chartStyle="chartStyle" :grid="grid" :series="barSeries"
+          :tooltip="tooltip" :xAxis="xAxis" :yAxis="yAxis" style="height: 260px"></Echarts>
       </div>
     </div>
 
     <!-- 搴曢儴妯悜涓ゆ爮 -->
     <div class="dashboard-row">
-      			<div class="main-panel">
-      				<div class="section-title">璐ㄩ噺缁熻</div>
-      				<div class="quality-cards">
-      					<div class="quality-card one">鍘熸潗鏂欏凡妫�娴嬫暟 <span>{{qualityStatisticsObject.supplierNum}}浠�</span></div>
-      					<div class="quality-card two">杩囩▼妫�楠屾暟閲� <span>{{qualityStatisticsObject.processNum}}浠�</span></div>
-      					<div class="quality-card three">鍑哄巶宸叉鏁伴噺 <span>{{qualityStatisticsObject.factoryNum}}浠�</span></div>
-      				</div>
-      				<Echarts ref="chart"
-      								 :chartStyle="chartStyle"
-      								 :grid="grid"
-      								 :legend="barLegend"
-      								 :series="barSeries1"
-      								 :tooltip="tooltip"
-      								 :xAxis="xAxis1"
-      								 :yAxis="yAxis1"
-      								 style="height: 260px"></Echarts>
-      			</div>
+      <div class="main-panel">
+        <div style="display: flex;justify-content: space-between;align-items: center;margin-bottom: 10px;">
+          <div class="section-title" style="margin-bottom: 0;">璐ㄩ噺缁熻</div>
+          <el-radio-group v-model="qualityRange" size="small" @change="qualityStatisticsInfo">
+            <el-radio-button :value="1">鍛�</el-radio-button>
+            <el-radio-button :value="2">鏈�</el-radio-button>
+            <el-radio-button :value="3">瀛e害</el-radio-button>
+          </el-radio-group>
+        </div>
+        <div class="quality-cards">
+          <div class="quality-card one">鍘熸潗鏂欏凡妫�娴嬫暟 <span>{{ qualityStatisticsObject.supplierNum }}浠�</span></div>
+          <div class="quality-card two">杩囩▼妫�楠屾暟閲� <span>{{ qualityStatisticsObject.processNum }}浠�</span></div>
+          <div class="quality-card three">鍑哄巶宸叉鏁伴噺 <span>{{ qualityStatisticsObject.factoryNum }}浠�</span></div>
+        </div>
+        <Echarts ref="chart" :chartStyle="chartStyle" :grid="grid" :legend="barLegend" :series="barSeries1"
+          :tooltip="tooltip" :xAxis="xAxis1" :yAxis="yAxis1" style="height: 260px"></Echarts>
+      </div>
 
       <div class="main-panel">
         <div class="section-title">鍥炴涓庡紑绁ㄥ垎鏋�</div>
-        <Echarts
-          ref="invoiceChart"
-          :chartStyle="chartStyle"
-          :grid="grid"
-          :legend="lineLegend"
-          :series="lineSeries"
-          :tooltip="tooltipLine"
-          :xAxis="xAxis2"
-          :yAxis="yAxis2"
-          style="height: 270px;"
-        />
+        <Echarts ref="invoiceChart" :chartStyle="chartStyle" :grid="grid" :legend="lineLegend" :series="lineSeries"
+          :tooltip="tooltipLine" :xAxis="xAxis2" :yAxis="yAxis2" style="height: 270px;" />
       </div>
     </div>
   </div>
@@ -249,11 +253,20 @@
   analysisCustomerContractAmounts, getAmountHalfYear,
   getBusiness,
   homeTodos,
-  qualityStatistics,
-  statisticsReceivablePayable
+  processDataProductionStatistics,
+  statisticsReceivablePayable,
+  qualityInspectionStatistics
 } from "@/api/viewIndex.js";
+import { list } from '@/api/productionManagement/productionProcess';
+
 
 const userStore = useUserStore()
+
+const processOptions = ref([])
+const selectedProcessIds = ref([])
+const tempProcessIds = ref([])
+const processDialogVisible = ref(false)
+const activeProcessIndex = ref(0)
 
 const businessInfo = ref({
   inventoryNum: 0,
@@ -354,7 +367,7 @@
 }])
 const yAxis = [{
   type: 'category',
-  data: [ '搴斾粯璐︽', '搴旀敹璐︽',]
+  data: ['搴斾粯璐︽', '搴旀敹璐︽',]
 }]
 const yAxis1 = [{
   type: 'value'
@@ -407,7 +420,7 @@
     data: [],
     axisLabel: {
       interval: 0,
-      formatter: function(value) {
+      formatter: function (value) {
         return value.replace(/~/g, '\n');
       },
     }
@@ -417,6 +430,7 @@
 // 寰呭姙浜嬮」
 const todoList = ref([])
 const radio1 = ref(1)
+const qualityRange = ref(1)
 
 // 鍥捐〃寮曠敤
 const barChart = ref(null)
@@ -435,11 +449,12 @@
   statisticsReceivable()
   qualityStatisticsInfo()
   getAmountHalfYearNum()
+  getProcessList()
 })
 // 鏁版嵁缁熻
 const getBusinessData = () => {
   getBusiness().then((res) => {
-    businessInfo.value = {...res.data}
+    businessInfo.value = { ...res.data }
   })
 }
 // 鍚堝悓閲戦
@@ -461,9 +476,38 @@
     todoList.value = res.data
   })
 }
+// 鑾峰彇宸ュ簭鍒楄〃
+const getProcessList = () => {
+  list().then(res => {
+    processOptions.value = res.data
+  })
+}
+
+const openProcessDialog = () => {
+  tempProcessIds.value = [...selectedProcessIds.value]
+  processDialogVisible.value = true
+}
+
+const handleProcessDialogConfirm = () => {
+  selectedProcessIds.value = [...tempProcessIds.value]
+  processDialogVisible.value = false
+  refreshProcessStats()
+}
+
+const resetProcessFilter = () => {
+  selectedProcessIds.value = []
+  tempProcessIds.value = []
+  refreshProcessStats()
+}
+
+const handleChartClick = (params) => {
+  if (params && params.dataIndex !== undefined) {
+    activeProcessIndex.value = params.dataIndex
+  }
+}
 // 搴斾粯搴旀敹缁熻
 const statisticsReceivable = () => {
-  statisticsReceivablePayable({type: radio1.value}).then((res) => {
+  statisticsReceivablePayable({ type: radio1.value }).then((res) => {
     barSeries.value[0].data = [
       // { value: res.data.prepayMoney, itemStyle: { color: barColors2[0] } },
       { value: res.data.payableMoney, itemStyle: { color: barColors2[0] } },
@@ -474,7 +518,11 @@
 }
 // 璐ㄦ缁熻
 const qualityStatisticsInfo = () => {
-  qualityStatistics().then((res) => {
+  qualityInspectionStatistics({ type: qualityRange.value }).then((res) => {
+    xAxis1.value[0].data = []
+    barSeries1.value[0].data = []
+    barSeries1.value[1].data = []
+    barSeries1.value[2].data = []
     res.data.item.forEach(item => {
       xAxis1.value[0].data.push(item.date)
       barSeries1.value[0].data.push(item.supplierNum)
@@ -563,7 +611,7 @@
 }
 
 // 宸ュ簭鏁版嵁鐢熶骇缁熻鏄庣粏锛堝亣鏁版嵁 + 鍥捐〃锛�
-const processRange = ref('week')
+const processRange = ref(1)
 const processChartData = ref([])
 
 const processXAxis = ref([
@@ -593,11 +641,11 @@
     const name = params?.[0]?.name ?? ''
     const list = Array.isArray(params) ? params : []
     const lines = list
-        .map((p) => {
-          const colorBox = `<span style="display:inline-block;margin-right:6px;border-radius:2px;width:10px;height:10px;background:${p.color}"></span>`
-          return `${colorBox}${p.seriesName} <b style="float:right;">${Number(p.value || 0).toFixed(2)}</b>`
-        })
-        .join('<br/>')
+      .map((p) => {
+        const colorBox = `<span style="display:inline-block;margin-right:6px;border-radius:2px;width:10px;height:10px;background:${p.color}"></span>`
+        return `${colorBox}${p.seriesName} <b style="float:right;">${Number(p.value || 0).toFixed(2)}</b>`
+      })
+      .join('<br/>')
     return `<div style="min-width:140px;"><div style="font-weight:700;margin-bottom:6px;">${name}</div>${lines}</div>`
   },
 })
@@ -637,14 +685,12 @@
 
 const processAside = computed(() => {
   const list = processChartData.value
-  const totalInput = list.reduce((s, i) => s + Number(i.input || 0), 0)
-  const totalScrap = list.reduce((s, i) => s + Number(i.scrap || 0), 0)
-  const totalOutput = list.reduce((s, i) => s + Number(i.output || 0), 0)
+  const item = list[activeProcessIndex.value] || {}
   return {
-    processName: '宸ュ簭鍚嶇О',
-    totalInput,
-    totalScrap,
-    totalOutput,
+    processName: item.name || '鏆傛棤鏁版嵁',
+    totalInput: item.input || 0,
+    totalScrap: item.scrap || 0,
+    totalOutput: item.output || 0,
   }
 })
 
@@ -653,27 +699,20 @@
   return num.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })
 }
 
-const buildProcessFake = (range) => {
-  // 璁╀笉鍚屽垏鎹㈡湁鐐瑰樊寮�
-  const factor = range === 'week' ? 1 : range === 'month' ? 1.4 : 1.9
-  const baseNames = ['宸ュ簭1', '宸ュ簭2', '宸ュ簭3', '宸ュ簭4', '宸ュ簭5', '宸ュ簭6', '宸ュ簭7']
-  return baseNames.map((name, idx) => {
-    const seed = (idx + 1) * 120 * factor
-    const input = seed + (idx % 2 === 0 ? 80 : 40)
-    const scrap = Math.max(20, seed * 0.15)
-    const output = Math.max(30, seed * 0.35)
-    return {
-      name,
-      input: Number(input.toFixed(2)),
-      scrap: Number(scrap.toFixed(2)),
-      output: Number(output.toFixed(2)),
-    }
-  })
-}
-
 const refreshProcessStats = () => {
-  processChartData.value = buildProcessFake(processRange.value)
-  processYAxis.value[0].data = processChartData.value.map((i) => i.name)
+  processDataProductionStatistics({
+    type: processRange.value,
+    processIds: selectedProcessIds.value.length > 0 ? selectedProcessIds.value.join(',') : null
+  }).then(res => {
+    processChartData.value = res.data.map(item => ({
+      name: item.processName,
+      input: item.totalInput,
+      scrap: item.totalScrap,
+      output: item.totalOutput
+    }))
+    processYAxis.value[0].data = processChartData.value.map((i) => i.name)
+    activeProcessIndex.value = 0
+  })
 }
 
 onMounted(() => {
@@ -694,6 +733,7 @@
   padding: 20px;
   box-sizing: border-box;
 }
+
 .dashboard-top {
   display: flex;
   gap: 20px;
@@ -701,6 +741,7 @@
   align-items: flex-start;
   justify-content: space-evenly;
 }
+
 .company-info {
   padding: 0;
   overflow: hidden;
@@ -784,6 +825,7 @@
   object-fit: cover;
   flex: 0 0 auto;
 }
+
 .data-cards {
   width: 50%;
   display: flex;
@@ -793,17 +835,20 @@
   border-radius: 12px;
   padding: 20px;
 }
+
 .data-title {
   font-weight: 700;
   font-size: 26px;
   color: #FFFFFF;
 }
+
 .data-num {
   display: flex;
   align-items: center;
   justify-content: space-between;
   margin-top: 20px;
 }
+
 .data-card {
   background: #fff;
   border-radius: 12px;
@@ -815,35 +860,41 @@
   width: 32%;
   height: 140px;
 }
+
 .data-card.sales {
   background-image: url("../assets/images/xioashoushuju.png");
   background-size: cover;
   background-position: center;
   background-repeat: no-repeat;
 }
+
 .data-card.purchase {
   background-image: url("../assets/images/caigou.png");
   background-size: cover;
   background-position: center;
   background-repeat: no-repeat;
 }
+
 .data-card.inventory {
   background-image: url("../assets/images/kucun.png");
   background-size: cover;
   background-position: center;
   background-repeat: no-repeat;
 }
+
 .data-desc {
   font-weight: 500;
   font-size: 13px;
   color: #FFFFFF;
 }
+
 .data-value {
   font-size: 18px;
   font-weight: 500;
   margin: 10px 0;
   color: #FFFFFF;
 }
+
 .top-left {
   display: flex;
   flex-direction: column;
@@ -851,6 +902,7 @@
   height: 180px;
   width: 20%;
 }
+
 .todo-panel {
   background: #fff;
   border-radius: 12px;
@@ -858,6 +910,7 @@
   height: 180px;
   width: 30%;
 }
+
 .todo-list {
   height: 100px;
   list-style: none;
@@ -866,6 +919,7 @@
   font-size: 15px;
   overflow-y: auto;
 }
+
 .todo-list li {
   border-radius: 8px;
   margin-bottom: 12px;
@@ -874,44 +928,58 @@
   display: flex;
   justify-content: space-between;
   align-items: center;
-  background: rgba(225,227,250,0.62);
+  background: rgba(225, 227, 250, 0.62);
 }
+
 .todo-title {
   font-weight: 400;
   font-size: 12px;
   color: #000000;
   position: relative;
 }
+
 .todo-title::before {
-  content: ''; /* 蹇呴渶锛岃〃绀鸿繖閲屾湁涓�涓唴瀹� */
+  content: '';
+  /* 蹇呴渶锛岃〃绀鸿繖閲屾湁涓�涓唴瀹� */
   position: absolute;
-  left: -10px; /* 瀹氫綅鍒板乏渚� */
-  top: 50%; /* 鍨傜洿灞呬腑 */
-  transform: translateY(-50%); /* 寰皟鍨傜洿灞呬腑 */
-  width: 6px; /* 鍦嗙殑鐩村緞 */
-  height: 6px; /* 鍦嗙殑鐩村緞 */
+  left: -10px;
+  /* 瀹氫綅鍒板乏渚� */
+  top: 50%;
+  /* 鍨傜洿灞呬腑 */
+  transform: translateY(-50%);
+  /* 寰皟鍨傜洿灞呬腑 */
+  width: 6px;
+  /* 鍦嗙殑鐩村緞 */
+  height: 6px;
+  /* 鍦嗙殑鐩村緞 */
   background: #498CEB;
-  border-radius: 50%; /* 璁╁叾鍙樻垚鍦嗗舰 */
+  border-radius: 50%;
+  /* 璁╁叾鍙樻垚鍦嗗舰 */
 }
+
 .todo-division {
   font-weight: 400;
   font-size: 12px;
   color: #000000;
 }
+
 .todo-time {
   font-weight: 400;
   font-size: 12px;
   color: #000000;
 }
+
 .todo-meta {
   color: #888;
   font-size: 13px;
 }
+
 .dashboard-row {
   display: flex;
   gap: 20px;
   margin-bottom: 20px;
 }
+
 .main-panel {
   background: #fff;
   border-radius: 12px;
@@ -921,6 +989,7 @@
   display: flex;
   flex-direction: column;
 }
+
 .section-title {
   position: relative;
   font-size: 18px;
@@ -940,42 +1009,52 @@
   background-color: #002FA7;
   border-radius: 2px;
 }
+
 .contract-info {
   display: flex;
   align-items: center;
   gap: 20px;
   height: 90px;
-  background: rgba(245,245,245,0.59);
+  background: rgba(245, 245, 245, 0.59);
   width: 100%;
   border-radius: 10px;
   padding: 10px 30px;
 }
+
 .contract-summary {
   display: flex;
   align-items: center;
   gap: 30px;
 }
+
 .contract-card {
   display: flex;
   flex-direction: column;
   gap: 10px;
 }
+
 .contract-name {
   font-weight: 400;
   font-size: 14px;
   color: #050505;
 }
+
 .contract-meta {
   display: flex;
   align-items: center;
   width: 100%;
   gap: 80px;
 }
+
 .main-amount {
   font-size: 24px;
-  color: rgba(51,50,50,0.85);
+  color: rgba(51, 50, 50, 0.85);
 }
-.up { color: #e57373; }
+
+.up {
+  color: #e57373;
+}
+
 .contract-list {
   margin-top: 16px;
   font-size: 14px;
@@ -986,10 +1065,12 @@
   overflow-y: auto;
   width: 460px;
 }
+
 .line {
   position: relative;
   width: 230px;
 }
+
 .line::after {
   content: '';
   position: absolute;
@@ -1000,46 +1081,55 @@
   background-color: #C9C5C5;
   border-radius: 2px;
 }
+
 .contract-list li {
   margin-top: 10px;
 }
+
 .quality-cards {
   display: flex;
   gap: 12px;
   margin-bottom: 12px;
 }
+
 .quality-card {
   border-radius: 8px;
   padding: 15px 10px 10px 50px;
   font-weight: 400;
   font-size: 12px;
-  color: rgba(0,0,0,0.67);
+  color: rgba(0, 0, 0, 0.67);
   width: 236px;
   height: 49px;
   background-size: cover;
   background-position: center;
   background-repeat: no-repeat;
 }
+
 .quality-card.one {
   background-image: url("../assets/images/yuancailiao.png");
 }
+
 .quality-card.two {
   background-image: url("../assets/images/guocheng.png");
 }
+
 .quality-card.three {
   background-image: url("../assets/images/chuchang.png");
 
 }
+
 .quality-card span {
   color: #4fc3f7;
   font-weight: bold;
   margin-left: 6px;
 }
+
 .chart {
   width: 100%;
   height: 220px;
   margin-top: 10px;
 }
+
 .process-panel {
   padding-bottom: 10px;
 }
@@ -1141,14 +1231,33 @@
   .process-panel__body {
     flex-direction: column;
   }
+
   .process-panel__aside {
     width: 100%;
     flex-direction: row;
     flex-wrap: wrap;
   }
+
   .process-card {
     flex: 1;
     min-width: 220px;
   }
 }
+
+.process-selection-wrapper {
+  max-height: 400px;
+  overflow-y: auto;
+  padding: 10px;
+}
+
+.process-grid {
+  display: grid;
+  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
+  gap: 12px;
+}
+
+:deep(.el-checkbox.is-bordered) {
+  margin-left: 0 !important;
+  width: 100%;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3