<template>
|
<a-modal
|
title="新增小车类型信息"
|
:width="900"
|
:visible="visible"
|
:confirmLoading="confirmLoading"
|
@ok="handleSubmit"
|
@cancel="handleCancel">
|
<a-spin :spinning="confirmLoading">
|
<a-form :form="form">
|
<a-form-item label="类型编码" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
|
<a-input placeholder="请输入类型编码" v-decorator="['wareContainerTypeCode', {rules: [{ required: true, message: '请输入类型编码!' }]}]" />
|
</a-form-item>
|
<a-form-item label="类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
|
<a-input placeholder="请输入类型名称" v-decorator="['wareContainerTypeName', {rules: [{ required: true, message: '请输入类型名称!' }]}]" />
|
</a-form-item>
|
<a-form-item label="长" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
|
<a-input-number placeholder="请输入长" style="width: 100%" min="0" v-decorator="['length', {rules: [{ required: true, message: '请输入长!' }]}]" />
|
</a-form-item>
|
<a-form-item label="高" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
|
<a-input-number placeholder="请输入高" style="width: 100%" min="0" v-decorator="['height', {rules: [{ required: true, message: '请输入高!' }]}]" />
|
</a-form-item>
|
<a-form-item label="宽" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
|
<a-input-number placeholder="请输入宽" style="width: 100%" min="0" v-decorator="['width', {rules: [{ required: true, message: '请输入宽!' }]}]" />
|
</a-form-item>
|
<a-form-item label="可入库位类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-select style="width: 100%" placeholder="请选择可入库位类型" v-decorator="['locationType', {rules: [{ required: true, message: '请选择可入库位类型!' }]}]">
|
<a-select-option v-for="(item,index) in locationTypeData" :key="index" :value="item.code">{{ item.name }}</a-select-option>
|
</a-select>
|
</a-form-item>
|
<a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
|
<a-input placeholder="请输入备注" v-decorator="['remarks']" />
|
</a-form-item>
|
<!-- <a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-select style="width: 100%" placeholder="请选择状态" v-decorator="['status', {rules: [{ required: true, message: '请选择状态!' }]}]">
|
<a-select-option v-for="(item,index) in statusData" :key="index" :value="item.code">{{ item.name }}</a-select-option>
|
</a-select>
|
</a-form-item> -->
|
</a-form>
|
</a-spin>
|
</a-modal>
|
</template>
|
|
<script>
|
import {
|
WmsContainerTypeAdd
|
} from '@/api/modular/main/WmsContainerTypeManage'
|
import {
|
WmsLocationTypeList
|
} from '@/api/modular/main/WmsLocationTypeManage'
|
export default {
|
data () {
|
return {
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 5 }
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 15 }
|
},
|
locationTypeData: [],
|
statusData: [],
|
visible: false,
|
confirmLoading: false,
|
form: this.$form.createForm(this),
|
ceshi:[]
|
}
|
},
|
methods: {
|
// 初始化方法
|
add (record) {
|
this.visible = true
|
this.$nextTick(() => {
|
|
});
|
const locationTypeOption = this.$options
|
//this.locationTypeData = locationTypeOption.filters['dictData']('height_level')
|
const statusOption = this.$options
|
this.statusData = statusOption.filters['dictData']('common_status')
|
this.getlocationType()
|
},
|
|
getlocationType(){
|
WmsLocationTypeList().then(res => {
|
this.locationTypeData = res.data
|
})
|
},
|
/**
|
* 提交表单
|
*/
|
handleSubmit () {
|
const { form: { validateFields } } = this
|
this.confirmLoading = true
|
validateFields((errors, values) => {
|
if (!errors) {
|
for (const key in values) {
|
if (typeof (values[key]) === 'object') {
|
values[key] = JSON.stringify(values[key])
|
}
|
}
|
WmsContainerTypeAdd(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>
|