<template>
|
<vol-box v-model="show" title="空托入库" :width="800" :height="1200">
|
<template #content>
|
<el-form ref="form" :model="form" label-width="90px">
|
<el-form-item label="入库区域:">
|
<el-select v-model="form.locationType" placeholder="请选择入库区域">
|
<el-option v-for="item in locationTypes" :key="item.locationType" :label="item.locationTypeDesc"
|
:value="item.locationType" />
|
</el-select>
|
</el-form-item>
|
|
<el-form-item label="托盘条码:">
|
<el-input v-model="form.palletCode" placeholder="请扫描/输入托盘条码" @keyup.enter="submit" @keyup.13="submit"
|
clearable maxlength="50" @paste="handlePaste" @input="handleInput" />
|
</el-form-item>
|
</el-form>
|
</template>
|
|
<template #footer>
|
<div class="dialog-footer">
|
<el-button type="primary" @click="submit">确认</el-button>
|
<el-button @click="show = false">关闭</el-button>
|
</div>
|
</template>
|
</vol-box>
|
</template>
|
|
<script>
|
import VolBox from '@/components/basic/VolBox.vue'
|
|
export default {
|
components: { VolBox },
|
props: {
|
value: { type: Boolean, default: false }
|
},
|
data() {
|
return {
|
show: false,
|
form: {
|
palletCode: '',
|
locationType: ''
|
},
|
locationTypes: []
|
}
|
},
|
methods: {
|
open() {
|
this.show = true
|
this.getData();
|
},
|
|
async getData() {
|
try {
|
const { data } = await this.http.post("api/LocationInfo/GetLocationTypes")
|
this.locationTypes = data
|
} catch (e) {
|
this.$message.error('获取区域类型失败')
|
}
|
},
|
|
async submit() {
|
if (!this.form.palletCode) {
|
this.$message.warning('请输入托盘条码')
|
return
|
}
|
|
if (!this.form.locationType) {
|
this.$message.warning('请选择入库区域')
|
return
|
}
|
|
try {
|
let param = {
|
WarehouseCode: this.form.locationType,
|
PalletCode: this.form.palletCode
|
}
|
|
const { status, message } = await this.http.post(
|
`/api/InboundOrder/EmptyMaterielGroup`,
|
param
|
)
|
|
if (status) {
|
this.$message.success("组盘成功")
|
this.show = false
|
this.$emit('refresh')
|
} else {
|
this.$message.error(message || '操作失败')
|
}
|
} catch (error) {
|
this.$message.error('请求异常')
|
}
|
},
|
|
// 扫描枪优化处理
|
handleInput(value) {
|
// 过滤非数字和条码常用字符
|
this.form.palletCode = value.replace(/[^a-zA-Z0-9\-]/g, '')
|
},
|
|
handlePaste(e) {
|
// 粘贴时自动提交
|
setTimeout(this.submit, 100)
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
.dialog-footer {
|
text-align: right;
|
}
|
</style>
|