分页add

This commit is contained in:
2022-12-08 16:22:27 +08:00
parent 404d5ad4aa
commit 7a2e3904cd
3 changed files with 50 additions and 7 deletions

View File

@@ -27,7 +27,9 @@
,{ ,{
"path" : "pages/ProductManage/SboProdProgress", "path" : "pages/ProductManage/SboProdProgress",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom",
"enablePullDownRefresh": true,
"onReachBottomDistance": 50
} }
} }
,{ ,{

View File

@@ -54,6 +54,7 @@
</table> </table>
</view> </view>
</view> </view>
<uni-load-more color="#007AFF" iconType="circle" :status="status" :icon-size="14" :content-text="contentText" v-if="dataList.length > 0"/>
</view> </view>
<view class="submit-bar"> <view class="submit-bar">
<button class="submit-button" @tap="_queryRawFoil">查询</button> <button class="submit-button" @tap="_queryRawFoil">查询</button>
@@ -76,7 +77,17 @@
val2: '', val2: '',
options: [], options: [],
index: '', index: '',
dataList: [] dataList: [],
reload: false,
status: 'more',
contentText: {
contentdown: '查看更多',
contentrefresh: '加载中',
contentnomore: '没有更多'
},
totalCount: 0,
pageNum: 1,
pageSize: 10
}; };
}, },
created () { created () {
@@ -96,10 +107,38 @@
let res = await queryProductArea() let res = await queryProductArea()
this.options = [...res.data] this.options = [...res.data]
}, },
// /** 初始化查询 */
// async _queryRawFoil () {
// let res = await queryRawFoil(this.val1, this.val2, this.index)
// this.dataList = [...res.data]
// }
/** 初始化查询 */ /** 初始化查询 */
async _queryRawFoil () { async _queryRawFoil () {
let res = await queryRawFoil(this.val1, this.val2, this.index) let res = await queryRawFoil(this.val1, this.val2, this.index, this.pageNum + '', this.pageSize + '')
this.dataList = [...res.data] 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'
}
} }
} }
} }

View File

@@ -10,12 +10,14 @@ export const queryProductArea = (type) => request({
data: {} data: {}
}) })
// 1.2生箔生产进度初始化查询 // 1.2生箔生产进度初始化查询
export const queryRawFoil = (pcode, cname, parea) => request({ export const queryRawFoil = (pcode, cname, parea, page, size) => request({
url: 'api/pda/raw/queryRawFoil', url: 'api/pda/raw/queryRawFoil',
data: { data: {
point_code: pcode, point_code: pcode,
container_name: cname, container_name: cname,
product_area: parea product_area: parea,
page: page,
size: size
} }
}) })