From 7c2192a2f000d94add173b77b6bd4c8c4fc6a5e4 Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期三, 17 九月 2025 09:41:47 +0800
Subject: [PATCH] SJ穴模数

---
 pages/QC/SJ/detail.vue |  233 +++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 174 insertions(+), 59 deletions(-)

diff --git a/pages/QC/SJ/detail.vue b/pages/QC/SJ/detail.vue
index 1597e12..023ce37 100644
--- a/pages/QC/SJ/detail.vue
+++ b/pages/QC/SJ/detail.vue
@@ -159,14 +159,16 @@
             </view>
           </view>
           <view class="td">
+            <!-- 淇敼鎸夐挳 - 宸插~鍐欏悗鏄剧ず -->
             <button v-if="!isHoleBlocked(index) && item.fcheckResu && !isNumber" class="btn danger-btn" @tap="numberEdit(item)">
               {{ editResult(item.fcheckResu) }}
             </button>
             <button v-if="!isHoleBlocked(index) && item.fcheckResu && isNumber" class="btn danger-btn" @tap="toDetail(item)">
               淇敼
             </button>
+            <!-- 鐘舵�佹樉绀� -->
             <span v-if="isHoleBlocked(index)" class="blocked-text">宸插牭绌�</span>
-            <span v-else-if="!item.fcheckResu" class="no-data-text">寰呭~鍐�</span>
+            <span v-else-if="!item.fcheckResu" class="ready-text">鍙~鍐�</span>
           </view>
         </view>
       </view>
@@ -219,6 +221,7 @@
         </view>
       </view>
     </view>
+
   </view>
 </template>
 
