From d5fb7ee0b1109dd71274803f059a11703af9156d Mon Sep 17 00:00:00 2001 From: wwl <xchao828@163.com> Date: 星期二, 11 二月 2025 13:51:49 +0800 Subject: [PATCH] 1 --- src/views/sampling/sampling/index.vue | 55 ++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 36 insertions(+), 19 deletions(-) diff --git a/src/views/sampling/sampling/index.vue b/src/views/sampling/sampling/index.vue index 0327f4e..1ec984b 100644 --- a/src/views/sampling/sampling/index.vue +++ b/src/views/sampling/sampling/index.vue @@ -393,6 +393,12 @@ } }, async piliangPrint() { + // 妫�鏌ユ槸鍚︽湁閫変腑鐨勬暟鎹� + if (this.piliangList.length === 0) { + this.$message.warning('璇峰厛閫夋嫨瑕佹墦鍗扮殑鏁版嵁'); + return; + } + const loadingInstance = this.$loading({ lock: true, text: '鎵撳嵃涓�...', @@ -406,15 +412,29 @@ // 鑾峰彇鏁版嵁锛屽苟绛夊緟鏁版嵁鏇存柊瀹屾垚 const tableList = await this.fetchData(item.tjNumber); - // 鍙繚鐣欐渶鏂颁袱涓厓绱� - if (tableList.length > 0) { - this.selectList = tableList.slice(0, 2); - } else { - this.selectList = []; // 濡傛灉娌℃湁鏁版嵁锛屾竻绌簊electList + // 妫�鏌� tableList 鏄惁鏈夋暟鎹� + if (!tableList || tableList.length === 0) { + console.error(`浣撴鍙� ${item.tjNumber} 鏃犵浉鍏虫暟鎹甡); + continue; } - // 浣跨敤鏇存柊鍚庣殑tableList鑾峰彇ids + // 鐩存帴浣跨敤鎵�鏈夋暟鎹� + this.selectList = tableList; + + // 妫�鏌� selectList 鏄惁鏈夋暟鎹� + if (this.selectList.length === 0) { + console.error(`浣撴鍙� ${item.tjNumber} 鐨� selectList 涓虹┖锛岃烦杩� WebSocket 鎿嶄綔`); + continue; + } + + // 浣跨敤鏇存柊鍚庣殑 tableList 鑾峰彇 ids let ids = this.selectList.map(row => row.id); + if (ids.length === 0) { + console.error(`浣撴鍙� ${item.tjNumber} 鏃犳湁鏁� ID`); + continue; + } + + // 纭閲囨牱 await this.Confirmreceipt1(ids); // 绛夊緟涓�娈垫椂闂� @@ -424,8 +444,8 @@ } } } finally { - this.ids = []; // 娓呯┖ids - this.selectList = []; // 娓呯┖selectList + this.ids = []; // 娓呯┖ ids + this.selectList = []; // 娓呯┖ selectList loadingInstance.close(); } }, @@ -628,11 +648,14 @@ const selectedCount = selection.length; const totalCount = this.samplingList.length; - // 濡傛灉鍙湁涓�鏉℃暟鎹紝涓嶈绂佺敤閫夋嫨 - if (selectedCount === 1 && totalCount === 1) { + // 濡傛灉鍙湁涓�鏉℃暟鎹紝涓嶈绂佺敤閫夋嫨锛屽苟灞曠ず鍙充晶鍒楄〃 + if (selectedCount === 1) { this.disableSelections = false; - - } else if (selectedCount === totalCount && selectedCount > 0) { + const selectedPerson = selection[0]; + const tjNumber = selectedPerson.tjNumber; + console.log(`閫変腑鐨勪綋妫�鍙�: ${tjNumber}`); + this.fetchData(tjNumber); + } else if (selectedCount === totalCount && selectedCount > 1) { // 鍏ㄩ�夋椂绂佺敤閫夋嫨鏂拌 this.disableSelections = true; this.tableList = []; @@ -640,13 +663,7 @@ } else { // 闈炲叏閫夋椂鍚敤閫夋嫨 this.disableSelections = false; - - if (selectedCount === 1) { - const selectedPerson = selection[0]; - const tjNumber = selectedPerson.tjNumber; - console.log(`閫変腑鐨勪綋妫�鍙�: ${tjNumber}`); - this.fetchData(tjNumber); - } else if (selectedCount > 1) { + if (selectedCount > 1) { // 淇濈暀鍗曢�夊姛鑳斤紝鍙栨秷澶氶�� let del_row = selection.shift(); this.$refs.tb.toggleRowSelection(del_row, false); -- Gitblit v1.8.0