licp
2024-06-28 771699a2a85aecde95a4393ef6016b28f73a551e
检验任务bug修复
已修改2个文件
201 ■■■■■ 文件已修改
src/components/do/b1-inspect-order-plan/Inspection.vue 80 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/util/excelFountion.js 121 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -253,7 +253,7 @@
      </el-form>
    </div>
    <div class="center">
      <div class="search">
      <div class="search" style="text-align: left;">
        <el-radio-group v-model="currentTable" size="small">
          <el-radio-button :label="item.templateId" v-for="(item,index) in tableLists" :key="index"
            size="small">{{ item.templateName }}</el-radio-button>
@@ -272,7 +272,7 @@
                  <template v-if="n.v.ps!=undefined && n.v.ps.value==='检验值' && state==1">
                    <el-input v-if="getInspectionValueType(n.i) == 1" class="table_input" v-model="n.v.v"
                      :disabled="getInspectionItemType(n.i) == 1 || (n.u != userId && n.u != undefined && n.u != '')"
                      @change="m=>changeInput(m,`${item.templateId}-${n.r}-${n.c}-${n.i}`)" type="number" @mousewheel.native.prevent>
                      @change="m=>changeInput(m,`${item.templateId}-${n.r}-${n.c}-${n.i}`)" type="number" @mousewheel.native.prevent :key="'abc-'+'000'+index+'000'+i+'000'+j">
                      <el-button slot="append" type="primary" icon="el-icon-edit" size="mini"
                        v-if="getInspectionItemType(n.i) == 1" @click="getSystemValue(n)"></el-button>
                    </el-input>
