lilei 11 месяцев назад
Родитель
Сommit
d1efd1d7f2
1 измененных файлов с 26 добавлено и 13 удалено
  1. 26 13
      src/views/salesManagement/waitDispatchNew/queryPart.vue

+ 26 - 13
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -410,7 +410,7 @@ export default {
         { title: '', field: '', key: 'acheck', width: 50, type: 'checkbox', align: 'center' },
         { title: '序号', field: 'no', key: 'a', width: 50, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return noFormat(row, row[column.field], h) } },
         { title: '产品编码', field: 'productCode', key: 'b', width: 150, align: 'left', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return codeFormat(row, row[column.field], h) } },
-        { title: '产品名称', field: 'productName', key: 'c', width: 250, align: 'left', operationColumn: false, ellipsis: { showTitle: true }, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
+        { title: '产品名称', field: 'productName', key: 'c', width: 220, align: 'left', operationColumn: false, ellipsis: { showTitle: true }, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
         { title: '原厂编码', field: 'productOrigCode', key: 'd', width: 150, align: 'left', operationColumn: false, ellipsis: { showTitle: true }, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
         { title: '出库仓库', field: 'warehouseName', key: 'e', width: 100, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } }
       ]
@@ -429,6 +429,7 @@ export default {
         { title: '可用库存', field: 'stockQty', width: 80, key: 'j', align: 'center', fixed: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } }
       ])
       if (this.showLockStockQty) {
+        this.colspanNums = this.colspanNums + 1
         arr.push({ title: '锁定库存', field: 'lockStockQty', width: 80, key: 'jk', align: 'center', fixed: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } })
       }
       arr = arr.concat([
@@ -659,11 +660,15 @@ export default {
     },
     // 添加
     handleAdd (row) {
-      if (row.stockQty > 0) { //  可用库存大于0才可添加
-        this.$emit('addProduct', [row.salesBillDetailSn])
-      } else {
-        if (row && row.productEntity && row.productEntity.productBrandName == '箭冠' && row.productEntity.productTypeName3 == '轮胎') {
+      if (row && row.productEntity && row.productEntity.productBrandName == '箭冠' && row.productEntity.productTypeName3 == '轮胎') {
+        if (!row.lockStockQty) {
           this.$message.warning('锁定库存不足!')
+        } else {
+          this.$emit('addProduct', [row.salesBillDetailSn])
+        }
+      } else {
+        if (row.stockQty > 0) { //  可用库存大于0才可添加
+          this.$emit('addProduct', [row.salesBillDetailSn])
         } else {
           this.$message.warning('库存为0,不可添加!')
         }
@@ -715,33 +720,41 @@ export default {
         _this.$message.warning('请先选择产品!')
         return
       }
-      // 可添加产品
-      const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.stockQty > 0)
+
       // 库存为0的产品
       const noStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && !item.stockQty)
       // 冻结库存为0的产品
       const noLockStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.productEntity && item.productEntity.productBrandName == '箭冠' && item.productEntity.productTypeName3 == '轮胎' && !item.lockStockQty)
 
-      // 可添加产品sn列表
-      const obj = []
-      chooseRow && chooseRow.map(item => {
-        obj.push(item.salesBillDetailSn)
-      })
       // 库存为0产品编码列表
       const noObj = []
+      const noObjSn = []
       noStockRow && noStockRow.map(item => {
         noObj.push(item.productCode)
+        noObjSn.push(item.salesBillDetailSn)
       })
       // 冻结库存为0的产品
       const noLockObj = []
+      const noLockObjSn = []
       noLockStockRow && noLockStockRow.map(item => {
         noLockObj.push(item.productCode)
+        noLockObjSn.push(item.salesBillDetailSn)
+      })
+
+      // 可添加产品
+      const chooseRow = this.dataSource.filter(item => {
+        return chooseList.includes(item.id) && !noObjSn.includes(item.salesBillDetailSn) && !noLockObjSn.includes(item.salesBillDetailSn)
+      })
+      // 可添加产品sn列表
+      const obj = []
+      chooseRow && chooseRow.map(item => {
+        obj.push(item.salesBillDetailSn)
       })
 
       if (obj.length) {
         this.$confirm({
           title: '提示',
-          content: <div><div style="text-align:center;padding:10px 0;font-weight:bold;">确认要批量添加到待下推列表吗?</div>{(noObj.length || noLockObj.length) ? <div><div>总共选择了 {chooseList.length} 个产品,其中 {obj.length} 个产品可添加。</div><div> {noObj.length ? <div>产品 ({noObj.toString()}) 因库存为0不可添加!</div> : noLockObj.length ? <div>产品 ({noLockObj.toString()}) 因锁定库存不足不可添加!</div> : ''}</div></div> : ''}</div>,
+          content: <div><div style="text-align:center;padding:10px 0;font-weight:bold;">确认要批量添加到待下推列表吗?</div>{(noObj.length || noLockObj.length) ? <div><div>总共选择了 {chooseList.length} 个产品,其中 {obj.length} 个产品可添加。</div>{noObj.length ? <div>产品 ({noObj.toString()}) 因库存为0不可添加!</div> : ''}</div> : ''}<div>{noLockObj.length ? <div>产品 ({noLockObj.toString()}) 因锁定库存为0不可添加!</div> : ''}</div></div>,
           centered: true,
           closable: true,
           class: 'confirm-center',