Przeglądaj źródła

质检工单合格率不合格率计算更改

jingshuyong 10 miesięcy temu
rodzic
commit
be183aa948

+ 0 - 542
src/views/inspectionPlan/components/new-edit.vue

@@ -645,12 +645,9 @@
           if (newVal && newVal.length > 0 && !newVal[0].sampleCode) {
             let count = newVal ? newVal.length : 0;
             const codeList = await this.batchCodes(count);
-            console.log(codeList, 'codeList 0000');
-            console.log(newVal, 'newVal');
             newVal.map(async (el, index) => {
               if (!el.sampleCode) {
                 this.$set(el, 'sampleCode', codeList[index]);
-                // el.sampleCode = codeList[index];
               }
             });
           }
@@ -806,128 +803,17 @@
     methods: {
       //
       calculate(list) {
-        // if (list.length == 0) {
-        //   this.baseForm.sampleQuantity = 0;
-        //   this.baseForm.sampleWeight = 0;
-        // }
         let sampleQuantity = 0; // 样品数量
         let sampleWeight = 0; // 样品重量
-        // // let sampleQualifiedNumber = 0; //  样品合格数
-        // let sampleNoQualifiedNumber = 0; //  样品不合格数
         list.forEach((el) => {
           sampleQuantity += el.measureQuantity - 0;
           sampleWeight += el.weight - 0;
-          // if (el.qualityResults != 2) {
-          //   sampleQualifiedNumber += el.measureQuantity - 0;
-          // } else {
-          //   sampleNoQualifiedNumber += el.measureQuantity - 0;
-          // }
         });
         this.$set(this.baseForm, 'sampleQuantity', sampleQuantity); // 样品数量
         this.$set(this.baseForm, 'sampleWeight', sampleWeight); // 样品重量
-        // // 计算合格率和不合格率(百分比形式)
-        // let sampleQualificationRate = ''; // 合格率
-        // let sampleNoQualificationRate = ''; // 不合格率
-        // if (sampleQualifiedNumber) {
-        //   sampleQualificationRate =
-        //     ((sampleQualifiedNumber / sampleQuantity) * 100).toFixed(2) || '';
-        //   sampleNoQualificationRate =
-        //     ((sampleNoQualifiedNumber / sampleQuantity) * 100).toFixed(2) || '';
-        // }
-        // if (sampleQualificationRate || sampleQualificationRate == '0.00') {
-        //   sampleQualificationRate = sampleQualificationRate + '%';
-        // }
-        // if (sampleNoQualificationRate || sampleNoQualificationRate == '0.00') {
-        //   sampleNoQualificationRate = sampleNoQualificationRate + '%';
-        // }
-        // let resultsTotal = this.baseForm.productNumber - sampleQuantity;
-        // if (sampleQuantity == sampleQualifiedNumber) {
-        //   this.$set(this.baseForm, 'qualifiedNumber', resultsTotal);
-        //   this.$set(this.baseForm, 'unqualifiedNumber', 0);
-        //   this.$set(this.baseForm, 'qualificationRate', '100%');
-        //   // this.$set(this.baseForm, 'noQualificationRate', '0');
-        //   this.$set(this.baseForm, 'qualityResults', 1);
-        // } else {
-        //   this.$set(this.baseForm, 'unqualifiedNumber', resultsTotal);
-        //   this.$set(this.baseForm, 'qualifiedNumber', 0);
-        //   this.$set(this.baseForm, 'qualificationRate', '0');
-        //   // this.$set(this.form, 'noQualificationRate', '100%');
-        //   this.$set(this.baseForm, 'qualityResults', 2);
-        // }
-        // // this.$set(this.form, 'resultsTotal', resultsTotal);
-        // this.$set(
-        //   this.baseForm,
-        //   'sampleQualificationRate', // 样品合格率
-        //   sampleQualificationRate
-        // );
-        // this.$set(
-        //   this.baseForm,
-        //   'sampleNoQualificationRate', // 样品不合格率
-        //   sampleNoQualificationRate
-        // );
-        // this.$set(
-        //   this.baseForm,
-        //   'sampleNoQualifiedNumber', // 样品不合格数
-        //   sampleNoQualifiedNumber
-        // );
-        // this.$set(
-        //   this.baseForm,
-        //   'sampleQualifiedNumber',
-        //   sampleQualifiedNumber
-        // ); // 样品合格数
       },
       //成品检验类型,计划来源主数据,修改数量生成来源清单
       changeProductNumberModel(num) {
-        // if (
-        //   this.btnType == 'add' ||
-        //   (this.btnType == 'edit' && !this.isUpdateData)
-        // ) {
-        //   this.$refs.table12.setData([]);
-        //   this.isOrder = false;
-        //   let nums = Number(num);
-        //   let p = this.productItem;
-        //   let list = [];
-        //   if (this.isConsumable == 0) {
-        //     for (let i = 0; i < nums; i++) {
-        //       let obj = {
-        //         id: p.id,
-        //         batchNo: p.batchNo,
-        //         categoryCode: p.code, //编码
-        //         categoryName: p.name, //名称
-        //         measureQuantity: 1,
-        //         measureUnit: p.measuringUnit, //计量单位
-        //         weightUnit: p.weightUnit, //重量单位
-        //         weight: p.netWeight //重量
-        //       };
-        //       list.push(obj);
-        //     }
-        //   } else if (this.isConsumable == 1) {
-        //     let obj = {
-        //       id: p.id,
-        //       batchNo: p.batchNo,
-        //       categoryCode: p.code, //编码
-        //       categoryName: p.name, //名称
-        //       measureQuantity: nums, //计量数量
-        //       measureUnit: p.measuringUnit, //计量单位
-        //       weightUnit: p.weightUnit, //重量单位
-        //       weight: p.netWeight * nums //重量
-        //     };
-        //     list.push(obj);
-        //   }
-        //   this.$refs.table12.setData(list);
-
-        //   // *** 如果检验方式是全量的话 还需要同步样品清单数据
-        //   if (
-        //     this.baseForm.qualityMode == 1 &&
-        //     this.baseForm.inspectionStandards
-        //   ) {
-        //     this.isFormNumber = false;
-        //     this.handleSampleList();
-        //   }
-        //   console.log(this.baseForm, 'form --');
-        // }
-        console.log('数据33333');
-        // this.$refs.table12.setData([]);
         this.sourceList = [];
         this.packingList = [];
         this.isOrder = false;
@@ -1056,33 +942,6 @@
         }
       },
 
