From e449a5408265e4bd1f6c66f5be28a42efac444ee Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期日, 20 九月 2026 15:22:46 +0800
Subject: [PATCH] 天津豹鸣app 1.需求修改

---
 src/pages/qualityManagement/finalInspection/detail.vue |   80 ++++++++++++++++++++++++++-------------
 1 files changed, 53 insertions(+), 27 deletions(-)

diff --git a/src/pages/qualityManagement/finalInspection/detail.vue b/src/pages/qualityManagement/finalInspection/detail.vue
index d274a28..4080d94 100644
--- a/src/pages/qualityManagement/finalInspection/detail.vue
+++ b/src/pages/qualityManagement/finalInspection/detail.vue
@@ -94,6 +94,12 @@
                 <text class="item-detail-label">鍗曚綅:</text>
                 <text class="item-detail-value">{{ item.unit || '-' }}</text>
               </view>
+              <!-- 鏁板瓧鍨嬫寜涓婁笅闄愬垽瀹氾紝鎶婁笂涓嬮檺鎽嗗嚭鏉ユ墠鐪嬪緱鎳傚垽瀹氫緷鎹� -->
+              <view v-if="isNumeric(item)"
+                    class="item-detail-row">
+                <text class="item-detail-label">涓婁笅闄�:</text>
+                <text class="item-detail-value">{{ item.minValue }} ~ {{ item.maxValue }}</text>
+              </view>
               <view class="item-detail-row">
                 <text class="item-detail-label">鏍囧噯鍊�:</text>
                 <text class="item-detail-value">{{ item.standardValue || '-' }}</text>
@@ -104,23 +110,28 @@
               </view>
               <view class="item-detail-row">
                 <text class="item-detail-label">妫�楠屽��:</text>
+                <text class="item-detail-value">{{ item.testValue || '-' }}</text>
+              </view>
+              <view class="item-detail-row">
+                <text class="item-detail-label">鍒ゅ畾:</text>
                 <text class="item-detail-value result"
-                      :class="getResultClass(item.testValue, item.standardValue)">
-                  {{ item.testValue || '-' }}
+                      :class="judgeClass(item)">
+                  {{ judgeText(item) }}
                 </text>
               </view>
             </view>
           </view>
         </view>
       </view>
-      <!-- 鎿嶄綔鎸夐挳 -->
-      <!-- <view class="action-buttons">
+      <!-- 闇�姹備節.4锛氫笅杞� PDF 鍚堟牸璇� -->
+      <view class="action-buttons">
         <u-button type="primary"
                   class="action-btn"
+                  :loading="downloading"
                   @click="downloadReport">
-          涓嬭浇鎶ュ憡
+          涓嬭浇鍚堟牸璇丳DF
         </u-button>
-      </view> -->
+      </view>
     </view>
     <view v-else
           class="no-data">
@@ -136,6 +147,8 @@
   import PageHeader from "@/components/PageHeader.vue";
   import dayjs from "dayjs";
   import { qualityInspectParamInfo } from "@/api/qualityManagement/materialInspection.js";
+  import { downloadQualityInspectPdf } from "@/api/qualityManagement/qualityInspectFile.js";
+  import { NUMERIC_TYPE, isItemPass } from "./_utils/inspection";
 
   // 鏄剧ず鎻愮ず淇℃伅
   const showToast = message => {
@@ -149,6 +162,8 @@
   const detailData = ref(null);
   // 妫�楠岄」鐩�
   const inspectionItems = ref([]);
+  // 鍚堟牸璇丳DF 涓嬭浇涓�
+  const downloading = ref(false);
 
   // 杩斿洖涓婁竴椤�
   const goBack = () => {
@@ -178,31 +193,34 @@
     return state ? "success" : "warning";
   };
 
-  // 鑾峰彇缁撴灉鏍峰紡
-  const getResultClass = (testValue, standardValue) => {
-    // 绠�鍗曠殑缁撴灉鍒ゆ柇閫昏緫锛屽疄闄呴」鐩腑鍙兘闇�瑕佹洿澶嶆潅鐨勫垽鏂�
-    if (testValue === "鍚堟牸") {
-      return "result-passed";
-    } else if (testValue === "涓嶅悎鏍�") {
-      return "result-rejected";
-    }
-    return "";
+  // 鏁板瓧鍨嬫墠鏈変笂涓嬮檺
+  const isNumeric = item => item?.parameterType === NUMERIC_TYPE;
+
+  const judgeText = item => {
+    const val = item?.testValue;
+    if (val === null || val === undefined || val === "") return "-";
+    return isItemPass(item) ? "鍚堟牸" : "涓嶅悎鏍�";
   };
 
-  // 涓嬭浇鎶ュ憡
-  const downloadReport = () => {
-    uni.showToast({
-      title: "鎶ュ憡涓嬭浇涓�...",
-      icon: "loading",
-    });
+  const judgeClass = item => {
+    const val = item?.testValue;
+    if (val === null || val === undefined || val === "") return "";
+    return isItemPass(item) ? "result-passed" : "result-rejected";
+  };
 
-    // 妯℃嫙涓嬭浇
-    setTimeout(() => {
-      uni.showToast({
-        title: "鎶ュ憡涓嬭浇鎴愬姛",
-        icon: "success",
+  // 涓嬭浇 PDF 鍚堟牸璇�
+  const downloadReport = () => {
+    if (!optionsId.value) {
+      showToast("鍙傛暟閿欒");
+      return;
+    }
+    downloading.value = true;
+    // downloadFileByPost 鍐呴儴宸� toast锛岃繖閲屽彧璐熻矗鏀跺熬 loading
+    downloadQualityInspectPdf(optionsId.value)
+      .catch(() => {})
+      .finally(() => {
+        downloading.value = false;
       });
-    }, 1500);
   };
 
   // 鑾峰彇璇︽儏鏁版嵁
@@ -413,6 +431,14 @@
     color: #f56c6c;
   }
 
+  .action-buttons {
+    padding: 4px 0 8px;
+  }
+
+  .action-btn {
+    width: 100%;
+  }
+
   // 绌虹姸鎬�
   .no-data {
     padding: 60px 20px;

--
Gitblit v1.9.3