From dbfb045ad92072e880104e13fddb4dc7574499a1 Mon Sep 17 00:00:00 2001
From: fcx <2246384483@qq.com>
Date: 星期五, 19 十二月 2025 13:56:02 +0800
Subject: [PATCH] 1.给SJ获取检验项目添加防抖

---
 pages/QC/XJ/detail.vue |   87 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 72 insertions(+), 15 deletions(-)

diff --git a/pages/QC/XJ/detail.vue b/pages/QC/XJ/detail.vue
index 82571cc..18e6037 100644
--- a/pages/QC/XJ/detail.vue
+++ b/pages/QC/XJ/detail.vue
@@ -94,9 +94,14 @@
 
           <view class="input-group input1">
             <view class="input-wrapper">
+              <button class="btn upload-btn" @click="chooseImage">
+                <uni-icons type="upload" size="16" color="#fff"></uni-icons>
+                涓婁紶/鏌ョ湅鍥剧墖
+              </button>
               <input v-if="tableData.length < formData.levelNum" v-model="formData.fcheckResu" class="result-input"
                      placeholder="璇疯緭鍏ユ楠岀粨鏋�..." type="number"/>
-              <button v-if="tableData.length < formData.levelNum" class="btn primary-btn" @click="submit">淇濆瓨缁撴灉
+              <button v-if="tableData.length < formData.levelNum" class="btn primary-btn" @click="submit" style="margin: 0;">淇濆瓨缁撴灉 
+			   
               </button>
               <button v-if="isShowImg" class="btn upload-btn" @click="previewImage">
                 <uni-icons color="#fff" size="16" type="image"></uni-icons>
@@ -112,6 +117,10 @@
           <!-- 鍝嶅簲寮忚璁$殑绗簩涓緭鍏ョ粍 -->
           <view class="input-group input2">
             <view class="input-wrapper">
+              <button class="btn upload-btn" @click="chooseImage">
+                <uni-icons type="upload" size="16" color="#fff"></uni-icons>
+                涓婁紶/鏌ョ湅鍥剧墖
+              </button>
               <button v-if="isShowImg" class="btn upload-btn" @click="previewImage">
                 <uni-icons color="#fff" size="16" type="image"></uni-icons>
                 鏌ョ湅鍥剧墖
@@ -156,9 +165,9 @@
               <view v-if="isNumber && !isNaN(parseFloat(item.fcheckResu))" class="simple-number-result">
                 <view class="result-value">{{ item.fcheckResu }}</view>
                 <view v-if="formData.unitName" class="result-unit">{{ formData.unitName }}</view>
-                <view :class="{'pass': isInRange(item.fcheckResu), 'fail': !isInRange(item.fcheckResu)}"
+                <view :class="{'pass': item.fstand === '鈭�' || item.isPass === 1, 'fail': item.fstand === '脳' || item.isPass === 0}"
                       class="result-status">
-                  {{ isInRange(item.fcheckResu) ? '鍚堟牸' : '涓嶅悎鏍�' }}
+                  {{ (item.fstand === '鈭�' || item.isPass === 1) ? '鍚堟牸' : '涓嶅悎鏍�' }}
                 </view>
               </view>
 
@@ -170,12 +179,13 @@
               </view>
             </view>
             <view class="simple-data-cell simple-action">
-              <button v-if="!isNumber" class="simple-btn" @click="numberEdit(item)">
+              <button v-if="!isNumber && current" class="simple-btn" @click="numberEdit(item)">
                 {{ editResult(item.fcheckResu) }}
               </button>
-              <button v-if="isNumber" class="simple-btn" @click="toDetail(item)">
+              <button v-if="isNumber && current" class="simple-btn" @click="toDetail(item)">
                 淇敼
               </button>
+              <view v-if="!current" class="simple-disabled">宸叉彁浜�</view>
             </view>
           </view>
         </view>
@@ -236,7 +246,8 @@
       remarks: "",
       remarksPopup: false,
       currentTab: 0,
