From ffd88d66e16c6c7a37135bb2631c3f1aa4b43e98 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期三, 10 九月 2025 15:22:30 +0800 Subject: [PATCH] 111 --- H5/Js/Scll.js | 153 +++++++++++++++++++++++++++++--------------------- 1 files changed, 88 insertions(+), 65 deletions(-) diff --git a/H5/Js/Scll.js b/H5/Js/Scll.js index ec387f3..381055d 100644 --- a/H5/Js/Scll.js +++ b/H5/Js/Scll.js @@ -24,6 +24,12 @@ // { printerId: 'Printer2', ipAddress: '192.168.1.2' }, // { printerId: 'Printer3', ipAddress: '192.168.1.3' } //], // 鎵撳嵃鏈哄垪琛� + // 褰撳墠閫変腑琛岀殑绱㈠紩 + currentIndex: -1, + // 瀛樺偍閫変腑琛屾暟鎹璞� + selItem: {} , + ItemBarKw: [],//褰撳ぉ琛岀浉鍏虫潯鐮佸簱浣嶄俊鎭� + DaaInfo: {}, } }, mounted() { @@ -34,30 +40,49 @@ }; }, methods: { - getModel() { + + + /** + * 澶勭悊琛岀偣鍑讳簨浠讹紙鍗曢�夐�昏緫锛� + * @param {Object} item 褰撳墠琛屾暟鎹� + * @param {Number} index 褰撳墠琛岀储寮� + */ + handleRowClick(item, index) { + if (this.isLoading) { + return; + } + + // 閲嶇疆鎵�鏈夎鐨勯�変腑鐘舵�� + this.currentIndex = -1; + + // 璁剧疆褰撳墠閫変腑琛� + this.currentIndex = index; + this.selItem = { + itemid: item.fMaterialId, + index: index + }; + + console.log('褰撳墠閫変腑椤�:', this.selItem); // 璋冭瘯鐢� + + this.GetBarKwByItem(); + }, + GetBarKwByItem() { + var that = this; that.isLoading = true; - that.AxiosHttp("post", 'Womdaa/GetItemsByDaa001User', { - daa001: that.modeInfo.daa001, + that.AxiosHttp("post", 'Womdaa/GetBarKwByItem', { + itemId: that.selItem.itemid, userName: that.userInfo.loginAccount }, false) .then(function (res) { var json = res; - if (json.status == 0) { - console.log(json) - that.ItemDetail = json.data.tbBillList; - that.modeInfo.planNo = json.data.tbBillList.planNo; - that.$playSound('success'); - that.$refs.barcode.focus(); + that.ItemBarKw = json.data.tbBillList; } else { that.$toast.fail(json.message); that.$playSound('error'); - that.$refs.daa001.focus(); - that.modeInfo.daa001 = ""; - that.modeInfo.planNo = ""; - that.ItemDetail = []; + that.ItemBarKw = []; } that.isLoading = false; }) @@ -66,11 +91,12 @@ that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�"); that.$playSound('error'); console.log(error); - that.$refs.daa001.focus(); - that.modeInfo.daa001 = ""; + that.ItemBarKw = []; }); }, - getModelAll() { + + + getModel() { var that = this; that.isLoading = true; that.AxiosHttp("post", 'Womdaa/GetItemsByDaa001', { @@ -79,13 +105,15 @@ }, false) .then(function (res) { var json = res; - if (json.status == 0) { - console.log(json) that.ItemDetail = json.data.tbBillList; + that.DaaInfo = json.data.tbBillList.daaInfo; that.modeInfo.planNo = json.data.tbBillList.planNo; - that.$playSound('success'); + that.modeInfo.startTime = json.data.tbBillList.startTime; that.$refs.barcode.focus(); + // 閲嶇疆鎵�鏈夎鐨勯�変腑鐘舵�� + that.currentIndex = -1; + that.ItemBarKw = []; } else { that.$toast.fail(json.message); @@ -93,6 +121,7 @@ that.$refs.daa001.focus(); that.modeInfo.daa001 = ""; that.modeInfo.planNo = ""; + that.modeInfo.startTime = ""; that.ItemDetail = []; } that.isLoading = false; @@ -115,12 +144,10 @@ var that = this; if (that.modeInfo.daa001.length <= 0) { that.$toast.fail("宸ュ崟鍗曞彿涓嶈兘涓虹┖锛�"); - that.$playSound('error'); return; } if (that.scanInfo.barcode.length * 1 <= 0) { that.$toast.fail("鐗╂枡鏉$爜涓嶈兘涓虹┖锛�"); - that.$playSound('error'); return; } @@ -142,7 +169,6 @@ } else if (json.status == 2) { that.$refs.splitNum.focus(); - that.$playSound('success'); that.scanInfo.splitNum = json.data.tbBillList.splitNum; that.scanInfo.barcodeNum = json.data.tbBillList.barcodeNum; } @@ -171,17 +197,14 @@ var that = this; if (that.modeInfo.daa001.length <= 0) { that.$toast.fail("宸ュ崟鍗曞彿涓嶈兘涓虹┖锛�"); - that.$playSound('error'); return; } if (that.scanInfo.splitNum * 1 <= 0) { that.$toast.fail("鎷嗗垎鏁伴噺涓嶈兘涓虹┖锛�"); - that.$playSound('error'); return; } if (that.scanInfo.barcode.length * 1 <= 0) { that.$toast.fail("鐗╂枡鏉$爜涓嶈兘涓虹┖锛�"); - that.$playSound('error'); return; } //that.ip = ""; @@ -211,7 +234,7 @@ that.$notify({ type: 'success', message: json.message }); that.$playSound('success'); - //that.sendMessage(json.data.tbBillList); + that.sendPrintMessage(json.data.tbBillList); that.$refs.barcode.focus(); that.getModel(); @@ -230,43 +253,43 @@ }, - sendMessage(tbBillList) { - const cfDetails = tbBillList.cfBarInfo.map(item => { - return "! 0 200 200 210 1\r\n" + - "PAGE - WIDTH 700 \r\n" + - "BOX 0 0 700 180 0 \r\n" + - `T 16 0 10 10 鐗╂枡缂栫爜锛歕r\n` + - `T 55 3 120 10 ${item.iteM_NO}\r\n` + - `T 16 0 310 10 ${item.item_name}\r\n` + - "T 55 2 10 42 鐗╂枡瑙勬牸锛歕r\n" + - `T 55 2 110 42 ${item.item_model}\r\n` + - "T 16 0 10 78 鏁伴噺锛歕r\n" + - `T 0 5 90 78 ${item.quantity}\r\n` + - `T 16 5 180 78 ${item.barType}\r\n` + - `BARCODE 128 1 25 35 350 130 ${item.iteM_BARCODE}\r\n` + - `T 0 1 350 130 ${item.iteM_BARCODE}\r\n` + - "T 55 0 10 125 鍒涘缓鏃堕棿锛歕r\n" + - `T 55 0 120 125 ${item.creatE_DATE}\r\n` + - "T 55 0 10 150 鎵撳嵃鏃堕棿锛歕r\n" + - `T 55 0 120 150 ${item.print_date}\r\n` + - "B QR 580 12 M 2 U 4\r\n" + - `MA,${item.iteM_BARCODE}\r\n` + - "ENDQR\r\nFORM\r\nPRINT\r\n"; - }); - //alert(cfDetails); - let sendData = { - Type: 'Bar', - Barcode: tbBillList.cfBarInfo[0].iteM_BARCODE, - Detail: cfDetails, - Ip: tbBillList.printInfo[0].ip, - Port: tbBillList.printInfo[0].port, - } - console.log('sendMessage 寮�濮�1:') - console.log('sendMessage 寮�濮�2:' + JSON.stringify(sendData)) - uni.webView.postMessage({ - data: JSON.stringify(sendData) - }) - }, + //sendMessage(tbBillList) { + // const cfDetails = tbBillList.cfBarInfo.map(item => { + // return "! 0 200 200 210 1\r\n" + + // "PAGE - WIDTH 700 \r\n" + + // "BOX 0 0 700 180 0 \r\n" + + // `T 16 0 10 10 鐗╂枡缂栫爜锛歕r\n` + + // `T 55 3 120 10 ${item.iteM_NO}\r\n` + + // `T 16 0 310 10 ${item.item_name}\r\n` + + // "T 55 2 10 42 鐗╂枡瑙勬牸锛歕r\n" + + // `T 55 2 110 42 ${item.item_model}\r\n` + + // "T 16 0 10 78 鏁伴噺锛歕r\n" + + // `T 0 5 90 78 ${item.quantity}\r\n` + + // `T 16 5 180 78 ${item.barType}\r\n` + + // `BARCODE 128 1 25 35 350 130 ${item.iteM_BARCODE}\r\n` + + // `T 0 1 350 130 ${item.iteM_BARCODE}\r\n` + + // "T 55 0 10 125 鍒涘缓鏃堕棿锛歕r\n" + + // `T 55 0 120 125 ${item.creatE_DATE}\r\n` + + // "T 55 0 10 150 鎵撳嵃鏃堕棿锛歕r\n" + + // `T 55 0 120 150 ${item.print_date}\r\n` + + // "B QR 580 12 M 2 U 4\r\n" + + // `MA,${item.iteM_BARCODE}\r\n` + + // "ENDQR\r\nFORM\r\nPRINT\r\n"; + // }); + // //alert(cfDetails); + // let sendData = { + // Type: 'Bar', + // Barcode: tbBillList.cfBarInfo[0].iteM_BARCODE, + // Detail: cfDetails, + // Ip: tbBillList.printInfo[0].ip, + // Port: tbBillList.printInfo[0].port, + // } + // console.log('sendMessage 寮�濮�1:') + // console.log('sendMessage 寮�濮�2:' + JSON.stringify(sendData)) + // uni.webView.postMessage({ + // data: JSON.stringify(sendData) + // }) + //}, //getPrintInfo() { // var that = this; @@ -359,8 +382,8 @@ that.itemInfo = json.data.tbBillList; that.actions = json.data.tbBillList.map(item => { return { - name: item.daaInfo // 鎷兼帴瀛楁 - + name: item.daaInfo, // 鎷兼帴瀛楁 + subname: item.startTime }; }); } -- Gitblit v1.9.3