-      // changesStokledgerNumberModal(val, dimension) {
-      //   console.log(val, dimension, '获取成品检验订单数据');
-      //   this.$refs.table12.setData([]);
-      //   if (dimension) this.dimensionType = dimension;
-      //   if (dimension == 3) return this.$refs.table12.setData(val);
-      //   let item = val[0];
-      //   let num = Number(item.outboundNum);
-      //   let list = [];
-      //   let weight = (item.weight / item.measureQuantity).toFixed(2);
-      //   for (let i = 0; i < num; i++) {
-      //     list.push({
-      //       ...item,
-      //       id: i + 1,
-      //       packingQuantity: null,
-      //       measureQuantity: 1,
-      //       weight
-      //     });
-      //   }
-      //   console.log(list, 'for循环成品检验订单数据');
-      //   this.$refs.table12.setData(list);
-      //   if (this.baseForm.qualityMode == '1') {
-      //     this.handleUnpackCase(list);
-      //   } else if (this.baseForm.qualityMode == '2') {
-      //     this.sampleList = [];
-      //   }
-      // },
-
       //获取基本信息中计量方式
       getInspectionStandards(data) {
         console.log(data, 'data');
@@ -1098,17 +957,6 @@
         this.isOnce = false;
       },
       async datasource({ page, limit, where }) {
-        // console.log(this.btnType);
-        // console.log(this.isScheme, this.isOrder);
-        // const res = await getInventoryListByPlanId({
-        //   ...where,
-        //   pageNum: page,
-        //   size: limit
-        // });
-        // console.log(res.list);
-        // this.packingList = res.list;
-        // return res;
-
         return await getInventoryListByPlanId({
           ...where,
           pageNum: page,
@@ -1239,30 +1087,6 @@
           this.sourceList = [];
           return;
         }
-
-        // let o = listData.list[0];
-        // let listArr = [];
-        // console.log(listData,'listData 会执行吗1234')
-        // if (o.measureUnit) {
-        //   listArr.push({
-        //     packageCellTotal: 1,
-        //     conversionUnit: o.measureUnit,
-        //     id: '111'
-        //   });
-        // }
-        // if (o.packingUnit) {
-        //   listArr.push({
-        //     packageCellTotal: o.measureQuantity - 0,
-        //     conversionUnit: o.packingUnit,
-        //     id: '222'
-        //   });
-        // }
-        // listData.list.map((el) => {
-        //   el.weightProportion = el.weight
-        //     ? (el.weight / el.measureQuantity).toFixed(4)
-        //     : 0;
-        //   el.weightProportion = el.weightProportion - 0;
-        // });
         listData.list = this.proceSources(listData.list);
         // this.packingSpecificationOption = listArr;
         this.sourceList = listData.list;
@@ -1297,16 +1121,6 @@
         return list;
       },
       async getSampleList(id) {
-        // console.log('执行?')
-        // let res = await getSampleListByPlanId({
-        //   planId: id,
-        //   pageNum: this.samplePagination.currentPage,
-        //   size: this.samplePagination.pageSize
-        // });
-
-        // this.sampleList = res?.list || [];
-        // this.samplePagination.total = res.count;
-
         let newRes = await getSampleListByPlanId({
           planId: id,
           pageNum: 1,
@@ -1420,12 +1234,6 @@
           // this.$refs.table12.setData(_arr1); //赋值
           this.sourceList = _arr1;
           this.packingList = _arr1;
-          // const _arr2 = this.$refs.table12.getData();
-          // if (_arr2.length > 1) {
-          //   this.baseForm.productNumber = _arr2.length;
-          // } else {
-          //   this.baseForm.productNumber = _arr2[0].measureQuantity;
-          // }
           this.baseForm.totalWeight = this.sourceList.reduce((acc, pre) => {
             return pre.weight ? acc + Number(pre.weight) : acc;
           }, 0);
@@ -1482,13 +1290,6 @@
               let packList = this.$refs.table12.getData();
               this.getFullInspectionWeight(packList);
             }
-
-            // this.$refs.table12.setData(list);
-            // let packList = this.$refs.table12.getData();
-            // console.log(list);
-            // console.log(1654646);
-            // this.getFullInspectionWeight(packList);
-            // this.getFullInspectionWeight(list);
           } else {
             if (this.$refs.table12) {
               let packingList = this.$refs.table12.getData();
@@ -1507,16 +1308,6 @@
                 this.getFullInspectionWeight(packingList);
               }
             }
-            // let packingList = this.$refs.table12.getData();
-            // if (
-            //   Math.ceil(Number(this.baseForm.productNumber || 0)) ===
-            //   packingList.length
-            // ) {
-            //   await this.handleUnpackCase(packingList);
-            //   return;
-            // } else {
-            //   this.getFullInspectionWeight(packingList);
-            // }
           }
         }
 
