|
|
@@ -1434,15 +1434,20 @@
|
|
|
processScanCode(code) {
|
|
|
console.log('扫描条码:', code);
|
|
|
|
|
|
- // 1. 在产品信息表格按批次号匹配
|
|
|
+ // 1. 在产品信息表格按 产品编码-批次号 匹配(二维码由产品编码和批号用-拼接)
|
|
|
const productIndex = this.productList.findIndex(
|
|
|
- (item) => item.batchNo === code
|
|
|
+ (item) =>
|
|
|
+ item.categoryCode &&
|
|
|
+ item.batchNo &&
|
|
|
+ code === `${item.categoryCode}-${item.batchNo}`
|
|
|
);
|
|
|
if (productIndex > -1) {
|
|
|
// productList 没有 deep watcher,用 $set 让字段进入响应式,
|
|
|
// 后续 spread/序列化都能拿到 confirmStatus
|
|
|
this.$set(this.productList[productIndex], 'confirmStatus', 1);
|
|
|
- this.$message.success(`产品信息匹配成功:批次号 ${code}`);
|
|
|
+ this.$message.success(
|
|
|
+ `产品信息匹配成功:${this.productList[productIndex].categoryCode}-${this.productList[productIndex].batchNo}`
|
|
|
+ );
|
|
|
console.log('修改后的数据', this.productList);
|
|
|
return;
|
|
|
}
|