From c5a95de4dfc0b8f165e7382e03a04472f25e5993 Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Mon, 17 Nov 2025 17:38:10 +0800 Subject: [PATCH] =?UTF-8?q?2025-11-17=20=E9=94=80=E5=94=AE=E5=8F=91?= =?UTF-8?q?=E8=B4=A7=E8=A3=85=E7=AE=B1=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/boxManage/saleBoxManage.vue | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/views/modules/boxManage/saleBoxManage.vue b/src/views/modules/boxManage/saleBoxManage.vue index cd38c9e..d3c3b1e 100644 --- a/src/views/modules/boxManage/saleBoxManage.vue +++ b/src/views/modules/boxManage/saleBoxManage.vue @@ -968,8 +968,30 @@ export default { return } - // 将所有查询到的卷信息添加到列表最前面(后扫描的在上面) + // 检查卷标签是否重复(根据 site 和 rollNo) + const duplicateRolls = [] + const newRolls = [] + rollList.forEach(rollInfo => { + // 检查当前列表中是否已存在相同 site 和 rollNo 的记录 + const isDuplicate = this.caseRollList.some(item => + item.site === this.caseForm.site && item.rollNo === rollInfo.rollNo + ) + + if (isDuplicate) { + duplicateRolls.push(rollInfo.rollNo) + } else { + newRolls.push(rollInfo) + } + }) + + // 如果有重复的卷标签,提示用户 + if (duplicateRolls.length > 0) { + this.$message.warning(`以下卷标签已存在,不能重复添加:${duplicateRolls.join(', ')}`) + } + + // 只添加不重复的卷到列表最前面(后扫描的在上面) + newRolls.forEach(rollInfo => { this.caseRollList.unshift({ casesNo: this.caseForm.casesNo, rollNo: rollInfo.rollNo, @@ -995,7 +1017,10 @@ export default { this.$refs.rollNoInput.focus() }) - this.$message.success(`扫描成功,添加了 ${rollList.length} 条记录`) + // 提示添加成功(仅显示实际添加的记录数) + if (newRolls.length > 0) { + this.$message.success(`扫描成功,添加了 ${newRolls.length} 条记录`) + } } else { this.$message.error(data.msg || '扫描失败') }