Bladeren bron

fix(inspectionProjectReport): 添加合格与不合格数量切换逻辑

xieyong 1 dag geleden
bovenliggende
commit
b0ce5f07b2
1 gewijzigde bestanden met toevoegingen van 27 en 0 verwijderingen
  1. 27 0
      src/views/inspectionWork/components/inspectionProjectReport.vue

+ 27 - 0
src/views/inspectionWork/components/inspectionProjectReport.vue

@@ -212,6 +212,7 @@
           placeholder="请选择"
           style="width: 100%"
           :disabled="type == 'detail'"
+          @change="(val) => handleQualityResultsChange(val, row, $index)"
         >
           <el-option
             v-for="item in qualityResultsList"
@@ -976,6 +977,32 @@
         ) {
           this.setNumber(item, index, type, '留样', 'retainedSampleQuantity');
         }
+      },
+      handleQualityResultsChange(val, row, index) {
+        //切换到合格:把不合格数移到合格数
+        if (val == 1) {
+          if (
+            row.qualifiedQuantity == 0 &&
+            row.noQualifiedQuantity &&
+            row.noQualifiedQuantity != 0
+          ) {
+            this.$set(row, 'qualifiedQuantity', row.noQualifiedQuantity);
+            this.$set(row, 'noQualifiedQuantity', 0);
+            this.isQualifiedQuantity(row, index, 'qualifiedQuantity');
+          }
+        }
+        //切换到不合格:把合格数移到不合格数
+        if (val == 2) {
+          if (
+            row.noQualifiedQuantity == 0 &&
+            row.qualifiedQuantity &&
+            row.qualifiedQuantity != 0
+          ) {
+            this.$set(row, 'noQualifiedQuantity', row.qualifiedQuantity);
+            this.$set(row, 'qualifiedQuantity', 0);
+            this.isQualifiedQuantity(row, index, 'noQualifiedQuantity');
+          }
+        }
       }
     }
   };