loulijun2021
2022-07-21 63fce2b793451ee340b7a0f6e0d6ce6c2d470dd0
src/views/zlgl/gxjy.vue
@@ -6,7 +6,7 @@
          <i class="el-icon-s-operation" style="color:#42b983; margin-right: 5px" />扫码信息
        </div>
        <div style="display: flex;align-items: center">
          <div style="width: 90px">扫描条码:</div>
          <div style="width: 90px;display: flex"><div style="color: red;width:10px">*</div>扫描条码:</div>
          <el-input
            v-model="form.orderstepqrcode"
            name="GXproduceCode"
@@ -51,7 +51,7 @@
          <i class="el-icon-s-operation" style="color:#42b983; margin-right: 5px" />检验标准信息
        </div>
        <div style="display: flex;align-items: center">
          <div style="width: 90px">检验标准:</div>
          <div style="width: 90px;display: flex"><div style="color: red;width:10px">*</div>检验标准:</div>
          <el-select
            v-model="checkStandard"
            style="width: 200px;"
@@ -66,7 +66,7 @@
              :value="item.code"
            />
          </el-select>
          <div style="width: 90px;margin-left: 50px;">检验人员:</div>
          <div style="width: 90px;margin-left: 50px;display: flex"><div style="color: red;width:10px">*</div>检验人员:</div>
          <el-select
            v-model="checkUser"
            style="width: 200px;"
@@ -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>
@@ -202,7 +212,7 @@
        <div style="display: flex;margin-top: 20px;align-items: center">
          <div style="display: flex;margin-right: 50px;align-items: center">
            <div style="width: 90px">检验结果:</div>
            <div style="width: 90px;display: flex"><div style="color: red;width:10px">*</div>检验结果:</div>
            <el-select
              v-model="checkResult"
              style="width: 200px;"
@@ -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) => {
@@ -455,8 +462,23 @@
    },
    // 提交
    submitButton(val) {
      console.log(val)
      if (val !== 'Cancel') {
        if (this.form.orderstepqrcode.length < 1) {
          return this.$message.info('扫描条码不能为空!')
        }
        if (this.checkStandard.length < 1) {
          return this.$message.info('检验标准不能为空!')
        }
        if (this.checkUser.length < 1) {
          return this.$message.info('检验人员不能为空!')
        }
        if (this.JYTableData.length < 1) {
          return this.$message.info('检验项信息不能为空!')
        }
        if (this.checkResult.length < 1) {
          return this.$message.info('检验结果不能为空!')
        }
        const text = val === 'FirstCheck' ? '首检保存' : (val === 'PatroCheck' ? '巡检保存' : '完工检保存')
        this.$confirm('是否确认' + text + '?', '提示', {
          confirmButtonText: '确定',
@@ -484,12 +506,13 @@
            'checkdescr': this.checkdescr, // 检验描述
            'data': arr
          }
          const res = SaveMesOrderStepCheckItem(data)
          if (res.code === '200') {
            this.$message.success(text + '成功!')
            this.clearContent()
            this.getFocus()
          }
          SaveMesOrderStepCheckItem(data).then(res => {
            if (res.code === '200') {
              this.$message.success(text + '成功!')
              this.clearContent()
              this.getFocus()
            }
          })
        }).catch(() => {
          this.$message.info('已取消保存')
        })
@@ -514,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(() => {