|
|
@@ -601,9 +601,10 @@
|
|
|
},
|
|
|
|
|
|
// 确定选择
|
|
|
+ // 注意:这里只做"追加",不能清空 form.poList。修改台账时 poList 里是已保存的明细(带 id),
|
|
|
+ // 清空后提交会让后端认为这些明细被删除,把它们物理删掉。
|
|
|
confirmChoose(data) {
|
|
|
console.log(data);
|
|
|
- this.form.poList = [];
|
|
|
|
|
|
let list = [];
|
|
|
list = data.map((item, index) => {
|
|
|
@@ -661,21 +662,24 @@
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
- this.form.categoryCode = data[0].code;
|
|
|
- this.form.categoryName = data[0].name;
|
|
|
- this.form.categoryId = data[0].id;
|
|
|
- this.form.brandNum = data[0].brandNum;
|
|
|
- this.form.batchNo = data[0].batchNo;
|
|
|
- this.form.specification = data[0].specification;
|
|
|
- this.form.modelType = data[0].modelType;
|
|
|
- this.form.measureQuantity = '';
|
|
|
- this.form.measureUnit = data[0].measuringUnit;
|
|
|
- this.form.weight = data[0].netWeight;
|
|
|
- this.form.weightUnit = data[0].weightUnit;
|
|
|
- this.form.quantity = data.length;
|
|
|
-
|
|
|
this.form.poList = this.form.poList.concat(list);
|
|
|
|
|
|
+ // 修改台账时保留原有主表信息(产品、批次号、规格等),只追加明细行,避免被新增行的产品覆盖
|
|
|
+ if (this.title !== '修改') {
|
|
|
+ this.form.categoryCode = data[0].code;
|
|
|
+ this.form.categoryName = data[0].name;
|
|
|
+ this.form.categoryId = data[0].id;
|
|
|
+ this.form.brandNum = data[0].brandNum;
|
|
|
+ this.form.batchNo = data[0].batchNo;
|
|
|
+ this.form.specification = data[0].specification;
|
|
|
+ this.form.modelType = data[0].modelType;
|
|
|
+ this.form.measureQuantity = '';
|
|
|
+ this.form.measureUnit = data[0].measuringUnit;
|
|
|
+ this.form.weight = data[0].netWeight;
|
|
|
+ this.form.weightUnit = data[0].weightUnit;
|
|
|
+ this.form.quantity = this.form.poList.length;
|
|
|
+ }
|
|
|
+
|
|
|
this.produceTaskChange();
|
|
|
// this.inputNumber();
|
|
|
},
|