| | |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="库位号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="locationCode"> |
| | | <a-input v-model="model.locationCode" placeholder="请输入库位号" ></a-input> |
| | | <a-form-model-item label="货架编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="shelfNumber"> |
| | | <a-input v-model="model.shelfNumber" placeholder="请输入货架编号" ></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="货架名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="shelfName"> |
| | | <a-input v-model="model.shelfName" placeholder="请输入货架名称" ></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | |
| | | <a-input v-model="model.columnNumber" placeholder="请输入列数" ></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="库位号" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-input v-model="model.locationCode" placeholder="请输入库位号" ></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="货架编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="shelfNumber"> |
| | | <a-input v-model="model.shelfNumber" placeholder="请输入货架编号" ></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="货架名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="shelfName"> |
| | | <a-input v-model="model.shelfName" placeholder="请输入货架名称" ></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark"> |
| | | <a-textarea v-model="model.remark" rows="4" placeholder="请输入备注" /> |
| | |
| | | data () { |
| | | return { |
| | | model:{ |
| | | }, |
| | | warehouseId: '', |
| | | warehouseNum: '', |
| | | warehouseName: '', |
| | | shelfNumber: '', |
| | | shelfName: '', |
| | | storey: '', |
| | | arrange: '', |
| | | columnNumber: '', |
| | | locationCode: '', |
| | | remark: '' |
| | | }, |
| | | autoLocationCode: '', // 自动拼接的库位号 |
| | | userEditedLocationCode: false, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 }, |
| | |
| | | storey: [ |
| | | { required: true, message: '请输入层数!'}, |
| | | ], |
| | | arrange: [ |
| | | { required: true, message: '请输入排数!'}, |
| | | ], |
| | | columnNumber: [ |
| | | { required: true, message: '请输入列数!'}, |
| | | ], |
| | | shelfNumber: [ |
| | | { required: true, message: '请输入货架号!'}, |
| | | ], |
| | | shelfName: [ |
| | | { required: true, message: '请输入货架名称!'}, |
| | | ], |
| | | }, |
| | | url: { |
| | | add: "/tms/goodsShelves/add", |
| | |
| | | formDisabled(){ |
| | | return this.disabled |
| | | }, |
| | | //拼接库位号 |
| | | autoGeneratedLocationCode() { |
| | | const { shelfNumber, storey, arrange, columnNumber } = this.model; |
| | | if (shelfNumber || storey || arrange || columnNumber) { |
| | | return `${shelfNumber}${storey}${arrange}${columnNumber}`; |
| | | } |
| | | return ''; |
| | | } |
| | | }, |
| | | created () { |
| | | //备份model原始值 |
| | | this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
| | | }, |
| | | methods: { |
| | | updateLocationCode() { |
| | | this.model.locationCode = this.locationCode; |
| | | }, |
| | | add (treeSelected) { |
| | | this.modelDefault.warehouseId = treeSelected.key |
| | | this.modelDefault.warehouseNum = treeSelected.entity.warehouseId |
| | |
| | | |
| | | }) |
| | | }, |
| | | }, |
| | | watch: { |
| | | autoGeneratedLocationCode(newVal) { |
| | | // 只有当用户没有手动输入时才自动填充 |
| | | if (!this.userEditedLocationCode) { |
| | | this.model.locationCode = newVal; |
| | | } |
| | | this.autoLocationCode = newVal; |
| | | }, |
| | | 'model.locationCode'(newVal) { |
| | | // 如果用户手动输入,则标记为已编辑 |
| | | if (newVal !== this.autoLocationCode) { |
| | | this.userEditedLocationCode = true; |
| | | } else { |
| | | this.userEditedLocationCode = false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |