From cb1f69717eed3b6a61b6c61a8934bac752782b2d Mon Sep 17 00:00:00 2001 From: wwl <xchao828@163.com> Date: 星期三, 05 三月 2025 17:00:38 +0800 Subject: [PATCH] 1 --- src/views/sampling/sampling/index.vue | 61 +++++++++++++++++++----------- 1 files changed, 39 insertions(+), 22 deletions(-) diff --git a/src/views/sampling/sampling/index.vue b/src/views/sampling/sampling/index.vue index 0327f4e..925f7e6 100644 --- a/src/views/sampling/sampling/index.vue +++ b/src/views/sampling/sampling/index.vue @@ -21,10 +21,10 @@ </el-select> </el-form-item> <!-- <el-form-item label="鏄惁閲囨牱" prop="isSignFor"> - <el-select style="width:100px" v-model="queryParams.isSignFor" placeholder="鏄惁閲囨牱"> + <el-select1 style="width:100px" v-model="queryParams.isSignFor" placeholder="鏄惁閲囨牱"> <el-option v-for="dict in dict.type.sampling_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option> - </el-select> + </el-select1> </el-form-item> --> <!-- <el-form-item label="浣撴鏃堕棿" prop="tjTime"> <el-date-picker clearable v-model="queryParams.tjTime" type="date" value-format="yyyy-MM-dd" @@ -249,7 +249,7 @@ piliangList: [], msg: "", getNumbr: null, - valueUrl: "ws://192.168.1.138:6789/websocket", + valueUrl: "ws://127.0.0.1:6789/websocket", webSocket: null, list: [], selectList: [], @@ -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