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 | 116 +++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 83 insertions(+), 33 deletions(-) diff --git a/src/views/doctor/inspectCheck/index.vue b/src/views/doctor/inspectCheck/index.vue index 7a3a261..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%" @@ -173,49 +174,98 @@ }, handleSelectionChange(val) { - this.selectedFirstTable = val; + // 闃叉閲嶅瑙﹀彂 + if (this.isProcessingSelection) { + console.log('姝e湪澶勭悊閫夋嫨锛岃烦杩囬噸澶嶈Е鍙�'); + return; + } + this.isProcessingSelection = true; - this.$nextTick(() => { - if (val.length === 0) { - console.log('鏃犻�変腑琛岋紝娓呯┖閫夋嫨鍜� checkList'); - this.checkList = []; - this.exaLists.forEach(row => { - this.$refs.firstTable && this.$refs.firstTable.toggleRowSelection(row, false); - }); - return; - } + // 濡傛灉娌℃湁閫変腑琛岋紝娓呯┖鎵�鏈夐�夋嫨骞惰烦杩囨帴鍙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; + } - const firstSelectedRow = val[0]; - let filterKey = firstSelectedRow.checkParts ? 'checkParts' : 'brid'; - let filterValue = firstSelectedRow.checkParts || 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); - + // 妫�鏌ユ槸鍚︾偣鍑讳簡鍏ㄩ�夋寜閽紙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; } - const shouldSelect = selectedSet.has(row.tempId); - console.log(`琛� tempId: ${row.tempId}, ${filterKey}: ${row[filterKey]}, 鏄惁閫変腑: ${shouldSelect}`); - this.$refs.firstTable.toggleRowSelection(row, shouldSelect); + this.$refs.firstTable.toggleRowSelection(row, true, false); + }); + } else { + // 鑾峰彇鏈�鏂伴�変腑鐨勮 + const latestSelectedRow = val[val.length - 1]; + + // 妫�鏌ユ槸鍚︾偣鍑讳簡宸查�変腑鐨勮锛堝彇娑堟墍鏈夐�変腑锛� + 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(() => { + 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); }); - if (!this.isFetchingRightTableData) { - this.isFetchingRightTableData = true; - this.fetchRightTableData().finally(() => { - this.isFetchingRightTableData = 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