licp
2024-07-11 ef1b406e8112c097d70deb0e23fc9cec1c9a535f
static/js/worker.js
@@ -71,10 +71,20 @@
          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'){
            item.v.v = ''
            item.v.v = null
            list.forEach(a => {
              if (a[0].r == item.r) {
                for (let  b=0; b<a.length; b++) {
                  if (a[b].c == item.c) {
                    a[b].v.v = null
                    break
                  }
                }
              }
            })
          }else{
            console.log(ask,res,item.v.f)
            if(ask){
              comp = ask.map((m, i) => {
                if (m.includes('RTS')) {
@@ -131,7 +141,6 @@
                    return handleMoreParam(res,m,'-')
                  }else{
                    let k = m.split('-')
                    console.log(k,eval(res),eval(res) >= eval(handleFraction(k[0])) && eval(res) <= eval(handleFraction(k[1])))
                    return  eval(res) >= eval(handleFraction(k[0])) && eval(res) <= eval(handleFraction(k[1]))
                  }
                }else if(m.includes('±')){
@@ -203,7 +212,6 @@
          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;
            comResult = compute(item.v.f.replace(/=/g, ' '),comValue)
            console.log(1111,comResult)
            // 装备项目检验值转化
            if (PROJECT === '装备电缆' && ask[0].includes('RTS')) {
              let num2 = new Big(comResult)
@@ -299,10 +307,17 @@
  }
}
/**
 * 处理带有多个参数的函数
 *
 * @param res 字符串,需要被分割并处理的字符串
 * @param str 字符串,与res中的每一项进行比较的字符串,可能是分数或者带有比较符号的字符串
 * @param comp 字符串,表示比较类型的字符(如 '>'、'<'、'='、'≥'、'≤'、'±'、'~'、'-')
 * @returns 返回布尔值,如果res中每一项都满足与str的比较条件,则返回true,否则返回false
 */
function handleMoreParam(res,str,comp){
  let arr = res.split('/')
  let arr0 = arr.every(item=>{
    console.log(comp)
    switch (comp){
      case '>':
        return item > handleFraction(str)
@@ -332,6 +347,11 @@
  }
}
/**
 * 获取参数
 *
 * @returns 返回处理后的参数对象
 */
function getParam(){
  for (var b in param){
    param[b].insValue = []
@@ -669,6 +689,7 @@
  }
}
/**
 * 计算函数
 *
@@ -686,8 +707,6 @@
        if(typeof(comValue[a])=='string'&&comValue[a].includes('^')){
          // 计算幂次
          arr[a] = CalculatePower(comValue[a])
        } else if (typeof(comValue[a])=='string'&&comValue[a].includes('/')) {
          arr[a] = comValue[a].split('/')[0] / comValue[a].split('/')[1];
        } else{
          arr[a] = comValue[a]
        }
@@ -734,6 +753,8 @@
    }
    if(str.includes('&"/"&')){
      return str.replaceAll('&"/"&', '/').replaceAll('//','')
    }else if(str.includes('/')){
      return str
    }else{
      return eval(str)
    }