From a80532b337571f0989b11cb9a5b7197f5b849ca7 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期六, 10 八月 2024 15:37:20 +0800
Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/center-lims-before into master
---
static/js/worker.js | 94 ++++++++++++++++++++++++++++++++++------------
1 files changed, 69 insertions(+), 25 deletions(-)
diff --git a/static/js/worker.js b/static/js/worker.js
index 24bb42f..e9efd59 100644
--- a/static/js/worker.js
+++ b/static/js/worker.js
@@ -5,14 +5,37 @@
let comparisonList = []
let currentSample = {}
let PROJECT = ''
+let bushing = ''
let result = {
method:'',
value:null
}
let param = null
+let currentTable = ''
+let getDataTypeId = null
self.onmessage = function(event) {
const data = JSON.parse(event.data);
+ if(currentTable!=data.currentTable){
+ tableList = data.tableList;
+ }
+ currentTable = data.currentTable;
+ if(data.type&&data.type=='saveData'){
+ tableList = data.tableList;
+ param = data.param;
+ return
+ }
+ if(data.bushing&&(data.bushing!=bushing)&&data.type=='saveData'){
+ tableList = data.tableList;
+ param = data.param;
+ bushing = data.bushing;
+ return
+ }
code = data.code;
+ if(data.getDataTypeId){
+ getDataTypeId = data.getDataTypeId
+ }else{
+ getDataTypeId = null
+ }
if(tableList){
let str = code.split('-')
let r = str[1]
@@ -96,8 +119,7 @@
let ask = currentSample.insProduct.find(m => m.id == item.i).ask?currentSample.insProduct.find(m => m.id == item.i).ask.split('&'):null;
let res = Object.values(comValue)[0]
let comp = []
-
- if(res==''||res==null||res==undefined||res=='Infinity'){
+ if(res===''||res===null||res===undefined||res==='Infinity'){
item.v.v = null
list.forEach(a => {
if (a[0].r == item.r) {
@@ -157,6 +179,7 @@
}
}else{
let str = handleFraction(m.split('鈮�')[1])
+ console.log(555555,res,str)
return eval(res) <= eval(str)
}
}else if (m.includes('<')) {
@@ -272,14 +295,20 @@
}
})
}
- // console.log(tableList)
+ // console.log(5555,tableList)
}
// console.log('1234567789', tableList,getParam())
+ // console.log('1234567789', item)
+ let getDataType0 = false
+ if(item.i==getDataTypeId){
+ getDataType0 = true
+ }
result = {
method:'saveInsContext',
value:{
tableList,
- param:getParam()
+ param:getParam(),
+ getDataTypeId:getDataType0?getDataTypeId:''
}
}
self.postMessage(JSON.stringify(result))
@@ -334,10 +363,17 @@
try{
if(comResult==0){
a[b].v.v = 0
+ }else if(a[b].v.ct&&a[b].v.ct.fa&&typeof a[b].v.ct.fa == 'string'&&a[b].v.ct.fa.includes('.')){
+ let num = 0
+ let str = a[b].v.ct.fa.split('.')[1]
+ num = str.length
+ a[b].v.v = comResult?Number(comResult).toFixed(num):comResult
}else{
- let val = parseFloat(comResult.toFixed(3))
- a[b].v.v = isNaN(val) ? '' : val
+ let val = parseFloat(Number(comResult).toFixed(3))
+ a[b].v.v = isNaN(val) ? comResult : val
}
+ // console.log('a[b].v.ct', comResult)
+ // console.log('a[b].v.v', a[b])
}catch(error){
a[b].v.v = comResult
console.log('error---', error)
@@ -444,33 +480,41 @@
* @returns 杩斿洖澶勭悊鍚庣殑鍙傛暟瀵硅薄
*/
function getParam(){
- for (var b in param){
- param[b].insValue = []
- param[b].comValue = []
- param[b].equipValue = []
- param[b].equipName = []
- param[b].resValue = null
- param[b].insResult = null
- }
+ tableList[0].arr.forEach(a=>{
+ a.forEach(b=>{
+ if(param[b.i]){
+ param[b.i].insValue = []
+ param[b.i].comValue = []
+ param[b.i].equipValue = []
+ param[b.i].equipName = []
+ param[b.i].resValue = null
+ param[b.i].insResult = null
+ }
+ })
+ })
tableList[0].arr.forEach(a => {
a.forEach(b=>{
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 === '璁$畻鍊�') {
- b.i &&b.v.v&& param[b.i].comValue.push(b)
+ b.i &&b.v.v&&b.valueList&&b.valueList.length>0&& param[b.i].comValue.push(b)
}
if (b.v.ps != undefined && b.v.ps.value === '璁惧缂栫爜') {
- b.i &&b.v.v&& param[b.i].equipValue.push(b)
+ b.i &&b.v&& param[b.i].equipValue.push(b)
}
if (b.v.ps != undefined && b.v.ps.value === '璁惧鍚嶇О') {
- b.i &&b.v.v&& param[b.i].equipName.push(b)
+ b.i &&b.v&& param[b.i].equipName.push(b)
}
if (b.v.ps != undefined && b.v.ps.value === '鏈�缁堝��') {
- b.i &&b.v.v&& (param[b.i].resValue = b)
+ b.i &&b.v&&b.valueList&&b.valueList.length>0&& (param[b.i].resValue = b)
}
if (b.v.ps != undefined && b.v.ps.value === '缁撹') {
- b.i &&(b.v.v||b.v.v===0||b.v.v==='0')&& (param[b.i].insResult = b)
+ if(b.i &&(b.v.v||b.v.v===0||b.v.v==='0')){
+ if(b.v.v != '鍚堟牸'&&b.v.v != '涓嶅悎鏍�'){
+ param[b.i].insResult = b
+ }
+ }
}
})
})
@@ -487,7 +531,7 @@
function SUM(...val){
try {
let num = null;
- if(val&&val.length>0){
+ if(val!=null&&val!=undefined&&val!='undefined'&&val!='NaN'&&val.length>0){
val.forEach(item=>{
num+=item;
})
@@ -506,7 +550,7 @@
function MAX(...val){
try {
let max = null;
- if(val&&val.length>0){
+ if(val!=null&&val!=undefined&&val!='undefined'&&val!='NaN'&&val.length>0){
val = val.filter(item=>item!=null&&item!=='')
if(val.length>0){
max = Math.max(...val)
@@ -528,7 +572,7 @@
function MIN(...val){
try {
let min = null;
- if(val&&val.length>0){
+ if(val!=null&&val!=undefined&&val!='undefined'&&val!='NaN'&&val.length>0){
val = val.filter(item=>item!=null&&item!=='')
if(val.length>0){
min = Math.min(...val)
@@ -549,8 +593,8 @@
try {
let num = null;
let arr = [];
- if(val&&val.length>0){
- arr = val.filter(item=>item!=null&&item!=''&&item!=undefined)
+ if(val!=null&&val!=undefined&&val!='undefined'&&val!='NaN'&&val.length>0){
+ arr = val.filter(item=>item!==null&&item!==''&&item!=undefined)
arr.forEach(item=>{
num+=item;
})
@@ -852,7 +896,7 @@
} else if (isPoint) {
return str.replace('ABS', '').replace(/\(|\)/g, '')
}else {
- console.log('str', str,eval(str))
+ console.log('str', str)
return eval(str)
}
} catch (error) {
--
Gitblit v1.9.3