<template>
|
<view class="page-containter page-containter-x">
|
<view class="page-header">
|
<page-header-x ctitle="缸盖上线" />
|
<user-row></user-row>
|
</view>
|
<view class="page-content">
|
<view class="online">
|
<!-- 叫料 -->
|
<view class="online_site">
|
<u-form :model="callForm" ref="callRef">
|
<!-- 站点 -->
|
<u-row gutter="16">
|
<u-col span="3">站点选择:</u-col>
|
<u-col span="9">
|
<u-input placeholder="请选择站点" v-model="callForm.station" type="select" :border="true" @click="siteFlag = true"></u-input>
|
<u-action-sheet :list="siteList" v-model="siteFlag" @click="confirm"></u-action-sheet>
|
</u-col>
|
</u-row>
|
<!-- 物料编号 -->
|
<u-row gutter="16">
|
<u-col span="3">物料编号:</u-col>
|
<u-col span="9">
|
<u-input v-model="callForm.materialCode" :border="true" placeholder="请输入物料编号" @blur="getSelectMaterialList"/>
|
</u-col>
|
</u-row>
|
<!-- 呼叫物料 -->
|
<u-row>
|
<u-col span="6" offset="3">
|
<u-button type="success" :disabled=" !(callForm.materialCode.length > 0 && callForm.station.length > 0)" @click="callMaterial">呼叫物料</u-button>
|
</u-col>
|
</u-row>
|
</u-form>
|
</view>
|
<!-- 托盘回库 -->
|
<view class="online_site">
|
<u-form :model="backForm" ref="backRef">
|
<!-- 站点选择 -->
|
<u-row gutter="16">
|
<u-col span="3">站点选择:</u-col>
|
<u-col span="9">
|
<u-input placeholder="请选择站点" v-model="backForm.station" type="select" :border="true" @click="siteBack = true"></u-input>
|
<u-action-sheet :list="siteList" v-model="siteBack" @click="confirmBack"></u-action-sheet>
|
</u-col>
|
</u-row>
|
<!-- 回库数量 -->
|
<u-row gutter="16">
|
<u-col span="3">回库数量:</u-col>
|
<!-- 物料编号 -->
|
<u-col span="9">
|
<u-input v-model="backForm.quality" type="number" max="3" :border="true" :disabled="true" placeholder="请输入回库数量"/>
|
</u-col>
|
</u-row>
|
<!-- 空托盘回库 -->
|
<u-row gutter="16">
|
<u-col span="6" offset="3">
|
<u-button type="warning" :disabled="!(backForm.quality > 0 && backForm.station.length > 0)" @click="emptyBack">空托盘回库</u-button>
|
</u-col>
|
</u-row>
|
</u-form>
|
</view>
|
<u-picker v-model="materialFlag" mode="selector" :default-selector="[0]" :range="selectMaterialList" @confirm="confirmMaterial"></u-picker>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import {callMaterial,emptyBack,geMaterialList} from '../../api/online/online.js'
|
import PageHeaderX from '../../compontents/PageHeaderX.vue'
|
import UserRow from '../../compontents/UserRow.vue'
|
import $config from '../../util/config.js'
|
export default {
|
components:{"page-header-x":PageHeaderX,UserRow},
|
data() {
|
return {
|
callForm: { //呼叫物料请求参数
|
station: '',
|
materialCode: ''
|
},
|
backForm: { // 空托盘回库
|
station: '',
|
quality: 3,
|
},
|
siteFlag:false,//叫料站点列表
|
siteBack:false, //空托站点列表
|
siteList:$config.sites.onLineHeader,
|
totalMaterialList:[], //总的物料列表数据
|
selectMaterialList:[], //匹配成功的 物料列表数据
|
materialFlag: false, //物料picker的状态
|
}
|
},
|
//页面加载事件
|
onReady() {
|
this.geMaterialList();
|
},
|
//下来刷新,清空请求数据
|
onPullDownRefresh() {
|
this.resetForm(() => {
|
uni.stopPullDownRefresh();
|
})
|
},
|
methods: {
|
//叫料站点点击确定
|
confirm(index) {
|
this.callForm.station = this.siteList[index].text;
|
},
|
//空托站点点击确定
|
confirmBack(index) {
|
this.backForm.station = this.siteList[index].text;
|
},
|
//获取物料列表
|
geMaterialList(){
|
this.totalMaterialList = [];
|
geMaterialList().then(res => {
|
res.data.forEach(item => {
|
this.totalMaterialList.push(item.materialCode);
|
})
|
}).catch(()=>{})
|
},
|
//物料输入框失焦事件
|
getSelectMaterialList(){
|
this.selectMaterialList = [];
|
this.selectMaterialList = this.totalMaterialList.filter(item => item.includes(this.callForm.materialCode));
|
this.materialFlag = true;
|
},
|
//picker选择器点击确定事件
|
confirmMaterial(selectArr) {
|
this.callForm.materialCode = this.selectMaterialList[selectArr[0]];
|
},
|
//清空请求参数
|
resetForm(callback){
|
this.callForm.materialCode = '';
|
this.callForm.station = '';
|
this.backForm.station = '';
|
callback && callback();
|
},
|
// 呼叫物料
|
callMaterial(){
|
callMaterial(this.callForm).then(res => {
|
//叫料成功
|
uni.showToast({
|
title:'叫料成功',
|
icon:'success'
|
})
|
//清空物料
|
this.callForm.materialCode = '';
|
}).catch(()=>{})
|
},
|
//空托盘回库
|
emptyBack(){
|
emptyBack(this.backForm).then(res => {
|
uni.showToast({
|
title:'回库成功',
|
icon: 'success'
|
});
|
}).catch(()=>{})
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.online {
|
width: 100%;
|
height: 100%;
|
overflow: hidden;
|
}
|
.online_site {
|
width: 96%;
|
margin: 50rpx auto;
|
border: 1px solid #ccc;
|
border-radius: 6rpx;
|
box-shadow: 5rpx 5rpx 3rpx #eee;
|
.u-row {
|
margin: 40rpx auto;
|
font-size: 32rpx;
|
.u-col {
|
text-align: center !important;
|
}
|
}
|
}
|
.online_item {
|
width: 94%;
|
margin: 20rpx auto;
|
border: 1px solid #eee;
|
padding: 10rpx;
|
box-shadow: 5rpx 5rpx 5rpx #eee;
|
border-radius: 10rpx;
|
.u-row {
|
font-size: 32rpx;
|
margin-bottom: 10rpx;
|
.sendBtn {
|
text-align: center !important;
|
}
|
}
|
}
|
</style>
|