From 2bb623a2fd4ed6155450c66c04706ca18e3dbcb7 Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期四, 12 六月 2025 16:52:18 +0800
Subject: [PATCH] Merge branch 'master' of http://101.42.27.146:5001/r/ltkj_peisweb

---
 src/views/doctor/inspectCheck/index.vue |  157 ++++++++++++++++++++++++++++++----------------------
 1 files changed, 91 insertions(+), 66 deletions(-)

diff --git a/src/views/doctor/inspectCheck/index.vue b/src/views/doctor/inspectCheck/index.vue
index 5ccb3fe..51c2dd6 100644
--- a/src/views/doctor/inspectCheck/index.vue
+++ b/src/views/doctor/inspectCheck/index.vue
@@ -55,6 +55,7 @@
     <span class="highlight">濮撳悕锛歿{ infoList.tjCustomerName || "鏆傛棤" }}</span>
     <span class="highlight">鎬у埆锛歿{ infoList.tjCustomerSex == 0 ? "鐢�" : infoList.tjCustomerSex == 1 ? "濂�" : "鏆傛棤" }}</span>
     <span class="highlight">骞撮緞锛歿{ infoList.tjCustomerAge || "鏆傛棤" }}</span>
+    <span class="highlight">闂ㄨ瘖鍙凤細{{ infoList.cardId || "鏆傛棤" }}</span>
   </h3>
 </div>
     <el-table border height="350" ref="tab1" :data="checkList" v-loading="loading" style="width: 100%"
@@ -87,6 +88,8 @@
   dicts: ["dict_tj_status"],
   data() {
     return {
+        isProcessing: false, // 闃叉姝诲惊鐜�
+    isDeselection: false, // 鏍囪鏄惁涓哄彇娑堥�変腑
       infoList: {},
       dis: false,
       code: null,
@@ -170,77 +173,99 @@
       return !row.brid ? "row-disabled" : "";
     },
 
-    handleSelectionChange(val) {
-      // console.log(val);
-      /*  if (val.length > 1) {
-        let del_row = val.shift();
-        this.$refs.tb.toggleRowSelection(del_row, false); //璁剧疆杩欎竴琛屽彇娑堥�変腑
+handleSelectionChange(val) {
+  // 闃叉閲嶅瑙﹀彂
+  if (this.isProcessingSelection) {
+    console.log('姝e湪澶勭悊閫夋嫨锛岃烦杩囬噸澶嶈Е鍙�');
+    return;
+  }
+  this.isProcessingSelection = true;
+
+  // 濡傛灉娌℃湁閫変腑琛岋紝娓呯┖鎵�鏈夐�夋嫨骞惰烦杩囨帴鍙h皟鐢�
+  if (val.length === 0) {
+    console.log('妫�娴嬪埌鍙栨秷閫変腑锛屾竻绌烘墍鏈夐�夋嫨');
+    this.$refs.firstTable.clearSelection();
+    this.selectedFirstTable = null;
+    this.checkList = [];
+    this.isDeselection = true;
+    this.$nextTick(() => {
+      this.isProcessingSelection = false;
+      this.$refs.firstTable.$forceUpdate(); // 寮哄埗鍒锋柊琛ㄦ牸
+    });
+    return;
+  }
+
+  // 妫�鏌ユ槸鍚︾偣鍑讳簡鍏ㄩ�夋寜閽紙val 闀垮害绛変簬琛ㄦ牸鎬昏鏁帮級
+  if (val.length === this.exaLists.length) {
+    console.log('妫�娴嬪埌鍏ㄩ�夛紝閫変腑鎵�鏈夎');
+    this.selectedFirstTable = [...this.exaLists]; // 閫変腑鎵�鏈夎
+    this.$refs.firstTable.clearSelection();
+    this.exaLists.forEach(row => {
+      if (!row.brid) {
+        console.warn(`鍚嶇О涓� ${row.name} 鐨勮娌℃湁鐢宠鍗曞彿锛岃烦杩囬�夋嫨`);
+        return;
       }
-      console.log(val, 999); */
+      this.$refs.firstTable.toggleRowSelection(row, true, false);
+    });
+  } else {
+    // 鑾峰彇鏈�鏂伴�変腑鐨勮
+    const latestSelectedRow = val[val.length - 1];
 
-      if (val.length > 0) {
-        // const selectedRow = val[0];
-        // console.log(val[0], 555);
-
-        this.selectedFirstTable = val;
-        console.log("褰撳墠閫変腑鐨勮鏁版嵁:", this.selectedFirstTable);
-        this.fetchRightTableData(val);
-      } else {
-        this.selectedFirstTable = null;
-        this.checkList = [];
-      }
-
+    // 妫�鏌ユ槸鍚︾偣鍑讳簡宸查�変腑鐨勮锛堝彇娑堟墍鏈夐�変腑锛�
+    const isTogglingSelectedRow = this.selectedFirstTable && this.selectedFirstTable.some(row => row.tempId === latestSelectedRow.tempId);
+    if (isTogglingSelectedRow) {
+      console.log('鐐瑰嚮宸查�変腑琛岋紝鍙栨秷鎵�鏈夐�変腑');
+      this.$refs.firstTable.clearSelection();
+      this.selectedFirstTable = null;
+      this.checkList = [];
+      this.isDeselection = true;
       this.$nextTick(() => {
-        if (isDeselection) {
-          console.log('妫�娴嬪埌鍙栨秷閫変腑锛屾竻绌烘墍鏈夐�夋嫨');
-          this.exaLists.forEach(row => {
-            if (!row.brid) {
-              console.warn(`鍚嶇О涓� ${row.name} 鐨勮娌℃湁鐢宠鍗曞彿锛岃烦杩囬�夋嫨`);
-              return;
-            }
-            this.$refs.firstTable.toggleRowSelection(row, false, false);
-          });
-          this.checkList = [];
-        } else if (val.length > 0) {
-          const firstSelectedRow = val[0];
-          let filterKey = firstSelectedRow.checkParts ? 'checkParts' : 'brid';
-          let filterValue = firstSelectedRow.checkParts || firstSelectedRow.brid;
-
-          const checkPartsMatches = this.exaLists.filter(row => row.checkParts === firstSelectedRow.checkParts);
-          if (firstSelectedRow.checkParts && checkPartsMatches.length <= 1) {
-            filterKey = 'brid';
-            filterValue = firstSelectedRow.brid;
-          }
-
-          console.log(`鎸� ${filterKey} 绛涢��: ${filterValue}`);
-          const selectedSet = new Set(this.exaLists
-            .filter(row => row[filterKey] === filterValue)
-            .map(item => item.tempId));
-          console.log(`閫変腑鐨� ${filterKey} 闆嗗悎 (tempId):`, selectedSet);
-
-          this.exaLists.forEach(row => {
-            if (!row.brid) {
-              console.warn(`鍚嶇О涓� ${row.name} 鐨勮娌℃湁鐢宠鍗曞彿锛岃烦杩囬�夋嫨`);
-              return;
-            }
-            const shouldSelect = selectedSet.has(row.tempId);
-            console.log(`琛� tempId: ${row.tempId}, ${filterKey}: ${row[filterKey]}锛屾槸鍚﹂�変腑: ${shouldSelect}`);
-            this.$refs.firstTable.toggleRowSelection(row, shouldSelect, false);
-          });
-
-          if (!this.isFetchingRightTableData) {
-            this.isFetchingRightTableData = true;
-            this.fetchRightTableData().finally(() => {
-              this.isFetchingRightTableData = false;
-            });
-          }
-        } else {
-          console.log('鏃犻�変腑琛岋紝娓呯┖ checkList');
-          this.checkList = [];
-        }
+        this.isProcessingSelection = false;
+        this.$refs.firstTable.$forceUpdate(); // 寮哄埗鍒锋柊琛ㄦ牸
       });
-    },
+      return;
+    }
 
