<template>
|
<a-modal
|
title="确认操作"
|
:width="500"
|
v-model="visible"
|
:confirmLoading="confirmLoading"
|
@ok="handleSubmit"
|
@cancel="handleCancel">
|
<a-spin :spinning="confirmLoading">
|
<a-form :form="form">
|
<a-form-item label="零件编号" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-input placeholder="请输入零件编号" :disabled="true" v-decorator="['partCode']" />
|
</a-form-item>
|
<a-form-item label="小车编号" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-input placeholder="请输入小车编号" :disabled="true" v-decorator="['containercode']" />
|
</a-form-item>
|
<a-form-item v-if="this.type != '入库'" label="货位编号" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-input placeholder="请输入货位编号" :disabled="true" v-decorator="['placecode']" />
|
</a-form-item>
|
<a-form-item v-if="this.type == '入库'" label="绑定库位" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-input placeholder="请输入货位编号" :disabled="true" v-decorator="['realLocationCode']" />
|
</a-form-item>
|
<a-form-item v-if="this.type == '出库'" label="出库口" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-select style="width: 100%" placeholder="请选择出库口" allow-Clear="true" v-decorator="['toPlace', {rules: [{ required: true, message: '请选择出库口!' }]}]">
|
<a-select-option v-for="(item,index) in siteNoData" :key="index" :value="item.lineType">{{ item.name }}</a-select-option>
|
</a-select>
|
</a-form-item>
|
<a-form-item v-if="this.type == '入库'" label="入库口" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-select style="width: 100%" placeholder="请选择入库口" allow-Clear="true" v-decorator="['toPlace', {rules: [{ required: true, message: '请选择出库口!' }]}]">
|
<a-select-option v-for="(item,index) in siteNoData" :key="index" :value="item.lineType">{{ item.name }}</a-select-option>
|
</a-select>
|
</a-form-item>
|
<a-form-item v-if="this.type == '移库'" label="目标库位" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-select style="width: 100%" showSearch="true" allow-Clear="true" placeholder="请选择目标库位" v-decorator="['toPlace', {rules: [{ required: true, message: '请选择目标库位!' }]}]">
|
<a-select-option v-for="(item,index) in placeData" :key="index" :value="item.code">{{ item.code }}</a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-form>
|
</a-spin>
|
</a-modal>
|
</template>
|
|
<script>
|
import {
|
WareSiteList
|
} from '@/api/modular/main/WareSiteManage'
|
import { IexwarehouseManual, IexwarehouseAuto,GetMoveLocation,MovewarehouseManual,InwarehouseManual } from '@/api/modular/main/ExWarehouseManage'
|
export default {
|
data() {
|
return {
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 5 }
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 15 }
|
},
|
visible: false,
|
confirmLoading: false,
|
siteNoData:[],
|
form: this.$form.createForm(this),
|
type:'',
|
placeData:[],
|
containercodetemp:'',
|
}
|
},
|
methods: {
|
//3.定义一个函数,通过设置detailvisible值为true来让弹窗弹出,这个函数会在父组件的方法中被调用
|
handle(record,type) {
|
this.visible = true;
|
this.type = type;
|
this.containercodetemp = record.wareContainerCode;
|
this.$nextTick(() => {
|
this.form.setFieldsValue(
|
{
|
containercode: record.wareContainerCode,
|
placecode: record.wareLocationCode,
|
realLocationCode:record.realLocationCode,
|
partCode:record.partCode,
|
toPlace:this.toPlace,
|
}
|
)
|
});
|
this.getSiteNoData();
|
this.getPlaceData();
|
},
|
getSiteNoData(){
|
WareSiteList().then(res => {
|
this.siteNoData = res.data
|
})
|
},
|
getPlaceData(){
|
let params = {containercode:this.containercodetemp};
|
GetMoveLocation(params).then(res => {
|
this.placeData = res.data
|
})
|
},
|
handleSubmit () {
|
const { form: { validateFields } } = this
|
this.confirmLoading = true
|
validateFields((errors, values) => {
|
if (!errors) {
|
for (const key in values) {
|
if(values[key]==null){
|
values[key]=0
|
}
|
if (typeof (values[key]) === 'object') {
|
values[key] = JSON.stringify(values[key])
|
}
|
}
|
//let param = {Placecode:this.record.placecode,Containercode:this.record.containercode,toPlace:values.toPlace}
|
if(this.type == '出库'){
|
IexwarehouseManual(values).then((res) => {
|
if (res.success) {
|
this.$message.success('出库成功')
|
this.confirmLoading = false
|
this.$emit('ok', values)
|
this.handleCancel()
|
} else {
|
this.$message.error('出库失败:' + JSON.stringify(res.message))
|
}
|
}).finally((res) => {
|
this.confirmLoading = false
|
})
|
}
|
else if (this.type == '入库'){
|
InwarehouseManual(values).then((res) => {
|
if (res.success) {
|
this.$message.success('入库成功')
|
this.confirmLoading = false
|
this.$emit('ok', values)
|
this.handleCancel()
|
} else {
|
this.$message.error('入库失败:' + JSON.stringify(res.message))
|
}
|
}).finally((res) => {
|
this.confirmLoading = false
|
})
|
}
|
else{
|
MovewarehouseManual(values).then((res) => {
|
if (res.success) {
|
this.$message.success('移库成功')
|
this.confirmLoading = false
|
this.$emit('ok', values)
|
this.handleCancel()
|
} else {
|
this.$message.error('移库失败:' + JSON.stringify(res.message))
|
}
|
}).finally((res) => {
|
this.confirmLoading = false
|
})
|
}
|
|
|
} else {
|
this.confirmLoading = false
|
}
|
})
|
},
|
handleCancel () {
|
this.form.resetFields()
|
this.visible = false
|
}
|
},
|
}
|
</script>
|