<template>
|
<view class="overflow">
|
<view class="upWp">
|
<cu-custom bgColor="bg-white" :isBack="true">
|
<block slot="backText">
|
</block>
|
<block slot="content">空托入库</block>
|
</cu-custom>
|
<!-- <view class="flex justify-end align-center padding_right30rpx padding_top12rpx">
|
操作人:{{operator}}
|
</view> -->
|
<view class="text-bold width fontSize32rpx" style="padding: 10rpx 10rpx;background-color: #d6d6d6;">
|
<view class="flex justify-between align-center">
|
<text class="width23 padding10">入库单号</text>
|
<text>{{warehouse.orderNo}}</text>
|
</view>
|
</view>
|
<u-form labelPosition="top" :model="warehouse" ref="warehouseRef">
|
<u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label="容器数量:" prop="warehouse.containerQty" required class="myFormItem">
|
<u-input type="number" v-model="warehouse.containerQty" :focus="focusType" placeholder="请输入容器数量"
|
class="width myInp" clearable/>
|
</u-form-item>
|
</u-col>
|
<u-col span="12">
|
<u-form-item label="容器编号:" prop="warehouse.wareContain" required class="myFormItem">
|
<!-- <input v-model="warehouse.wareContainerCode" :focus="focusType" placeholder="请选择或扫描容器编号"
|
class="width myInp" > -->
|
|
<u-input v-model.trim="warehouse.wareContainerCode" :focus="focusType" placeholder="请选择或扫描容器编号"
|
class="width myInp" clearable/>
|
|
<!-- <input v-model="warehouse.wareContainerCode" type="select" @focus="containerFocus"
|
placeholder="请选择容器编号" class="width myInp"> -->
|
<!-- <u-select v-model="modalshow" :list="wolist" @confirm="confirm" value-name="code"
|
label-name="code" ></u-select> -->
|
</u-form-item>
|
</u-col>
|
</u-row>
|
</u-form>
|
</view>
|
<view class="wolistWp" v-show="modalshow" :style="{height: mtHeight+'px'}">
|
<view :key="index" v-for="(item,index) in wolistRes" @click="confirm(item.code)">
|
<text> {{ item.code}}</text>
|
</view>
|
</view>
|
<modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' />
|
|
<button-modal :empTytowerShow='true' class="dowmWp" cleaningTitle="查询" garmenTitle='确认入库' @submit='submit' @reset='rest' />
|
|
</view>
|
</template>
|
|
<script>
|
import {
|
getDate
|
} from '../../../utils/dateTime.js'
|
import ModalCode from '../../../components/ModalCode.vue'
|
import ButtonModal from '../../../components/buttonModal.vue'
|
import {
|
trayPutStorage,
|
getContainerNumList,
|
getOrderNumList,
|
containerTypeArr,
|
getAllEnums
|
} from '@/api/container/index.js'
|
import calBoxHt from '@/mixins/calBoxHt.js'
|
export default {
|
mixins:[calBoxHt],
|
data() {
|
return {
|
mtHeight: 'auto',
|
focusType: true,
|
rescode: 0,
|
resmessage: "",
|
focu: true,
|
Datetime: getDate(),
|
containerTypeArr: [],
|
warehouse: { //入库请求参数
|
orderNo: "",
|
containerQty: 1, //空托-默认1
|
containerType: "",
|
wareContainerCode: "", //容器编号
|
createdTime: "",
|
updatedTime: "",
|
createdUserId: "",
|
createdUserName: "",
|
orderStatus: 3,
|
orderType: 13, //空托入库
|
warehousOrderDetails: []
|
},
|
warehouseRules: {
|
ContainerCode: [{
|
required: true,
|
message: '容器编号不能为空',
|
trigger: 'blur'
|
}],
|
// StorehouseCode: [{
|
// required: true,
|
// message: '入库口不能为空',
|
// trigger: 'blur'
|
// }],
|
},
|
operator: '', //
|
wolist: [],
|
wolistRes: [111,2222,33333,33333,33333],
|
modalshow: false
|
};
|
},
|
components: {
|
ModalCode,
|
ButtonModal
|
},
|
onReady() {
|
this.$refs.warehouseRef.setRules(this.warehouseRules)
|
|
this.calBoxHt() //动态计算滚动区域的高度
|
},
|
mounted() {
|
this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
|
|
this.getOrderNum()
|
this.getContainerNum()
|
this.getAllEnums()
|
},
|
// 模糊查询
|
watch: {
|
'warehouse.wareContainerCode': {
|
immediate: true, //在框的值还没变化时执行如下函数显示出所有的情况
|
handler(val) {
|
this.modalshow = true
|
this.wolistRes = this.wolist.filter((p) => {
|
return p.code.indexOf(val.trim()) !== -1
|
})
|
}
|
}
|
},
|
methods: {
|
// 获取入库单号
|
getOrderNum() {
|
getOrderNumList().then((res) => {
|
if (res.code != 200) {
|
this.rescode = res.code
|
this.resmessage = '暂无数据'
|
this.$refs.resmodal.show = true
|
return
|
}
|
this.warehouse.orderNo = res.data
|
})
|
},
|
// 获取容器编号
|
getContainerNum(trayNumber) {
|
getContainerNumList().then((res) => {
|
if(res.code==200){
|
if (res.data.length == 0) {
|
this.rescode = res.data.code
|
this.resmessage = '暂无数据'
|
this.$refs.resmodal.show = true
|
return
|
}
|
this.wolist = res.data
|
this.wolistRes = res.data
|
// 捕获操作过程中 被空出来的容器
|
if(trayNumber&&this.warehouse.wareContainerCode!=''){
|
this.wolistRes = this.wolist.filter((p) => {
|
return p.code.indexOf(this.warehouse.wareContainerCode) !== -1
|
})
|
}
|
}
|
})
|
},
|
// 确认
|
submit() {
|
if (this.warehouse.orderNo == '' || this.warehouse.orderNo == undefined) {
|
this.getOrderNum()
|
this.$u.toast('稍等,重新获取入库单号');
|
return
|
}
|
if(this.warehouse.containerQty <= 0){
|
this.$u.toast('请输入容器数量');
|
return
|
}
|
if(this.warehouse.wareContainerCode == ''){
|
this.$u.toast('容器编号未扫描或未选择');
|
return
|
}
|
|
this.$refs.warehouseRef.validate(valid => {
|
if (valid) {
|
var jsonSom = {
|
createdUserId: JSON.parse(uni.getStorageSync('userInfo')).id,
|
createdUserName: JSON.parse(uni.getStorageSync('userInfo')).name,
|
createdTime: this.Datetime,
|
updatedTime: this.Datetime,
|
containerQty: this.warehouse.containerQty
|
}
|
this.warehouse = Object.assign(this.warehouse, jsonSom);
|
this.warehouse.containerType = '';
|
const arr = this.wolist.filter((item) => item.code == this.warehouse.wareContainerCode)
|
if (arr.length > 0) {
|
let nameTray = arr[0].typeName //塑料容器
|
const arr2 = this.containerTypeArr.filter((item) => item.title == nameTray)
|
if (arr2.length <= 0) {
|
this.$u.toast('对应容器类型找不到');
|
return;
|
}
|
this.warehouse.containerType = arr2[0].value || ''; //"299120688255045"
|
}
|
trayPutStorage(this.warehouse).then((res) => {
|
if (res.code === 200) {
|
this.rescode = res.code
|
this.resmessage = res.message
|
this.$refs.warehouseRef.resetFields()
|
this.warehouse = {
|
orderNo: "",
|
containerQty: 1, //空托-默认1
|
containerType: "",
|
wareContainerCode: "", //容器编号
|
createdTime: "",
|
updatedTime: "",
|
createdUserId: "",
|
createdUserName: "",
|
orderStatus: 3,
|
orderType: 13, //空托入库
|
warehousOrderDetails: []
|
}
|
this.focusType = true
|
this.getOrderNum()
|
this.getContainerNum()
|
this.$refs.resmodal.show = true
|
}
|
})
|
}
|
})
|
},
|
// 获取常用变量 应存入vuex
|
getAllEnums() {
|
getAllEnums().then((res) => {
|
if (res.data.length == 0 || res.data.containerType.length == 0) {
|
this.rescode = res.code
|
this.resmessage = '暂无数据'
|
this.$refs.resmodal.show = true
|
return
|
}
|
this.containerTypeArr = res.data.containerType
|
})
|
},
|
//容器 聚焦事件
|
containerFocus() {
|
// uni.hideKeyboard()
|
// this.modalshow = true
|
},
|
//选择 容器
|
confirm(e) {
|
if(e==this.warehouse.wareContainerCode){
|
return
|
}
|
this.warehouse.wareContainerCode = e
|
this.modalshow = false
|
},
|
//出入库口扫描
|
wareScane() {
|
uni.scanCode({
|
scanType: ['barCode', 'qrCode'],
|
autoDecodeCharset: true,
|
success: (res) => {
|
this.warehouseRules.StorehouseCode = res.result.trim()
|
},
|
fail: (err) => {
|
this.rescode = 400
|
this.resmessage = `扫描失败${JSON.stringify(err)}`
|
this.$refs.resmodal.show = true
|
}
|
})
|
},
|
//容器扫描
|
containerScane() {
|
uni.scanCode({
|
scanType: ['barCode', 'qrCode'],
|
autoDecodeCharset: true,
|
success: (res) => {
|
this.warehouse.ContainerCode = res.result
|
},
|
fail: (err) => {
|
this.rescode = 400
|
this.resmessage = `扫描失败${JSON.stringify(err)}`
|
this.$refs.resmodal.show = true
|
}
|
})
|
},
|
//重置
|
rest() {
|
this.getContainerNum(1)
|
},
|
_empty(v) {
|
let tp = typeof v,
|
rt = false;
|
if (tp == "number" && String(v) == "") {
|
rt = true
|
} else if (tp == "undefined") {
|
rt = true
|
} else if (tp == "object") {
|
if (JSON.stringify(v) == "{}" || JSON.stringify(v) == "[]" || v == null) rt = true
|
} else if (tp == "string") {
|
if (v == "" || v == "undefined" || v == "null" || v == "{}" || v == "[]") rt = true
|
} else if (tp == "function") {
|
rt = false
|
}
|
return rt
|
}
|
}
|
|
}
|
</script>
|
|
<style lang="scss">
|
.myFormItem {
|
font-size: 32rpx;
|
font-weight: bold;
|
padding: 0;
|
}
|
|
.myInp {
|
font-weight: bolder;
|
margin-left: 30rpx;
|
margin-top: 16rpx;
|
}
|
|
/deep/.u-drawer__scroll-view {
|
border-top: 5px solid #d6d6d6;
|
}
|
.wolistWp{
|
z-index: 999;
|
// height: 45vh;
|
padding-top: 10px;
|
padding-bottom: 20px;
|
border-top: 1px solid gray;
|
// border-bottom: 1px solid gray;
|
overflow: auto;
|
text-align: left;
|
view{
|
display: inline-block;
|
border-radius: 3px;
|
border: 1px solid orange;
|
width: 27.3%;
|
text-align: center;
|
min-width: 80px;
|
padding: 5px ;
|
margin: 8px 3%;
|
color: #f18202;
|
text{
|
}
|
}
|
}
|
</style>
|