licp
2024-08-20 6f30bbf4f118d3357d1e6e503aa986227e2cc6ea
static/js/worker.js
@@ -1,30 +1,45 @@
// 多线程里面需要保存的数据
let code = ''
// 表格数据(渲染)
let tableList = null
// 方法列表
let excelMethodList = []
// excel坐标比较列表
let comparisonList = []
// 当前样品信息
let currentSample = {}
// 当前项目:检测中心、装备电缆
let PROJECT = ''
// 套管
let bushing = ''
// 多线程传递到主线程的数据
let result = {
  method:'',
  value:null
}
// 保存时传到后端参数
let param = null
// 当前的模板
let currentTable = ''
// 优化数采较多数据时-记录最后一个检验项的id
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;
@@ -32,11 +47,13 @@
  }
  code = data.code;
  if(data.getDataTypeId){
    // 记录 优化数采较多数据时-记录最后一个检验项的id
    getDataTypeId = data.getDataTypeId
  }else{
    getDataTypeId = null
  }
  if(tableList){
    // 如果表格数据存在,则更新当前修改检验项的表格数据
    let str = code.split('-')
    let r = str[1]
    let c = str[2]
@@ -48,48 +65,56 @@
      })
    })
  }else{
    // 如果初始化表格数据不存在,直接赋值
    tableList = data.tableList;
  }
  if(param){
    // 如果传递到后端的参数存在,则更新当前修改检验项的传递到后端的参数
    let str = code.split('-')
    let pId = str[3]
    param[pId] = data.param[pId]
  }else{
    // 初始化传递到后端的参数
    param = data.param;
  }
  // tableList = data.tableList;
  // param = data.param;
  // 更新方法列表、坐标比较列表、当前样品信息、项目
  excelMethodList = JSON.parse(JSON.stringify(data.excelMethodList));
  comparisonList = JSON.parse(JSON.stringify(data.comparisonList));
  currentSample = JSON.parse(JSON.stringify(data.currentSample));
  PROJECT = data.PROJECT
  // 执行计算方法
  changeInput('', code);
};
function changeInput(m, code){
  let str = code.split('-')
  let r = str[1]
  let c = str[2]
  let r = str[1]//当前行
  let c = str[2]//当前列
  let id = str[0]
  let pId = str[3]
  var list = []
  let pId = str[3]//当前检验项id,param[pId]为当前检验项的所有值,包含:过程值insValue、计算值comValue、设备编码equipValue、设备名称equipName、最终值resValue、结论insResult
  var list = []//一个双层数组,里面保存有当前页面渲染的所有数据
  // 赋值当前模板的表格数据
  for (let a in tableList) {
    if (tableList[a].templateId == id) {
      list = tableList[a].arr
      break
    }
  }
  let isToExponential = ''
  let list2 = []
  let isPoint = ''
  let isToExponential = ''//是否为科学计数法
  let list2 = [] //一个数组,里面保存有当前检验项的所有参数值
  let isPoint = '' //是否为小数点
  // 循环所有excel方法,找到当前行、列的检验项,如果此单元格(r,c)是某个excel方法里面的参数,则执行此方法
  excelMethodList.forEach(item => {
    // item.valueList  是当前excel方法的参数列表,找到当前填入的值是否是参数
    if (item.valueList&&item.valueList.length>0&&item.valueList.find(m => m.r == r && m.c == c)) {
      // 如果是,则定义一个参数的对象集合,用于保存当前excel方法参数的值
      var comValue = {}
      item.valueList.forEach(a => {
        list.forEach(b => {
          if (b[0].r == a.r) {
            b.forEach(c => {
              if (c.c == a.c) {
                // 获取当前参数的Execl行坐标(ABCD)等等
                var tableCode = ''
                for (var d in comparisonList) {
                  if (c.c == comparisonList[d].value) {
@@ -98,14 +123,18 @@
                  }
                }
                list2.push(c.v.v)
                // 组装参数的对象集合并赋值,列如{A3:12,B4:15}
                if(getInspectionValueType(item.i)==1&&!isNaN(parseFloat(c.v.v))){
                  // 如果是数字输入框
                  let n = String(c.v.v)
                  if(n.includes('/')){
                    // 如果是分数,则赋值
                    comValue[(tableCode + (c.r + 1))] = c.v.v
                  }else{
                    comValue[(tableCode + (c.r + 1))] = parseFloat(c.v.v)
                  }
                }else{
                  // 如果是文本、下拉框等等
                  comValue[(tableCode + (c.r + 1))] = c.v.v
                }
              }
@@ -113,12 +142,16 @@
          }
        })
      })
      // 如果此excel方法是结论判断方法,则执行此方法
      if (item.v.ps != undefined && item.v.ps.value == '结论') {
        try {
          if (currentSample.insProduct.find(m => m.id == item.i)) {
            // 如果当前检验项是产品检验项,则执行此方法,找到此检验项的要求值
          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 = null
            list.forEach(a => {
@@ -132,185 +165,209 @@
              }
            })
          }else{
            // console.log(ask,res,item.v.f)
            if(ask){
              comp = ask.map((m, i) => {
                // console.log('m----', m)
                if (m.includes('RTS')) {
                  m = m.replace('RTS*', '')
            // 如果不为空,则判断当前结论就需要进行判断
            //要求值为-,/,—,则结论设置为不判定,结论赋值为3
            if(ask[0]=='-' || ask[0]=='/' || ask[0]=='—'){
              item.v.v = 3
              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 = 3
                      break
                    }
                  }
                }
                if (m.includes('=')) {
                  let str = handleFraction(m.split('=')[1])
                  if(typeof res == 'string'&&typeof str == 'string'){
                    if(res.includes('/')){
                      if (m.includes('/')) {
                        return  eval(res) == eval(str)
                      } else {
                        return handleMoreParam(res,m.split('=')[1],'=')
              })
            }else{
              // 要求值不为-,/,—,则进行判断
              if(ask){
                // 循环要求值列表,判断当前结论的参数是否符合要求
                comp = ask.map((m, i) => {
                  // 装备特有的判断方法(需要科学计数法的),要求值进行替换
                  if (m.includes('RTS')) {
                    m = m.replace('RTS*', '')
                  }
                  // 如果要求值包含=,则判断当前结论的参数是否等于要求值,
                  // 以下判断基本一致,只是判断类型不一样,就不做注释了
                  if (m.includes('=')) {
                    // 处理要求值
                    let str = handleFraction(m.split('=')[1])
                    if(typeof res == 'string'&&typeof str == 'string'){
                      // 如果要求值和当前结论的参数都是字符串,则执行
                      if(res.includes('/')){
                        // 如果结论的参数是分数,则判断
                        if (m.includes('/')) {
                          // 如果要求值是分数,则判断
                          return  eval(res) == eval(str)
                        } else {
                          // 如果要求值不是分数,则判断
                          return handleMoreParam(res,m.split('=')[1],'=')
                        }
                      }else{
                        // 如果结论的参数不是分数,则判断
                        return  res.trim().replace(/[.,。、;:'";??“,]/g, '') == str.trim().replace(/[.,。、;:'";??“,]/g, '')
                      }
                    }else{
                      // console.log(res.trim().replace(/[.,。、;:'";??“,]/g, ''),' == ',str.trim().replace(/[.,。、;:'";??“,]/g, ''))
                      return  res.trim().replace(/[.,。、;:'";??“,]/g, '') == str.trim().replace(/[.,。、;:'";??“,]/g, '')
                      // 如果要求值和当前结论的参数有一个是数字,则执行
                      return  eval(res) == eval(str)
                    }
                  }else{
                    return  eval(res) == eval(str)
                  }
                } else if (m.includes('≥')) {
                  if(typeof res =='string'&&res.includes('/')){
                    if (m.includes('/')) {
                      // console.log('eval(res)----', eval(res))
                  } else if (m.includes('≥')) {
                    if(typeof res =='string'&&res.includes('/')){
                      if (m.includes('/')) {
                        let str = handleFraction(m.split('≥')[1])
                        return eval(res) >= eval(str)
                      } else {
                        return handleMoreParam(res,m.split('≥')[1],'≥')
                      }
                    }else{
                      let str = handleFraction(m.split('≥')[1])
                      // console.log('eval(str)----', eval(str))
                      return eval(res) >= eval(str)
                    } else {
                      return handleMoreParam(res,m.split('≥')[1],'≥')
                    }
                  }else{
                    let str = handleFraction(m.split('≥')[1])
                    return eval(res) >= eval(str)
                  }
                }else if (m.includes('≤')) {
                  if(typeof res =='string'&&res.includes('/')){
                    if (m.includes('/')) {
                  }else if (m.includes('≤')) {
                    if(typeof res =='string'&&res.includes('/')){
                      if (m.includes('/')) {
                        let str = handleFraction(m.split('≤')[1])
                        return eval(res) <= eval(str)
                      } else {
                        return handleMoreParam(res,m.split('≤')[1],'≤')
                      }
                    }else{
                      let str = handleFraction(m.split('≤')[1])
                      return eval(res) <= eval(str)
                    } else {
                      return handleMoreParam(res,m.split('≤')[1],'≤')
                    }
                  }else{
                    let str = handleFraction(m.split('≤')[1])
                    console.log(555555,res,str)
                    return eval(res) <= eval(str)
                  }
                }else if (m.includes('<')) {
                  if(typeof res =='string'&&res.includes('/')){
                    if (m.includes('/')) {
                  }else if (m.includes('<')) {
                    if(typeof res =='string'&&res.includes('/')){
                      if (m.includes('/')) {
                        let str = handleFraction(m.split('<')[1])
                        return  eval(res) < eval(str)
                      } else {
                        return handleMoreParam(res,m.split('<')[1],'<')
                      }
                    }else{
                      let str = handleFraction(m.split('<')[1])
                      return  eval(res) < eval(str)
                    } else {
                      return handleMoreParam(res,m.split('<')[1],'<')
                    }
                  }else{
                    let str = handleFraction(m.split('<')[1])
                    return  eval(res) < eval(str)
                  }
                }else if (m.includes('>')) {
                  if(typeof res =='string'&&res.includes('/')){
                    if (m.includes('/')) {
                  }else if (m.includes('>')) {
                    if(typeof res =='string'&&res.includes('/')){
                      if (m.includes('/')) {
                        let str = handleFraction(m.split('>')[1])
                        return  eval(res) > eval(str)
                      } else {
                        return handleMoreParam(res,m.split('>')[1],'>')
                      }
                    }else{
                      let str = handleFraction(m.split('>')[1])
                      return  eval(res) > eval(str)
                    } else {
                      return handleMoreParam(res,m.split('>')[1],'>')
                    }
                  }else{
                    let str = handleFraction(m.split('>')[1])
                    return  eval(res) > eval(str)
                  }
                }else if (m.includes('~')) {
                  if(typeof res =='string'&&res.includes('/')){
                    if (m.includes('/')) {
                  }else if (m.includes('~')) {
                    if(typeof res =='string'&&res.includes('/')){
                      if (m.includes('/')) {
                        let k = m.split('~')
                        return  eval(res) >= eval(handleFraction((k[0]))) && eval(res) <= eval(handleFraction(k[1]))
                      } else {
                        return handleMoreParam(res,m,'~')
                      }
                    }else{
                      let k = m.split('~')
                      return  eval(res) >= eval(handleFraction((k[0]))) && eval(res) <= eval(handleFraction(k[1]))
                    } else {
                      return handleMoreParam(res,m,'~')
                    }
                  }else{
                    let k = m.split('~')
                    return  eval(res) >= eval(handleFraction((k[0]))) && eval(res) <= eval(handleFraction(k[1]))
                  }
                }else if(m.includes('-')){
                  if(typeof res =='string'&&res.includes('/')){
                    if (m.includes('/')) {
                  }else if(m.includes('-')){
                    if(typeof res =='string'&&res.includes('/')){
                      if (m.includes('/')) {
                        let k = m.split('-')
                        return  eval(res) >= eval(handleFraction(k[0])) && eval(res) <= eval(handleFraction(k[1]))
                      } else {
                        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 {
                      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('±')){
                  if(typeof res =='string'&&res.includes('/')){
                    if (m.includes('/')) {
                  }else if(m.includes('±')){
                    if(typeof res =='string'&&res.includes('/')){
                      if (m.includes('/')) {
                        let k = m.split('±')
                        return  eval(res) >= eval((handleFraction(k[0]) - handleFraction(k[1]))) && eval(res) <= eval(Number((handleFraction(k[0])) + Number(handleFraction(k[1]))))
                      } else {
                        return handleMoreParam(res,m,'±')
                      }
                    }else{
                      let k = m.split('±')
                      return  eval(res) >= eval((handleFraction(k[0]) - handleFraction(k[1]))) && eval(res) <= eval((handleFraction(k[0]) + handleFraction(k[1])))
                    } else {
                      return handleMoreParam(res,m,'±')
                      return  eval(res) >= eval((handleFraction(k[0]) - handleFraction(k[1]))) && eval(res) <= eval(Number((handleFraction(k[0]) )+ Number(handleFraction(k[1]))))
                    }
                  }else{
                    let k = m.split('±')
                    return  eval(res) >= eval((handleFraction(k[0]) - handleFraction(k[1]))) && eval(res) <= eval((handleFraction(k[0]) + handleFraction(k[1])))
                  }
                }else if(m.includes('>')){
                  if(typeof res =='string'&&res.includes('/')){
                    if (m.includes('/')) {
                  }else if(m.includes('>')){
                    if(typeof res =='string'&&res.includes('/')){
                      if (m.includes('/')) {
                        let str = handleFraction(m.split('>')[1])
                        return  eval(res) > eval(str)
                      } else {
                        return handleMoreParam(res,m.split('>')[1],'>')
                      }
                    }else{
                      let str = handleFraction(m.split('>')[1])
                      return  eval(res) > eval(str)
                    } else {
                      return handleMoreParam(res,m.split('>')[1],'>')
                    }
                  }else{
                    let str = handleFraction(m.split('>')[1])
                    return  eval(res) > eval(str)
                  }
                }else if(m.includes('<')){
                  if(typeof res =='string'&&res.includes('/')){
                    if (m.includes('/')) {
                  }else if(m.includes('<')){
                    if(typeof res =='string'&&res.includes('/')){
                      if (m.includes('/')) {
                        let str = handleFraction(m.split('<')[1])
                        return  eval(res) < eval(str)
                      } else {
                        return handleMoreParam(res,m.split('<')[1],'<')
                      }
                    }else{
                      let str = handleFraction(m.split('<')[1])
                      return  eval(res) < eval(str)
                    } else {
                      return handleMoreParam(res,m.split('<')[1],'<')
                    }
                  }else{
                    let str = handleFraction(m.split('<')[1])
                    return  eval(res) < eval(str)
                  }
                }
              })
                })
              }
              // 如果要求值的每个条件都符合,则给结论赋值为1,合格
              if (comp.every(m => m)) {
                item.v.v = 1
                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 = 1
                        break
                      }
                    }
                  }
                })
              }else {
                // 否则给结论赋值为0,不合格
                item.v.v = 0
                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 = 0
                        break
                      }
                    }
                  }
                })
              }
            }
            if (comp.every(m => m)) {
              item.v.v = 1
              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 = 1
                      break
                    }
                  }
                }
              })
            } else {
              item.v.v = 0
              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 = 0
                      break
                    }
                  }
                }
              })
            }
            // console.log(5555,tableList)
          }
          // console.log('1234567789', tableList,getParam())
          // console.log('1234567789', item)
          let getDataType0 = false
          // 优化数采较多数据时-记录最后一个检验项的id,如果当前检验项的id与记录的id相同,则多传一个参数到主线程,进行数据保存,否则数采就不进行保存
          if(item.i==getDataTypeId){
            getDataType0 = true
          }
          // 赋值传递到主线程的数据,method:saveInsContext表示此消息需要保存数据
          result = {
            method:'saveInsContext',
            value:{
              tableList,
              param:getParam(),
              tableList,// 表格数据
              param:getParam(),//传给后端的参数
              getDataTypeId:getDataType0?getDataTypeId:''
            }
          }
          // 发消息给主线程
          self.postMessage(JSON.stringify(result))
        }
        } catch (error) {
@@ -318,27 +375,36 @@
        }
      } else {
        let comResult = ''
        // 如果是函数方法,则执行此方法
        let comResult = ''//初始化计算结果
        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 = PROJECT=='装备电缆'&&tell&&tell.length>0&&typeof tell[0] =='string'&&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+')||val.includes('e-'))
            // 装备项目检验值转化
            if (PROJECT === '装备电缆' && isToExponential) {
            // 检验值转化
            let findProduct = currentSample.insProduct.find(i=>i.inspectionItem=='体积电阻率')
            // 判断检验项是否为体积电阻率,如果为体积电阻率且大于100000,则进行转化
            if (findProduct && isToExponential && comResult>=100000) {
              let num2 = new Big(comResult)
              comResult = num2.toExponential(1)
            }
          }else{
            // 如果检验值类型是文本输入框、下拉框
            let valueList = [];
            // 处理excel函数参数列表
            item.valueList.forEach(a => {
              valueList.push({
                name: `${comparisonList.find(e=>e.value==a.c).label}${a.r+1}`,
                value: 0,
              })
            })
            // 给excel函数参数赋文本值
            for (var a in comValue) {
              valueList.forEach(b => {
                if (b.name == a) {
@@ -346,37 +412,44 @@
                }
              })
            }
            // 计算公式,去掉excel函数的等号,并替换参数,列如:=A1  变成 A1 变成 ‘文本输入的值’
            let str = item.v.f.replace(/=/g, ' ')
            valueList.forEach(b => {
              str = str.replace(b.name, b.value)
            })
            // 计算结果赋值
            comResult = str
          }
        } catch (error) {
          console.log('error---', error)
        }
        try {
          // 循环表格数据,给表格数据进行赋值
          list.forEach(a => {
            if (a[0].r == item.r && comResult !== '') {
              // 判断当前行是否为当前检验项所在行,如果为当前行,则给表格数据赋值
              for (var b in a) {
                if (a[b].c == item.c) {
                  try{
                    if(comResult==0){
                      // 判断计算结果是否为0,如果为0,则给表格数据赋值为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 if(typeof comResult == 'string' && (comResult.includes('e+')|| comResult.includes('e-'))){
                      // 判断计算结果是否为科学计数法,如果为科学计数法,则给表格数据赋值为科学计数法
                      a[b].v.v = comResult
                    }else{
                      // 判断计算结果是否为数字,如果为数字,则给表格数据赋值为数字
                      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)
                  }
@@ -385,6 +458,7 @@
              }
            }
          })
          // 如果此计算结果所属单元格,同时也是另一个excel函数的参数,那么就需要递归进行计算
          changeInput(comResult, `${id}-${item.r}-${item.c}-${pId}`) //改变最终值
        } catch (error) {
          console.log('error---', error)
@@ -392,22 +466,31 @@
      }
    }
  })
  // 赋值多线程传输数据
  result = {
    method:'tableList',
    value:tableList
  }
  // 发送主线程数据
  self.postMessage(JSON.stringify(result))
  try {
    // 赋值多线程传输数据
    result = {
      method:'getCurrentInsProduct',
      value:pId
    }
    // 发送主线程数据
    self.postMessage(JSON.stringify(result))
  } catch (error) {
    console.log('error---', error)
  }
}
/**
 * 获取检测值类型
 *
 * @param id 检测值类型对应的id
 * @returns 返回检测值类型
 */
