chenrui vor 3 Jahren
Ursprung
Commit
4f06109995
1 geänderte Dateien mit 9 neuen und 7 gelöschten Zeilen
  1. 9 7
      src/views/salesManagement/salesQuery/edit.vue

+ 9 - 7
src/views/salesManagement/salesQuery/edit.vue

@@ -224,7 +224,7 @@ export default {
             data.list[i].priceBackups = data.list[i].price
           }
           this.disabled = false
-          this.dataSource = data.list
+          this.dataSource = data.list || []
           return data
         })
       },
@@ -234,7 +234,7 @@ export default {
   methods: {
     // 已选产品 销售数量  blur
     qtyBlur (val, record) {
-      this.dataSource = record
+      this.dataSource = record || []
       if (val && val != record.qtyBackups) {
         this.spinning = true
         salesDetailUpdateQty({
@@ -254,7 +254,7 @@ export default {
     },
     // 已选产品 售价  blur
     priceBlur (val, record) {
-      this.dataSource = record
+      this.dataSource = record || []
       //  光标移出,值发生改变再调用编辑接口
       if (val && val != record.priceBackups) {
         this.spinning = true
@@ -427,10 +427,12 @@ export default {
       if (this.isInster) { return }
       const _this = this
       // 判断是否已添加此产品
-      const hasRow = this.dataSource.find(item => item.productSn == row.productSn && item.warehouseSn == row.warehouseSn && item.warehouseLocationSn == row.warehouseLocationSn)
-      if (hasRow) {
-        this.$message.info('该产品已在当前销售单中存在!')
-        return
+      if (this.dataSource && this.dataSource.length > 0) {
+        const hasRow = this.dataSource.find(item => item.productSn == row.productSn && item.warehouseSn == row.warehouseSn && item.warehouseLocationSn == row.warehouseLocationSn)
+        if (hasRow) {
+          this.$message.info('该产品已在当前销售单中存在!')
+          return
+        }
       }
       // 库存不足时
       if (row.currentQty < row.salesNums) {