|
@@ -1196,7 +1196,17 @@
|
|
|
handleDeleteClick(row, index) {
|
|
handleDeleteClick(row, index) {
|
|
|
console.log('删除', row.id);
|
|
console.log('删除', row.id);
|
|
|
this.productList.splice(index, 1);
|
|
this.productList.splice(index, 1);
|
|
|
- this.formData.outInDetailList.splice(index, 1);
|
|
|
|
|
|
|
+ // 表格数据会经过去重和排序,不能再用表格下标删除原始明细。
|
|
|
|
|
+ const detailIndex = this.formData.outInDetailList.findIndex(
|
|
|
|
|
+ (item) =>
|
|
|
|
|
+ (row.id != null && item.id === row.id) ||
|
|
|
|
|
+ (row.id == null && row.tempId != null && item.tempId === row.tempId) ||
|
|
|
|
|
+ (row.id == null && row.tempId == null && row.deliveryDetailId != null
|
|
|
|
|
+ && item.deliveryDetailId === row.deliveryDetailId)
|
|
|
|
|
+ );
|
|
|
|
|
+ if (detailIndex !== -1) {
|
|
|
|
|
+ this.formData.outInDetailList.splice(detailIndex, 1);
|
|
|
|
|
+ }
|
|
|
this.packingList = this.packingList.filter(
|
|
this.packingList = this.packingList.filter(
|
|
|
(item) => item.outInDetailId !== row.id
|
|
(item) => item.outInDetailId !== row.id
|
|
|
);
|
|
);
|