From 61a2db936dcbc3d5aebe8ff850bcaab76e3b3785 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 15 六月 2026 11:09:18 +0800
Subject: [PATCH] 合并恢复

---
 src/pages/qualityManagement/materialInspection/detail.vue |  124 +++--------------------------------------
 1 files changed, 9 insertions(+), 115 deletions(-)

diff --git a/src/pages/qualityManagement/materialInspection/detail.vue b/src/pages/qualityManagement/materialInspection/detail.vue
index 7bd3443..12ff7a3 100644
--- a/src/pages/qualityManagement/materialInspection/detail.vue
+++ b/src/pages/qualityManagement/materialInspection/detail.vue
@@ -15,7 +15,8 @@
           </view>
           <text class="header-title">{{ detailData.productName || '-' }}</text>
           <view class="status-tags">
-            <u-tag :type="getTagType(detailData.checkResult)"
+            <u-tag v-if="detailData.checkResult"
+                   :type="getTagType(detailData.checkResult)"
                    size="small"
                    class="status-tag">
               {{ detailData.checkResult || '-' }}
@@ -131,7 +132,7 @@
 
 <script setup>
   import { ref, onMounted } from "vue";
-  import { onShow } from "@dcloudio/uni-app";
+  import { onShow, onLoad } from "@dcloudio/uni-app";
   import PageHeader from "@/components/PageHeader.vue";
   import dayjs from "dayjs";
   import { qualityInspectParamInfo } from "@/api/qualityManagement/materialInspection.js";
@@ -204,16 +205,9 @@
     }, 1500);
   };
 
-  // 鑾峰彇椤甸潰ID
-  const getPageId = () => {
-    const pages = getCurrentPages();
-    const currentPage = pages[pages.length - 1];
-    return currentPage.options.id;
-  };
-
   // 鑾峰彇璇︽儏鏁版嵁
   const getDetail = () => {
-    const id = getPageId();
+    const id = optionsId.value;
     if (!id) {
       showToast("鍙傛暟閿欒");
       return;
@@ -235,31 +229,6 @@
             ) {
               // 濡傛灉鎺ュ彛娌℃湁杩斿洖鏁版嵁锛屼娇鐢ㄦ湰鍦板瓨鍌ㄤ腑鐨勬暟鎹�
               inspectionItems.value = detailDataFromStorage.qualityInspectParams;
-            } else {
-              // 妯℃嫙妫�楠岄」鐩�
-              inspectionItems.value = [
-                {
-                  parameterItem: "鍘氬害",
-                  unit: "mm",
-                  standardValue: "2.0 卤 0.1",
-                  controlValue: "2.0 卤 0.05",
-                  testValue: "2.05",
-                },
-                {
-                  parameterItem: "纭害",
-                  unit: "HB",
-                  standardValue: "鈮� 200",
-                  controlValue: "鈮� 210",
-                  testValue: "220",
-                },
-                {
-                  parameterItem: "琛ㄩ潰璐ㄩ噺",
-                  unit: "",
-                  standardValue: "鏃犲垝鐥曘�佹棤閿堣殌",
-                  controlValue: "鏃犲垝鐥曘�佹棤閿堣殌",
-                  testValue: "鍚堟牸",
-                },
-              ];
             }
           })
           .catch(error => {
@@ -272,90 +241,10 @@
               inspectionItems.value = detailDataFromStorage.qualityInspectParams;
             }
           });
-      } else {
-        // 妯℃嫙鏁版嵁
-        detailData.value = {
-          id: id,
-          checkTime: "2026-03-03",
-          purchaseContractNo: "PO20260303001",
-          supplier: "涓婃捣閲戝睘鏉愭枡鏈夐檺鍏徃",
-          checkName: "寮犱笁",
-          productName: "涓嶉攬閽㈡澘鏉�",
-          model: "304",
-          unit: "kg",
-          quantity: 1000,
-          checkCompany: "绗笁鏂规娴嬫満鏋�",
-          checkResult: "鍚堟牸",
-          inspectState: true,
-        };
-
-        // 妯℃嫙妫�楠岄」鐩�
-        inspectionItems.value = [
-          {
-            parameterItem: "鍘氬害",
-            unit: "mm",
-            standardValue: "2.0 卤 0.1",
-            controlValue: "2.0 卤 0.05",
-            testValue: "2.05",
-          },
-          {
-            parameterItem: "纭害",
-            unit: "HB",
-            standardValue: "鈮� 200",
-            controlValue: "鈮� 210",
-            testValue: "220",
-          },
-          {
-            parameterItem: "琛ㄩ潰璐ㄩ噺",
-            unit: "",
-            standardValue: "鏃犲垝鐥曘�佹棤閿堣殌",
-            controlValue: "鏃犲垝鐥曘�佹棤閿堣殌",
-            testValue: "鍚堟牸",
-          },
-        ];
       }
     } catch (error) {
       console.error("鍔犺浇璇︽儏鏁版嵁澶辫触:", error);
       showToast("鍔犺浇璇︽儏鏁版嵁澶辫触锛岃閲嶈瘯");
-      // 鍔犺浇澶辫触鏃朵娇鐢ㄦā鎷熸暟鎹�
-      detailData.value = {
-        id: id,
-        checkTime: "2026-03-03",
-        purchaseContractNo: "PO20260303001",
-        supplier: "涓婃捣閲戝睘鏉愭枡鏈夐檺鍏徃",
-        checkName: "寮犱笁",
-        productName: "涓嶉攬閽㈡澘鏉�",
-        model: "304",
-        unit: "kg",
-        quantity: 1000,
-        checkCompany: "绗笁鏂规娴嬫満鏋�",
-        checkResult: "鍚堟牸",
-        inspectState: true,
-      };
-
-      inspectionItems.value = [
-        {
-          parameterItem: "鍘氬害",
-          unit: "mm",
-          standardValue: "2.0 卤 0.1",
-          controlValue: "2.0 卤 0.05",
-          testValue: "2.05",
-        },
-        {
-          parameterItem: "纭害",
-          unit: "HB",
-          standardValue: "鈮� 200",
-          controlValue: "鈮� 210",
-          testValue: "220",
-        },
-        {
-          parameterItem: "琛ㄩ潰璐ㄩ噺",
-          unit: "",
-          standardValue: "鏃犲垝鐥曘�佹棤閿堣殌",
-          controlValue: "鏃犲垝鐥曘�佹棤閿堣殌",
-          testValue: "鍚堟牸",
-        },
-      ];
     }
   };
 
@@ -366,6 +255,11 @@
   onMounted(() => {
     getDetail();
   });
+  const optionsId = ref("");
+  onLoad(options => {
+    optionsId.value = options.id || "";
+    getDetail();
+  });
 </script>
 
 <style scoped lang="scss">

--
Gitblit v1.9.3