From 06e5e9e9c7aabcb5c155b25f84e5de2c935b2137 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期一, 22 七月 2024 16:39:37 +0800
Subject: [PATCH] 新增数采检验功能

---
 static/js/worker.js |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/static/js/worker.js b/static/js/worker.js
index fcf7735..26ba16a 100644
--- a/static/js/worker.js
+++ b/static/js/worker.js
@@ -38,7 +38,6 @@
   let isToExponential = ''
   let list2 = []
   let isPoint = ''
-
   excelMethodList.forEach(item => {
     if (item.valueList&&item.valueList.length>0&&item.valueList.find(m => m.r == r && m.c == c)) {
       var comValue = {}
@@ -93,7 +92,7 @@
             // console.log(ask,res,item.v.f)
             if(ask){
               comp = ask.map((m, i) => {
-                console.log('m----', m)
+                // console.log('m----', m)
                 if (m.includes('RTS')) {
                   m = m.replace('RTS*', '')
                 }
@@ -116,9 +115,9 @@
                 } else if (m.includes('鈮�')) {
                   if(typeof res =='string'&&res.includes('/')){
                     if (m.includes('/')) {
-                      console.log('eval(res)----', eval(res))
+                      // console.log('eval(res)----', eval(res))
                       let str = handleFraction(m.split('鈮�')[1])
-                      console.log('eval(str)----', eval(str))
+                      // console.log('eval(str)----', eval(str))
                       return eval(res) >= eval(str)
                     } else {
                       return handleMoreParam(res,m.split('鈮�')[1],'鈮�')
@@ -254,6 +253,7 @@
             }
             // console.log(tableList)
           }
+          // console.log('1234567789', tableList,getParam())
           result = {
             method:'saveInsContext',
             value:{
@@ -272,7 +272,7 @@
         try {
           if(getInspectionValueType(item.i)==1){
             let tell = currentSample.insProduct.find(m => m.id == item.i).tell?currentSample.insProduct.find(m => m.id == item.i).tell.split('&'):null;
-            isPoint = tell[0].includes('/') // 鍒ゆ柇瑕佹眰鍊兼槸鍚︿负鍒嗘暟
+            isPoint = PROJECT=='瑁呭鐢电紗'&&tell&&tell.length>0&&typeof tell[0] =='string'&&tell[0].includes('/') // 鍒ゆ柇瑕佹眰鍊兼槸鍚︿负鍒嗘暟
             comResult = compute(item.v.f.replace(/=/g, ' '),comValue, isPoint)
             let list3 = list2.map(item=>item+'')
             isToExponential = list3.some(val => val.includes('e+'))
@@ -310,10 +310,13 @@
             if (a[0].r == item.r && comResult !== '') {
               for (var b in a) {
                 if (a[b].c == item.c) {
-                  console.log('comResult---', comResult)
                   try{
-                    let val = parseFloat(comResult.toFixed(3))
-                    a[b].v.v = isNaN(val) ? '' : val
+                    if(comResult==0){
+                      a[b].v.v = 0
+                    }else{
+                      let val = parseFloat(comResult.toFixed(3))
+                      a[b].v.v = isNaN(val) ? '' : val
+                    }
                   }catch(error){
                     a[b].v.v = comResult
                     console.log('error---', error)
@@ -430,7 +433,7 @@
   }
   tableList[0].arr.forEach(a => {
     a.forEach(b=>{
-      if (b.v.ps != undefined && b.v.ps.value === '妫�楠屽��') {
+      if (b.v.ps != undefined &&typeof b.v.ps.value =='string'&& b.v.ps.value.includes('妫�楠屽��')) {
         b.i &&b.v.v&& param[b.i].insValue.push(b)
       }
       if (b.v.ps != undefined && b.v.ps.value === '璁$畻鍊�') {
@@ -526,7 +529,7 @@
     let num = null;
     let arr = [];
     if(val&&val.length>0){
-      arr = val.filter(item=>item!=null&&item!=='')
+      arr = val.filter(item=>item!=null&&item!=''&&item!=undefined)
       arr.forEach(item=>{
         num+=item;
       })
@@ -607,8 +610,6 @@
     console.log('error---', error)
   }
 }
-
-
 
 /**
  * 鏍规嵁鍧愭爣鑾峰彇鍒楀悕
@@ -818,12 +819,13 @@
     if(str.includes(',,')){
       str = str.replace(new RegExp(',,', 'g'),'')
     }
+    // console.log('str', str)
     if(str.includes('&"/"&')){
       return str.replace(new RegExp('&"/"&', 'g'),'/').replace(new RegExp('//', 'g'),'')
-      return str.replaceAll('&"/"&', '/').replaceAll('//','')
     } else if (isPoint) {
       return str.replace('ABS', '').replace(/\(|\)/g, '')
     }else {
+      console.log('str', str,eval(str))
       return eval(str)
     }
   } catch (error) {

--
Gitblit v1.9.3