@@ -249,13 +252,23 @@
     displayTableData() {
       const result = [];
       
+      console.log('displayTableData - formData:', this.formData);
+      console.log('displayTableData - tableData:', this.tableData);
+      
       // 濡傛灉鏈夌┐鍙蜂俊鎭紝浣跨敤绌村彿淇℃伅鐢熸垚鏁版嵁
       if (this.formData.holeNumbers && this.formData.holeNumbers.length > 0) {
+        // 瀵规暟鎹簱璁板綍鎸夊垱寤烘椂闂存帓搴忥紝纭繚椤哄簭绋冲畾
+        const sortedTableData = [...this.tableData].sort((a, b) => {
+          if (a.id && b.id) return a.id - b.id;
+          if (a.createDate && b.createDate) return new Date(a.createDate) - new Date(b.createDate);
+          return 0;
+        });
+        
+        console.log('displayTableData - sortedTableData:', sortedTableData);
+        
         this.formData.holeNumbers.forEach((holeInfo, index) => {
-          // 鏌ユ壘鏄惁鏈夊搴旂殑瀹為檯鏁版嵁
-          const actualData = this.tableData.find(item => {
-            return this.tableData.indexOf(item) === index;
-          });
+          // 鐩存帴閫氳繃绱㈠紩鑾峰彇瀵瑰簲鐨勬暟鎹簱璁板綍
+          const actualData = sortedTableData[index];
           
           if (actualData) {
             // 濡傛灉鏈夊疄闄呮暟鎹紝浣跨敤瀹為檯鏁版嵁
@@ -281,10 +294,17 @@
         // 濡傛灉娌℃湁绌村彿淇℃伅锛屼娇鐢ㄥ師鏉ョ殑閫昏緫
         const levelNum = this.formData.levelNum || 0;
         
+        // 鎸夌収鍒涘缓鏃堕棿鎴朓D鎺掑簭锛岀‘淇濋『搴忕ǔ瀹�
+        const sortedTableData = [...this.tableData].sort((a, b) => {
+          if (a.id && b.id) return a.id - b.id;
+          if (a.createDate && b.createDate) return new Date(a.createDate) - new Date(b.createDate);
+          return 0;
+        });
+        
+        console.log('displayTableData - sortedTableData (no holes):', sortedTableData);
+        
         for (let i = 0; i < levelNum; i++) {
-          const actualData = this.tableData.find(item => {
-            return this.tableData.indexOf(item) === i;
-          });
+          const actualData = sortedTableData[i];
           
           if (actualData) {
             result.push({
@@ -304,12 +324,21 @@
         }
       }
       
+      console.log('displayTableData - result:', result);
       return result;
     },
     
     // 鍒ゆ柇鏄惁鎵�鏈夋楠岄兘宸插畬鎴�
     isAllCompleted() {
-      return this.displayTableData.every(item => item.fcheckResu !== null && item.fcheckResu !== undefined);
+      // 鍙鏌ラ潪鍫电┐鐨勮鏄惁閮藉凡濉啓
+      return this.displayTableData.every(item => {
+        // 濡傛灉鏄牭绌达紝璺宠繃妫�鏌�
+        if (item.holeInfo && item.holeInfo.isBlocked) {
+          return true;
+        }
+        // 闈炲牭绌寸殑琛屽繀椤绘湁妫�楠岀粨鏋�
+        return item.fcheckResu !== null && item.fcheckResu !== undefined;
+      });
     }
   },
   methods: {
@@ -324,29 +353,7 @@
         return 'PENDING';
       }
       
-      // 鏍规嵁妫�楠岀粨鏋滃拰鍒ゅ畾鏍囪瘑纭畾鏍峰紡绫�
-      if (fstand === '鈭�' || fcheckResu === 'OK') {
-        return 'OK';
-      } else if (fstand === '脳' || fcheckResu === 'NG') {
-        return 'NG';
-      } else {
-        // 瀵逛簬鏁板瓧缁撴灉锛屾牴鎹甪stand鍒ゆ柇
-        return fstand === '鈭�' ? 'OK' : 'NG';
-      }
-    },
-    
-    getResultText(fcheckResu, fstand, index) {
-      // 妫�鏌ユ槸鍚﹁鍫电┐
-      if (this.isHoleBlocked(index)) {
-        return '/';
-      }
-      
-      // 濡傛灉娌℃湁璁板綍鍊硷紝鏄剧ず鏈楠�
-      if (!fcheckResu) {
-        return '鏈楠�';
-      }
-      
-      // 鏍规嵁璁板綍鍊煎垽鏂楠岀粨鏋滄槸鍚K
+      // 浼樺厛鏍规嵁fstand鍒ゆ柇
       if (fstand === '鈭�') {
         return 'OK';
       } else if (fstand === '脳') {
@@ -369,6 +376,47 @@
               }
             }
           }
+          // 榛樿杩斿洖OK鏍峰紡
+          return 'OK';
+        }
+      }
+    },
+    
+    getResultText(fcheckResu, fstand, index) {
+      // 妫�鏌ユ槸鍚﹁鍫电┐
+      if (this.isHoleBlocked(index)) {
+        return '/';
+      }
+      
+      // 濡傛灉娌℃湁璁板綍鍊硷紝鏄剧ず鏈楠�
+      if (!fcheckResu) {
+        return '鏈楠�';
+      }
+      
+      // 浼樺厛鏍规嵁fstand鍒ゆ柇
+      if (fstand === '鈭�') {
+        return '鍚堟牸';
+      } else if (fstand === '脳') {
+        return '涓嶅悎鏍�';
+      } else {
+        // 濡傛灉娌℃湁fstand锛屾牴鎹甪checkResu鐨勫�煎垽鏂�
+        if (fcheckResu === '1' || fcheckResu === 1) {
+          return '鍚堟牸';
+        } else if (fcheckResu === '0' || fcheckResu === 0) {
+          return '涓嶅悎鏍�';
+        } else {
+          // 瀵逛簬鏈変笂涓嬮檺鐨勬暟鍊兼楠岋紝鏍规嵁fcheckResu鏄惁鍦ㄨ寖鍥村唴鍒ゆ柇
+          if (this.formData.maxValue && this.formData.minValue) {
+            const value = parseFloat(fcheckResu);
+            if (!isNaN(value)) {
+              if (value >= this.formData.minValue && value <= this.formData.maxValue) {
+                return '鍚堟牸';
+              } else {
+                return '涓嶅悎鏍�';
+              }
+            }
+          }
+          // 濡傛灉鏄湁鏁板�肩殑妫�楠岀粨鏋滐紝鐩存帴鏄剧ず鏁板��
           return fcheckResu || '鏈娴�';
         }
       }
@@ -405,6 +453,7 @@
       }
       return false;
     },