@@ -1560,60 +1351,7 @@
 
               return;
             }
-            // this.$refs.table12.setData([]);
-            // let nums = Number(this.baseForm.productNumber);
-            // let p = this.productItem;
-            // let list = [];
-
-            // for (let i = 0; i < nums; i++) {
-            //   let obj = {
-            //     id: p.id,
-            //     batchNo: p.batchNo,
-            //     categoryCode: p.code, //编码
-            //     categoryName: p.name, //名称
-            //     measureQuantity: 1,
-            //     measureUnit: p.measuringUnit, //计量单位
-            //     weightUnit: p.weightUnit, //重量单位
-            //     weight: p.netWeight //重量
-            //   };
-            //   list.push(obj);
-            // }
-            // console.log('数据666666');
-            // this.$refs.table12.setData(list);
-            // let packList = this.$refs.table12.getData();
-            // await this.handleUnpackCase(packList);
-
-            // return;
           }
-          // if (this.rowIds) {
-          //   const res = await getInventoryListByPlanId({
-          //     planId: this.rowIds,
-          //     pageNum: 1,
-          //     size: 5000
-          //   });
-          //   // console.log(res.list);
-          //   if (res.list.length > 0) {
-          //     await this.handleUnpackCase(res.list);
-          //   }
-          // } else {
-          // await this.handleUnpackCase(packingList);
-          // }
-
-          // if (this.baseForm.isUnpack != null && this.baseForm.isUnpack != undefined && this.baseForm.isUnpack != '') {
-          //   //拆包
-          //   if (this.baseForm.isUnpack == 1) {
-          //     await this.handleUnpackCase(packingList);
-          //   } else if (this.baseForm.isUnpack == 0) {
-          //     await this.updatePackingList(packingList);
-          //   }
-          // } else {
-          //   console.log(this.isCheck, 'this.isCheck')
-          //   if (!this.isCheck) {
-          //     await this.handleUnpackCase(packingList);
-          //   } else {
-          //     await this.updatePackingList(packingList);
-          //   }
-          // }
           //全检 计重时
         } else if (
           this.baseForm.qualityMode == 1 &&
@@ -1647,10 +1385,6 @@
             let packList = this.$refs.table12.getData();
             this.getFullInspectionWeight(packList);
           }
