瀏覽代碼

feat(发货单): 将批次号输入框改为下拉选择并添加相关逻辑

liujt 7 月之前
父節點
當前提交
1b288d4edb
共有 1 個文件被更改,包括 89 次插入5 次删除
  1. 89 5
      src/views/saleManage/saleOrder/invoice/components/inventoryTable.vue

+ 89 - 5
src/views/saleManage/saleOrder/invoice/components/inventoryTable.vue

@@ -75,9 +75,22 @@
         </el-form-item>
       </template>
 
-      <template v-slot:batchNo="scope">
-        <el-form-item :prop="'datasource.' + scope.$index + '.batchNo'">
-          <el-input v-model="scope.row.batchNo" v-no-chinese></el-input>
+      <template v-slot:batchStockId="scope">
+        <el-form-item :prop="'datasource.' + scope.$index + '.batchStockId'">
+          <!-- <el-input v-model="scope.row.batchNo" v-no-chinese></el-input> -->
+          <el-select
+            v-model="scope.row.batchStockId"
+            placeholder="请选择"
+            @change="batchNoChange(scope.$index, scope.row)"
+          >
+            <el-option
+              v-for="item in (scope.row.batchNoList || [])"
+              :key="item.id"
+              :label="item.batchNo"
+              :value="item.id"
+            >
+            </el-option>
+          </el-select>
         </el-form-item>
       </template>
       <!-- 生产编号 可编辑 -->
@@ -375,6 +388,7 @@
   import { changeCount } from '@/BIZComponents/setProduct.js';
   import { parameterGetByCode } from '@/api/main/index.js';
   import { getSummaries } from '@/utils/util.js';
+  import { getBatchList } from '@/api/wms';
 
   export default {
     mixins: [dictMixins, getDynamicsColumns, tabMixins],
@@ -537,9 +551,9 @@
           },
           {
             width: 160,
-            prop: 'batchNo',
+            prop: 'batchStockId',
             label: '批次号',
-            slot: 'batchNo',
+            slot: 'batchStockId',
             align: 'center'
           },
           {
@@ -987,6 +1001,7 @@
         const data = row.warehouseList.find(
           (item) => item.warehouseId == row.warehouseId
         );
+        
 
         this.$set(
           this.form.datasource[index],
@@ -1007,6 +1022,37 @@
           'warehouseNum',
           warehouseOutStock || 0
         );
+
+        this.$set(
+          this.form.datasource[index],
+          'batchStockId',
+          ''
+        );
+
+        this.$set(
+          this.form.datasource[index],
+          'batchNo',
+          ''
+        );
+      },
+
+      //批次号选择
+      async batchNoChange(index, row) {
+        const data = row.batchNoList.find(
+          (item) => item.id == row.batchStockId
+        );
+        this.$set(
+          this.form.datasource[index],
+          'batchNo',
+          data.batchNo
+        );
+
+        this.$set(
+          this.form.datasource[index],
+          'warehouseNum',
+          data.measureQuantity || 0
+        );
+
       },
       //改变数量
       changeCount(row, index, isBlockCount = true) {
@@ -1214,6 +1260,13 @@
               categoryId: item.id
             })
           );
+
+          this.$set(parasm, 'batchNoList', await getBatchList({
+            categoryCode: item.productCode,
+            warehouseId: item.warehouseId,
+            size: -1
+          }));
+
           this.$set(
             parasm,
             'packingSpecification',
@@ -1286,6 +1339,7 @@
         }
       },
       setValue(data) {
+        console.log('setValue~~~~~~', data);
         let indexS = [];
         data.forEach((item, index) => {
           if (item.modelKey) {
@@ -1351,6 +1405,36 @@
               );
               await this.warehouseChange(index, this.form.datasource[index]);
             }
+
+            
+
+            const templist = await getBatchList({
+              categoryCode: item.productCode,
+              warehouseId: item.warehouseId,
+              size: -1
+            });
+
+            console.log('templist~~~~', templist.list);
+
+            // 批次号
+            this.$set(
+              this.form.datasource[index],
+              'batchNoList',
+              templist?.list || []
+            );
+            console.log(this.form.datasource[index]);
+            if (item.batchStockId) {
+              // this.$set(
+              //   this.form.datasource[index],
+              //   'warehouseNum',
+              //   await getWarehouseOutStock({
+              //     warehouseId: item.warehouseId,
+              //     code: item.productCode
+              //   })
+              // );
+
+              await this.batchNoChange(index, this.form.datasource[index]);
+            }
           }
         });
       },