yusheng hai 8 meses
pai
achega
8a3519ed00
Modificáronse 1 ficheiros con 29 adicións e 19 borrados
  1. 29 19
      src/views/productionPlan/components/factoryAdd/index.vue

+ 29 - 19
src/views/productionPlan/components/factoryAdd/index.vue

@@ -377,9 +377,9 @@
               </div>
             </template>
 
-            <template v-slot:productWeight="{ row, $index }">
+            <!-- <template v-slot:productWeight="{ row, $index }">
               <span>{{ row.productWeight ? row.productWeight : '-' }}</span>
-            </template>
+            </template> -->
 
             <template v-slot:set="{ row, $index }">
               <el-button type="text" @click="handleDeleteItem($index)"
@@ -701,9 +701,9 @@
           },
 
           {
-            slot: 'productWeight',
-            prop: 'productWeight',
-            label: '订单重量',
+            slot: 'newSumOrderWeight',
+            prop: 'newSumOrderWeight',
+            label: '计划重量',
             align: 'center',
             minWidth: 140
           },
@@ -1378,20 +1378,6 @@
           if (!this.form.id) {
             if (this.form.productInfoList.length) {
               this.form.productInfoList.map((item, index) => {
-                if (
-                  item.weightUnit == 'G' ||
-                  item.weightUnit == 'g' ||
-                  item.weightUnit == '克'
-                ) {
-                  let total =
-                    ((item.requiredFormingNum - 0) * item.productUnitWeight) /
-                    1000;
-                  item.newSumOrderWeight = total.toFixed(2);
-                  item.newWeightUnit = 'KG';
-                } else {
-                  item.newWeightUnit = item.weightUnit;
-                  item.newSumOrderWeight = item.requiredFormingNum;
-                }
                 delete item.selectionRowShow;
                 // if (item.bomVersionList && item.bomVersionList.length) {
                 //   item.bomCategoryName = item.bomVersionList[0].name;
@@ -1600,6 +1586,30 @@
         // }
         // 更新绑定值
         row.requiredFormingNum = value;
+        //       if (
+        //   item.weightUnit == 'G' ||
+        //   item.weightUnit == 'g' ||
+        //   item.weightUnit == '克'
+        // ) {
+        //   let total =
+        //     ((item.requiredFormingNum - 0) * item.productUnitWeight) /
+        //     1000;
+        //   item.newSumOrderWeight = total.toFixed(2);
+        //   item.newWeightUnit = 'KG';
+        // } else {
+        //   item.newWeightUnit = item.weightUnit;
+        //   item.newSumOrderWeight = item.requiredFormingNum;
+        // }
+        row.newWeightUnit = row.weightUnit;
+        if (row.weightUnit == row.measuringUnit) {
+          row.newSumOrderWeight = row.requiredFormingNum;
+        } else if (row.requiredFormingNum && row.productUnitWeight) {
+          row.newSumOrderWeight =
+            row.requiredFormingNum * row.productUnitWeight;
+        } else {
+          row.newSumOrderWeight = 0;
+        }
+        row.productWeight = row.newSumOrderWeight;
         this.tableHandleKeyUp(row, 'sum');
       },
       changeProduceType(e) {