<template>
|
<view class="page-containter page-containter-x">
|
<view class="page-header">
|
<page-header-x :ctitle="page_ctitle" />
|
<user-row></user-row>
|
</view>
|
<view class="page-content">
|
<view class="add_site">
|
<u-form :model="addForm" ref="addRef" label-width="180">
|
<!-- 托盘号 -->
|
<u-form-item label="托盘号:">
|
<u-input v-model="addForm.containerCode" :focus="true" placeholder="请扫描托盘条码" border></u-input>
|
</u-form-item>
|
<u-form-item label="站点选择:">
|
<u-input placeholder="请选择站点" v-model="addForm.station" type="select" :border="true"
|
@click="siteFlag = true"></u-input>
|
<u-action-sheet :list="siteList" v-model="siteFlag" @click="confirm"></u-action-sheet>
|
</u-form-item>
|
</u-form>
|
<view class="btns-row">
|
<view class="btn-block"><u-button type="error" @click="cancalAdd">取消</u-button></view>
|
<view class="divider-block"></view>
|
<view class="btn-block"><u-button type="primary" @click="confirmAdd">确定</u-button></view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
addEmptySalverStore
|
} from '../../api/addSite/addSite.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 {
|
focus_productCode:true,
|
page_ctitle:'增加空托库存',
|
materialList: [], //物料列表数据
|
addForm: {
|
type:'', //类型:body header
|
station: '',
|
containerCode: ''//托盘号
|
},
|
result: {},
|
siteFlag: false,
|
siteList: []
|
}
|
},
|
watch: {
|
addForm: {
|
handler(val) {
|
},
|
deep: true
|
}
|
},
|
/* 通常只用于获取传递参数 */
|
onLoad(options) {
|
console.log('load')
|
this.addForm.type=options.type;//记住type值 【EditBy shaocx,2022-03-16】
|
if (options.type === 'body') {
|
this.siteList = $config.sites.onLineBody;
|
this.page_ctitle='增加空托库存(缸体)';
|
} else {
|
this.siteList = $config.sites.onLineHeader;
|
this.page_ctitle='增加空托库存(缸盖)';
|
}
|
},
|
//页面加载事件
|
onReady() {
|
|
},
|
|
//下拉刷新
|
onPullDownRefresh() {
|
this.clearAddForm();
|
//重新获取物料列表
|
uni.stopPullDownRefresh();
|
},
|
methods: {
|
confirm(index) {
|
this.addForm.station = this.siteList[index].text;
|
},
|
confirm_toPlace(index) {
|
this.addForm.toStieCode = this.to_siteList[index].text;
|
},
|
change(e) {
|
console.log(e.detail);
|
},
|
edit(item) {
|
uni.showToast({
|
title: item.name,
|
icon: 'none'
|
});
|
},
|
subList(index)
|
{
|
},
|
//清空添加数据
|
clearAddForm() {
|
this.addForm.station = '';
|
this.addForm.containerCode = '';
|
},
|
//聚焦事件
|
focus() {
|
//阻止软件盘弹出
|
uni.hideKeyboard()
|
},
|
//取消添加
|
cancalAdd() {
|
uni.navigateBack({
|
delta: 1
|
})
|
},
|
//提交添加
|
confirmAdd() {
|
if (this.addForm.station&&this.addForm.containerCode) {
|
addEmptySalverStore(this.addForm.station,this.addForm.type,this.addForm.containerCode).then(res => {
|
uni.showToast({
|
title: '提交成功',
|
icon: 'success'
|
})
|
//关闭当前页面
|
setTimeout(() => {
|
//关闭当前页面
|
this.cancalAdd();
|
}, 2000)
|
}).catch(() => {
|
|
})
|
} else {
|
uni.showToast({
|
title: '参数不规范'
|
})
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.add_site {
|
width: 94%;
|
margin: 10rpx auto;
|
font-size: 30rpx;
|
text-align: left;
|
|
.btns-row{
|
display: flex;
|
padding: 12rpx 0;
|
.btn-block{
|
width: 10rpx;
|
flex: 1;
|
}
|
.divider-block{
|
width: 8px;
|
flex-shrink: 0;
|
}
|
}
|
|
.list-item{
|
display: flex;
|
padding-bottom: 16rpx;
|
border-bottom: 1px solid #dcdcdc;
|
.list-no{
|
width: 100rpx;
|
flex-shrink: 0;
|
display: flex;
|
align-items: center;
|
}
|
.list-value{
|
flex: 1;
|
word-break:break-all;
|
word-wrap:break-word;
|
}
|
}
|
}
|
</style>
|