|
|
@ -1,28 +1,27 @@ |
|
|
|
<template> |
|
|
|
<!-- <page-meta root-font-size="18px"></page-meta> --> |
|
|
|
<view class=""> |
|
|
|
<com-blank-view @goScan='openScanPopup' v-if="locationCode==''"></com-blank-view> |
|
|
|
|
|
|
|
<my-paging v-show="locationCode!=''" ref="paging" v-model="dataList" @query="queryList"> |
|
|
|
<!-- 需要固定在顶部不滚动的view放在slot="top"的view中,如果需要跟着滚动,则不要设置slot="top" --> |
|
|
|
<template #top> |
|
|
|
<view v-if="locationCode!=''"> |
|
|
|
<location-info :locationDetail='locationDetail' v-if="locationCode"></location-info> |
|
|
|
<z-tabs :list="tabList" @change="tabChange" /> |
|
|
|
</view> |
|
|
|
|
|
|
|
</template> |
|
|
|
<view class="" style="padding-bottom: 50rpx;"> |
|
|
|
<view v-if="tabIndex == 0" v-for="(item, index) in dataList"> |
|
|
|
<view class="" style=" width: 100%; position: fixed; top: 20rpx;right: 0;"> |
|
|
|
<com-blank-view @goScan='openScanPopup' v-if="locationCode==''"></com-blank-view> |
|
|
|
<location-info :locationDetail='locationDetail' v-if="locationCode"></location-info> |
|
|
|
<z-tabs v-if="locationCode" :list="tabList" @change="tabChange" /> |
|
|
|
</view> |
|
|
|
<view style="margin-top: 200rpx;width:100%"> |
|
|
|
<view v-if="totalCount>0" style="margin:10rpx; font-size:35rpx; font-weight:bold">总数 : {{totalCount}} </view> |
|
|
|
<view v-for="(item, index) in dataList" style="width:100%"> |
|
|
|
<view class="uni-flex uni-row" style=" align-items: center; background-color: #fff; border-radius:10rpx;margin:10rpx; " > |
|
|
|
<view class="" style="font-size:35rpx; "> |
|
|
|
({{index+1}}) |
|
|
|
</view> |
|
|
|
<comLocationDetailCard :isShowPack="false" :dataContent="item" style='margin: 10rpx;'> |
|
|
|
</comLocationDetailCard> |
|
|
|
</view> |
|
|
|
<view v-if="tabIndex == 1" v-for="(item, index) in dataList"> |
|
|
|
<comLocationDetailCard :dataContent="item" style='margin: 10rpx;'></comLocationDetailCard> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
<uni-load-more :status="loadingType" v-if="dataList.length>0" /> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
</my-paging> |
|
|
|
|
|
|
|
<win-scan-button @goScan='openScanPopup' v-if="locationCode!=''"></win-scan-button> |
|
|
|
<winScanLocation ref="scanPopup" title="库位代码" @getLocation='getScanCode'></winScanLocation> |
|
|
@ -36,17 +35,19 @@ |
|
|
|
<script> |
|
|
|
import { |
|
|
|
getBalanceByLocationcode, |
|
|
|
getBalanceByLocationcodeGroup |
|
|
|
getBalanceByLocationcodeGroup, |
|
|
|
getExpectInByLocationCode, |
|
|
|
getExpectOutByLocationCode |
|
|
|
} from '@/api/request2.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
maxPageSize, |
|
|
|
goHome |
|
|
|
} from '@/common/basic.js'; |
|
|
|
|
|
|
|
|
|
|
|
import { |
|
|
|
calc |
|
|
|
} from '@/common/calc.js'; |
|
|
|
calc |
|
|
|
} from '@/common/calc.js'; |
|
|
|
|
|
|
|
import locationInfo from '@/mycomponents/location/locationInfo.vue' |
|
|
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|
|
@ -72,15 +73,18 @@ |
|
|
|
balances: [], |
|
|
|
dataIn: [], |
|
|
|
dataOut: [], |
|
|
|
pageNo: 1, |
|
|
|
// 每页数据量 |
|
|
|
pageSize: 1000, |
|
|
|
pageSize: 10, |
|
|
|
// 当前页 |
|
|
|
pageCurrent: 1, |
|
|
|
// 数据总量 |
|
|
|
|
|
|
|
dataList: [], |
|
|
|
tabList: ['汇总', '明细'], |
|
|
|
tabList: ['汇总', '明细', '预计入', '预计出'], |
|
|
|
tabIndex: 0, |
|
|
|
loadingType: "nomore", |
|
|
|
totalCount:0 |
|
|
|
}; |
|
|
|
}, |
|
|
|
onLoad() {}, |
|
|
@ -95,6 +99,21 @@ |
|
|
|
mounted() { |
|
|
|
this.openScanPopup() |
|
|
|
}, |
|
|
|
|
|
|
|
onPullDownRefresh() { |
|
|
|
this.getContentByTab(this.tabIndex, this.pageNo, this.pageSize, "refresh"); |
|
|
|
}, |
|
|
|
|
|
|
|
onReachBottom() { |
|
|
|
console.log("底部") |
|
|
|
//避免多次触发 |
|
|
|
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
|
|
|
return; |
|
|
|
} |
|
|
|
this.getContentByTab(this.tabIndex, this.pageNo, this.pageSize, "more"); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
openScanPopup() { |
|
|
|
this.$refs.scanPopup.openScanPopup(); |
|
|
@ -112,114 +131,181 @@ |
|
|
|
// this.getContentByTab(this.tabIndex); |
|
|
|
}, |
|
|
|
|
|
|
|
getSummary(pageNo, pageSize) { |
|
|
|
getSummary(pageNo, pageSize, type) { |
|
|
|
let that = this; |
|
|
|
uni.showLoading({ |
|
|
|
title: "加载中...", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
this.loadingType = "loading"; |
|
|
|
if (type === "refresh") { |
|
|
|
this.pageNo = 1; |
|
|
|
this.dataList = []; |
|
|
|
} |
|
|
|
|
|
|
|
var params = { |
|
|
|
itemCode: this.itemCode, |
|
|
|
pageNo: pageNo, |
|
|
|
locationCode: this.locationCode, |
|
|
|
pageNo: this.pageNo, |
|
|
|
pageSize: pageSize |
|
|
|
} |
|
|
|
|
|
|
|
getBalanceByLocationcodeGroup(params).then(res => { |
|
|
|
uni.hideLoading(); |
|
|
|
if (res.data.list.length > 0) { |
|
|
|
this.summarysList = this.setShowList(res.data.list) |
|
|
|
this.$refs.paging.complete(this.summarysList); |
|
|
|
|
|
|
|
} else { |
|
|
|
this.$refs.paging.complete(false); |
|
|
|
this.showMessage('未查找到库位【' + this.locationCode + '】'); |
|
|
|
if (type === "refresh") { |
|
|
|
uni.stopPullDownRefresh(); |
|
|
|
} |
|
|
|
var list = res.data.list; |
|
|
|
this.totalCount = res.data.total |
|
|
|
this.loadingType = "loadmore"; |
|
|
|
if (list == null || list.length == 0) { |
|
|
|
this.loadingType = "nomore"; |
|
|
|
return; |
|
|
|
} |
|
|
|
this.dataList = type === "refresh" ? list : this.dataList.concat(list); |
|
|
|
this.pageNo++; |
|
|
|
|
|
|
|
}).catch(error => { |
|
|
|
this.$refs.paging.complete(false); |
|
|
|
uni.hideLoading(); |
|
|
|
this.showMessage(error); |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getDetailList(pageNo, pageSize) { |
|
|
|
getDetailList(pageNo, pageSize, type) { |
|
|
|
let that = this; |
|
|
|
uni.showLoading({ |
|
|
|
title: "加载中...", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
|
|
|
|
this.loadingType = "loading"; |
|
|
|
if (type === "refresh") { |
|
|
|
this.pageNo = 1; |
|
|
|
this.dataList = []; |
|
|
|
} |
|
|
|
|
|
|
|
var params = { |
|
|
|
locationCode: this.locationCode, |
|
|
|
pageNo: pageNo, |
|
|
|
pageNo: this.pageNo, |
|
|
|
pageSize: pageSize |
|
|
|
} |
|
|
|
getBalanceByLocationcode(params).then(res => { |
|
|
|
uni.hideLoading(); |
|
|
|
if (res.data.list.length > 0) { |
|
|
|
this.detailList = this.setShowList(res.data.list) |
|
|
|
this.$refs.paging.complete(this.detailList); |
|
|
|
} else { |
|
|
|
this.$refs.paging.complete(false); |
|
|
|
this.showMessage('未查找到库位w【' + this.locationCode + '】'); |
|
|
|
if (type === "refresh") { |
|
|
|
uni.stopPullDownRefresh(); |
|
|
|
} |
|
|
|
var list = res.data.list; |
|
|
|
this.totalCount = res.data.total |
|
|
|
this.loadingType = "loadmore"; |
|
|
|
if (list == null || list.length == 0) { |
|
|
|
this.loadingType = "nomore"; |
|
|
|
return; |
|
|
|
} |
|
|
|
this.dataList = type === "refresh" ? list : this.dataList.concat(list); |
|
|
|
this.pageNo++; |
|
|
|
|
|
|
|
}).catch(error => { |
|
|
|
this.$refs.paging.complete(false); |
|
|
|
uni.hideLoading(); |
|
|
|
this.showMessage(error); |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
setShowList(list) { |
|
|
|
var resultlist = []; |
|
|
|
list.forEach(res => { |
|
|
|
var temp = resultlist.find(res1 => |
|
|
|
res1.itemCode == res.itemCode) |
|
|
|
|
|
|
|
if (temp == undefined) { |
|
|
|
var data = { |
|
|
|
itemCode: res.itemCode, |
|
|
|
qty: Number(res.qty), |
|
|
|
uom: res.uom, |
|
|
|
list: [] |
|
|
|
} |
|
|
|
var item = { |
|
|
|
packingNumber: res.packingNumber, |
|
|
|
batch: res.batch, |
|
|
|
uom: res.uom, |
|
|
|
qty: Number(res.qty), |
|
|
|
inventoryStatus: res.inventoryStatus, |
|
|
|
} |
|
|
|
data.list.push(item) |
|
|
|
resultlist.push(data) |
|
|
|
} else { |
|
|
|
temp.qty = calc.add(temp.qty,res.qty) |
|
|
|
var item = { |
|
|
|
packingNumber: res.packingNumber, |
|
|
|
batch: res.batch, |
|
|
|
uom: res.uom, |
|
|
|
qty: Number(res.qty), |
|
|
|
inventoryStatus: res.inventoryStatus, |
|
|
|
} |
|
|
|
temp.list.push(item) |
|
|
|
getExpectin(pageNo, pageSize, type) { |
|
|
|
let that = this; |
|
|
|
uni.showLoading({ |
|
|
|
title: "加载中...", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
|
|
|
|
if (type === "refresh") { |
|
|
|
this.pageNo = 1; |
|
|
|
this.dataList = []; |
|
|
|
} |
|
|
|
|
|
|
|
var params = { |
|
|
|
pageNo: this.pageNo, |
|
|
|
pageSize: pageSize, |
|
|
|
filters: [{ |
|
|
|
column: "locationCode", |
|
|
|
action: "==", |
|
|
|
value: this.locationCode |
|
|
|
|
|
|
|
}] |
|
|
|
} |
|
|
|
|
|
|
|
getExpectInByLocationCode(params).then(res => { |
|
|
|
uni.hideLoading(); |
|
|
|
if (type === "refresh") { |
|
|
|
uni.stopPullDownRefresh(); |
|
|
|
} |
|
|
|
var list = res.data.list; |
|
|
|
this.totalCount = res.data.total |
|
|
|
this.loadingType = "loadmore"; |
|
|
|
if (list == null || list.length == 0) { |
|
|
|
this.loadingType = "nomore"; |
|
|
|
return; |
|
|
|
} |
|
|
|
this.dataList = type === "refresh" ? list : this.dataList.concat(list); |
|
|
|
this.pageNo++; |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading(); |
|
|
|
this.showMessage(error); |
|
|
|
}) |
|
|
|
return resultlist; |
|
|
|
|
|
|
|
}, |
|
|
|
ontabtap(e) { |
|
|
|
let index = e.target.dataset.current || e.currentTarget.dataset.current; |
|
|
|
this.tabIndex = index; |
|
|
|
this.getContentByTab(this.tabIndex); |
|
|
|
|
|
|
|
getExpectOut(pageNo, pageSize, type) { |
|
|
|
let that = this; |
|
|
|
uni.showLoading({ |
|
|
|
title: "加载中...", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
|
|
|
|
if (type === "refresh") { |
|
|
|
this.pageNo = 1; |
|
|
|
this.dataList = []; |
|
|
|
} |
|
|
|
|
|
|
|
var params = { |
|
|
|
pageNo: this.pageNo, |
|
|
|
pageSize: pageSize, |
|
|
|
filters: [{ |
|
|
|
column: "locationCode", |
|
|
|
action: "==", |
|
|
|
value: this.locationCode |
|
|
|
|
|
|
|
}] |
|
|
|
} |
|
|
|
|
|
|
|
getExpectOutByLocationCode(params).then(res => { |
|
|
|
uni.hideLoading(); |
|
|
|
if (type === "refresh") { |
|
|
|
uni.stopPullDownRefresh(); |
|
|
|
} |
|
|
|
var list = res.data.list; |
|
|
|
this.totalCount = res.data.total |
|
|
|
this.loadingType = "loadmore"; |
|
|
|
if (list == null || list.length == 0) { |
|
|
|
this.loadingType = "nomore"; |
|
|
|
return; |
|
|
|
} |
|
|
|
this.dataList = type === "refresh" ? list : this.dataList.concat(list); |
|
|
|
this.pageNo++; |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading(); |
|
|
|
this.showMessage(error); |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getContentByTab(index, pageNo, pageSize) { |
|
|
|
getContentByTab(index, pageNo, pageSize, type) { |
|
|
|
if (index === 0) { |
|
|
|
this.getSummary(pageNo, pageSize); |
|
|
|
} else if (index === 1) this.getDetailList(pageNo, pageSize) |
|
|
|
this.getSummary(pageNo, pageSize, type); |
|
|
|
} else if (index === 1) this.getDetailList(pageNo, pageSize, type) |
|
|
|
else if (index === 2) { |
|
|
|
this.dataIn = this.balances; |
|
|
|
this.getExpectin(pageNo, pageSize, type) |
|
|
|
} else if (index == 3) { |
|
|
|
this.dataOut = this.balances; |
|
|
|
this.getExpectOut(pageNo, pageSize, type) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
@ -237,14 +323,7 @@ |
|
|
|
}, |
|
|
|
tabChange(index) { |
|
|
|
this.tabIndex = index; |
|
|
|
this.$refs.paging.reload(true); |
|
|
|
}, |
|
|
|
queryList(pageNo, pageSize) { |
|
|
|
console.log("加载", pageNo) |
|
|
|
if (this.locationCode != "") { |
|
|
|
this.getContentByTab(this.tabIndex, pageNo, pageSize) |
|
|
|
} |
|
|
|
|
|
|
|
this.getContentByTab(index, this.pageNo, this.pageSize,"refresh") |
|
|
|
}, |
|
|
|
} |
|
|
|
}; |
|
|
@ -254,4 +333,4 @@ |
|
|
|
page { |
|
|
|
height: 100%; |
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |