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.

279 lines
6.8 KiB

1 year ago
<template>
<!-- <page-meta root-font-size="18px"></page-meta> -->
<view class="">
<com-blank-view @goScan='openScanPopup' v-if="containerNumber==''"></com-blank-view>
1 year ago
<my-paging v-show="containerNumber!=''" ref="paging" v-model="dataList" @query="queryList">
<!-- 需要固定在顶部不滚动的view放在slot="top"的view中如果需要跟着滚动则不要设置slot="top" -->
<template #top>
<view v-if="containerNumber!=''">
<containerInfo :itemDetail="containerInfo" v-if="containerNumber"></containerInfo>
1 year ago
<u-line />
<z-tabs :list="tabList" @change="tabChange" />
</view>
1 year ago
</template>
<view class="" style="padding-bottom: 50rpx;">
<view v-if="tabIndex == 0" v-for="(item, index) in dataList">
<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>
1 year ago
</my-paging>
<win-scan-button @goScan='openScanPopup' v-if="containerNumber!=''"></win-scan-button>
<win-scan-item ref="scanPopup" title='器具代码' @getScanCode='getScanCode'>
</win-scan-item>
<show-modal ref="modal"></show-modal>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
getBalanceByContainerNumber,
getBalanceByContainerNumberGroup,
getContainerByNumber
} from '@/api/request2.js';
import {
maxPageSize,
goHome
} from '@/common/basic.js';
import {
calc
} from '@/common/calc.js';
1 year ago
import locationInfo from '@/mycomponents/location/locationInfo.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comMessage from '@/mycomponents/common/comMessage.vue'
import comLocationDetailCard from '@/pages/query/coms/comLocationDetailCard.vue'
11 months ago
import winScanContainer from "@/mycomponents/scan/winScanContainer.vue"
1 year ago
import containerInfo from '@/mycomponents/container/containerInfo.vue'
export default {
name: 'location',
components: {
locationInfo,
comBlankView,
winScanButton,
comMessage,
comLocationDetailCard,
11 months ago
containerInfo,
winScanContainer
1 year ago
},
data() {
return {
containerInfo: {},
containerNumber: '',
summarys: [],
balances: [],
// 每页数据量
pageSize: 1000,
// 当前页
pageCurrent: 1,
// 数据总量
scrollTop: 0,
old: {
scrollTop: 0
},
1 year ago
detailList: [],
summarysList: [],
dataList: [],
tabList: ['汇总', '明细'],
tabIndex: 0,
};
},
onLoad() {},
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
filters: {},
1 year ago
mounted() {
this.openScanPopup()
},
methods: {
openScanPopup() {
this.$refs.scanPopup.openScanPopup();
},
closeScanPopup() {
this.$refs.scanPopup.closeScanPopup();
},
getScanCode(code) {
this.containerNumber = '';
this.summarys = [];
this.balances = [];
this.occupieds = [];
this.getItemInfo(code);
},
1 year ago
getItemInfo(code) {
uni.showLoading({
title: "正在查询器具信息...",
mask: true
});
1 year ago
getContainerByNumber(code).then(res => {
uni.hideLoading();
if (res.data.list.length > 0) {
this.closeScanPopup();
this.containerNumber = res.data.list[0].number;
this.containerInfo = res.data.list[0];
this.tabChange(0)
} else {
this.showMessage('未查找到物料【' + code + '】');
1 year ago
}
1 year ago
}).catch(error => {
uni.hideLoading();
this.containerNumber = "";
this.showMessage(error);
})
},
getSummary(pageNo, pageSize) {
1 year ago
let that = this;
uni.showLoading({
title: "加载中...",
mask: true
});
var params = {
containerNumber: this.containerNumber,
pageNo: pageNo,
pageSize: pageSize
}
getBalanceByContainerNumberGroup(params).then(res => {
uni.hideLoading();
if (res.data.list.length > 0) {
this.summarysList = this.setShowList(res.data.list)
this.$refs.paging.complete(this.summarysList);
1 year ago
} else {
this.$refs.paging.complete(false);
this.showMessage('未查找到器具【' + this.containerNumber + '】');
}
}).catch(error => {
this.$refs.paging.complete(false);
uni.hideLoading();
this.showMessage(error);
})
},
getDetailList(pageNo, pageSize) {
1 year ago
let that = this;
uni.showLoading({
title: "加载中...",
mask: true
});
var params = {
containerNumber: this.containerNumber,
pageNo: pageNo,
pageSize: pageSize
}
getBalanceByContainerNumber(params).then(res => {
uni.hideLoading();
if (res.data.total > 0) {
this.detailList = this.setShowList(res.data.list)
this.$refs.paging.complete(this.detailList);
} else {
this.$refs.paging.complete(false);
this.showMessage('未查找到器具【' + this.containerNumber + '】');
}
}).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)
1 year ago
var item = {
packingNumber: res.packingNumber,
batch: res.batch,
uom: res.uom,
qty: Number(res.qty),
inventoryStatus: res.inventoryStatus,
}
temp.list.push(item)
}
})
return resultlist;
},
getContentByTab(index, pageNo, pageSize) {
1 year ago
if (index === 0) {
this.getSummary(pageNo, pageSize);
} else if (index === 1) this.getDetailList(pageNo, pageSize)
},
upper: function(e) {},
lower: function(e) {},
1 year ago
tabChange(index) {
this.tabIndex = index;
this.$refs.paging.reload(true);
},
showMessage(message) {
this.$refs.comMessage.showWarningMessage(message, res => {
if (res) {
this.afterCloseMessage()
}
});
},
afterCloseMessage() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
}
1 year ago
},
queryList(pageNo, pageSize) {
console.log("加载", pageNo)
if (this.containerNumber != "") {
this.getContentByTab(this.tabIndex, pageNo, pageSize)
}
1 year ago
},
}
};
</script>
<style scoped lang="scss">
page {
height: 100%;
}
</style>