Ver código fonte

fix(inventoryTable): 修复重量单位相同时禁用输入框及包装单位变更问题

yusheng 7 meses atrás
pai
commit
6f4e337540

+ 28 - 11
src/views/purchasingManage/purchaseOrder/invoice/components/inventoryTable.vue

@@ -120,6 +120,7 @@
             v-model="scope.row.receiveTotalWeight"
             @blur="setIcreaseTotalWeight(scope.$index)"
             style="width: 100%"
+            :disabled="isDis(scope.row)"
           >
           </el-input-number>
         </el-form-item>
@@ -225,7 +226,7 @@
               dictName="质保期单位"
               clearable
               v-model="scope.row.guaranteePeriodUnitCode"
-                :isOne="scope.$index === 0"
+              :isOne="scope.$index === 0"
               @change="
                 setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
               "
@@ -848,7 +849,7 @@
         ],
         isTotalCount: 0, //采购收货数量是否限制不能大于采购总数 //0否 1是
         isBatchNo: 0,
-        isWarehouseId:0
+        isWarehouseId: 0
       };
     },
     created() {
@@ -923,6 +924,13 @@
           row.produceRoutingId
         );
       },
+      packingChange(item, index) {
+        this.$set(
+          this.form.datasource[index],
+          'purchaseUnit',
+          item.conversionUnit
+        );
+      },
 
       //出库单详情
       handleOutBound(e, rows, index) {
@@ -953,7 +961,16 @@
 
         this.setIcreaseTotalWeight(this.curIndex);
       },
+      isDis(row) {
+        console.log(row, 'row');
+        console.log(row.weightUnit, 'row.weightUnit');
+        console.log(row.purchaseUnit, 'row.purchaseUnit');
+        if (row.weightUnit == row.purchaseUnit) {
+          return true;
+        }
 
+        return false;
+      },
       //改变数量
       changeCount(row, index) {
         this.$set(
@@ -1096,7 +1113,7 @@
           this.form.datasource.push(row);
         });
         this.form.datasource.forEach((item, index) => {
-          if (!item.warehouseId&&this.isWarehouseId==1) {
+          if (!item.warehouseId && this.isWarehouseId == 1) {
             this.warehouseChange(index, item);
           }
         });
@@ -1203,7 +1220,7 @@
                 item.colorKey?.split(',')
               );
             }
-            if (!item.warehouseId&&this.isWarehouseId==1) {
+            if (!item.warehouseId && this.isWarehouseId == 1) {
               this.warehouseChange(index, item);
             }
             item.guaranteePeriodUnitCode = item.guaranteePeriodUnitCode
@@ -1264,14 +1281,14 @@
       },
       // 添加
       handlAdd() {
-        // this.$refs.productListMainRef.open('', -1);
+        this.$refs.productListMainRef.open('', -1);
 
-        if (!this.orderId) return this.$message.error('请先选择订单');
-        if (orderSourceType.includes(this.sourceType)) {
-          this.$refs.productListMainRef.open('', -1);
-        } else {
-          this.$refs.productListRef.open(this.form.datasource);
-        }
+        // if (!this.orderId) return this.$message.error('请先选择订单');
+        // if (orderSourceType.includes(this.sourceType)) {
+        //   this.$refs.productListMainRef.open('', -1);
+        // } else {
+        //   this.$refs.productListRef.open(this.form.datasource);
+        // }
       },
 
       validateForm(callback) {