<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">
|
<!-- step 1 start -->
|
<!-- <radio-form-item label="物料类型" :options="MaterialTypeData" v-model="form.materialType" /> -->
|
|
<scan-input-form-item placeholder="请选择" :clearable="false" :hasScan="false" :hasSearch="false"
|
@click.native="visible=true" class="forma-item" label="件号" v-model="form.materialNo" />
|
<EasyPicker :visible.sync="visible" :list="materialData" labelField="materialNo" valueField="materialNo"
|
@select="getMaterialNoVal" />
|
|
<scan-input-form-item disabled placeholder="" :clearable="false" :hasScan="false" :hasSearch="false"
|
class="forma-item" label="物料类型" :value="getParseDic('material_type',form.materialType)" />
|
|
<scan-input-form-item disabled placeholder="" :clearable="false" :hasScan="false" :hasSearch="false"
|
class="forma-item" label="物料型号" :value="getParseDic('material_modal',form.materialModel)" />
|
|
<scan-input-form-item disabled placeholder="" :clearable="false" :hasScan="false" :hasSearch="false"
|
class="forma-item" label="所属库区" :value="getParseDic('material_bigtype',form.areaCodeType)" />
|
|
<scan-input-form-item class="forma-item" label="数量" v-model="form.materialNumber" type="number"
|
:hasScan="false" :hasSearch='false' @blur="numberBlur" />
|
|
<!-- <scan-input-form-item class="forma-item" label="位置" :hasScan="false" :hasSearch='false'
|
v-model="form.site" /> -->
|
|
<scan-input-form-item placeholder="请选择" :clearable="false" :hasScan="false" :hasSearch="false"
|
@click.native="visibleSort1=true" class="forma-item" label="是否自动出库" v-model="form.sorting" />
|
<EasyPicker :visible.sync="visibleSort1" :list="isSorting" labelField="label" valueField="value"
|
@select="radioChange1" />
|
|
<scan-input-form-item placeholder="请选择" :clearable="false" :hasScan="false" :hasSearch="false"
|
@click.native="visibleSort=true" class="forma-item" label="出库目的地" v-model="form.toPlace" />
|
<EasyPicker :visible.sync="visibleSort" :list="placeList" labelField="code" valueField="code"
|
@select="radioChange" />
|
</view>
|
</view>
|
<template v-slot:footer>
|
<view class="bottom-btns-row">
|
<template>
|
<div class="btn-frame"><u-button type="primary" text="确 定" @click="onSubmit"
|
:disabled="abled"></u-button></div>
|
</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 RadioFormItem from '@/components/RadioFormItem.vue'
|
import EasyPicker from '@/components/EasyPicker.vue'
|
import {
|
getDicList,
|
parseDic,
|
$alert,
|
$successInfo
|
} from '@/static/js/utils/index.js'
|
import {
|
materialStockListNoPage,
|
addRange
|
} from '@/api/replenishMent.js'
|
let initInterVal = null;
|
export default {
|
components: {
|
DefaultHeaderPageLayout,
|
ActionUserRow,
|
ScanInputFormItem,
|
RadioFormItem,
|
EasyPicker
|
},
|
data() {
|
return {
|
isSorting: [{
|
label: '是',
|
value: '1'
|
},
|
{
|
label: '否',
|
value: '0'
|
}
|
],
|
pageBodyHeight: 0,
|
form: {
|
materialNo: '',
|
materialModel: '',
|
materialType: 0,
|
materialNumber: 0,
|
areaCodeType: 0,
|
toPlace:null,
|
orderType: null,
|
sorting: null
|
},
|
// msg: {
|
// material: '',
|
// },
|
// msgType: {
|
// containter: 'info',
|
// material: 'error',
|
// site: 'error'
|
// },
|
materialData: [],
|
visible: false,
|
visibleSort: false,
|
visibleSort1:false,
|
// materialModalData: [],
|
// materialType: [],
|
placeList: []
|
}
|
},
|
computed: {
|
|
abled() {
|
return !Boolean(this.form.materialNo);
|
},
|
|
},
|
created() {
|
this.getMaterialNoList()
|
},
|
watch: {
|
'form.materialNo': {
|
handler(val, oldVal) {
|
if (this.form.areaCodeType == 1 && this.form.materialType == 1) {
|
this.placeList = [{
|
code: '5080UP01'
|
},
|
{
|
code: '5080UP02'
|
}
|
]
|
} else if (this.form.areaCodeType == 1 && this.form.materialType == 3) {
|
this.placeList = [{
|
code: '3090UP01'
|
},
|
{
|
code: '3090UP02'
|
}
|
]
|
} else {
|
this.placeList = [{
|
code: 'WXJ-KTXLD'
|
}]
|
}
|
|
console.log(this.placeList,'placeList');
|
|
},
|
}
|
},
|
methods: {
|
// 获取字典值
|
getParseDic(enumType, val) {
|
var res = parseDic(this.$store, enumType, val)
|
return res == '无此字典' ? '' : res
|
},
|
// 获取件号值
|
getMaterialNoVal(val, item) {
|
this.form.materialNo = val
|
this.form.materialModel = item.materialModel
|
this.form.materialType = item.materialType
|
this.form.stockNumber = item.stockNumber
|
this.form.containerNo = item.containerNo
|
this.form.materialName = item.materialName
|
this.form.areaCodeType = item.areaCodeType
|
},
|
// 数量输入框失去焦点
|
numberBlur(val) {
|
if (val < 1) {
|
$alert("数量不能小于1")
|
this.form.materialNumber = 0
|
} else if (val > this.form.stockNumber) {
|
$alert("当前件号在库存量为" + this.form.stockNumber)
|
this.form.materialNumber = 0
|
} else {
|
this.form.materialNumber = val
|
}
|
},
|
// 获取件号列表
|
async getMaterialNoList() {
|
try {
|
let {
|
result
|
} = await materialStockListNoPage()
|
this.materialData = result
|
} catch (e) {
|
//TODO handle the exception
|
console.log(e);
|
}
|
},
|
// 是否分拣
|
radioChange(val, b) {
|
this.form.toPlace = val
|
},
|
radioChange1(val, b) {
|
this.form.orderType = val
|
this.form.sorting=b.label
|
},
|
// 提交
|
async onSubmit() {
|
|
var {
|
form
|
} = this
|
if (form.materialNumber <= 0) {
|
return $alert('请输入物料数量!')
|
}
|
if (!Boolean(form.sorting)) {
|
return $alert('请选择是否自动出库!')
|
}
|
if (!Boolean(form.toPlace)) {
|
return $alert('请选择出库目的地!')
|
}
|
var {
|
materialNo,
|
materialModel,
|
materialNumber,
|
materialType,
|
materialName,
|
orderType,
|
containerNo,
|
toPlace
|
} = form
|
orderType = orderType == 1 ? orderType : 3;
|
let data = {
|
orderType,
|
orderSource: 2,
|
addInAndOutOrderMaterials: [{
|
materialNo,
|
materialModel,
|
materialNumber,
|
materialType,
|
materialName,
|
containerNo,
|
toPlace
|
}]
|
}
|
try {
|
await addRange(data)
|
$alert("提交成功")
|
this.form = {
|
materialNo: '',
|
materialModel: '',
|
containerNo: '',
|
materialType: 0,
|
materialNumber: 0,
|
orderType: null,
|
sorting: null
|
}
|
this.getMaterialNoList()
|
} catch (e) {
|
//TODO handle the exception
|
}
|
// addRange
|
},
|
|
|
/* 页面初始化获取页面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(async () => {
|
/* 页面初始化后需要执行的代码在这边调用 */
|
})
|
},
|
onUnload() {
|
this.clearInitInterval()
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.bottom-btns-row {
|
display: flex;
|
justify-content: center;
|
padding: 10rpx 10rpx;
|
background-color: #fff;
|
|
.btn-frame {
|
flex: 1;
|
box-sizing: border-box;
|
}
|
|
.btn-frame:nth-child(1) {
|
margin-right: 10rpx;
|
}
|
|
.left-btn-frame {
|
padding-left: 20rpx;
|
padding-right: 8rpx;
|
}
|
|
.right-btn-frame {
|
padding-right: 20rpx;
|
padding-left: 8rpx;
|
}
|
}
|
|
.forma-item {
|
margin-bottom: 24rpx;
|
}
|
|
.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: 144rpx;
|
}
|
|
&>.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>
|