-          // this.$refs.table12.setData(list);
-          // let packList = this.$refs.table12.getData();
-          // this.getFullInspectionWeight(packList);
-          // this.getFullInspectionWeight(packList);
         } else {
           console.log('进来了这里');
 
@@ -1896,61 +1630,6 @@
         this.conditionType = val;
         //清空样品清单列表
         this.sampleList = [];
-        // const dataS = this.$refs.table12.getData();
-        //取整样
-        // if (val == 1) {
-        //   if (this.selectedList.length == 0) {
-        //     this.$message.warning('请先选择样品!');
-        //   } else {
-        //     if (this.isCheck) {
-        //       for (let i = 0; i < this.selectedList.length; i++) {
-        //         for (let j = 0; j < this.selectedList[i].measureQuantity; j++) {
-        //           // this.selectedList[i].sampleCode = await this.getSampleCode();
-        //           this.sampleList.push({
-        //             ...this.selectedList[i],
-        //             sampleCode: await this.getSampleCode(),
-        //             measureQuantity: 1,
-        //             weight: this.selectedList[i].weight / this.selectedList[i].measureQuantity
-        //           });
-        //         }
-        //       }
-        //     } else {
-        //       for (let i = 0; i < this.selectedList.length; i++) {
-        //         let forNum = 0;
-        //         if (this.formData.portion != null && this.formData.portion != '') {
-        //           forNum = this.formData.portion;
-        //         } else {
-        //           forNum = this.selectedList[i].measureQuantity;
-        //         }
-        //         for (let j = 0; j < forNum; j++) {
-        //           // this.selectedList[i].sampleCode = await this.getSampleCode();
-        //           this.sampleList.push({
-        //             ...this.selectedList[i],
-        //             sampleCode: await this.getSampleCode(),
-        //             measureQuantity: 1,
-        //             weight: this.selectedList[i].weight / this.selectedList[i].measureQuantity
-        //           });
-        //         }
-        //       }
-
-        //     }
-        //     this.formData.portion = this.sampleList.length;
-        //     this.activeName = '2';
-        //     this.$message.success('取样成功!');
-        //   }
-        // } else if (val == 2) {
-        //   this.formData.sampleUnit = dataS[0].measureUnit;
-
-        //   this.$refs.table12.clearSelection();
-        //   //小样
-        //   if (this.selectedList.length == 0) {
-        //     this.$message.warning('请先选择样品!');
-        //   } else {
-        //     if (this.formData.number == null || this.formData.sampleUnit == '') {
-        //       this.$message.warning('请先选择取样的数量和单位!');
-        //     }
-        //   }
-        // }
       },
 
       handleInputNumber(val) {
@@ -2076,98 +1755,6 @@
           return pre.measureQuantity ? acc + Number(pre.measureQuantity) : acc;
         }, 0);
       },
