Bladeren bron

fix:5397【销售订单-提交发货】创建订单成功,然后去发货-这个时候有个物品没有库存了,发货不了,删掉这个没有库存的产品,去发货其它的,就提交不了

mlchen 6 dagen geleden
bovenliggende
commit
ef50dd67d8
1 gewijzigde bestanden met toevoegingen van 11 en 1 verwijderingen
  1. 11 1
      src/views/warehouseManagement/outgoingManagement/add.vue

+ 11 - 1
src/views/warehouseManagement/outgoingManagement/add.vue

@@ -1196,7 +1196,17 @@
       handleDeleteClick(row, index) {
         console.log('删除', row.id);
         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(
           (item) => item.outInDetailId !== row.id
         );