loulijun2021
2022-07-21 63fce2b793451ee340b7a0f6e0d6ce6c2d470dd0
src/views/zlgl/gxjy.vue
@@ -98,7 +98,9 @@
            highlight-current-row
            :header-cell-style="this.$headerCellStyle"
            :cell-style="this.$cellStyle"
            :row-class-name="tableRowClassName"
            @selection-change="handleSelectionChange"
            @cell-dblclick="cellDblclick"
          >
            <el-table-column
              type="index"
@@ -141,9 +143,17 @@
              prop="stepcheckitem_desc"
              label="检验标准描述"
            >
              <template slot-scope="{row}">
                <el-input v-if="row.isVisible===1" v-model="row.stepcheckitem_desc" placeholder="请输入" />
                <div v-else> {{ row.stepcheckitem_desc }}</div>
              <template slot-scope="scope">
                <el-input
                  v-if="scope.row.isVisible===1||scope.row.index === tabClickIndex && tabClickLabel === '检验标准描述'"
                  v-model="scope.row.stepcheckitem_desc"
                  placeholder="请输入"
                  @keyup.enter.native="val=>keyUpEnterNative(val,scope.row)"
                />
                <div
                  v-else
                > {{ scope.row.stepcheckitem_desc }}</div>
              </template>
            </el-table-column>
@@ -242,7 +252,6 @@
// const SER_HZ = /^[\u4e00-\u9fa5]+$/
import $ from 'jquery'
import {
  DeleteStepCheckStaned,
  MesOrderStepCheckItemList,
  MesOrderStepCheckSearch,
  MesOrderStepCheckSelect, SaveMesOrderStepCheckItem,
@@ -283,7 +292,9 @@
      JYTableData: [], // 检验项信息表格
      JYSelectArr: [], // 检验下拉数组
      JYSelectedArr: [], // 已选检验项目数组
      multipleSelection: []// 表格多选框
      multipleSelection: [], // 表格多选框
      tabClickIndex: null, // 点击的单元格
      tabClickLabel: '' // 当前点击的列名
    }
  },
  created() {
@@ -330,12 +341,13 @@
        number = number === 0 ? (10 + Math.random()) : number
        // item.result = 0 // 0合格  1不良
        item.result = 'NG'
        item.result = 'OK'
        item.isVisible = 0
        item.number = number
        this.JYSelectedArr.push(item.code)
      })
      this.$refs.multipleTable.toggleAllSelection()
    },
    // changeRadioValue(val, row) {
    //   console.log(val, row.result, 20000)
@@ -354,14 +366,11 @@
          it.result = 'NG'
        }
      })
      if (this.multipleSelection.length > 0) {
        if (this.multipleSelection.length === this.JYTableData.length) {
          this.checkResult = 'OK'
        } else {
          this.checkResult = 'NG'
        }
      if (this.multipleSelection.length > 0 && this.multipleSelection.length === this.JYTableData.length) {
        this.checkResult = 'OK'
      } else {
        this.checkResult = ''
        this.checkResult = 'NG'
      }
    },
    // 检验项目编码(名称)
@@ -390,8 +399,9 @@
      let number = Math.random() * Math.random()// 作为删除时的标识符
      number = number === 0 ? (10 + Math.random()) : number
      const data = { result: 'NG', code: '', name: '', stepcheckitem_desc: '', isVisible: 1, number }
      const data = { result: 'OK', code: '', name: '', stepcheckitem_desc: '', isVisible: 1, number }
      this.JYTableData.push(data)
      this.$refs.multipleTable.toggleRowSelection(data, true)
    },
    //  确认
@@ -415,14 +425,10 @@
        }
      })
      if (this.multipleSelection.length > 0) {
        if (this.multipleSelection.length === this.JYTableData.length) {
          this.checkResult = 'OK'
        } else {
          this.checkResult = 'NG'
        }
      if (this.multipleSelection.length > 0 && this.multipleSelection.length === this.JYTableData.length) {
        this.checkResult = 'OK'
      } else {
        this.checkResult = ''
        this.checkResult = 'NG'
      }
    },
    //  取消
@@ -439,6 +445,7 @@
        }
      })
    },
    // 删除
    del(row) {
      this.JYTableData.forEach((item, index) => {
@@ -530,6 +537,33 @@
      this.form.stepcode = ''
      this.form.stepname = ''
    },
    // 单元格被点击时
    cellDblclick(row, column, cell, event) {
      console.log(row, column, cell, event)
      console.log(column.label)
      console.log(row.index)
      switch (column.label) {
        case '检验标准描述':
          this.tabClickIndex = row.index
          this.tabClickLabel = column.label
          break
        // case '判责金额(元)':
        //   this.tabClickIndex = row.index
        //   this.tabClickLabel = column.label
        //   break
        default: return
      }
    },
    // 回车事件
    keyUpEnterNative(val, row) {
      this.tabClickLabel = ''
    },
    tableRowClassName({ row, rowIndex }) {
      // 把每一行的索引放进row
      row.index = rowIndex
    },
    // 获取页面高度
    getHeight() {
      this.$nextTick(() => {