-
-      //整样确认按钮-样品列表右上角确认按钮
-      // handleExtractFull() {
-      //   this.$refs.ruleForm.validate((valid) => {
-      //     if (valid) {
-      //       if (!this.selectedList || this.selectedList.length == 0) {
-      //         this.$message.warning('请先选择样品!');
-      //         return;
-      //       }
-      //       this.sampleList = []
-      //       //取样条数
-      //       let safePortion = Number(this.formData.portion);
-      //       //计量数量
-      //       let measureQ = this.formData.number || 1;
-      //       //计量单位
-      //       let unit = this.formData.sampleUnit;
-      //       //抽检计量整样小样或者抽检计重小样
-      //       if ((this.baseForm.inspectionStandards === 1) || (this.baseForm.inspectionStandards === 2 && this.conditionType == 2)) {
-      //         if (this.conditionType == 2) {
-      //           if (measureQ <= 0) {
-      //             this.$message.info('取样计量数量必须大于0');
-      //             return
-      //           }
-      //         }
-      //         // 计算总计量数量
-      //         const totalQuantity = this.selectedList.reduce((sum, item) => sum + item['measureQuantity'], 0);
-      //         // 验证取样总量不超过总计量数量,只有计量单位相同才进行验证
-      //         if (this.selectedList[0].measureUnit == unit || this.conditionType == 1) {
-      //           if (measureQ * safePortion > totalQuantity) {
-      //             this.$message.info('取样计量数量不能大于总计量数量');
-      //             return
-      //           }
-      //           // 验证每条数据的计量数量都大于等于取样计量数量
-      //           for (const item of this.selectedList) {
-      //             if (item['measureQuantity'] < measureQ) {
-      //               this.$message.info(`条目计量数量小于取样计量数量`);
-      //               return
-      //             }
-      //           }
-      //         }
-
-      //         if (unit === 'KG') {
-      //           let totalMaxPossible = 0;
-      //           this.selectedList.map(item => {
-      //           const maxPossible = item['measureQuantity'] / measureQ;
-      //           totalMaxPossible += maxPossible;});
-      //           if (totalMaxPossible < safePortion) {
-      //             this.formData.portion = totalMaxPossible;
-      //             return this.$message.info(`最大取样条数为${totalMaxPossible}`);
-      //           }
-      //           // 计算总重量
-      //           let totalWeight = this.selectedList.reduce((sum, item) => sum + item['weight'], 0);
-      //           let weightUnit = this.selectedList[0].weightUnit;
-      //           if (weightUnit === 'G') {
-      //             totalWeight = totalWeight / 1000
-      //           }
-      //           if (measureQ * safePortion > totalWeight) {
-      //             this.$message.info('取样计量重量不能大于总计量重量');
-      //             return
-      //           }
-      //           for (const item of this.selectedList) {
-      //             let weight = weightUnit === 'G' ? item.weight / 1000 : item.weight
-      //             if (weight < measureQ) {
-      //               this.$message.info(`勾选条目重量小于取样重量`);
-      //               return
-      //             }
-      //           }
-      //         }
-
-      //         this.getNewFullSampleList(Math.ceil(safePortion), measureQ, unit);
-      //         //抽检计重整样
-      //       } else if (this.baseForm.inspectionStandards === 2 && this.conditionType == 1) {
-      //         for (const item of this.selectedList) {
-      //           if (item['measureQuantity'] < safePortion) {
-      //             this.$message.info(`所选的条目计量数量小于取样计量数量`);
-      //             return
-      //           }
-      //         }
-      //         let list = [];
-      //         for (let i = 0; i < this.selectedList.length; i++) {
-      //           list.push({
-      //             ...this.selectedList[i],
-      //             measureQuantity: safePortion, //作为计量数量
-      //           });
-      //         }
-      //         this.updatePackingList(list);
-      //       }
-      //       this.activeName = '2'
-      //     }
-      //   });
-      // },
-
       //从来源数组取样到目标数组
       async getNewFullSampleList(
         sampleCount,
@@ -2328,59 +1915,11 @@
 
             console.log(measureQ, unit, nums, 'measureQ, unit, nums');
             this.getNewFullSampleList(nums, measureQ, unit);
-            // if (this.conditionType == 1) {
-            //   this.sampleList = this.selectedList
-            // } else {
-            //   let measureQ = this.formData.number;
-            //   let unit = this.formData.sampleUnit;
-            //   let nums = Number(this.formData.portion);
-            //
-            //   console.log(measureQ, unit, nums, 'measureQ, unit, nums')
-            //   this.getNewSampleList(measureQ, unit, nums)
-            // }
             this.activeName = '2';
           }
         });
       },
 
