物料查询分页

This commit is contained in:
2023-08-30 16:51:53 +08:00
parent 1c6b16d6ce
commit d23ddf09be
3 changed files with 51 additions and 7 deletions

View File

@@ -33,7 +33,9 @@
{ {
"path": "pages/modules/SemifinishedMaterSearch", "path": "pages/modules/SemifinishedMaterSearch",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom",
"enablePullDownRefresh": true,
"onReachBottomDistance": 50
} }
}, },
{ {

View File

@@ -40,10 +40,11 @@
</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" :class="{'btn-disabled': !pkId}" @tap="toSure">确认</button> <button class="submit-button" :class="{'btn-disabled': !pkId}" @tap="toSure">确认</button>
<button class="submit-button" @tap="_getMaterial(val1)">查询</button> <button class="submit-button" @tap="searchList">查询</button>
</view> </view>
</view> </view>
</template> </template>
@@ -62,17 +63,56 @@
val1: '', val1: '',
dataList: [], dataList: [],
pkId: '', pkId: '',
pkObj: {} pkObj: {},
reload: false,
status: 'more',
contentText: {
contentdown: '查看更多',
contentrefresh: '加载中',
contentnomore: '没有更多'
},
totalCount: 0,
pageNum: 1,
pageSize: 30
}; };
}, },
methods: { methods: {
handleChange (e) { handleChange (e) {
this.dataList = []
this.pageNum = 1
this._getMaterial(e) this._getMaterial(e)
}, },
searchList () {
this.dataList = []
this.pageNum = 1
this._getMaterial(this.val1)
},
/** grid查询 */ /** grid查询 */
async _getMaterial (e) { async _getMaterial (e) {
let res = await getMaterial(e) let res = await getMaterial(e, 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._getMaterial(this.val1)
}, 1000)
} else { //停止加载
this.status = 'noMore'
}
}, },
toCheck (e) { toCheck (e) {
this.pkId = this.pkId === e.material_code ? '' : e.material_code this.pkId = this.pkId === e.material_code ? '' : e.material_code

View File

@@ -80,10 +80,12 @@ export const authority = () => {
* 半成品入库 * 半成品入库
*/ */
// 1.1物料选择页面 -- 单选 // 1.1物料选择页面 -- 单选
export const getMaterial = (sp) => request({ export const getMaterial = (sp, page, size) => request({
url:'api/pda/hrBcp/iosIn/getMaterial', url:'api/pda/hrBcp/iosIn/getMaterial',
data: { data: {
material_spec: sp material_spec: sp,
page: page,
size: size
} }
}) })
// 1.2工序下拉框 // 1.2工序下拉框