function getInspectionValueType(id) {
  for (var a in currentSample.insProduct) {
    if (currentSample.insProduct[a].id == id) {
@@ -423,8 +506,10 @@
 */
function handleFraction(str){
  if(str&&typeof(str)=='string'&&str.includes('/')){
    // 处理分数
    return eval(str.split('/')[0]/str.split('/')[1])
  } else if (str && typeof(str) == 'string' && str.includes('*') && str.includes('^')) {
    // 计算乘方
    const num1 = str.split('*')
    const num2 = num1[1].split('^')
    let num3 = new Big(num2[0]);
@@ -460,7 +545,7 @@
          return item <= handleFraction(str)
        case '±':
          let k = str.split('±')
          return  item >= eval((handleFraction(k[0]) - handleFraction(k[1]))) && item <= eval((handleFraction(k[0]) + handleFraction(k[1])))
          return  item >= eval((handleFraction(k[0]) - handleFraction(k[1]))) && item <= eval(Number((handleFraction(k[0])) + Number(handleFraction(k[1]))))
        case '~':
          let j = str.split('~')
          return  item >= eval(handleFraction((j[0]))) && item <= eval(handleFraction(j[1]))
@@ -484,6 +569,7 @@
function getParam(){
  tableList[0].arr.forEach(a=>{
    a.forEach(b=>{
      // 初始化传递到后端的参数
      if(param[b.i]){
        param[b.i].insValue = []
        param[b.i].comValue = []
@@ -496,24 +582,31 @@
  })
  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&&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&& param[b.i].equipValue.push(b)
      }
      if (b.v.ps != undefined && b.v.ps.value === '设备名称') {
        // 赋值设备名称
        b.i &&b.v&& param[b.i].equipName.push(b)
      }
      if (b.v.ps != undefined && b.v.ps.value === '最终值') {
        // 赋值最终值
        b.i &&b.v&&b.valueList&&b.valueList.length>0&& (param[b.i].resValue = b)
      }
      if (b.v.ps != undefined && b.v.ps.value === '结论') {
        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
          }
        }
@@ -755,6 +848,7 @@
    let arr = getABCList(f)
    let arr2 = []
    arr.forEach(item=>{
      // 判断是否为范围,列如MAX(A1:B2)
      if(item.includes(':')){
        let r0 = getIdFromColumnName(item.split(':')[0]).r;
        let c0 = getIdFromColumnName(item.split(':')[0]).c;
@@ -769,6 +863,7 @@
          }
        }
      }else{
        // 没有则直接获取
        arr2.push(getIdFromColumnName(item))
      }
    })
@@ -786,6 +881,7 @@
function getABCList(f){
  try {
    let regex = /[=\+\-\*\%\(\)\/\^\s]/g;
    // 上面计算函数新增后,这里也要同步增加
    let fouList = [
      "SUM",
      'MAX',
@@ -793,6 +889,7 @@
      'AVERAGE',
      'ABS',
    ]
    // 替换特殊字符
    f = f.replace(regex, ',').replace(new RegExp('"&', 'g'),'').replace(new RegExp('&"', 'g'),'')
    fouList.forEach(item=>{
      f = f.replace(new RegExp(item, 'g'),',')
@@ -892,13 +989,22 @@
    if(str.includes(',,')){
      str = str.replace(new RegExp(',,', 'g'),',')
    }
    if(str.includes(',,')){
      str = str.replace(new RegExp(',,', 'g'),',')
    }
    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'),'')
    } else if (isPoint) {
      // 计算带小数点的
      return str.replace('ABS', '').replace(/\(|\)/g, '')
    }else {
      console.log('str', str)
      // 计算常规的
      return eval(str)
    }
  } catch (error) {