+    // 姝e父閫変腑閫昏緫锛氭牴鎹� brid 绛涢��
+    const filterKey = 'brid';
+    const filterValue = latestSelectedRow.brid;
+    console.log(`鎸� ${filterKey} 绛涢��: ${filterValue}`);
+
+    // 娓呯┖鎵�鏈夐�変腑鐘舵��
+    this.$refs.firstTable.clearSelection();
+
+    // 閫変腑涓� brid 鍖归厤鐨勮
+    const rowsToSelect = this.exaLists.filter(row => row.brid === filterValue);
+    rowsToSelect.forEach(row => {
+      if (!row.brid) {
+        console.warn(`鍚嶇О涓� ${row.name} 鐨勮娌℃湁鐢宠鍗曞彿锛岃烦杩囬�夋嫨`);
+        return;
+      }
+      this.$refs.firstTable.toggleRowSelection(row, true, false);
+    });
+
+    // 鏇存柊 selectedFirstTable 涓� brid 鍖归厤鐨勮
+    this.selectedFirstTable = rowsToSelect;
+  }
+
+  // 璋冪敤鍙充晶琛ㄦ牸鏁版嵁
+  if (!this.isFetchingRightTableData && this.selectedFirstTable.length > 0) {
+    this.isFetchingRightTableData = true;
+    this.fetchRightTableData().finally(() => {
+      this.isFetchingRightTableData = false;
+      this.$nextTick(() => {
+        // 浠呮洿鏂版牱寮忥紝涓嶈Е鍙戞柊浜嬩欢
+        this.$refs.firstTable.$forceUpdate();
+        this.isProcessingSelection = false;
+      });
+    });
+  } else {
+    this.isProcessingSelection = false;
+  }
+
+  // 閲嶇疆 isDeselection 鐘舵��
+  this.isDeselection = false;
+},
     fetchRightTableData() {
       const code = this.queryParams.tjNum;
       if (!code) {

--
Gitblit v1.8.0