You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

177 lines
4.1 KiB

<template>
<page-meta root-font-size="18px"></page-meta>
<view class="">
<win-empty-view v-if="dataList.length==0"></win-empty-view>
<view hover-class="uni-list-cell-hover" v-for="(item, index) in dataList" :key="item.id"
@click="openDetail(item)">
<comUnProduce :dataContent="item" fromType ="pick"></comUnProduce>
</view>
<uni-load-more :status="loadingType" v-if="dataList.length>0" />
<win-scan-button @goScan='openScanPopup'></win-scan-button>
<win-mulit-scan ref="scanPopup" :titleArray="titleArray" @getScanResult='getScanResult'>
</win-mulit-scan>
<com-scan-issue-list ref="scanList" @selectedItem="selectedItem"></com-scan-issue-list>
<!-- com-message必须放在最下层 -->
<com-message ref="comMessage"></com-message>
</view>
</template>
<script>
import {
getUnProducePickList,
} from '@/api/index.js';
import {
goHome
} from '@/common/basic.js';
import winEmptyView from '@/mycomponents/wincom/winEmptyView.vue'
import comUnProduce from '@/mycomponents/coms/task/comUnProduce.vue';
import comMessage from '@/mycomponents/common/comMessage.vue'
import winScanButton from '@/mycomponents/wincom/winScanButton.vue'
import winMulitScan from '@/mycomponents/wincom/winMulitScan.vue'
import comScanIssueList from '@/mycomponents/scan/comScanIssueList.vue'
export default {
name: 'issue',
components: {
winEmptyView,
comUnProduce,
comMessage,
winScanButton,
winMulitScan,
comScanIssueList
},
data() {
return {
//popup
type: '',
dataList: [],
reload: false,
status: '',
contentText: {
contentdown: '上拉加载更多',
contentrefresh: '加载中',
contentnomore: '没有更多'
},
pageSize: this.modelConfig,
pageIndex: 1,
isIssueTimeChange: false,
isToday: false,
titleArray: ['任务编号'],
loadingType: "nomore"
};
},
onShow() {
this.getList('refresh');
},
mounted() {
},
//返回首页
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}else if(e.index === 1){
window.location.reload();
}
},
methods: {
openScanPopup() {
this.$refs.scanPopup.openScanPopup();
},
//按时间窗口排序
timeSortingChange() {
this.isIssueTimeChange = !this.isIssueTimeChange;
this.getList()
},
//只看当天到货
isTodayChange() {
this.isToday = !this.isToday
this.getList()
},
//查询发料任务
getList(type) {
let that = this;
uni.showLoading({
title: "加载中....",
mask: true
});
this.loadingType = "loading";
if (type === "refresh") {
this.pageIndex = 1;
this.dataList = [];
}
let params = {
pageSize: that.pageSize,
pageIndex: that.pageIndex,
isCreationTimeSorting: that.isIssueTimeChange,
isToday: that.isToday
};
getUnProducePickList(params)
.then(res => {
uni.hideLoading();
if (type === "refresh") {
uni.stopPullDownRefresh();
}
var list = res.items;
this.loadingType = "loadmore";
if (list == null || list.length == 0) {
//没数据了
this.loadingType = "nomore";
return;
}
that.dataList = type === "refresh" ? list : this.dataList.concat(list);
that.pageIndex++;
})
.catch(err => {
this.showMessage(err.message);
uni.hideLoading();
});
},
getScanResult(type, result) {
let code = result.data.code;
if (code == '') {
this.showMessage('扫描的内容不能为空')
return;
}
},
openDetail(item) {
uni.navigateTo({
url: './unProducePickDetail?id=' + item.id
});
},
showMessage(message) {
this.$refs.comMessage.showMessage(message);
},
onPull() {
this.getList('refresh');
},
onReachBottom() {
//避免多次触发
if (this.loadingType == 'loading' || this.loadingType == 'nomore') {
return;
}
this.getList('more');
},
showItemList(itemList) {
this.$refs.scanList.openPopup(itemList);
},
selectedItem(item) {
this.openDetail(item);
}
}
};
</script>
<style scoped lang="scss">
</style>