From 82e5335ce391e116a8aab48097e7efb76ce35007 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期五, 26 七月 2024 12:40:53 +0800
Subject: [PATCH] 解决j数采多个项目时数据回显不完的问题

---
 src/components/do/b1-inspect-order-plan/Inspection.vue |  122 ++++++++++++++++++++++++----------------
 1 files changed, 73 insertions(+), 49 deletions(-)

diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue
index 498b892..d10c9a0 100644
--- a/src/components/do/b1-inspect-order-plan/Inspection.vue
+++ b/src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -940,6 +940,7 @@
         },
         result: null,
         worker: null,
+        worker0: null,
         wareLength:[],
         dataAcquisitionInfo:{},
         dataAcquisitionEidt:0,
@@ -1124,69 +1125,92 @@
             return
           }
           this.dataAcquisitionInfo = res.data
-          let list = this.tableList[0].arr
-          list.forEach((item,index)=>{
-            let num = 0;
-            let str = ''
-            item.forEach(m=>{
-              if(m.v.ps&&(m.v.ps.value=='妫�楠屽瓙椤�'||m.v.ps.value=='妫�楠岄」')){
-                if(m.v.ps&&m.v.ps.value=='妫�楠岄」'){
-                  if(num==0){
-                    str = m.v.v+','
-                    num++
-                  }
-                }
-                if(m.v.ps&&m.v.ps.value=='妫�楠屽瓙椤�'){
-                  if(num==1){
-                    str = str+m.v.v
-                  }
-                }
-                if(this.dataAcquisitionInfo[str]){
-                  let num = 0;
-                  list[index].forEach(n=>{
-                    if(n.v.ps&&n.v.ps.value&&typeof n.v.ps.value == 'string'&&n.v.ps.value.includes('妫�楠屽��')){
-                      num++
-                    }
-                  })
-                  list[index].forEach((n,i)=>{
-                    if(n.v.ps&&n.v.ps.value&&typeof n.v.ps.value == 'string'&&n.v.ps.value.includes('妫�楠屽��')){
-                      let arr = n.v.ps.value.split('鍊�')
-                      if(arr[1] ==this.dataAcquisitionInfo.frequency){
-                        setTimeout(()=>{
-                          this.$delete(n.v,'v')
-                          this.$set(n.v,'v',this.dataAcquisitionInfo[str])
-                          this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n)
-                        },1000)
-                      }else if(Number(this.dataAcquisitionInfo.frequency)>num){
-                        if(n.v.ps.value.includes(num)){
-                          setTimeout(()=>{
-                            this.$delete(n.v,'v')
-                            this.$set(n.v,'v',this.dataAcquisitionInfo[str])
-                            this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n)
-                          },1000)
-                        }
-                      }
-                    }
-                  })
-                }
-              }
-            })
-          })
+          // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫
+          this.worker0.postMessage(JSON.stringify({
+            dataAcquisitionInfo: this.dataAcquisitionInfo,
+            list:this.tableList[0].arr
+          }));
+          // 鐩戝惉 Worker 杩斿洖鐨勭粨鏋�
+          this.worker0.onmessage = (event) => {
+            let result = JSON.parse(event.data);
+            if(result.method=='changeInput'){
+              let {list,n} = result.value
+              this.$set(this.tableList[0],'arr',list)
+              this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n)
+            }
+          };
+          // let list = this.tableList[0].arr
+          // list.forEach((item,index)=>{
+          //   let num = 0;
+          //   let str = ''
+          //   item.forEach(m=>{
+          //     if(m.v.ps&&(m.v.ps.value=='妫�楠屽瓙椤�'||m.v.ps.value=='妫�楠岄」')){
+          //       if(m.v.ps&&m.v.ps.value=='妫�楠岄」'){
+          //         if(num==0){
+          //           str = m.v.v+','
+          //           num++
+          //         }
+          //       }
+          //       if(m.v.ps&&m.v.ps.value=='妫�楠屽瓙椤�'){
+          //         if(num==1){
+          //           str = str+m.v.v
+          //         }
+          //       }
+          //       if(this.dataAcquisitionInfo[str]){
+          //         let num = 0;
+          //         list[index].forEach(n=>{
+          //           if(n.v.ps&&n.v.ps.value&&typeof n.v.ps.value == 'string'&&n.v.ps.value.includes('妫�楠屽��')){
+          //             num++
+          //           }
+          //         })
+          //         list[index].forEach((n,i)=>{
+          //           if(n.v.ps&&n.v.ps.value&&typeof n.v.ps.value == 'string'&&n.v.ps.value.includes('妫�楠屽��')){
+          //             let arr = n.v.ps.value.split('鍊�')
+          //             if(arr[1] ==this.dataAcquisitionInfo.frequency){
+          //               setTimeout(()=>{
+          //                 this.$delete(n.v,'v')
+          //                 this.$set(n.v,'v',this.dataAcquisitionInfo[str])
+          //                 this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n)
+          //               },1000)
+          //             }else if(Number(this.dataAcquisitionInfo.frequency)>num){
+          //               if(n.v.ps.value.includes(num)){
+          //                 setTimeout(()=>{
+          //                   this.$delete(n.v,'v')
+          //                   this.$set(n.v,'v',this.dataAcquisitionInfo[str])
+          //                   this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n)
+          //                 },1000)
+          //               }
+          //             }
+          //           }
+          //         })
+          //       }
+          //     }
+          //   })
+          // })
         })
       },
       // 澶氱嚎绋�
       startWorker() {
-      if (this.worker) {
+        if (this.worker) {
         this.stopWorker(); // 纭繚涔嬪墠鐨� Worker 宸插仠姝�
         }
         // 鍒涘缓 Worker 瀹炰緥
         this.worker = new Worker('/static/js/worker.js');
+        if (this.worker0) {
+        this.stopWorker(); // 纭繚涔嬪墠鐨� Worker 宸插仠姝�
+        }
+        // 鍒涘缓 Worker 瀹炰緥
+        this.worker0 = new Worker('/static/js/worker0.js');
       },
       stopWorker() {
         if (this.worker) {
           this.worker.terminate();
           this.worker = null;
         }
+        if (this.worker0) {
+          this.worker0.terminate();
+          this.worker0 = null;
+        }
       },
       // 娓╁害寰幆---寮�濮�
       changeItem(row){

--
Gitblit v1.9.3