<template>
|
<default-header-page-layout ref="page" title="组盘管理" >
|
<view class="page-frame with-action-user-row" :style="{height:pageBodyHeight+'px'}" v-if="pageBodyHeight">
|
<action-user-row />
|
<view class="with-action-user-row-page-content">
|
<template>
|
<scan-input-form-item
|
class="forma-item"
|
label="小车编号"
|
v-model="wareContainerCode"
|
:msg="msg.containter"
|
:msg-type="msgType.containter"
|
:has-search="false"
|
@search="onSearchContainter"
|
@clear="onClearContainter"
|
/>
|
<view>
|
<view class="labelnew">端拾器信息:</view>
|
<button type="default" class="btn" @click="toggle('bottom')">添加端拾器</button>
|
</view>
|
<view class="line2 pl2" v-for="(item,index) in arr" :key="index">
|
|
<view class="" style="display: flex;">
|
<view class="" style="width: 100%;">
|
<view>
|
<text class="col7">端拾器名称:</text>
|
<text class="ml10">{{item.materialname}}</text>
|
</view>
|
<view>
|
<text class="col7">端拾器编号:</text>
|
<text class="ml10">{{item.materialno}}</text>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
</view>
|
|
</view>
|
<template v-slot:footer>
|
<view class="bottom-btns-row">
|
<template >
|
<div class="btn-frame left-btn-frame"><u-button text="重置" @click="reset"></u-button></div>
|
<div class="btn-frame right-btn-frame"><u-button type="primary" text="组盘" @click="onBind"></u-button></div>
|
</template>
|
<template>
|
<view>
|
<uni-popup ref="popup" background-color="#fff" >
|
<view class="title">
|
<text style="width: 35%;">选择端拾器</text>
|
<view class="">
|
<view @click="getall" class="slot-right"
|
style="width: 100%; display: flex; justify-content: flex-end;margin-right: 15px;color:#00cc33">
|
显示全部
|
</view>
|
</view>
|
</view>
|
<view class="search">
|
<u-search placeholder="搜索端拾器编号" @clear="clearcode" @blur="getMaterialInfo" v-model="materialno"
|
input-align="center" bg-color="#fff" shape="square" :show-action="false"></u-search>
|
</view>
|
<scroll-view scroll-y="true" style="height:350px" @scrolltolower="lower">
|
<view class="line3" v-for="(item,index) in list" :key="index" @click="picker(item, $event)">
|
<text style="color:#000">{{item.materialname + " "}}</text>
|
<text class="col7 ml10">{{item.materialno}}</text>
|
</view>
|
<u-empty text="暂无数据" mode="list" v-if='list.length==0'></u-empty>
|
<!-- <u-loadmore :status="status" v-if='list.length>=6' /> -->
|
</scroll-view>
|
</uni-popup>
|
</view>
|
</template>
|
</view>
|
</template>
|
</default-header-page-layout>
|
</template>
|
|
<script>
|
import DefaultHeaderPageLayout from '@/components/DefaultHeaderPageLayout.vue'
|
import ActionUserRow from '@/components/ActionUserRow.vue'
|
import ScanInputFormItem from '@/components/ScanInputFormItem.vue'
|
import EasySelectFormItem from '@/components/EasySelectFormItem.vue'
|
import { parseDic, $alert, $successInfo } from '@/static/js/utils/index.js'
|
let initInterVal = null;
|
const defaultFormA = {
|
containter:'',
|
material:''
|
}
|
const defaultFormB = {
|
entrance:'',
|
placecode:''
|
}
|
export default {
|
name:'baseInPage',
|
components:{DefaultHeaderPageLayout,ActionUserRow,ScanInputFormItem,EasySelectFormItem},
|
data(){
|
return {
|
materialno:'',
|
pageBodyHeight:0,
|
wareContainerCode:'',
|
msg:{
|
containter:'',
|
material:'',
|
entrance:'',
|
placecode:'',
|
code:'',
|
name:'',
|
},
|
msgType:{
|
containter:'info',
|
material:'error',
|
entrance:'error',
|
placecode:'error',
|
code:'info',
|
name:'info',
|
},
|
list:[],
|
arr:[],
|
}
|
},
|
methods:{
|
toggle(type) {
|
this.type = type
|
this.$refs.popup.open(type)
|
this.getMaterialInfo()
|
},
|
/* 托盘编码搜索 */
|
onSearchContainter(){
|
if (!this.forma.containter) {
|
this.msgType.containter = 'error'
|
this.msg.containter = '请输入托盘号!';
|
return false;
|
}
|
this.msg.containter = '';
|
this.getContainterInfo()
|
},
|
/* 物料编码搜索 */
|
onSearchMaterial(){
|
this.getMaterialInfo()
|
},
|
/* 删除物料列表某条数据 */
|
onDelList(index){
|
this.list.splice(index,1)
|
},
|
|
/* 页面重置 */
|
reset(){
|
this.msg.containter = '';
|
this.arr = [];
|
this.wareContainerCode = '';
|
},
|
/* 获取托盘信息 */
|
getContainterInfo(callback,needloding=true){
|
let params = {Containercode:this.forma.containter}
|
if (needloding) {
|
uni.showLoading({
|
title: '加载中...',
|
mask:true
|
});
|
}
|
this.$api.get('list',params,{block:'container',fullRes:true,loading:false}).then((d)=>{
|
d.data.forEach((item) => {
|
if (d.data) {
|
this.msgType.containter = 'info'
|
this.msg.containter = `小车编号:` + item.code;
|
callback && callback(true)
|
} else {
|
this.msgType.containter = 'error'
|
this.msg.containter = d.message || '查无信息!';
|
this.containter = null;
|
this.list = []
|
callback && callback(false)
|
}
|
})
|
if (needloding) {
|
uni.hideLoading();
|
}
|
}).catch(()=>{
|
this.containter = null;
|
this.list = []
|
if (needloding) {
|
uni.hideLoading();
|
}
|
callback && callback(false)
|
})
|
},
|
getall(){
|
this.materialno = "";
|
this.getMaterialInfo();
|
},
|
/* 获取物料信息 */
|
getMaterialInfo(callback){
|
let params = {materialno:this.materialno}
|
this.$api.get('page',params,{block:'material',fullRes:true}).then((d)=>{
|
if (d.data.rows) {
|
//let cf = this.checkMaterialSame(d.data.rows);
|
if (true) {
|
let obj = {...d.data.rows}
|
obj.bindquantity = 0;
|
//this.list.push(obj)
|
this.list = d.data.rows;
|
callback && callback(true)
|
} else {
|
callback && callback(false)
|
}
|
} else {
|
this.msg.material = d.message || '查无信息!';
|
callback && callback(false)
|
}
|
}).catch((err)=>{
|
callback && callback(false)
|
})
|
},
|
/* 检查新增物料的重复性 */
|
checkMaterialSame(obj) {
|
let res = true;
|
for (let i=0;i<this.list.length;i++) {
|
if (this.list[i].materialno===obj.materialno) {
|
res = false;
|
break;
|
}
|
}
|
if (!res) {
|
$alert('已有端拾器,不可添加!')
|
}
|
return res;
|
},
|
//物料回显
|
picker(val, event) {
|
this.arr = []
|
this.arr.push({
|
materialname: val.materialname,
|
materialno: val.materialno,
|
})
|
this.materialno = ""
|
this.$refs.popup.close()
|
},
|
onBind(callback){
|
let cf = this.checkBeforeNext();
|
if (!cf) return false;
|
let params = {WareContainerCode:this.wareContainerCode,WareMaterialCode:this.arr[0].materialno};
|
this.$api.post('add',params,{block:'bind',loading:false}).then((res)=>{
|
callback && callback(true)
|
this.reset()
|
}).catch(()=>{
|
callback && callback(false)
|
})
|
},
|
checkBeforeNext(){
|
let flag=true, msg="";
|
|
if(this.wareContainerCode == ""){
|
msg = `请输入小车编号!`
|
flag = false;
|
}
|
if(this.arr.length == 0){
|
msg = `请添加端拾器信息!`
|
flag = false;
|
}
|
|
if (!flag && msg) {
|
$alert(msg)
|
}
|
|
return flag;
|
},
|
/* 页面初始化获取页面body高度的定时器 */
|
startInitInterval(callback){
|
initInterVal = setInterval(()=>{
|
if (this.pageBodyHeight) {
|
this.clearInitInterval()
|
callback && callback()
|
} else {
|
this.pageBodyHeight = this.$refs.page.getBodyHeight()
|
}
|
},200)
|
},
|
/* 清除定时器 */
|
clearInitInterval(){
|
try{
|
clearInterval(initInterVal)
|
initInterVal = null
|
}catch(e){
|
//TODO handle the exception
|
}
|
}
|
},
|
onReady(){
|
this.startInitInterval(()=>{
|
/* 页面初始化后需要执行的代码在这边调用 */
|
})
|
},
|
onUnload(){
|
this.clearInitInterval()
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.bottom-btns-row{
|
display: flex;
|
padding: 10rpx 0;
|
background-color: #fff;
|
.btn-frame{
|
width: 50%;
|
box-sizing: border-box;
|
}
|
.left-btn-frame{
|
padding-left: 20rpx;
|
padding-right: 8rpx;
|
}
|
.right-btn-frame{
|
padding-right: 20rpx;
|
padding-left: 8rpx;
|
}
|
}
|
.forma-item{
|
margin-bottom: 24rpx;
|
}
|
.labelnew{
|
font-size: 36rpx;
|
color: $u-tips-color;
|
padding-left: 15rpx;
|
}
|
.line3 {
|
line-height: 1.8rem;
|
padding: 8px 3px;
|
font-size: 0.93rem;
|
border-bottom: 1px solid #eaeaea;
|
text-align: center;
|
}
|
.line {
|
height: 50px;
|
border-bottom: 1px solid #eaeaea;
|
padding-left: 3rem;
|
font-size: 1rem;
|
padding-right: 10px;
|
display: flex;
|
align-items: center;
|
}
|
.line2 {
|
line-height: 2.3rem;
|
padding: 8px 10px 8px 3rem;
|
font-size: 0.93rem;
|
border-bottom: 1px solid #eaeaea;
|
}
|
.col7 {
|
color: #777;
|
width: 1000rpx;
|
}
|
|
.ml10 {
|
margin-left: 10px;
|
width: 1000rpx;
|
}
|
.space-between {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
}
|
.pl2 {
|
padding-left: 2rem !important;
|
}
|
.material-item-group{
|
background-color: $uni-bg-color;
|
padding-top: 10rpx;
|
.material-list-item{
|
border-bottom: 2rpx solid $uni-border-color;
|
padding-bottom: 10rpx;
|
padding-left: 60rpx;
|
margin-bottom: 10rpx;
|
position: relative;
|
&:last-child{
|
border-bottom: 0;
|
}
|
.item-row{
|
display: flex;
|
&>.label{
|
flex-shrink: 0;
|
color: $u-tips-color;
|
width: 180rpx;
|
}
|
&>.content{
|
flex-grow: 1;
|
color: $u-content-color;
|
uni-input{
|
font: inherit;
|
color: $u-primary;
|
text-decoration: underline;
|
}
|
}
|
}
|
.badge-box{
|
position: absolute;
|
top:8rpx;
|
left: 8rpx;
|
z-index: 1;
|
}
|
.close-btn{
|
$closeBtnSize:70rpx;
|
width: $closeBtnSize;
|
height: $closeBtnSize;
|
z-index: 1;
|
position: absolute;
|
top:0rpx;
|
right: 8rpx;
|
background-color: $u-error;
|
opacity: 0.6;
|
border-radius: 25rpx;
|
.icon-layer{
|
position: absolute;
|
width: 100%;
|
height: 100%;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
z-index: 2;
|
}
|
}
|
}
|
}
|
</style>
|