浏览代码

修改计量取值判断

695593266@qq.com 11 月之前
父节点
当前提交
3069fffdea
共有 1 个文件被更改,包括 10 次插入3 次删除
  1. 10 3
      src/views/inspectionWork/edit.vue

+ 10 - 3
src/views/inspectionWork/edit.vue

@@ -587,6 +587,7 @@
               return; //取样数量验证
             if (unit === 'KG' && !this.validateWeight(measureQ, sampleCount))
               return; // 若计量单位为重量,还需验证总重量是否足够
+            console.log(1111111111111);
 
             await this.getNewFullSampleList(
               Math.ceil(sampleCount),
@@ -596,7 +597,7 @@
           } else if (this.isWeightStandardFullSample()) {
             //抽检取计重取整样
             if (!this.validateSampleCount(sampleCount)) return;
-
+            console.log(222222222222222222);
             await this.handleWeightFullSample(sampleCount);
           }
           this.activeName = '2';
@@ -1254,18 +1255,24 @@
       },
 
       async handleWeightFullSample(sampleCount) {
+        const dataList = [];
         for (const item of this.selectedList) {
           const qualitySampleTemplateList = item.qualitySampleTemplateList
             ?.length
             ? JSON.parse(JSON.stringify(item.qualitySampleTemplateList))
             : JSON.parse(JSON.stringify(this.schemeList));
-          this.sampleList.push({
+          dataList.push({
             ...item,
-            measureQuantity: sampleCount, //作为计量数量
+            // measureQuantity: sampleCount, //作为计量数量
             sampleCode: await this.getSampleCode(),
             qualitySampleTemplateList
           });
         }
+        if (dataList.length > sampleCount) {
+          this.sampleList = dataList.splice(0, sampleCount);
+        } else {
+          this.sampleList = dataList;
+        }
         this.sampleNumber = this.sampleList.length;
       },