value
2024-05-12 42ea8c6cba21c555e254ac41ce976d7c2f9366f6
src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -132,32 +132,32 @@
    color: #303133;
  }
  .inspection .el-input-group__append{
  .inspection .el-input-group__append {
    padding: 0 10px;
    color: #3A7BFA;
    background-color: #fff;
  }
  .inspection .center-box .el-input__inner{
  .inspection .center-box .el-input__inner {
    font-size: 12px;
    padding: 0 6px;
    text-align: center;
  }
  .inspection .el-textarea__inner{
  .inspection .el-textarea__inner {
    padding: 2px;
  }
  .inspection .el-textarea__inner::-webkit-scrollbar{
  .inspection .el-textarea__inner::-webkit-scrollbar {
    width: 0;
  }
  .inspection .el-select{
  .inspection .el-select {
    display: flex;
    align-items: center;
  }
  .inspection .el-textarea__inner{
  .inspection .el-textarea__inner {
    min-height: 100% !important;
  }
</style>
@@ -168,7 +168,8 @@
      <el-col :span="12" style="text-align: right;">
        <el-button size="small" type="primary" @click="sampleVisible=true">样品切换</el-button>
        <el-button size="small" type="primary" @click="taskVisible=true">任务切换</el-button>
        <el-button size="small" type="primary" @click="submit" v-show="state==1" :loading="submitLoading">提交</el-button>
        <el-button size="small" type="primary" @click="addVerifyDia = true" v-show="state==1"
          :loading="submitLoading">提交</el-button>
        <!-- 复核 -->
        <el-button size="medium" type="primary" @click="upInsReview(1)" :loading="reviewLoading"
          v-show="state>1">通过</el-button>
@@ -207,8 +208,8 @@
    <div class="center">
      <div class="search">
        <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>
          <el-radio-button :label="item.templateId" v-for="(item,index) in tableLists" :key="index"
            size="small">{{ item.templateName }}</el-radio-button>
        </el-radio-group>
      </div>
      <div class="center-box">
@@ -219,27 +220,29 @@
                v-if="n.v.mc==undefined || Object.keys(n.v.mc).length === 4" :colspan="n.v.mc&&n.v.mc.cs?n.v.mc.cs:1"
                :rowspan="n.v.mc&&n.v.mc.rs?n.v.mc.rs:1"
                :style="`background:${n.v.bg};color:${n.v.fc};font-size:${n.v.fs}px;width:${handleWidth(n)}px !important;height:${item.style.rowlen[n.r]}px;font-wight:${n.v.bl?'bold':''};`">
                <div class="content" :class="`content-h-${n.v.ht} content-v-${n.v.vt}`" :style="`width:${handleWidth(n)}px !important;min-height:${item.style.rowlen[n.r]}px;`">
                <div class="content" :class="`content-h-${n.v.ht} content-v-${n.v.vt}`"
                  :style="`width:${handleWidth(n)}px !important;min-height:${item.style.rowlen[n.r]}px;`">
                  <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}`)">
                      <el-button slot="append" type="primary" icon="el-icon-edit" size="mini" v-if="getInspectionItemType(n.i) == 1" @click="getSystemValue(n)"></el-button>
                      <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>
                    <el-input v-else-if="getInspectionValueType(n.i) == 2" class="table_input" type="textarea"
                       v-model="n.v.v"
                      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}`)"/>
                    <el-select v-else-if="getInspectionValueType(n.i) == 5" class="table_input"  v-model="n.v.v"
                      :disabled="state>1">
                      <el-option label="是" value="是"></el-option>
                      <el-option label="否" value="否"></el-option>
                      @change="saveInsContext()" />
                    <el-select v-else-if="getInspectionValueType(n.i) == 5" class="table_input" v-model="n.v.v"
                      :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;`"
                      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 && state==1" class="table_input" v-model="n.v.v" @change="saveInsContext()">
                    <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>
@@ -250,14 +253,24 @@
                    </template>
                  </template>
                  <template v-else-if="n.v.ps!=undefined && n.v.ps.value==='设备编码' && state==1">
                    <el-select v-model="n.v.v" placeholder="设备" @visible-change="e=>getEquipOptions(e,n.i)"
                       remote @change="(val)=>changeEquip(val, n)">
                    <el-select v-model="n.v.v" placeholder="设备" @visible-change="e=>getEquipOptions(e,n.i)" remote
                      @change="(val)=>changeEquip(val, n)">
                      <el-option v-for="item in equipOptions" :key="item.value" :label="item.value" :value="item.value">
                      </el-option>
                    </el-select>
                  </template>
                  <template v-else-if="n.v.ps!=undefined && n.v.ps.value==='要求值' && state==1">
                    <span :style="`font-family:${n.v.ff} !important;`">{{getTell(n.i)}}</span>
                  </template>
                  <template v-else-if="n.v.ps!=undefined && n.v.ps.value==='最终值' && state==1">
                    <el-input class="table_input" type="textarea"
                      :disabled="getInspectionItemType(n.i) == 1 || (n.u != userId && n.u != undefined && n.u != '')"
                      v-model="n.v.v" @change="saveInsContext()" v-if="getInspectionValueType(n.i) == 2"></el-input>
                    <el-select v-else-if="getInspectionValueType(n.i) == 5" class="table_input" v-model="n.v.v"
                      :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 v-else :style="`font-family:${n.v.ff} !important;`">{{n.v.v}}</span>
                  </template>
                  <span v-else :style="`font-family:${n.v.ff} !important;`">{{n.v.v}}</span>
                </div>
@@ -303,13 +316,27 @@
      <div class="body" style="display: flex;padding: 10px;" v-if="reviewDia">
        <div class="search_label" style="width: 150px;"><span class="required-span">* </span>不通过的理由:</div>
        <div class="search_input" style="width: 100%;">
          <el-input size="small" clearable v-model="noReason" type="textarea"
            :autosize="{ minRows: 4}"></el-input>
          <el-input size="small" clearable v-model="noReason" type="textarea" :autosize="{ minRows: 4}"></el-input>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="reviewDia = false">取 消</el-button>
        <el-button type="primary" @click="handleReviewDia" :loading="reviewLoading">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="指定复核人员" :visible.sync="addVerifyDia" width="400px">
      <div class="body" style="display: flex;padding: 10px;align-items: center;">
        <div class="search_label" style="width: 150px;"><span class="required-span">*</span>复核人</div>
        <div class="search_input" style="width: 100%;">
          <el-select v-model="verifyUser" placeholder="请选择" size="small" style="width: 100%;" clearable filterable>
            <el-option v-for="(item,i) in personList" :key="i" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addVerifyDia = false">取 消</el-button>
        <el-button type="primary" @click="submit()">确 定</el-button>
      </span>
    </el-dialog>
  </div>
@@ -380,9 +407,13 @@
        reviewDia: false,
        noReason: '',
        tableWidth: 1000,
        currentTable:null,
        tableLists:[],
        widthList:[]
        currentTable: null,
        tableLists: [],
        widthList: [],
        addVerifyDia: false,
        verifyUser: null,
        personList: [],
        enumList: []
      }
    },
    created() {
@@ -394,6 +425,7 @@
      this.getTypeDicts()
      this.getInsStateDicts()
      this.getComparisonList()
      this.getAuthorizedPerson()
    },
    watch: {
      id(val) {
@@ -428,10 +460,10 @@
          this.currentKey = 1;
        })
      },
      currentTable(val1,val0){
        if(val0!=null&&val1!=val0){
          this.tableLists.forEach((m,i)=>{
            if(m.templateId==val1){
      currentTable(val1, val0) {
        if (val0 != null && val1 != val0) {
          this.tableLists.forEach((m, i) => {
            if (m.templateId == val1) {
              this.tableList = null;
              this.tableList = [(this.tableLists[i])];
              this.handleTableData()
@@ -508,13 +540,24 @@
          this.comparisonList = data;
        })
      },
      selectEnumByCategoryOfSelect(val) {
        this.enumList = []
        if(val===undefined||val===null){
          return
        }
        this.$axios.post(this.$api.enums.selectEnumByCategory, {
          category: val
        }).then(res => {
          this.enumList = res.data;
        })
      },
      tableRowClassName({
        row,
        rowIndex
      }) {
        row.index = rowIndex + 1;
      },
      getTableLists(){
      getTableLists() {
        const mySet1 = new Set();
        this.tableLists = this.currentSample.insProduct.filter(m => {
          let num0 = mySet1.size;
@@ -529,7 +572,7 @@
            return m
          }
        });
        if(this.tableLists&&this.tableLists.length>0){
        if (this.tableLists && this.tableLists.length > 0) {
          this.tableList = null;
          this.tableList = [this.tableLists[0]]
          this.currentTable = this.tableLists[0].templateId;
@@ -597,18 +640,19 @@
                for (let i in this.currentSample.insProduct) {
                  if (this.currentSample.insProduct[i].templateId === a.templateId && this.currentSample
                    .insProduct[i].inspectionItem +
                     (this.currentSample.insProduct[i].inspectionItemSubclass==null?'':this.currentSample.insProduct[i].inspectionItemSubclass)
                     === str) {
                      ids.push({
                        r: b.r,
                        id: this.currentSample.insProduct[i].id,
                        product: this.currentSample.insProduct[i]
                      })
                      break
                    (this.currentSample.insProduct[i].inspectionItemSubclass == null ? '' : this.currentSample
                      .insProduct[i].inspectionItemSubclass) ===
                    str) {
                    ids.push({
                      r: b.r,
                      id: this.currentSample.insProduct[i].id,
                      product: this.currentSample.insProduct[i]
                    })
                    break
                  }
                  count2++
                }
                if(count2 == this.currentSample.insProduct.length){
                if (count2 == this.currentSample.insProduct.length) {
                  dels.add(b.r)
                }
              }
@@ -629,7 +673,8 @@
                if (a.template[b].v.ps != undefined && a.template[b].v.ps.value === '单位') {
                  a.template[b].v.v = id.product.unit
                }
                if (a.template[b].v.ps != undefined && (a.template[b].v.ps.value === '试验方法' || a.template[b].v.ps.value === '检测方法')) {
                if (a.template[b].v.ps != undefined && (a.template[b].v.ps.value === '试验方法' || a.template[b].v
                    .ps.value === '检测方法')) {
                  a.template[b].v.v = id.product.methodS
                }
              }
@@ -675,19 +720,19 @@
            if (b.v.ps != undefined && b.v.ps.value === '检验值') {
              b.v.v = ''
              b.u = ''
              b.i&&this.param[b.i].insValue.push(b)
              b.i && this.param[b.i].insValue.push(b)
            }
            if (b.v.ps != undefined && b.v.ps.value === '计算值') {
              b.v.v = ''
              b.i&&this.param[b.i].comValue.push(b)
              b.i && this.param[b.i].comValue.push(b)
            }
            if (b.v.ps != undefined && b.v.ps.value === '设备编码') {
              b.v.v = ''
              b.i&&this.param[b.i].equipValue.push(b)
              b.i && this.param[b.i].equipValue.push(b)
            }
            if (b.v.ps != undefined && b.v.ps.value === '设备名称') {
              b.v.v = ''
              b.i&&this.param[b.i].equipName.push(b)
              b.i && this.param[b.i].equipName.push(b)
            }
            if (b.v.ps != undefined && b.v.ps.value === '最终值') {
              b.v.v = ''
@@ -698,12 +743,12 @@
              } else {
                this.param[b.i].resValue = b
              } */
              if(b.i !== undefined){
              if (b.i !== undefined) {
                this.param[b.i].resValue = b
              }
            }
            if (b.v.ps != undefined && b.v.ps.value === '结论') {
              if(b.i!==undefined){
              if (b.i !== undefined) {
                this.param[b.i].insResult = b
                conclusionList.forEach((n, i) => {
                  if (n.r == b.r && n.c == b.c) {
@@ -803,7 +848,7 @@
                }
              })
            })
            if (item.methodName == '自定义方法' && item.v.ps!=undefined && item.v.ps.value == '结论') {
            if (item.methodName == '自定义方法' && item.v.ps != undefined && item.v.ps.value == '结论') {
              if (this.currentSample.insProduct.find(m => m.id == item.i)) {
                let ask = this.currentSample.insProduct.find(m => m.id == item.i).ask.split('&');
                let res = Object.values(comValue)[0]
@@ -867,13 +912,13 @@
                  valueList.forEach(b => {
                    str = str.replace(b.name, b.value)
                  })
                  if(item.v.f.includes('/')>-1){
                    if(Object.getOwnPropertyNames(comValue).length==valueList.length){
                  if (item.v.f.includes('/') > -1) {
                    if (Object.getOwnPropertyNames(comValue).length == valueList.length) {
                      comResult = eval(str)
                    }else{
                    } else {
                      comResult = ''
                    }
                  }else{
                  } else {
                    comResult = eval(str)
                  }
                  break;
@@ -883,7 +928,7 @@
                  for (var b in a) {
                    if (a[b].c == item.c) {
                      let val = parseFloat(comResult.toFixed(3))
                      a[b].v.v = isNaN(val)?'':val
                      a[b].v.v = isNaN(val) ? '' : val
                      break
                    }
                  }
@@ -895,19 +940,19 @@
        })
        this.getCurrentInsProduct(pId)
      },
      getCurrentInsProduct(pId){
        if(!this.tableList[0].insProductResult){
      getCurrentInsProduct(pId) {
        if (!this.tableList[0].insProductResult) {
          this.tableList[0].insProductResult = {}
        }
        for (let m in this.param[pId]){
        for (let m in this.param[pId]) {
          let value = this.param[pId][m]
          switch (m){
          switch (m) {
            case 'comValue':
              if(value&&value.length>0){
                this.tableList[0].insProductResult[m]=[];
                value.forEach((a,i)=>{
              if (value && value.length > 0) {
                this.tableList[0].insProductResult[m] = [];
                value.forEach((a, i) => {
                  let obj = {
                    v:a.v.v,
                    v: a.v.v,
                  }
                  this.tableList[0].insProductResult[m].push(obj);
                })
@@ -915,12 +960,12 @@
              this.tableList[0].insProductResult[m] = JSON.stringify(this.tableList[0].insProductResult[m])
              break;
            case 'insValue':
              if(value&&value.length>0){
                this.tableList[0].insProductResult[m]=[];
                value.forEach((a,i)=>{
              if (value && value.length > 0) {
                this.tableList[0].insProductResult[m] = [];
                value.forEach((a, i) => {
                  let obj = {
                    v:a.v.v,
                    u:a.u,
                    v: a.v.v,
                    u: a.u,
                  }
                  this.tableList[0].insProductResult[m].push(obj);
                })
@@ -928,11 +973,11 @@
              this.tableList[0].insProductResult[m] = JSON.stringify(this.tableList[0].insProductResult[m])
              break;
            case 'equipValue':
              if(value&&value.length>0){
                this.tableList[0].insProductResult[m]=[];
                value.forEach((a,i)=>{
              if (value && value.length > 0) {
                this.tableList[0].insProductResult[m] = [];
                value.forEach((a, i) => {
                  let obj = {
                    v:a.v.v,
                    v: a.v.v,
                  }
                  this.tableList[0].insProductResult[m].push(obj);
                })
@@ -940,11 +985,11 @@
              this.tableList[0].insProductResult[m] = JSON.stringify(this.tableList[0].insProductResult[m])
              break;
            case 'equipName':
              if(value&&value.length>0){
                this.tableList[0].insProductResult[m]=[];
                value.forEach((a,i)=>{
              if (value && value.length > 0) {
                this.tableList[0].insProductResult[m] = [];
                value.forEach((a, i) => {
                  let obj = {
                    v:a.v.v,
                    v: a.v.v,
                  }
                  this.tableList[0].insProductResult[m].push(obj);
                })
@@ -992,7 +1037,7 @@
              let regex = /[=\+\-\*\%\(\)\/\s]/g
              let mode = item.v.f.replace(regex, ' ').split(' ');
              mode.filter(m => m && !Number(m)).forEach(m => {
                let r =  m.replace(/[a-zA-Z]/g, "") - 1
                let r = m.replace(/[a-zA-Z]/g, "") - 1
                let c = this.comparisonList.find(j => j.label == m.split('')[0]).value
                valueList.push({
                  c,
@@ -1019,15 +1064,15 @@
          }
        }
      },
      handleWidth(n){
      handleWidth(n) {
        let sum = 0;
        if(n.v.mc&&n.v.mc.cs&&n.v.mc.c!=undefined){
          for(let i=0;i<n.v.mc.cs;i++){
            let num = this.widthList[i+n.v.mc.c]?this.widthList[i+n.v.mc.c]:100
            sum+=num;
        if (n.v.mc && n.v.mc.cs && n.v.mc.c != undefined) {
          for (let i = 0; i < n.v.mc.cs; i++) {
            let num = this.widthList[i + n.v.mc.c] ? this.widthList[i + n.v.mc.c] : 100
            sum += num;
          }
        }else{
          sum = this.widthList[n.c]?this.widthList[n.c]:100
        } else {
          sum = this.widthList[n.c] ? this.widthList[n.c] : 100
        }
        return sum
      },
@@ -1079,6 +1124,17 @@
          }).catch(error => {
            console.error(error)
          })
        }
      },
      getDic(e, id) {
        if (e) {
          for (var a in this.currentSample.insProduct) {
            if (this.currentSample.insProduct[a].id == id) {
              let str = this.currentSample.insProduct[a].dic
              this.selectEnumByCategoryOfSelect(str)
              return str
            }
          }
        }
      },
      getUserInfo() {
@@ -1134,10 +1190,16 @@
        }
      },
      submit() {
        if (this.verifyUser === null || this.verifyUser === '') {
          this.$message.error("请指定复核人员")
          return
        }
        this.addVerifyDia = false
        this.submitLoading = true;
        this.$axios.post(this.$api.insOrderPlan.submitPlan, {
          orderId: this.orderId,
          laboratory: this.sonLaboratory,
          verifyUser: this.verifyUser
        }).then(res => {
          if (res.code === 200) {
            this.$message.success("操作成功")
@@ -1149,7 +1211,7 @@
          this.submitLoading = false;
        })
      },
      saveInsContext(){
      saveInsContext() {
        this.$axios.post(this.$api.insOrderPlan.saveInsContext, {
          param: JSON.stringify(this.param)
        }).then(res => {
@@ -1160,18 +1222,30 @@
          this.$message.success('已保存')
        })
      },
      changeEquip(val,n){
        for(let i in this.equipOptions){
          if(this.equipOptions[i].value === val){
            for(let i1 in this.param[n.i].equipName){
              if(this.param[n.i].equipName[i1].i === n.i && this.param[n.i].equipName[i1].r === n.r){
      changeEquip(val, n) {
        for (let i in this.equipOptions) {
          if (this.equipOptions[i].value === val) {
            for (let i1 in this.param[n.i].equipName) {
              if (this.param[n.i].equipName[i1].i === n.i && this.param[n.i].equipName[i1].r === n.r) {
                this.param[n.i].equipName[i1].v.v = this.equipOptions[i].label
              }
            }
          }
        }
        this.saveInsContext()
      }
      },
      getAuthorizedPerson() {
        this.$axios.get(this.$api.user.getUserMenu).then(res => {
          let data = []
          res.data.forEach(a => {
            data.push({
              label: a.name,
              value: a.id
            })
          })
          this.personList = data
        })
      },
    }
  }
</script>