From 2b2310c50c0a45b2a8fe9964492ee3a96e0f465d Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期二, 22 四月 2025 09:46:45 +0800 Subject: [PATCH] 检验任务调整 --- src/workers/DataWorker.worker.js | 131 +++++++++++++++++++++---------------------- 1 files changed, 65 insertions(+), 66 deletions(-) diff --git a/src/workers/DataWorker.worker.js b/src/workers/DataWorker.worker.js index 1b24712..aaf032e 100644 --- a/src/workers/DataWorker.worker.js +++ b/src/workers/DataWorker.worker.js @@ -45,7 +45,7 @@ if (num == 1) { str = str + m.v.v + ","; num++; - } else { + } else if (num == 0) { str = m.v.v + ","; num++; } @@ -74,6 +74,11 @@ n.v.ps.value.includes("妫�楠屽��") ) { let arr = n.v.ps.value.split("鍊�"); + // console.log( + // `dataAcquisitionInfo[str].value`, + // dataAcquisitionInfo[str].value, + // str + // ); if (Array.isArray(dataAcquisitionInfo[str].value)) { // 濡傛灉鏁版嵁婧愪负鏁扮粍锛屽垯鎵ц for ( @@ -84,37 +89,34 @@ if (i + 1 == arr[1]) { // 璧嬪�兼暟閲囦紭鍖栨楠岄」鍒楄〃 arrSpecial.push(n.i); - setTimeout(() => { - let num0 = 0; - if ( - n.v.ct && - n.v.ct.fa && - typeof n.v.ct.fa == "string" && - n.v.ct.fa.includes(".") - ) { - // 淇濈暀妯℃澘閰嶇疆鐨勫皬鏁扮偣浣嶆暟 - let str0 = n.v.ct.fa.split(".")[1]; - num0 = str0.length; - n.v.v = dataAcquisitionInfo[str].value[i] - ? Number(dataAcquisitionInfo[str].value[i]).toFixed( - num0 - ) - : dataAcquisitionInfo[str].value[i]; - } else { - // 鐩存帴璧嬪�� - console.log(44444, dataAcquisitionInfo, str); - n.v.v = dataAcquisitionInfo[str].value[i]; - } - // 浼犻�掔粰涓荤嚎绋� - result = { - method: "changeInput", - value: { - list: list, - n: n, - }, - }; - self.postMessage(JSON.stringify(result)); - }, 2000); + let num0 = 0; + if ( + n.v.ct && + n.v.ct.fa && + typeof n.v.ct.fa == "string" && + n.v.ct.fa.includes(".") + ) { + // 淇濈暀妯℃澘閰嶇疆鐨勫皬鏁扮偣浣嶆暟 + let str0 = n.v.ct.fa.split(".")[1]; + num0 = str0.length; + n.v.v = dataAcquisitionInfo[str].value[i] + ? Number(dataAcquisitionInfo[str].value[i]).toFixed( + num0 + ) + : dataAcquisitionInfo[str].value[i]; + } else { + // 鐩存帴璧嬪�� + n.v.v = dataAcquisitionInfo[str].value[i]; + } + // 浼犻�掔粰涓荤嚎绋� + result = { + method: "changeInput", + value: { + list: list, + n: n, + }, + }; + self.postMessage(JSON.stringify(result)); } } } else { @@ -122,7 +124,36 @@ if (arr[1] == dataAcquisitionInfo[str].frequency) { // 濡傛灉鏁伴噰娆℃暟绛変簬妫�楠屽�煎簭鍙凤紝鍒欒祴鍊肩粰褰撳墠妫�楠屽�� arrSpecial.push(n.i); - setTimeout(() => { + let num0 = 0; + if ( + n.v.ct && + n.v.ct.fa && + typeof n.v.ct.fa == "string" && + n.v.ct.fa.includes(".") + ) { + // 淇濈暀妯℃澘閰嶇疆鐨勫皬鏁扮偣浣嶆暟 + let str0 = n.v.ct.fa.split(".")[1]; + num0 = str0.length; + n.v.v = dataAcquisitionInfo[str].value + ? Number(dataAcquisitionInfo[str].value).toFixed(num0) + : dataAcquisitionInfo[str].value; + } else { + // 鐩存帴璧嬪�� + n.v.v = dataAcquisitionInfo[str].value; + } + // 浼犻�掔粰涓荤嚎绋� + result = { + method: "changeInput", + value: { + list: list, + n: n, + }, + }; + self.postMessage(JSON.stringify(result)); + } else if (Number(dataAcquisitionInfo[str].frequency) > num) { + // 濡傛灉鏁伴噰娆℃暟澶т簬妫�楠屽�煎簭鍙凤紝鍒欒祴鍊肩粰鏈�鍚庝竴涓楠屽�� + if (n.v.ps.value.includes(num)) { + arrSpecial.push(n.i); let num0 = 0; if ( n.v.ct && @@ -138,6 +169,7 @@ : dataAcquisitionInfo[str].value; } else { // 鐩存帴璧嬪�� + console.log(555, dataAcquisitionInfo, str); n.v.v = dataAcquisitionInfo[str].value; } // 浼犻�掔粰涓荤嚎绋� @@ -149,39 +181,6 @@ }, }; self.postMessage(JSON.stringify(result)); - }, 2000); - } else if (Number(dataAcquisitionInfo[str].frequency) > num) { - // 濡傛灉鏁伴噰娆℃暟澶т簬妫�楠屽�煎簭鍙凤紝鍒欒祴鍊肩粰鏈�鍚庝竴涓楠屽�� - if (n.v.ps.value.includes(num)) { - arrSpecial.push(n.i); - setTimeout(() => { - let num0 = 0; - if ( - n.v.ct && - n.v.ct.fa && - typeof n.v.ct.fa == "string" && - n.v.ct.fa.includes(".") - ) { - // 淇濈暀妯℃澘閰嶇疆鐨勫皬鏁扮偣浣嶆暟 - let str0 = n.v.ct.fa.split(".")[1]; - num0 = str0.length; - n.v.v = dataAcquisitionInfo[str].value - ? Number(dataAcquisitionInfo[str].value).toFixed(num0) - : dataAcquisitionInfo[str].value; - } else { - // 鐩存帴璧嬪�� - n.v.v = dataAcquisitionInfo[str].value; - } - // 浼犻�掔粰涓荤嚎绋� - result = { - method: "changeInput", - value: { - list: list, - n: n, - }, - }; - self.postMessage(JSON.stringify(result)); - }, 2000); } } } -- Gitblit v1.9.3