Jelajahi Sumber

点击质检方式的时候样品数量会一直添加

PC-202503171525\Administrator 1 tahun lalu
induk
melakukan
755a6eb848
1 mengubah file dengan 33 tambahan dan 13 penghapusan
  1. 33 13
      src/views/inspectionPlan/components/edit.vue

+ 33 - 13
src/views/inspectionPlan/components/edit.vue

@@ -290,12 +290,13 @@ export default {
           //   this.baseForm?.productCode,
           //   row?.id
           // );
+          debugger
+          //操作行点击时查询清单
+          this.getInventoryList(row?.id);
           //操作行点击时查询质检
           this.getTemplateList(row?.id);
           //操作行点击时查询样品
           this.getSampleList(row?.id);
-          //操作行点击时查询清单
-          this.getInventoryList(row?.id);
         }
       } else {
         const code = await getCode('qms_plan_code');
@@ -304,6 +305,7 @@ export default {
       this.visible = true;
     },
     async getInventoryList(id) {
+      debugger
       let res = await getInventoryListByPlanId({
         planId: id
       });
@@ -408,18 +410,35 @@ export default {
       console.log('aaa')
       if (this.baseForm.qualityMode == 1) {
         this.sampleList = [];
-        if (!this.isCheck) {
-          const num = Number(this.baseForm.productNumber || 0);
-          if (num) {
-            this.getUnpackSamList(this.packingList, num)
+        if (this.baseForm.isUnpack != null && this.baseForm.isUnpack != undefined && this.baseForm.isUnpack!= '') {
+          if (this.baseForm.isUnpack == 2) {
+            const num = Number(this.baseForm.productNumber || 0);
+            if (num) {
+              this.getUnpackSamList(this.packingList, num)
+            }
+          }else if(this.baseForm.isUnpack == 1){
+            if (this.baseForm.qualityMode == 1) {
+              this.sampleList = this.packingList;
+              this.samplePagination.currentPage = 1;
+              this.samplePagination.total = this.packingList.length;
+            } else {
+              this.sampleList = [];
+            }
           }
-        } else {
-          if (this.baseForm.qualityMode == 1) {
-            this.sampleList = this.packingList;
-            this.samplePagination.currentPage = 1;
-            this.samplePagination.total = this.packingList.length;
+        }else{
+          if (!this.isCheck) {
+            const num = Number(this.baseForm.productNumber || 0);
+            if (num) {
+              this.getUnpackSamList(this.packingList, num)
+            }
           } else {
-            this.sampleList = [];
+            if (this.baseForm.qualityMode == 1) {
+              this.sampleList = this.packingList;
+              this.samplePagination.currentPage = 1;
+              this.samplePagination.total = this.packingList.length;
+            } else {
+              this.sampleList = [];
+            }
           }
         }
       } else {
@@ -428,7 +447,7 @@ export default {
 
     },
     getUnpackSamList(list, num) {
-      const data = [];
+      let data = [];
       list.forEach(oldItem => {
         const newMeasureQuantity = oldItem.measureQuantity / this.baseForm.productNumber;
         const newWeight = parseFloat((oldItem.weight / this.baseForm.productNumber).toFixed(2))
@@ -531,6 +550,7 @@ export default {
       this.schemePagination.currentPage = val;
     },
     changeModel(val) {
+      debugger
       this.baseForm.qualityMode = val;
       console.log(this.baseForm.productNumber, 'productNumberproductNumber数量')
       if (this.baseForm.qualityMode == 1) {