yusheng 10 maanden geleden
bovenliggende
commit
dd5d199e6d

+ 0 - 1
src/views/purchasingManage/purchaseOrder/components/inventoryTable.vue

@@ -482,7 +482,6 @@
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.purchaseUnitId'"
-   
         >
           <el-select
             v-model="scope.row.purchaseUnitId"

+ 16 - 8
src/views/purchasingManage/purchaseOrder/invoice/components/inventoryTable.vue

@@ -263,7 +263,6 @@
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.purchaseUnitId'"
- 
         >
           <el-select
             v-model="scope.row.purchaseUnitId"
@@ -805,13 +804,19 @@
         getFile({ objectName: file.storePath }, file.name);
       },
       async warehouseChange(index, row) {
-        const data = this.warehouseList.find(
-          (item) => item.id == row.warehouseId
-        );
-
-        this.$set(this.form.datasource[index], 'warehouseName', data.name);
-        this.$set(this.form.datasource[index], 'warehouseCode', data.code);
-        this.$set(this.form.datasource[index], 'warehouseId', data.id);
+        let data = null;
+        if (row.warehouseId) {
+          data = this.warehouseList.find((item) => item.id == row.warehouseId);
+        } else {
+          data = this.warehouseList.find(
+            (item) => item.inventoryType == row.categoryRootLevelId
+          );
+        }
+        if (data) {
+          this.$set(this.form.datasource[index], 'warehouseName', data.name);
+          this.$set(this.form.datasource[index], 'warehouseCode', data.code);
+          this.$set(this.form.datasource[index], 'warehouseId', data.id);
+        }
       },
       warehouseAllChange(data) {
         console.log(this.selection, 'this.selection');
@@ -1126,6 +1131,9 @@
             };
           });
           this.form.datasource.forEach((item, index) => {
+            if (!item.warehouseId) {
+              this.warehouseChange(index, item);
+            }
             item.guaranteePeriodUnitCode = item.guaranteePeriodUnitCode
               ? item.guaranteePeriodUnitCode + ''
               : '';

+ 27 - 25
src/views/purchasingManage/purchaseOrder/outSourceSend/components/inventoryTable.vue

@@ -186,7 +186,6 @@
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.purchaseUnitId'"
-       
         >
           <el-select
             v-model="scope.row.purchaseUnitId"
@@ -367,7 +366,6 @@
             }
           },
 
-   
           {
             minWidth: 150,
             prop: 'supplierMark',
@@ -678,8 +676,6 @@
     },
     methods: {
       async warehouseChange(index, row, item) {
-        console.log(item, 'row');
-
         this.$set(
           this.form.datasource[index],
           'warehouseName',
@@ -841,6 +837,14 @@
               categoryId: item.id
             })
           );
+          if (parasm?.warehouseList?.length) {
+            this.$set(
+              parasm,
+              'warehouseId',
+              parasm.warehouseList[0].warehouseId
+            );
+            await this.warehouseChange(index, parasm, parasm?.warehouseList[0]);
+          }
           this.$set(
             parasm,
             'packingSpecification',
@@ -887,19 +891,7 @@
           row.produceRoutingId
         );
       },
-      validateTotalCount(row) {
-        return (rule, value, callback) => {
-          if (isNaN(value) || Number(value) <= 0) {
-            this.$message.error('请输入大于0的数');
-            callback(new Error('请输入大于0的数字'));
-          } else if (Number(value) > row.orderTotalCount) {
-            this.$message.error('输入的数字不能大于最大发货值');
-            callback(new Error('输入的数字不能大于最大发货值'));
-          } else {
-            callback();
-          }
-        };
-      },
+
       // 返回列表数据
       getTableValue() {
         let comitDatasource = this.form.datasource;
@@ -927,6 +919,13 @@
         if (data) {
           this.form.datasource = data;
           data.forEach(async (item, index) => {
+            this.$set(
+              this.form.datasource[index],
+              'warehouseList',
+              await getIdWarehouseList({
+                categoryId: item.productId
+              })
+            );
             if (item.warehouseId) {
               this.$set(
                 this.form.datasource[index],
@@ -936,15 +935,18 @@
                   code: item.productCode
                 })
               );
+            } else if (this.form.datasource[index]?.warehouseList?.length) {
+              this.$set(
+                this.form.datasource[index],
+                'warehouseId',
+                this.form.datasource[index]?.warehouseList[0].warehouseId
+              );
+              await this.warehouseChange(
+                index,
+                this.form.datasource[index],
+                this.form.datasource[index]?.warehouseList[0]
+              );
             }
-            this.$set(
-              this.form.datasource[index],
-              'warehouseList',
-              await getIdWarehouseList({
-                categoryId: item.productId
-              })
-            );
-            // if (!item.sendTotalWeight)
             this.$set(
               item,
               'sendTotalWeight',

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

@@ -918,7 +918,7 @@
       packingChange(item, index) {
         this.$set(
           this.form.datasource[index],
-          'saleUnitId',
+          'saleUnit',
           item.conversionUnit
         );
       },