From 7ee681d2f4541517dbe4020cf75e42999f97d441 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期六, 18 七月 2026 09:57:51 +0800
Subject: [PATCH] feat: 质量报表管理添加半成品显示选项通过showSemiFinished控制成品半成品是否显示,优化相关图表和布局

---
 src/views/reportAnalysis/reportManagement/index.vue |   54 ++++++++++++++++++++++++++++++------------------------
 1 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/src/views/reportAnalysis/reportManagement/index.vue b/src/views/reportAnalysis/reportManagement/index.vue
index 3bcb8ae..4c9e1ea 100644
--- a/src/views/reportAnalysis/reportManagement/index.vue
+++ b/src/views/reportAnalysis/reportManagement/index.vue
@@ -37,7 +37,7 @@
                   </div>
                 </div>
               </div>
-              <div class="typeNum">
+              <div class="typeNum" v-if="showSemiFinished">
                 <div class="typeNum-left">
                   <img src="~@/assets/images/chartCard2.svg" alt="鍥捐〃"
                     style="width: 40px; height: 40px; object-fit: contain;">
@@ -123,7 +123,7 @@
                   </div>
                 </div>
               </div>
-              <div class="quality-card green-card">
+              <div class="quality-card green-card" v-if="showSemiFinished">
                 <div class="quality-card-title">
                   <img src="~@/assets/images/chartCard2.svg" alt="鍗婃垚鍝�"
                     style="width: 24px; height: 24px; margin-right: 8px;">
@@ -202,7 +202,7 @@
                     <div class="chart-box-title">鍘熸潗鏂欐�绘暟</div>
                     <div class="chart-box-num">{{ getYearlyStatValue(0, 'totalCount') }}</div>
                   </div>
-                  <div class="inspection-chart-box">
+                  <div class="inspection-chart-box" v-if="showSemiFinished">
                     <div class="chart-box-title">鍗婃垚鍝佹�绘暟</div>
                     <div class="chart-box-num">{{ getYearlyStatValue(1, 'totalCount') }}</div>
                   </div>
@@ -266,7 +266,7 @@
             <!-- Tab 閫夋嫨鍣� -->
             <div class="tab-selector">
               <div class="tab-item" :class="{ active: activeTab === 'raw' }" @click="activeTab = 'raw'">鍘熸潗鏂�</div>
-              <div class="tab-item" :class="{ active: activeTab === 'semi' }" @click="activeTab = 'semi'">鍗婃垚鍝�</div>
+              <div v-if="showSemiFinished" class="tab-item" :class="{ active: activeTab === 'semi' }" @click="activeTab = 'semi'">鍗婃垚鍝�</div>
               <div class="tab-item" :class="{ active: activeTab === 'final' }" @click="activeTab = 'final'">鎴愬搧</div>
             </div>
           </el-card>
@@ -295,6 +295,9 @@
 const monthlyCompletionDetailsData = ref([]);
 const topParametersData = ref({ totalCount: 0, list: [] });
 const activeTab = ref("raw");
+
+// 鏄惁鏄剧ず鍗婃垚鍝佺浉鍏冲唴瀹广�傛湁鐨勪紒涓氭病鏈夊崐鎴愬搧锛岃涓� false 鍗冲彲闅愯棌鎵�鏈夊崐鎴愬搧鐩稿叧灞曠ず
+const showSemiFinished = ref(false);
 
 const getParameterColor = (index) => {
   const colors = ['#165DFF', '#14C9C9', '#F7BA1E', '#722ED1', '#3491FA', '#FF7D00', '#F53F3F'];
@@ -526,7 +529,7 @@
         containLabel: true,
       },
       legend: {
-        data: ["鍘熸潗鏂�", "鍗婃垚鍝�", "鎴愬搧"], // 鍥句緥鏁版嵁
+        data: showSemiFinished.value ? ["鍘熸潗鏂�", "鍗婃垚鍝�", "鎴愬搧"] : ["鍘熸潗鏂�", "鎴愬搧"], // 鍥句緥鏁版嵁
         icon: ["circle", "circle", "circle"],
         itemWidth: 10, // 璁剧疆鍥炬爣瀹藉害
         itemHeight: 10,
@@ -564,7 +567,7 @@
             color: "#409EFF",
           },
         },