@@ -1204,43 +1204,47 @@
                let ask = this.currentSample.insProduct.find(m => m.id == item.i).ask?this.currentSample.insProduct.find(m => m.id == item.i).ask.split('&'):null;
                let res = Object.values(comValue)[0]
                let comp = []
                if(ask){
                  comp = ask.map((m, i) => {
                  if (m.includes('=')) {
                    let str = m.split('=')[1]
                    if(typeof res == 'string'&&typeof str == 'string'){
                      return res.trim() == str.trim()
                    }else{
                      return res == str
                    }
                  } else if (m.includes('≥')) {
                    return res >= m.split('≥')[1]
                  }else if (m.includes('≤')) {
                    return res <= m.split('≤')[1]
                  }else if (m.includes('<')) {
                    return res < m.split('<')[1]
                  }else if (m.includes('>')) {
                    return res > m.split('>')[1]
                  }else if (m.includes('~')) {
                    let k = m.split('~')
                    return res >= k[0] && res <= k[1]
                  }else if(m.includes('-')){
                    let k = m.split('-')
                    return res >= k[0] && res <= k[1]
                  }else if(m.includes('±')){
                    let k = m.split('±')
                    return res >= (k[0] - k[1]) && res <= (k[0] + k[1])
                  }else if(m.includes('>')){
                    return res > m.split('>')[1]
                  }else if(m.includes('<')){
                    return res < m.split('<')[1]
                if(res==''||res==null||res==undefined||res=='Infinity'){
                  item.v.v = ''
                }else{
                  if(ask){
                    comp = ask.map((m, i) => {
                      if (m.includes('=')) {
                        let str = m.split('=')[1]
                        if(typeof res == 'string'&&typeof str == 'string'){
                          return res.trim() == str.trim()
                        }else{
                          return res == str
                        }
                      } else if (m.includes('≥')) {
                        return res >= m.split('≥')[1]
                      }else if (m.includes('≤')) {
                        return res <= m.split('≤')[1]
                      }else if (m.includes('<')) {
                        return res < m.split('<')[1]
                      }else if (m.includes('>')) {
                        return res > m.split('>')[1]
                      }else if (m.includes('~')) {
                        let k = m.split('~')
                        return res >= k[0] && res <= k[1]
                      }else if(m.includes('-')){
                        let k = m.split('-')
                        return res >= k[0] && res <= k[1]
                      }else if(m.includes('±')){
                        let k = m.split('±')
                        return res >= (k[0] - k[1]) && res <= (k[0] + k[1])
                      }else if(m.includes('>')){
                        return res > m.split('>')[1]
                      }else if(m.includes('<')){
                        return res < m.split('<')[1]
                      }
                    })
                  }
                })
                }
                if (comp.every(m => m)) {
                  item.v.v = 1
                } else {
                  item.v.v = 0
                  if (comp.every(m => m)) {
                    item.v.v = 1
                  } else {
                    item.v.v = 0
                  }
                }
                this.saveInsContext()
              }
src/util/excelFountion.js
@@ -1,7 +1,7 @@
function SUM(...val){
  let num = 0;
  let num = null;
  if(val&&val.length>0){
    val.forEach(item=>{
      num+=item;
@@ -10,33 +10,44 @@
  return num;
}
function MAX(...val){
  let max = 0;
  let max = null;
  if(val&&val.length>0){
    val = val.filter(item=>item!=null&&item!=='')
    max = Math.max(...val)
    if(val.length>0){
      max = Math.max(...val)
    }else{
      max = null;
    }
  }
  return max;
}
function MIN(...val){
  let min = 0;
  let min = null;
  if(val&&val.length>0){
    val = val.filter(item=>item!=null&&item!=='')
    min = Math.min(...val)
    console.log(val)
    if(val.length>0){
      min = Math.min(...val)
    }
  }
  return min;
}
function AVERAGE(...val){
  let num = 0;
  let num = null;
  let arr = [];
  if(val&&val.length>0){
    arr = val.filter(item=>item!=null&&item!=='')
    arr.forEach(item=>{
      num+=item;
    })
    return num/arr.length;
    if(arr.length>0){
      return num/arr.length;
    }else{
      return null;
    }
  }else{
    return 0;
    return null;
  }
}
@@ -51,19 +62,23 @@
 * @param {Object} cellId
 */
function getColumnNameFromId(cellId){
    if (! Array.isArray(cellId)) {
        cellId = cellId.split('-');
    }
    var i = cellId[0];
    var letter = '';
    if (i > 701) {
        letter += String.fromCharCode(64 + parseInt(i / 676));
        letter += String.fromCharCode(64 + parseInt((i % 676) / 26));
    } else if (i > 25) {
        letter += String.fromCharCode(64 + parseInt(i / 26));
    }
    letter += String.fromCharCode(65 + (i % 26));
    return letter + (parseInt(cellId[1]) + 1);
  try{
    if (! Array.isArray(cellId)) {
      cellId = cellId.split('-');
    }
    var i = cellId[0];
    var letter = '';
    if (i > 701) {
      letter += String.fromCharCode(64 + parseInt(i / 676));
      letter += String.fromCharCode(64 + parseInt((i % 676) / 26));
    } else if (i > 25) {
      letter += String.fromCharCode(64 + parseInt(i / 26));
    }
    letter += String.fromCharCode(65 + (i % 26));
    return letter + (parseInt(cellId[1]) + 1);
  }catch(e){
    console.log('error',cellId)
  }
}
/**
 * 根据列名获取坐标
@@ -71,37 +86,41 @@
 * @param {Object} arr
 */
function getIdFromColumnName(id, arr) {
    // Get the letters
    var t = /^[a-zA-Z]+/.exec(id);
    if (t) {
        // Base 26 calculation
        var code = 0;
        for (var i = 0; i < t[0].length; i++) {
            code += parseInt(t[0].charCodeAt(i) - 64) * Math.pow(26, (t[0].length - 1 - i));
        }
        code--;
        // Make sure jexcel starts on zero
        if (code < 0) {
            code = 0;
        }
        // Number
        var number = parseInt(/[0-9]+$/.exec(id));
        if (number > 0) {
            number--;
        }
        if (arr == true) {
            id = [ code, number ];
        } else {
            // id = code + '-' + number;
      id = {
        c:code,
        r:number
  try{
    // Get the letters
    var t = /^[a-zA-Z]+/.exec(id);
    if (t) {
      // Base 26 calculation
      var code = 0;
      for (var i = 0; i < t[0].length; i++) {
        code += parseInt(t[0].charCodeAt(i) - 64) * Math.pow(26, (t[0].length - 1 - i));
      }
        }
    }
    return id;
      code--;
      // Make sure jexcel starts on zero
      if (code < 0) {
        code = 0;
      }
      // Number
      var number = parseInt(/[0-9]+$/.exec(id));
      if (number > 0) {
        number--;
      }
      if (arr == true) {
        id = [ code, number ];
      } else {
        // id = code + '-' + number;
        id = {
          c:code,
          r:number
        }
      }
    }
    return id;
  }catch(e){
    console.log('error',id)
  }
}
// 获取参数列表