licp
2024-06-26 254f5863bed7474f258e6829cc0a2a4f94989e1c
src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -135,6 +135,14 @@
  .table_caret:active{
    opacity: .8;
  }
  >>>input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;  /* 隐藏微调按钮 */
    margin: 0 !important;  /* 移除微调按钮的边距 */
  }
  >>>input[type=number] {
      -moz-appearance: textfield !important;  /* 针对 Firefox */
  }
</style>
<style>
  .inspection .el-form-item__label {
@@ -264,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}`)">
                      @change="m=>changeInput(m,`${item.templateId}-${n.r}-${n.c}-${n.i}`)" type="number">
                      <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>
@@ -281,12 +289,12 @@
                      v-else-if="getInspectionValueType(n.i) == 4">/</span>
                  </template>
                  <template v-else-if="n.v.ps!=undefined && n.v.ps.value==='结论'">
                    <el-select v-if="(getInspectionValueType(n.i) == 2 || getInspectionValueType(n.i) == 5) && state==1"
                    <!-- <el-select v-if="(getInspectionValueType(n.i) == 2 || getInspectionValueType(n.i) == 5) && state==1"
                      class="table_input" v-model="n.v.v" @change="saveInsContext()">
                      <el-option label="合格" :value="1"></el-option>
                      <el-option label="不合格" :value="0"></el-option>
                    </el-select>
                    <template v-else>
                    </el-select> -->
                    <template>
                      <span v-if="n.v.v===1" :style="`font-family:${n.v.ff} !important;color: green;`">合格</span>
                      <span v-else-if="n.v.v===0" :style="`font-family:${n.v.ff} !important;color: red;`">不合格</span>
                      <span v-else :style="`font-family:${n.v.ff} !important;`">待定</span>
@@ -310,7 +318,7 @@
                      :disabled="state>1" @visible-change="e=>getDic(e,n.i)" @change="saveInsContext()">
                      <el-option v-for="(e, i) in enumList" :key="i" :label="e.label" :value="e.value"></el-option>
                    </el-select> -->
                    <span :style="`font-family:${n.v.ff} !important;`">{{n.v.v}}</span>
                    <span :style="`font-family:${n.v.ff} !important;`">{{ toFixed(n.v.v,n.v.ct) }}</span>
                  </template>
                  <template v-else-if="n.v.ps!=undefined && n.v.ps.value==='样品编号'">
                    <div style="display: flex;flex-wrap: nowrap;align-items: center;width: 100%" :title="currentSample.sampleCode">
@@ -1196,7 +1204,12 @@
                if(ask){
                  comp = ask.map((m, i) => {
                  if (m.includes('=')) {
                    return res == m.split('=')[1]
                    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('≤')) {
@@ -1217,12 +1230,10 @@
                  }
                })
                }
                if(this.getInspectionValueType(item.i)==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()
              }
@@ -1293,6 +1304,7 @@
                  str = str.replaceAll('MAX', 'Math.max')
                  str = str.replaceAll('MIN', 'Math.min')
                  str = str.replaceAll(',', ',')
                  console.log(str)
                  try {
                    if(this.getInspectionValueType(item.i)==1){
                      comResult = eval(str)
@@ -1944,6 +1956,26 @@
        }).catch(error => {
        })
      },
      /**
       * 将数值v保留ct.fa中'##'后的指定小数位数,并返回格式化后的字符串。
       *
       * @param v 要格式化的数值
       * @param ct 包含格式化配置的对象
       * @param ct.fa 格式化配置字符串,若包含'##'则按照其后的内容确定小数位数
       * @returns 格式化后的字符串或原始数值(若配置不符合要求)
       */
      toFixed(v,ct){
        if(v&&ct&&ct.fa&&ct.fa.includes('##')){
          if(ct.fa.includes('.')){
            let num = ct.fa.slice(4).length
            return Number(v).toFixed(num)
          }else{
            return Number(v).toFixed(0)
          }
        }else{
          return v
        }
      }
    }
  }