From e34c215530a7587a6d5f5fe9c62646f9b38d054d Mon Sep 17 00:00:00 2001 From: lijuncheng Date: Thu, 26 Oct 2023 13:33:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=98=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fe/PDA/pages.js | 2 +- fe/PDA/pages.json | 2 +- fe/PDA/pages/task/count_detail.vue | 295 +++++++++++------- .../z-paging/js/modules/data-handle.js | 2 +- .../z-paging/components/z-paging/z-paging.vue | 4 +- 5 files changed, 187 insertions(+), 118 deletions(-) diff --git a/fe/PDA/pages.js b/fe/PDA/pages.js index 6a4683a46..d05c64fc0 100644 --- a/fe/PDA/pages.js +++ b/fe/PDA/pages.js @@ -378,7 +378,7 @@ module.exports = () => ({ "path": "pages/task/count_detail", "style": { "navigationBarTitleText": "盘点任务详情", - "enablePullDownRefresh": true + "enablePullDownRefresh": false } }, { diff --git a/fe/PDA/pages.json b/fe/PDA/pages.json index 4d4236273..b2354c19c 100644 --- a/fe/PDA/pages.json +++ b/fe/PDA/pages.json @@ -359,7 +359,7 @@ "path": "pages/task/count_detail", "style": { "navigationBarTitleText": "盘点任务详情", - "enablePullDownRefresh": true + "enablePullDownRefresh": false } }, { diff --git a/fe/PDA/pages/task/count_detail.vue b/fe/PDA/pages/task/count_detail.vue index af4380f14..c0365c5f9 100644 --- a/fe/PDA/pages/task/count_detail.vue +++ b/fe/PDA/pages/task/count_detail.vue @@ -156,15 +156,155 @@ --> - + + + @@ -265,22 +405,10 @@ ipage: 1, iSize: 20, testList: [], - isload: false, + isload: true, loadingType: "", - currentPage:1, - pageSize:10, - extraData: { - //给这个页面的虚拟列表取一个名字,这样在zp-virtual-cell中可以根据这个名字来区分不同页面的cell - id: 'test1', - //这边可以附加其他的当前页面需要传给cell的值 - - //这里示范了通过props传递方法回调来代替cell组件内部emit的场景,如果需要监听点击cell可以直接通过@innerCellClick监听 - editCountCallBack: (title) => { - //点击了标题 - console.log('点击了标题' + title) - } - }, - + currentPage: 0, + pageSize: 20, // array: [{ // text: '待检', // value: 1 @@ -333,24 +461,15 @@ }); } }, - onReachBottom() { - console.log("滑动底部") - // this.ipage = this.ipage + 1; - // this.refresh(); - //避免多次触发 - // if (this.loadingType == 'loading' || this.loadingType == 'nomore') { - // return; - // } - // this.getList("more"); - }, + onReachBottom() {}, filters: { statusStyle: function(val) { return getJobStatuStyle(val); }, - statusColor: function(val) { - return getJobStatuDesc(val); - }, + // statusColor: function(val) { + // return getJobStatuDesc(val); + // }, statusStyle: function(val) { return getInventoryTypeStyle(val); }, @@ -398,7 +517,7 @@ .then(async res => { that.datacontent = res; // var test = res.details[0] - // for (var i = 0; i < 6000; i++) { + // for (var i = 0; i < 10000; i++) { // var detail = {} // var detail = Object.assign(detail, test) // detail.id = i; @@ -415,9 +534,7 @@ } that.allDetails = res.details; that.allCount = res.details.length - // that.refresh(); - // this.details =this.getDataPage() - + //查询库位信息 let locationCode = that.datacontent.locationCode; let location = await locationsAsync(locationCode); @@ -430,58 +547,15 @@ 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; - } - } - } - }, - - getDataPage(){ + getDataPage(pageNo, pageSize) { //计算总页数 - var totalPages= Math.ceil(this.allCount/this.pageSize); - //当前页起始索引 - const start = (this.currentPage-1)*this.pageSize; - const end =start+this.pageSize;//当前页结束索引 - return this.allDetails.slice(start,end) - - }, - - //懒加载 - // 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) - }, + var totalPages = Math.ceil(this.allCount / pageSize); + //当前页起始索引 + const start = (pageNo - 1) * pageSize; + const end = start + pageSize; //当前页结束索引 + return this.allDetails.slice(start, end) + }, getScanResult(result) { let that = this; @@ -497,7 +571,7 @@ if (items.length === 0) { //按零件盘点,不能添加其他零件为明细 if (this.datacontent.countMethod === 2) { - if (this.details[0].itemCode === itemCode) { + if (this.allDetails[0].itemCode === itemCode) { this.addNewDetail(result); } else { this.showMessage('扫描的库存不在列表中'); @@ -517,7 +591,7 @@ } else { this.showMessage('盘点数量异常,箱码【' + packingCode + '】的出现多条数据'); } - this.scrollToTop(); + // this.scrollToTop(); this.calcScanCount(); }, @@ -534,7 +608,7 @@ if (confirm) { this.setDetailNoBalance(detail, result) this.allDetails.unshift(detail); - this.details.unshift(detail); + // this.details.unshift(detail); this.calcAllCount(); this.calcScanCount(); this.$forceUpdate(); @@ -554,7 +628,7 @@ if (confirm) { this.setDetailByBalance(detail, balanceItem); this.allDetails.unshift(detail); - this.details.unshift(detail); + // this.details.unshift(detail); this.calcAllCount(); this.calcScanCount(); this.$forceUpdate(); @@ -651,18 +725,8 @@ 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); - } - // var list =[]; - // var record ={} - // list.push(Object.assign(record, item)) - // this.$refs.paging.addDataFromTop(list); - this.allDetails.sort(compare('countTime')); //按扫描信息排序 - this.$refs.paging.setLocalPaging(this.allDetails); + this.$refs.paging.reload(); this.scanPopupGetfocus(); this.$forceUpdate(); }, @@ -681,7 +745,7 @@ content: '是否移除选择的行?', success: res => { if (res.confirm) { - that.details.splice(index, 1); + that.allDetails.splice(index, 1); } } }); @@ -722,6 +786,8 @@ }, submit() { + // let params = JSON.stringify(this.allDetails); + // console.log('params', params); let that = this; let unCheckedItems = that.allDetails.filter(r => { return r.scaned === false @@ -742,15 +808,16 @@ }, finish() { - if (this.details.length == 0) { - showConfirmMsg('还没有要盘点的任务详情,是否要继续提交?', confirm => { - if (confirm) { - this.finishJob(); - } - }); - } else { - this.finishJob(); - } + this.finishJob(); + // if (this.details.length == 0) { + // showConfirmMsg('还没有要盘点的任务详情,是否要继续提交?', confirm => { + // if (confirm) { + // this.finishJob(); + // } + // }); + // } else { + // this.finishJob(); + // } }, finishJob() { @@ -888,8 +955,10 @@ this.old.scrollTop = e.detail.scrollTop }, queryList(pageNo, pageSize) { - console.log("queryList") - this.$refs.paging.setLocalPaging(this.allDetails); + var list = [] + this.currentPage = pageNo + list = this.getDataPage(pageNo, pageSize) + this.$refs.paging.complete(list) } }, diff --git a/fe/PDA/uni_modules/z-paging/components/z-paging/js/modules/data-handle.js b/fe/PDA/uni_modules/z-paging/components/z-paging/js/modules/data-handle.js index f5d719987..cf5f15ea7 100644 --- a/fe/PDA/uni_modules/z-paging/components/z-paging/js/modules/data-handle.js +++ b/fe/PDA/uni_modules/z-paging/components/z-paging/js/modules/data-handle.js @@ -17,7 +17,7 @@ export default { //自定义pageSize,默认为10 defaultPageSize: { type: [Number, String], - default: u.gc('defaultPageSize', 10), + default: u.gc('defaultPageSize', 20), validator: (value) => { if (value <= 0) u.consoleErr('default-page-size必须大于0!'); return value > 0; diff --git a/fe/PDA/uni_modules/z-paging/components/z-paging/z-paging.vue b/fe/PDA/uni_modules/z-paging/components/z-paging/z-paging.vue index 4fad649ea..af375f61d 100644 --- a/fe/PDA/uni_modules/z-paging/components/z-paging/z-paging.vue +++ b/fe/PDA/uni_modules/z-paging/components/z-paging/z-paging.vue @@ -96,8 +96,8 @@ by ZXLee