-        {
+        ...(showSemiFinished.value ? [{
           name: "鍗婃垚鍝�",
           type: "bar",
           barWidth: "15%",
@@ -573,7 +576,7 @@
           itemStyle: {
             color: "#67C23A",
           },
-        },
+        }] : []),
         {
           name: "鎴愬搧",
           type: "bar",
@@ -607,7 +610,7 @@
           radius: "70%",
           data: [
             { value: getYearlyStatValue(0, 'totalCount'), name: "鍘熸潗鏂�", itemStyle: { color: "#1890FF" } },
-            { value: getYearlyStatValue(1, 'totalCount'), name: "鍗婃垚鍝�", itemStyle: { color: "#F7BA1E" } },
+            ...(showSemiFinished.value ? [{ value: getYearlyStatValue(1, 'totalCount'), name: "鍗婃垚鍝�", itemStyle: { color: "#F7BA1E" } }] : []),
             { value: getYearlyStatValue(2, 'totalCount'), name: "鎴愬搧", itemStyle: { color: "#14C9C9" } },
           ],
           label: {
@@ -655,7 +658,7 @@
       },
       // 鍥句緥閰嶇疆
       legend: {
-        data: ["鍘熸潗鏂�", "鍗婃垚鍝�", "鎴愬搧"], // 鍥句緥鏁版嵁
+        data: showSemiFinished.value ? ["鍘熸潗鏂�", "鍗婃垚鍝�", "鎴愬搧"] : ["鍘熸潗鏂�", "鎴愬搧"], // 鍥句緥鏁版嵁
         icon: ["circle", "circle", "circle"],
         itemWidth: 10, // 璁剧疆鍥炬爣瀹藉害
         itemHeight: 10,
@@ -697,7 +700,7 @@
           },
           data: monthlyPassRateData.value.map(item => item.rawMaterial.passRate),
         },
-        {
+        ...(showSemiFinished.value ? [{
           name: "鍗婃垚鍝�", // 绯诲垪鍚嶇О
           type: "line", // 鍥捐〃绫诲瀷涓烘姌绾垮浘
           // stack: "Total", // 鍫嗗彔鍚嶇О
@@ -706,7 +709,7 @@
             color: "#F7BA1E", // 璁剧疆杩欐潯绾跨殑棰滆壊
           },
           data: monthlyPassRateData.value.map(item => item.process.passRate),
-        },
+        }] : []),
         {
           name: "鎴愬搧", // 绯诲垪鍚嶇О
           type: "line", // 鍥捐〃绫诲瀷涓烘姌绾垮浘
@@ -769,16 +772,18 @@
     "#52c41a",
     getPassRateStatValue(0, 'passRate')
   );
-  semiCompletionChartInstance = initQualityChart(
-    semiCompletionChart,
-    "#1890ff",
-    getPassRateStatValue(1, 'completionRate')
-  );
-  semiQualityChartInstance = initQualityChart(
-    semiQualityChart,
-    "#52c41a",
-    getPassRateStatValue(1, 'passRate')
-  );
+  if (showSemiFinished.value) {
+    semiCompletionChartInstance = initQualityChart(
+      semiCompletionChart,
+      "#1890ff",
+      getPassRateStatValue(1, 'completionRate')
+    );
+    semiQualityChartInstance = initQualityChart(
+      semiQualityChart,
+      "#52c41a",
+      getPassRateStatValue(1, 'passRate')
+    );
+  }
   finalCompletionChartInstance = initQualityChart(
     finalCompletionChart,
     "#1890ff",
@@ -1161,7 +1166,7 @@
 
 .typeNum {
   height: 100%;
-  width: 33.33%;
+  flex: 1;
   display: flex;
   align-items: center;
   justify-content: center;
@@ -1297,11 +1302,12 @@
 
 .flex-center {
   justify-content: space-evenly;
+  gap: 15px;
 }
 
 .quality-card {
-  /* flex: 1; */
-  width: 32%;
+  flex: 1;
+  min-width: 0;
   /* height: 100px; */
   border-radius: 8px;
   padding: 12px;

--
Gitblit v1.9.3