From 7a2e3904cd67f9da491e7f6c1a3975a43d2f85d0 Mon Sep 17 00:00:00 2001 From: xiangxy Date: Thu, 8 Dec 2022 16:22:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=A1=B5add?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 6 ++-- pages/ProductManage/SboProdProgress.vue | 45 +++++++++++++++++++++++-- utils/getData1.js | 6 ++-- 3 files changed, 50 insertions(+), 7 deletions(-) diff --git a/pages.json b/pages.json index b94f1fb..7884be1 100644 --- a/pages.json +++ b/pages.json @@ -27,8 +27,10 @@ ,{ "path" : "pages/ProductManage/SboProdProgress", "style": { - "navigationStyle": "custom" - } + "navigationStyle": "custom", + "enablePullDownRefresh": true, + "onReachBottomDistance": 50 + } } ,{ "path" : "pages/ProductManage/SboProcess", diff --git a/pages/ProductManage/SboProdProgress.vue b/pages/ProductManage/SboProdProgress.vue index 9e1f1fe..19c8dec 100644 --- a/pages/ProductManage/SboProdProgress.vue +++ b/pages/ProductManage/SboProdProgress.vue @@ -54,6 +54,7 @@ + @@ -76,7 +77,17 @@ val2: '', options: [], index: '', - dataList: [] + dataList: [], + reload: false, + status: 'more', + contentText: { + contentdown: '查看更多', + contentrefresh: '加载中', + contentnomore: '没有更多' + }, + totalCount: 0, + pageNum: 1, + pageSize: 10 }; }, created () { @@ -96,10 +107,38 @@ let res = await queryProductArea() this.options = [...res.data] }, + // /** 初始化查询 */ + // async _queryRawFoil () { + // let res = await queryRawFoil(this.val1, this.val2, this.index) + // this.dataList = [...res.data] + // } /** 初始化查询 */ async _queryRawFoil () { - let res = await queryRawFoil(this.val1, this.val2, this.index) - this.dataList = [...res.data] + let res = await queryRawFoil(this.val1, this.val2, this.index, 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._queryRawFoil() + }, 1000) + } else { //停止加载 + this.status = 'noMore' + } } } } diff --git a/utils/getData1.js b/utils/getData1.js index 3d801e1..621957c 100644 --- a/utils/getData1.js +++ b/utils/getData1.js @@ -10,12 +10,14 @@ export const queryProductArea = (type) => request({ data: {} }) // 1.2生箔生产进度初始化查询 -export const queryRawFoil = (pcode, cname, parea) => request({ +export const queryRawFoil = (pcode, cname, parea, page, size) => request({ url: 'api/pda/raw/queryRawFoil', data: { point_code: pcode, container_name: cname, - product_area: parea + product_area: parea, + page: page, + size: size } })