From d23ddf09be379d63fb697eeb6c693ecc844ba83a Mon Sep 17 00:00:00 2001 From: caill <815519168@qq.com> Date: Wed, 30 Aug 2023 16:51:53 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99=E6=9F=A5=E8=AF=A2=E5=88=86?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 4 +- pages/modules/SemifinishedMaterSearch.vue | 48 +++++++++++++++++++++-- utils/getData2.js | 6 ++- 3 files changed, 51 insertions(+), 7 deletions(-) diff --git a/pages.json b/pages.json index 68b4571..dd3e26b 100644 --- a/pages.json +++ b/pages.json @@ -33,7 +33,9 @@ { "path": "pages/modules/SemifinishedMaterSearch", "style": { - "navigationStyle": "custom" + "navigationStyle": "custom", + "enablePullDownRefresh": true, + "onReachBottomDistance": 50 } }, { diff --git a/pages/modules/SemifinishedMaterSearch.vue b/pages/modules/SemifinishedMaterSearch.vue index 64d3596..34680ae 100644 --- a/pages/modules/SemifinishedMaterSearch.vue +++ b/pages/modules/SemifinishedMaterSearch.vue @@ -40,10 +40,11 @@ + - + @@ -62,17 +63,56 @@ val1: '', dataList: [], pkId: '', - pkObj: {} + pkObj: {}, + reload: false, + status: 'more', + contentText: { + contentdown: '查看更多', + contentrefresh: '加载中', + contentnomore: '没有更多' + }, + totalCount: 0, + pageNum: 1, + pageSize: 30 }; }, methods: { handleChange (e) { + this.dataList = [] + this.pageNum = 1 this._getMaterial(e) }, + searchList () { + this.dataList = [] + this.pageNum = 1 + this._getMaterial(this.val1) + }, /** grid查询 */ async _getMaterial (e) { - let res = await getMaterial(e) - this.dataList = [...res.data] + let res = await getMaterial(e, this.pageNum + '', this.pageSize + '') + this.totalCount = res.size + if (res.size > 0) { + const dataMap = res.data + this.dataList = this.reload ? dataMap : this.dataList.concat(dataMap) + this.reload = false + } else { + this.dataList = [] + } + if (this.totalCount == this.dataList.length) { + this.reload = false + this.status = 'noMore' + } + }, + onReachBottom () { + if (this.totalCount > this.dataList.length) { + this.status = 'loading' + setTimeout(() => { + this.pageNum++ + this._getMaterial(this.val1) + }, 1000) + } else { //停止加载 + this.status = 'noMore' + } }, toCheck (e) { this.pkId = this.pkId === e.material_code ? '' : e.material_code diff --git a/utils/getData2.js b/utils/getData2.js index dc08da5..12cd192 100644 --- a/utils/getData2.js +++ b/utils/getData2.js @@ -80,10 +80,12 @@ export const authority = () => { * 半成品入库 */ // 1.1物料选择页面 -- 单选 -export const getMaterial = (sp) => request({ +export const getMaterial = (sp, page, size) => request({ url:'api/pda/hrBcp/iosIn/getMaterial', data: { - material_spec: sp + material_spec: sp, + page: page, + size: size } }) // 1.2工序下拉框