From e5cf171d6d2977ba7c4eab2e91fdffea1f9d8244 Mon Sep 17 00:00:00 2001 From: binbin_pan Date: Wed, 3 Apr 2024 16:48:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E9=87=8F=E7=9B=98=E7=82=B9=E5=85=A5?= =?UTF-8?q?=E5=BA=93-=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/store/warehousing/putInStore.vue | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) 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) {