-      tabs: []
+      tabs: [],
+      current: true, // 娣诲姞current鐘舵�侊紝A=true(鏈彁浜�)锛孊=false(宸叉彁浜�)
     }
   },
   methods: {
@@ -292,15 +303,23 @@
       let fstand = "鈭�";
 
       //鏈夋渶澶у�煎拰鏈�灏忓�煎氨鏍规嵁鏄惁绗﹀悎鏍囧噯鍊兼洿鏂板垽瀹氱粨鏋滐紝娌℃湁鏈�澶у�煎拰鏈�灏忓�煎氨鏍规嵁鏄惁閫氳繃妫�楠屽垽瀹氱粨鏋�
-      if (this.formData.maxValue && this.formData.minValue) {
+      if (this.formData.maxValue != null && this.formData.minValue != null) {
 
         if (!this.formData.fcheckResu) {
           this.$showMessage("璇疯緭鍏ユ楠屽��");
           return;
         }
 
-        if (this.formData.fcheckResu >= this.formData.minValue && this.formData.fcheckResu <= this.formData
-            .maxValue) {
+        let checkValue = Number(this.formData.fcheckResu);
+        let minValue = Number(this.formData.minValue);
+        let maxValue = Number(this.formData.maxValue);
+
+        if (isNaN(checkValue) || isNaN(minValue) || isNaN(maxValue)) {
+          this.$showMessage("妫�楠屽�兼垨鑼冨洿鍊兼牸寮忎笉姝g‘锛岃妫�鏌ヨ緭鍏�");
+          return;
+        }
+
+        if (checkValue >= minValue && checkValue <= maxValue) {
           fstand = "鈭�"
         } else {
           fstand = "脳";
@@ -348,6 +367,10 @@
         }
       }).then(res => {
         this.formData = res.data.tbBillList.itemXj01;
+        // 纭繚formData鍖呭惈id灞炴�э紝鐢ㄤ簬鍥剧墖涓婁紶鍔熻兘
+        if (!this.formData.id && this.id) {
+          this.formData.id = this.id;
+        }
 
         this.tableData = res.data.tbBillList.itemXj02s;
 
@@ -356,7 +379,7 @@
           this.base64Image = 'data:image/jpeg;base64,' + this.formData.imageData;
         }
 
-        if (this.formData.maxValue && this.formData.minValue && this.formData.standardValue) {
+        if (this.formData.maxValue != null && this.formData.minValue != null && this.formData.standardValue != null) {
           this.isNumber = true;
         }
       })
@@ -378,15 +401,23 @@
 
       let fstand = "鈭�";
 
-      if (this.formData.maxValue && this.formData.minValue) {
+      if (this.formData.maxValue != null && this.formData.minValue != null) {
 
         if (!this.editData.fcheckResu) {
           this.$showMessage("璇疯緭鍏ユ楠屽��");
           return;
         }
 
-        if (this.editData.fcheckResu >= this.formData.minValue && this.editData.fcheckResu <= this.formData
-            .maxValue) {
+        let checkValue = Number(this.editData.fcheckResu);
+        let minValue = Number(this.formData.minValue);
+        let maxValue = Number(this.formData.maxValue);
+
+        if (isNaN(checkValue) || isNaN(minValue) || isNaN(maxValue)) {
+          this.$showMessage("妫�楠屽�兼垨鑼冨洿鍊兼牸寮忎笉姝g‘锛岃妫�鏌ヨ緭鍏�");
+          return;
+        }
+
+        if (checkValue >= minValue && checkValue <= maxValue) {
           this.editData.isPass = 1
         } else {
           this.editData.isPass = 0
@@ -427,7 +458,6 @@
       })
     },
     numberEdit(item) {
-
       let fstand = "鈭�";
       let fcheckResu = 1;
 
@@ -451,12 +481,19 @@
         this.refreshResult(); //鍒锋柊椤甸潰
       })
     },
+    // 涓婁紶鍥剧墖
+    chooseImage() {
+      uni.navigateTo({
+        url: 'ImageItem?id=666' + this.formData.id + '&gid=' + this.gid
+      });
+    },
     saveRemarks() {
       this.remarksPopup = !this.remarksPopup;
       this.remarks = this.formData.remarks;
     },
     editRemarks() {
-      if (this.remarks) {
+      // 鍏佽淇濆瓨绌哄瓧绗︿覆鎴栫┖鏍硷紝鍙鏌ユ槸鍚︿负null鎴杣ndefined
+      if (this.remarks !== null && this.remarks !== undefined) {
         //saveRemarksGid
         this.$post({
           url: "/XJ/saveRemarksPid",
@@ -498,6 +535,13 @@
     this.billNo = params["billNo"];
     this.gid = params["gid"];
     this.currentTab = parseInt(params["index"] || 0);
+    
+    // 璇诲彇current鍙傛暟锛屽垽鏂槸鍚﹀凡鎻愪氦
+    if (params["current"] === 'A') {
+      this.current = true;  // 鏈彁浜わ紝鍙互淇敼
+    } else if (params["current"] === 'B') {
+      this.current = false; // 宸叉彁浜わ紝绂佹淇敼
+    }
 
     this.refreshResult();
     this.loadTabItems();
@@ -645,6 +689,12 @@
       color: #fff;
       padding: 0 10px;
       margin: 0;
+      height: 45px;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      border: none;
+      border-radius: 4px;
     }
   }
 }
@@ -955,6 +1005,13 @@
   &.primary-btn {
     background-color: $primary-color;
     color: #fff;
+    height: 45px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    border: none;
+    border-radius: 4px;
+    padding: 0 20px;
   }
 
   &.danger-btn {

--
Gitblit v1.9.3