<template>
|
<view class="putbank_index">
|
<view class="putbank_header"></view>
|
<view class="putbank_content">
|
<view class="putbank_content_search">
|
<u-row gutter="5" customStyle="padding-right: 10px">
|
<u-col span="5" @click="propPicker()">
|
<u-input
|
v-model="value"
|
border="surround"
|
disabled
|
disabledColor="#FFFFFF"
|
placeholder="请选择堆场"
|
></u-input>
|
</u-col>
|
<u-col span="5">
|
<u-input
|
v-model="ringNum"
|
border="surround"
|
placeholder="请输入环号"
|
></u-input>
|
</u-col>
|
<u-col span="2">
|
<u-button type="primary" size="small" text="查询" color="#1977FF" @click="searchData()"></u-button>
|
</u-col>
|
</u-row>
|
</view>
|
<scroll-view :scroll-top="scrollTop" refresher-enabled="true" scroll-y="true" class="putbank_content_scroll"
|
refresher-background="#EAEAEA" @scrolltolower="scrolltoLower" :refresher-triggered="triggered"
|
@refresherrefresh="refresherrefresh">
|
<view
|
class="putbank_scroll_item"
|
v-for="(item, index) in putbankList"
|
:key="index">
|
<view class="scroll_item_header">
|
{{item.proName}}
|
</view>
|
<view class="scroll_item_content">
|
<view class="item_content_info">
|
<text class="label">环号:</text>
|
<text>{{item.ringNum}}</text>
|
</view>
|
<view class="item_content_info">
|
<text class="label">堆场:</text>
|
<text>{{item.repoName}}</text>
|
</view>
|
<view class="item_content_info">
|
<text class="label">入库时间:</text>
|
<text>{{item.createTime}}</text>
|
</view>
|
<view class="item_content_info">
|
<text class="label">入库操作人:</text>
|
<text>{{item.createUser}}</text>
|
</view>
|
</view>
|
</view>
|
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
|
</scroll-view>
|
</view>
|
<u-picker
|
:show="showPicker"
|
:columns="columsData"
|
keyName="repoName"
|
closeOnClickOverlay
|
@cancel="showPicker = false"
|
@confirm="confirmPicker"
|
@close="showPicker = false"
|
></u-picker>
|
</view>
|
</template>
|
|
<script>
|
import { throttle } from '../../plugins/public';
|
export default {
|
data() {
|
return {
|
value: '',
|
repoIdValue: '',
|
ringNum: '', // 环号
|
pageNum: 1,
|
pageSize: 10,
|
loadPage: '',
|
scrollTop: 0,
|
triggered: true,
|
status: 'loading',
|
iconType: 'flower',
|
loadText: {
|
loading: '努力加载中',
|
nomore: '没有更多数据了'
|
},
|
putbankList: [], // 入库列表信息
|
showPicker: false, // 选择堆场
|
columsData: [], // 堆场信息
|
}
|
},
|
onShow() {
|
const that = this;
|
uni.$off('scancodedate');
|
uni.$on('scancodedate', function(data) {
|
console.log(data);
|
console.log(data.code.slice(-17));
|
that.$api.putbank.scanPutbank({
|
pipeNum: data.code.slice(-17)
|
}).then((res) => {
|
if(res.success) {
|
uni.$u.toast('扫描完成!');
|
uni.navigateTo({
|
url: '../putbankIndex/scanIndex?data=' + JSON.stringify(res.data)
|
})
|
} else {
|
uni.$u.toast(res.statusMsg);
|
}
|
})
|
})
|
that.getRepoRecordData();
|
that.searchData();
|
},
|
onUnload() {
|
// 移除监听事件
|
uni.$off('scancodedate');
|
},
|
methods: {
|
// 获取堆场信息
|
async getRepoRecordData() {
|
this.columsData = [];
|
const { data } = await this.$api.putbank.getRepoRecordData();
|
this.$set(this.columsData, 0, data);
|
},
|
// 查询入库列表信息
|
async searchPutbankData() {
|
const { data } = await this.$api.putbank.searchPutbankData({
|
pageNum: this.pageNum,
|
pageSize: this.pageSize,
|
repoId: this.repoIdValue,
|
ringNum: this.ringNum
|
})
|
return data;
|
},
|
// 查询
|
searchData() {
|
this.triggered = true;
|
this.putbankList = [];
|
this.searchPutbankData().then((data) => {
|
this.putbankList = data.list;
|
this.loadPage = data.pages;
|
this.triggered = false;
|
this.status = 'nomore';
|
}).catch(() => {
|
this.triggered = false;
|
this.status = 'nomore';
|
uni.$u.toast('没有更多数据了');
|
})
|
},
|
//自定义下拉刷新
|
refresherrefresh: throttle(function() {
|
this.status = 'loading';
|
this.pageNum = 1;
|
this.searchData();
|
uni.$u.toast('刷新成功');
|
}, 500),
|
//触底刷新
|
scrolltoLower: throttle(function() {
|
this.status = 'loading';
|
if(this.pageNum >= this.loadPage) {
|
setTimeout(() => {
|
this.status = 'nomore';
|
uni.$u.toast('没有更数据了');
|
},1000)
|
return;
|
} else {
|
this.pageNum += 1;
|
this.searchPutbankData().then((data) => {
|
this.loadPage = data.pages;
|
this.putbankList.push(...data.list);
|
this.status = 'nomore';
|
})
|
}
|
}, 3000),
|
// 打开选择堆场
|
propPicker() {
|
this.value = '';
|
this.repoIdValue = ''
|
this.showPicker = true;
|
},
|
// 确认选择堆场
|
confirmPicker(data) {
|
this.value = data.value[0].repoName;
|
this.repoIdValue = data.value[0].repoId;
|
this.showPicker = false;
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.putbank_index {
|
position: relative;
|
width: 100vw;
|
height: 100vh;
|
background: #F6F6F6;
|
|
.putbank_header {
|
height: 16%;
|
background: #1976FF;
|
border-radius: 0 0 30% 30%;
|
}
|
|
.putbank_content {
|
position: absolute;
|
top: 4%;
|
left: 50%;
|
transform: translateX(-50%);
|
width: calc(100% - 30px);
|
height: 96%;
|
|
.putbank_content_search {
|
padding: 20px 10px;
|
margin-bottom: 10px;
|
background: #FFFFFF;
|
border-radius: 2px;
|
}
|
|
.putbank_content_scroll {
|
height: 85%;
|
|
.putbank_scroll_item {
|
margin: 10px 0;
|
padding-bottom: 15px;
|
background: #FFFFFF;
|
border-radius: 4px;
|
|
&:first-child {
|
margin-top: 0;
|
}
|
|
.scroll_item_header {
|
position: relative;
|
padding: 10px 20px;
|
color: #1977FF;
|
font-size: 18px;
|
background: #DAE9FF;
|
border-radius: 4px 4px 0 0;
|
|
&::before {
|
content: '';
|
position: absolute;
|
top: 50%;
|
left: 10px;
|
transform: translateY(-50%);
|
width: 3px;
|
height: 45%;
|
background: #1977FF;
|
}
|
}
|
|
.scroll_item_content {
|
padding: 10px;
|
margin: 15px 10px 0;
|
background: #F6F9FE;
|
|
.item_content_info {
|
display: flex;
|
align-items: center;
|
padding: 2px 0;
|
|
.label {
|
color: #AFB0B1;
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
::v-deep .u-button--small {
|
height: 36px;
|
}
|
</style>
|