diff --git a/sgzb-ui/src/views/store/warehousing/putInStore.vue b/sgzb-ui/src/views/store/warehousing/putInStore.vue index b5163d6a..cd60f710 100644 --- a/sgzb-ui/src/views/store/warehousing/putInStore.vue +++ b/sgzb-ui/src/views/store/warehousing/putInStore.vue @@ -229,18 +229,18 @@ @@ -734,7 +734,11 @@ export default { // 根据this.codeForm.num的数量, 往this.codeTableList中添加this.codeForm的数据 for (let i = 0; i < this.codeForm.num; i++) { // 设备编码: 前缀 拼接 后缀 - let suffix = (parseInt(this.codeForm.codeSuffixStart) + i).toString().padStart(this.codeForm.codeSuffixStart?.length, '0') + let suffix = parseInt(this.codeForm.codeSuffixStart) + i + if (suffix > parseInt(this.codeForm.codeSuffixEnd)) { + suffix = parseInt(this.codeForm.codeSuffixEnd) + } + suffix = suffix.toString().padStart(this.codeForm.codeSuffixStart?.length, '0') // console.log('🚀 ~ fillCodeForm ~ suffix:', suffix); suffix = isNaN(suffix) ? '' : suffix const maCode = `${this.codeForm.codePrefix || ''}${suffix}` @@ -761,11 +765,28 @@ export default { }) }, /** 输入框改变 */ - changeInput(num) { + changeSuffixStart(num) { if (isNaN(num)) { - this.$message.error('请输入数字类型') + this.$message.error('后缀范围请输入数字类型') this.codeForm.codeSuffixStart = this.codeForm.codeSuffixStart.replace(/[^\d]/g, '') } + if (!this.codeForm.codeSuffixStart) { + this.codeForm.codeSuffixEnd = '' + } + }, + changeSuffixEnd() { + if (!this.codeForm.codeSuffixStart) { + this.$message.error('请输入后缀范围起始值') + this.codeForm.codeSuffixEnd = '' + } else if (isNaN(this.codeForm.codeSuffixEnd)) { + this.$message.error('后缀范围请输入数字类型') + this.codeForm.codeSuffixEnd = this.codeForm.codeSuffixStart.replace(/[^\d]/g, '') + } else { + if (parseInt(this.codeForm.codeSuffixStart) > parseInt(this.codeForm.codeSuffixEnd)) { + this.$message.error('后缀结束值不能小于起始值') + this.codeForm.codeSuffixEnd = +this.codeForm.codeSuffixStart + 1 + } + } }, handleResetRow(row) {