| | |
| | | sectionCode: "", |
| | | barcode: "", |
| | | itemNo: "", |
| | | weight: "", |
| | | sumQuantity:0, |
| | | barcodeQuantity: 0, |
| | | returnBarcode: "", |
| | |
| | | }; |
| | | }, |
| | | methods: { |
| | | handleWeightInput(value) { |
| | | const source = value === undefined || value === null ? "" : String(value); |
| | | let sanitized = source.replace(/[^0-9.]/g, ""); |
| | | const dotIndex = sanitized.indexOf("."); |
| | | if (dotIndex !== -1) { |
| | | const before = sanitized.slice(0, dotIndex + 1); |
| | | const after = sanitized.slice(dotIndex + 1).replace(/\./g, ""); |
| | | sanitized = before + after; |
| | | } |
| | | if (sanitized.startsWith(".")) { |
| | | sanitized = "0" + sanitized; |
| | | } |
| | | if (sanitized === "") { |
| | | this.formData.weight = ""; |
| | | return; |
| | | } |
| | | this.formData.weight = sanitized; |
| | | }, |
| | | handleWeightBlur() { |
| | | if (this.formData.weight === "") { |
| | | return; |
| | | } |
| | | const numeric = Number(this.formData.weight); |
| | | if (isNaN(numeric) || numeric <= 0) { |
| | | this.formData.weight = ""; |
| | | this.$toast.fail("克重需为大于0的数字"); |
| | | this.$playSound('error'); |
| | | } else { |
| | | this.formData.weight = numeric.toString(); |
| | | } |
| | | }, |
| | | getModel() { |
| | | var that = this; |
| | | that.isLoading = true; |
| | |
| | | return; |
| | | } |
| | | |
| | | if (that.formData.weight !== "" && that.formData.weight !== null && that.formData.weight !== undefined) { |
| | | var weightValue = Number(that.formData.weight); |
| | | if (isNaN(weightValue) || weightValue <= 0) { |
| | | that.formData.weight = ""; |
| | | that.$toast.fail("克重需为大于0的数字"); |
| | | that.$playSound('error'); |
| | | that.$nextTick(() => { |
| | | if (that.$refs.weight && that.$refs.weight.focus) { |
| | | that.$refs.weight.focus(); |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | that.formData.weight = weightValue.toString(); |
| | | } else { |
| | | that.formData.weight = ""; |
| | | } |
| | | that.isLoading = true; |
| | | that.AxiosHttp("post", 'MesInvItemInCDetails/SaveBarCodes', { |
| | | sectionCode: that.sectionCode, |
| | | userName: that.userInfo.loginAccount, |
| | | barcode: that.formData.barcode, |
| | | weight: that.formData.weight ? Number(that.formData.weight) : null |
| | | }, false) |
| | | .then(function (res) { |
| | | var json = res; |
| | |
| | | that.$playSound('error'); |
| | | return; |
| | | } |
| | | if (that.formData.weight !== "" && that.formData.weight !== null && that.formData.weight !== undefined) { |
| | | var weightValue = Number(that.formData.weight); |
| | | if (isNaN(weightValue) || weightValue <= 0) { |
| | | that.formData.weight = ""; |
| | | that.$toast.fail("克重需为大于0的数字"); |
| | | that.$playSound('error'); |
| | | that.$nextTick(() => { |
| | | if (that.$refs.weight && that.$refs.weight.focus) { |
| | | that.$refs.weight.focus(); |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | that.formData.weight = weightValue.toString(); |
| | | } else { |
| | | that.formData.weight = ""; |
| | | } |
| | | |
| | | if (that.sectionCode.length * 1 <= 0) { |
| | | that.$toast.fail("库位编码不能为空!"); |
| | |
| | | sectionCode: that.sectionCode, |
| | | userName: that.userInfo.loginAccount, |
| | | returnBarcode: that.formData.returnBarcode, |
| | | returnQuantity: that.formData.returnQuantity |
| | | returnQuantity: that.formData.returnQuantity, |
| | | weight: that.formData.weight ? Number(that.formData.weight) : null |
| | | }, false) |
| | | .then(function (res) { |
| | | var json = res; |
| | |
| | | }); |
| | | }, |
| | | } |
| | | }) |
| | | }) |