-      //更新计量数量、单位后重新生成样品列表数据
-      // async getNewSampleList(measureQ, unit, nums) {
-      //   this.sampleList = [];
-      //   if (!this.selectedList || this.selectedList.length == 0) {
-      //     this.$message.warning('请先选择样品!');
-      //     return;
-      //   }
-
-      //   if (!this.isCheck) {
-      //     let measureQuantity = 1;
-      //     if (this.conditionType == 2) {
-      //       measureQuantity = this.formData.number;
-      //     }
-      //     for (let i = 0; i < nums; i++) {
-      //       this.sampleList.push({
-      //         ...this.selectedList[0],
-      //         sampleCode: await this.getSampleCode(),
-      //         measureQuantity: measureQuantity,
-      //         measureUnit: unit,
-      //         weight: this.netWeight || 0
-      //       });
-      //     }
-      //   } else {
-      //     if (this.conditionType == 1) {
-      //       measureQ = 1;
-      //     }
-      //     for (let i = 0; i < this.selectedList.length; i++) {
-      //       this.sampleList.push({
-      //         ...this.selectedList[i],
-      //         sampleCode: await this.getSampleCode(),
-      //         measureQuantity: measureQ,
-      //         measureUnit: unit,
-      //         weight: this.netWeight || 0
-      //       });
-      //     }
-
-      //   }
-      // },
       //监听类型变化
       resetTable() {
         this.$nextTick(() => {
@@ -2516,14 +2055,6 @@
               : this.btnType == 'edit' && this.isSampleList
               ? this.newSampleList
               : this.sampleList;
-
-          // let params = {
-          //   ...this.baseForm,
-          //   qualityInventoryList: this.$refs.table12.getData(),
-          //   sampleList: this.sampleList,
-          //   planTemplateList: this.schemeList
-          // };
-
           let params = {
             ...this.baseForm,
             qualityInventoryList: qualityListData,
@@ -2570,18 +2101,6 @@
           }
           this.baseForm.conditionType =
             this.conditionType ?? this.kkconditionType;
-          // let params = {
-          //   ...this.baseForm,
-          //   qualityInventoryList: this.$refs.table12.getData(),
-          //   sampleList: this.sampleList,
-          //   planTemplateList: this.schemeList
-          // };
-          // const qualityListData =
-          //   this.btnType == 'add'
-          //     ? this.sourceList
-          //     : this.btnType == 'edit' && this.isPackingList
-          //     ? []
-          //     : this.sourceList;
           console.log(this.newSampleList, 'newSampleList');
           const qualityListData = this.sourceList;
           const sampleListData =
@@ -2590,13 +2109,6 @@
               : this.btnType == 'issued' && this.isSampleList
               ? this.newSampleList
               : this.sampleList;
-
-          // let params = {
-          //   ...this.baseForm,
-          //   qualityInventoryList: this.$refs.table12.getData(),
-          //   sampleList: this.sampleList,
-          //   planTemplateList: this.schemeList
-          // };
           let params = {
             ...this.baseForm,
             qualityInventoryList: qualityListData,
@@ -2709,29 +2221,6 @@
               this.sampleList = [];
             }
           }
-
-          // if (this.$refs.table12 && this.dimensionType) {
-          //   const listData = this.$refs.table12.getData();
-          //   console.log(listData, '成品检验订单数据');
-          //   this.changesStokledgerNumberModal(
-          //     listData,
-          //     this.dimensionType,
-          //     'type'
-          //   );
-          //   // if (this.dimensionType == 3) {
-          //   //   if (this.baseForm.qualityMode == '1') {
-          //   //     this.handleUnpackCase(val);
-          //   //   } else if (this.baseForm.qualityMode == '2') {
-          //   //     this.sampleList = [];
-          //   //   }
-          //   // } else {
-          //   //   if (this.baseForm.qualityMode == '1') {
-          //   //     this.handleUnpackCase(listData);
-          //   //   } else if (this.baseForm.qualityMode == '2') {
-          //   //     this.sampleList = [];
-          //   //   }
-          //   // }
-          // }
           return;
         }
         // 全检
@@ -2767,9 +2256,6 @@
           let specifications = this.packingSpecificationOption.find(
             (el) => el.id == this.formData.packingUnit
           );
-          // console.log(this.conditionType, this.baseForm.inspectionStandards);
-          // console.log(this.isStandard1OrWeightSample())
-          // console.log(this.isWeightStandardFullSample())
           try {
             if (this.isStandard1OrWeightSample()) {
               // 新增校验 数量  取整样 ***
@@ -2932,13 +2418,6 @@
       },
 
       validateSampleCount(sampleCount, specifications) {
-        // const invalidItem = this.selectedList.find(
-        //   (item) => item.measureQuantity < sampleCount
-        // );
-
-        // const totalNumber = this.sourceList.reduce((acc, pro) => {
-        //   return pro.measureQuantity ? acc + Number(pro.measureQuantity) : acc;
-        // }, 0);
         // 新增校验 ***
         let isFlag = this.validateSampleQuantity(sampleCount, specifications);
         if (!isFlag) {
@@ -2959,8 +2438,6 @@
       },
 
       async handleWeightFullSample(sampleCount, specifications) {
-        // console.log(sampleCount, 'sampleCount');
-        // console.log(this.selectedList, 'this.selectedList');
         let currentNum = sampleCount - this.selectedList.length;
         let currentNum1 = sampleCount;
         let list = [];
@@ -3007,29 +2484,10 @@
               }
             });
           }
