| | |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="库位号" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-input :disabled="true" :value="locationCode" placeholder="请输入库位号" ></a-input> |
| | | <a-input v-model="model.locationCode" placeholder="请输入库位号" ></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | |
| | | locationCode: '', |
| | | remark: '' |
| | | }, |
| | | autoLocationCode: '', // 自动拼接的库位号 |
| | | userEditedLocationCode: false, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 }, |
| | |
| | | return this.disabled |
| | | }, |
| | | //拼接库位号 |
| | | locationCode() { |
| | | autoGeneratedLocationCode() { |
| | | const { shelfNumber, storey, arrange, columnNumber } = this.model; |
| | | if (shelfNumber || storey || arrange || columnNumber) { |
| | | return `${shelfNumber}${storey}${arrange}${columnNumber}`; |
| | |
| | | }, |
| | | }, |
| | | watch: { |
| | | 'model.shelfNumber': 'updateLocationCode', |
| | | 'model.storey': 'updateLocationCode', |
| | | 'model.arrange': 'updateLocationCode', |
| | | 'model.columnNumber': 'updateLocationCode' |
| | | 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> |