From 69eba97000521c196532a2c470632230cd5e5928 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期四, 11 七月 2024 18:05:47 +0800 Subject: [PATCH] 修改win7不兼容 --- static/js/worker.js | 67 +++++++++++++++++---------------- 1 files changed, 35 insertions(+), 32 deletions(-) diff --git a/static/js/worker.js b/static/js/worker.js index 76eb25b..a09aa41 100644 --- a/static/js/worker.js +++ b/static/js/worker.js @@ -37,9 +37,8 @@ } let isToExponential = '' let list2 = [] - excelMethodList.forEach(item => { - if (item.valueList.find(m => m.r == r && m.c == c)) { + if (item.valueList&&item.valueList.length>0&&item.valueList.find(m => m.r == r && m.c == c)) { var comValue = {} item.valueList.forEach(a => { list.forEach(b => { @@ -54,7 +53,6 @@ } } list2.push(c.v.v) - isToExponential = list2.some(val => val.includes('e+')) if(getInspectionValueType(item.i)==1&&!isNaN(parseFloat(c.v.v))){ let n = String(c.v.v) if(n.includes('/')){ @@ -102,7 +100,8 @@ if(res.includes('/')){ return handleMoreParam(res,m.split('=')[1],'=') }else{ - return res.trim() == str.trim() + // console.log(res.trim().replace(/[.,銆傘�侊紱锛�'";?锛熲�滐紝]/g, ''),' == ',str.trim().replace(/[.,銆傘�侊紱锛�'";?锛熲�滐紝]/g, '')) + return res.trim().replace(/[.,銆傘�侊紱锛�'";?锛熲�滐紝]/g, '') == str.trim().replace(/[.,銆傘�侊紱锛�'";?锛熲�滐紝]/g, '') } }else{ return eval(res) == eval(str) @@ -187,7 +186,6 @@ } }) } else { - console.log(333333) item.v.v = 0 list.forEach(a => { if (a[0].r == item.r) { @@ -200,6 +198,7 @@ } }) } + console.log(tableList) } result = { method:'saveInsContext', @@ -211,18 +210,20 @@ self.postMessage(JSON.stringify(result)) } } catch (error) { - + console.log('error---', error) } } else { let comResult = '' try { if(getInspectionValueType(item.i)==1){ - let ask = currentSample.insProduct.find(m => m.id == item.i).ask?currentSample.insProduct.find(m => m.id == item.i).ask.split('&'):null; - let tell = currentSample.insProduct.find(m => m.id == item.i).tell?currentSample.insProduct.find(m => m.id == item.i).tell.split('&'):null; + // let ask = currentSample.insProduct.find(m => m.id == item.i).ask?currentSample.insProduct.find(m => m.id == item.i).ask.split('&'):null; + // let tell = currentSample.insProduct.find(m => m.id == item.i).tell?currentSample.insProduct.find(m => m.id == item.i).tell.split('&'):null; comResult = compute(item.v.f.replace(/=/g, ' '),comValue) + let list3 = list2.map(item=>item+'') + isToExponential = list3.some(val => val.includes('e+')) // 瑁呭椤圭洰妫�楠屽�艰浆鍖� - if (PROJECT === '瑁呭鐢电紗' && isToExponential === true) { + if (PROJECT === '瑁呭鐢电紗' && isToExponential) { let num2 = new Big(comResult) comResult = num2.toExponential() } @@ -248,6 +249,7 @@ comResult = str } } catch (error) { + console.log('error---', error) } try { list.forEach(a => { @@ -257,8 +259,9 @@ try{ let val = parseFloat(comResult.toFixed(3)) a[b].v.v = isNaN(val) ? '' : val - }catch(e){ + }catch(error){ a[b].v.v = comResult + console.log('error---', error) } break } @@ -267,7 +270,7 @@ }) changeInput(comResult, `${id}-${item.r}-${item.c}-${pId}`) //鏀瑰彉鏈�缁堝�� } catch (error) { - + console.log('error---', error) } } } @@ -284,7 +287,7 @@ } self.postMessage(JSON.stringify(result)) } catch (error) { - + console.log('error---', error) } } @@ -412,7 +415,7 @@ } return num; } catch (error) { - + console.log('error---', error) } } /** @@ -434,7 +437,7 @@ } return max; } catch (error) { - + console.log('error---', error) } } /** @@ -454,7 +457,7 @@ } return min; } catch (error) { - + console.log('error---', error) } } /** @@ -481,7 +484,7 @@ return null; } } catch (error) { - + console.log('error---', error) } } /** @@ -494,7 +497,7 @@ try { return Math.abs(val); } catch (error) { - + console.log('error---', error) } } /** @@ -525,7 +528,7 @@ return null; } } catch (error) { - + console.log('error---', error) } } @@ -546,7 +549,7 @@ } } } catch (error) { - + console.log('error---', error) } } @@ -572,7 +575,7 @@ letter += String.fromCharCode(65 + (i % 26)); return letter + (parseInt(cellId[1]) + 1); }catch(e){ - console.log('error',cellId) + console.log('error',e) } } /** @@ -614,7 +617,7 @@ } return id; }catch(e){ - console.log('error',id) + console.log('error',e) } } @@ -648,7 +651,7 @@ }) return arr2; } catch (error) { - + console.log('error',error) } } /** @@ -667,16 +670,16 @@ 'AVERAGE', 'ABS', ] - f = f.replace(regex, ',').replaceAll('"&','').replaceAll('&"','') + f = f.replace(regex, ',').replace(new RegExp('"&', 'g'),'').replace(new RegExp('&"', 'g'),'') fouList.forEach(item=>{ - f = f.replaceAll(item,',') + f = f.replace(new RegExp(item, 'g'),',') }) let arr = f.split(',').filter(item=>{ return item&& /[a-zA-Z]/.test(item)&&item!='undefined'&&item!='null' }); return arr; } catch (error) { - + console.log('error',error) } } /** @@ -694,7 +697,7 @@ }) return arr0; } catch (error) { - + console.log('error',error) } } @@ -748,25 +751,25 @@ obj[item] = item } }) - str = str.replaceAll(':', '-') + str = str.replace(new RegExp(':', 'g'),'-') // 鏇挎崲鍙傛暟 for (var a in obj) { - str = str.replaceAll(a, obj[a]) + str = str.replace(new RegExp(a, 'g'),obj[a]) } // 璁$畻 for (var a in arr) { - str = str.replaceAll(a, arr[a]) + str = str.replace(new RegExp(a, 'g'),arr[a]) } if(str.includes(',,')){ - str = str.replaceAll(',,', '') + str = str.replace(new RegExp(',,', 'g'),'') } if(str.includes('&"/"&')){ - return str.replaceAll('&"/"&', '/').replaceAll('//','') + return str.replace(new RegExp('&"/"&', 'g'),'/').replace(new RegExp('//', 'g'),'') }else { return eval(str) } } catch (error) { - + console.log('error',error) } } -- Gitblit v1.9.3