-
-          // ...item,
-          // // measureQuantity: sampleCount,
-          // weight: item.singleWeight
-          //   ? (Number(item.singleWeight) * Number(sampleCount)).toFixed(2)
-          //   : item.outboundNum
-          //   ? (
-          //       (Number(item.weight) / Number(item.outboundNum)) *
-          //       Number(sampleCount)
-          //     ).toFixed(2)
-          //   : item.weight
-          // weight: item.singleWeight ? Number(item.singleWeight) : item.weight
         });
-        // if (this.selectedList.length > sampleCount) {
-        //   const newList = list.splice(0, sampleCount);
-        //   await this.updatePackingList(newList);
-        // } else {
-        //   await this.updatePackingList(list);
-        // }
         // 更改 从新计算 样品清单 取整样 数据
         if (specifications && specifications.id) {
           // let proportion = (obj.weight / obj.measureQuantity).toFixed(2);
-          console.log(list, 'dataList 这里是重量');
           console.log(specifications, 'specifications ===');
           list.map((el) => {
             el.measureQuantity =

+ 18 - 6
src/views/inspectionWork/components/baseInfo.vue

@@ -517,16 +517,28 @@
       },
       // *** 计算合格数 不合格数
       quantityCalculation(e) {
+        console.log('执行没有');
         let qualifiedNumber = this.form.qualifiedNumber - 0;
         let noQualifiedNumber = this.form.noQualifiedNumber - 0;
-        let total = qualifiedNumber + noQualifiedNumber;
-        if (total != this.form.total) {
-          let val =
-            e == 'qualifiedNumber' ? 'noQualifiedNumber' : 'qualifiedNumber';
-          this.$message.warning('合格数加上不合格数需要等于总数量');
+        let total = this.form.total - 0;
+        let val =
+          e == 'qualifiedNumber' ? 'noQualifiedNumber' : 'qualifiedNumber';
+        if (this.form[e] > this.form.total) {
           this.form[e] = this.form.total - this.form[val];
-          return false;
+          this.$message.warning('合格数与不合格数不能大于总数量');
+          return;
+        }
+
+        this.form[val] = this.form.total - this.form[e];
+
+        if (e == 'qualifiedNumber') {
+          noQualifiedNumber = total - this.form.qualifiedNumber;
+        }
+        if (e == 'noQualifiedNumber') {
+          qualifiedNumber = total - this.form.noQualifiedNumber;
         }
+        console.log(qualifiedNumber, 'qualifiedNumber');
+        console.log(noQualifiedNumber, 'noQualifiedNumber');
         let passRate = ((qualifiedNumber / total) * 100).toFixed(2);
         let failureRate = ((noQualifiedNumber / total) * 100).toFixed(2);
         this.form.qualificationRate = passRate + '%';

+ 2 - 1
src/views/inspectionWork/edit.vue

@@ -1391,6 +1391,8 @@
         this.activeName = '2';
         // *** 选完批量质检调用
         // this.countQualityResults();
+        console.log('质检没有 2')
+        this.$refs.baseInfoRefs.quantityCalculation('noQualifiedNumber');
       },
       // 批量质检
       batchQuality(index, row, type) {
@@ -1416,7 +1418,6 @@
             }
           });
         }
-
         this.$refs.detailRef.openDia(
           null,
           null,