From d8f34bfb422868bc8f31e5f7f6de9ba2f6c90737 Mon Sep 17 00:00:00 2001 From: niexiting <85552560@qq.com> Date: Tue, 25 Jul 2023 15:51:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=98=E7=82=B9=E6=98=8E?= =?UTF-8?q?=E7=BB=86=E5=8A=A0=E8=BD=BD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fe/PDA/pages/task/count_detail.vue | 91 ++++++++++++++++++++++++++---- 1 file changed, 80 insertions(+), 11 deletions(-) diff --git a/fe/PDA/pages/task/count_detail.vue b/fe/PDA/pages/task/count_detail.vue index 72f794729..79c32e2cd 100644 --- a/fe/PDA/pages/task/count_detail.vue +++ b/fe/PDA/pages/task/count_detail.vue @@ -9,7 +9,7 @@ :newCount="newCount" :location="location"> - + @@ -17,7 +17,7 @@ - {{ item.itemCode }} + {{index+1+'.'+item.itemCode }} {{ item.packingCode }} @@ -134,6 +134,7 @@ + @@ -192,7 +193,8 @@ type: '', id: '', datacontent: {}, - details: {}, + details: [], + allDetails: [], //所以的明细 currentItem: {}, editDescItem: {}, scrollTop: 0, @@ -208,7 +210,9 @@ topItem: '', isShowScanPopup: false, statusArray: [], - allStatusArray: [] + allStatusArray: [], + ipage: 1, + iSize: 50, // array: [{ // text: '待检', // value: 1 @@ -246,7 +250,7 @@ onNavigationBarButtonTap(e) { if (e.index === 0) { goHome(); - }else if(e.index === 1){ + } else if (e.index === 1) { window.location.reload(); } }, @@ -261,6 +265,16 @@ }); } }, + onReachBottom() { + this.ipage = this.ipage + 1; + this.refresh(); + //避免多次触发 + // if (this.loadingType == 'loading' || this.loadingType == 'nomore') { + // return; + // } + // this.getList("more"); + }, + filters: { statusStyle: function(val) { return getJobStatuStyle(val); @@ -314,7 +328,7 @@ getCountJobDetail(params) .then(async res => { that.datacontent = res; - that.allCount = res.details.length + if (res.details != null) { res.details.forEach(r => { r.scaned = false @@ -323,7 +337,9 @@ r.countQty = 0; }) } - that.details = res.details; + that.allDetails = res.details; + that.allCount = res.details.length + that.refresh(); //查询库位信息 let locationCode = that.datacontent.locationCode; let location = await locationsAsync(locationCode); @@ -336,6 +352,49 @@ uni.hideLoading(); }, + + refresh() { + let allPageSize = this.allDetails.length / this.iSize; + if (allPageSize + 1 > this.ipage) { + for (var i = (this.ipage - 1) * this.iSize; i < this.ipage * this.iSize; i++) { + if (i < this.allDetails.length) { + let item = this.allDetails[i]; + //判断是否加载出了该条数据 + let data = this.details.find(r => r.id == item.id); + if (data == null || data == undefined) { + this.details.push(item) + } + } else { + return; + } + } + } + }, + + //懒加载 + // this.navdelay(allData, this.ipage, 0); + navdelay(data, ipage, istart) { + //延时加载 + if (istart != 0) { + istart++ + } + for (let i = istart; i < data.length; i++) { + this.details.push(data[i]); + istart = i + console.log(istart) + if (i != 0 && i % ipage == 0) { + break + } + } + if (this.details == data.length) { + return + } + setTimeout(() => { + this.navdelay(data, ipage, istart) + }, 200) + }, + + getScanResult(result) { let that = this; this.scanResult = result; @@ -345,7 +404,7 @@ let lot = result.data.lot === null ? '' : result.data.lot; // let items = this.details.filter(r => r.itemCode === itemCode && // r.packingCode === packingCode && r.lot === lot) - let items = this.details.filter(r => + let items = this.allDetails.filter(r => r.packingCode === packingCode) if (items.length === 0) { //按零件盘点,不能添加其他零件为明细 @@ -479,7 +538,15 @@ item.countQty = Number(qty); item.countTime = new Date(); item.countOperator = localStorage.userId; + + //判断是否加载出了该条数据 + let data = this.details.find(r => r.id == item.id); + if (data == null || data == undefined) { + this.details.push(item); + } + this.details.sort(compare('countTime')); //按扫描信息排序 + this.scanPopupGetfocus(); this.$forceUpdate(); }, @@ -570,7 +637,7 @@ }, finishJob() { - let that=this; + let that = this; uni.showLoading({ title: "提交中...", mask: true @@ -630,8 +697,10 @@ }, openScanPopup() { - this.isShowScanPopup = true; - this.$refs.scanPopup.openScanPopup(); + setTimeout(r => { + this.isShowScanPopup = true; + this.$refs.scanPopup.openScanPopup(); + }, 0) }, closeScanPopup() {