+
 
     previewImage() {
       uni.previewImage({
@@ -445,23 +494,39 @@
 
         if (this.formData.fcheckResu == 0 || this.formData.fcheckResu == 1) {
           this.formData.isPass = this.formData.fcheckResu
+          // 鏍规嵁fcheckResu璁剧疆fstand
+          if (this.formData.fcheckResu == 1) {
+            fstand = "鈭�";  // 鍚堟牸
+          } else {
+            fstand = "脳";  // 涓嶅悎鏍�
+          }
         } else {
           this.$showMessage("鏃犳爣鍑嗗�兼椂锛屾楠岀粨鏋滃彧鑳戒负0鎴�1!");
           return;
         }
-        count = 1; // 姣忔鍙~鍐欎竴涓褰�
+        
+        // 璁$畻瀹為檯闇�瑕佸~鍐欑殑鏁伴噺锛堣�冭檻绌村彿淇℃伅锛�
+        if (this.formData.holeNumbers && this.formData.holeNumbers.length > 0) {
+          // 濡傛灉鏈夌┐鍙蜂俊鎭紝璁$畻闈炲牭绌寸殑鏁伴噺
+          const nonBlockedCount = this.formData.holeNumbers.filter(hole => !hole.isBlocked).length;
+          count = nonBlockedCount;
+        } else {
+          // 鍚﹀垯浣跨敤levelNum
+          count = this.formData.levelNum || 1;
+        }
       }
 
       this.formData.updater = this.$loginInfo.account;
 
+      // 鐩存帴鎵ц淇濆瓨锛屼笉鏄剧ず纭寮圭獥
       this.$post({
         url: "/SJ/SetQSItemDetail",
         data: {
           pid: this.id,
           gid: this.gid,
-          fstand: fstand,
-          fcheckResu: this.formData.fcheckResu,
-          updateBy: this.formData.updater,
+          Fstand: fstand,
+          FcheckResu: this.formData.fcheckResu,
+          UpdateBy: this.formData.updater,
           count: count
         }
       }).then(res => {
@@ -472,9 +537,11 @@
 
     },
     refreshResult() {
+      // 鍏堣幏鍙栨楠岄」鐩熀鏈俊鎭�
       this.$post({
         url: "/SJ/getQSItems",
         data: {
+          pid: this.gid,
           id: this.id
         }
       }).then(res => {
@@ -487,17 +554,21 @@
         if (this.formData.maxValue && this.formData.minValue && this.formData.standardValue) {
           this.isNumber = true;
         }
-      })
-
-      this.$post({
-        url: "/SJ/getQSItemDetail",
-        data: {
-          pid: this.id,
-          gid: this.gid
-        }
+        
+        // 鐒跺悗鑾峰彇妫�楠岃鎯呮暟鎹�
+        return this.$post({
+          url: "/SJ/getQSItemDetail",
+          data: {
+            pid: this.id,
+            gid: this.gid
+          }
+        });
       }).then(res => {
         this.tableData = res.data.tbBillList;
-      })
+        console.log('鍒锋柊鍚庣殑tableData:', this.tableData);
+      }).catch(error => {
+        console.error('鍒锋柊鏁版嵁澶辫触:', error);
+      });
     },
     toDetail(item) {
       this.showPopup = !this.showPopup;
@@ -547,21 +618,33 @@
 
       this.editData.updater = this.$loginInfo.account;
 
-      this.$post({
-        url: "/SJ/UpdateQSItemDetail",
-        data: {
-          id: this.editData.id,
-          pid: this.id,
-          gid: this.gid,
-          fstand: fstand,
-          fcheckResu: this.editData.fcheckResu,
-          updateBy: this.editData.updater,
+      // 鏄剧ず纭鎻愮ず妗�
+      uni.showModal({
+        title: '纭淇敼',
+        content: '纭畾瑕佷慨鏀规楠岀粨鏋滃悧锛�',
+        confirmText: '纭畾淇敼',
+        cancelText: '鍙栨秷',
+        success: (res) => {
+          if (res.confirm) {
+            // 鐢ㄦ埛纭鍚庢墽琛屼慨鏀�
+            this.$post({
+              url: "/SJ/UpdateQSItemDetail",
+              data: {
+                id: this.editData.id,
+                pid: this.id,
+                gid: this.gid,
+                fstand: fstand,
+                fcheckResu: this.editData.fcheckResu,
+                updateBy: this.editData.updater,
+              }
+            }).then(res => {
+              this.showPopup = !this.showPopup;
+              this.$showMessage("淇敼鎴愬姛");
+              this.refreshResult();//鍒锋柊椤甸潰
+            })
+          }
         }
-      }).then(res => {
-        this.showPopup = !this.showPopup;
-        this.$showMessage("淇敼鎴愬姛");
-        this.refreshResult();//鍒锋柊椤甸潰
-      })
+      });
     },
     numberEdit(item) {
 
@@ -836,6 +919,19 @@
   font-style: italic;
 }
 
+.waiting-text {
+  color: #E6A23C;
+  font-size: 12px;
+  font-style: italic;
+}
+
+.ready-text {
+  color: #67C23A;
+  font-size: 12px;
+  font-weight: bold;
+}
+
+
 .spec-text {
   font-size: 14px;
   color: #333;
@@ -943,6 +1039,12 @@
     color: #2c3e50;
     margin: 0;
   }
+
+  .popup-subtitle {
+    font-size: 14px;
+    color: #7f8c8d;
+    margin: 5px 0 0 0;
+  }
 }
 
 .popup-content {
@@ -967,6 +1069,19 @@
       background-color: white;
     }
   }
+
+  .input-hint {
+    margin-top: 8px;
+    padding: 8px 12px;
+    background-color: #f8f9fa;
+    border-radius: 4px;
+    border-left: 3px solid #409EFF;
+
+    text {
+      font-size: 12px;
+      color: #666;
+    }
+  }
 }
 
 .popup-actions {

--
Gitblit v1.9.3