loulijun2021
2022-09-01 99a010f21d278498bafd248217c584e101db2d8f
src/views/zlgl/gxjy.vue
@@ -13,7 +13,9 @@
          <el-input
            v-model="form.orderstepqrcode"
            name="GXproduceCode"
            style="width: 300px"
            @keyup.native="e=>judgeIsScanning(e,'GXproduceCode')"
            @keyup.enter.native="val=>enterNative(val,'GXproduceCode')"
          />
        </div>
@@ -128,7 +130,7 @@
            <div style="color: red;width:10px">*</div>
            检验数量:
          </div>
          <el-input v-model="checkCount" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" />
          <el-input v-model="checkqty" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" />
        </div>
        <!--   检验结果   和  检验备注      -->
@@ -380,7 +382,7 @@
      checkStandard: '', // 检验标准
      checkStandardSelect: [], // 检验标准下拉数组
      checkUser: '', // 检验人员
      checkCount: 0, // 检验数量
      checkqty: 0, // 检验数量
      checkUserSelect: [], // 检验人员下拉数组
      checkResult: '', // 检验结果
      checkResultSelect: [
@@ -396,7 +398,8 @@
      multipleSelection: [], // 表格多选框
      tabClickIndex: null, // 点击的单元格
      tabClickLabel: '', // 当前点击的列名
      isCancel: false// 是否点击取消按钮
      isCancel: false, // 是否点击取消按钮
      judgeIsScanningArr: []// 判断是否扫码数组
    }
  },
  created() {
@@ -498,6 +501,42 @@
      row.code = res.code
      row.name = res.name
      row.stepcheckitem_desc = res.descr
    },
    // 防抖      //扫码用的是防抖
    fnThrottle(method, delay, duration, belong) {
      var that = this
      var timer = this.timer
      var begin = new Date().getTime()
      return function() {
        var current = new Date().getTime()
        clearTimeout(timer)
        if (current - begin >= duration) {
          // method()
          // that.VALUE()
          begin = current
        } else {
          that.timer = setTimeout(function() {
            // method()
            that.enterNative(that.form.orderstepqrcode, belong)
          }, delay)
        }
      }
    },
    // 判断是否是扫码枪扫码
    judgeIsScanning(e, belong) {
      const timenow = e.timeStamp
      let flag = true
      this.judgeIsScanningArr.push(timenow)
      let i
      for (i in this.judgeIsScanningArr) {
        flag = Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 1]) - Math.ceil(this.judgeIsScanningArr[this.judgeIsScanningArr.length - 2]) < 10
        if (i > 0 && this.judgeIsScanningArr.length === parseInt(i) + 1) {
          if (flag) {
            this.fnThrottle(this.enterNative, 500, 2000, belong)()
            return
          }
        }
      }
    },
    // 扫码键盘回车事件
    async enterNative(val, belong) {
@@ -605,7 +644,7 @@
        if (this.checkUser.length < 1) {
          return this.$message.info('检验人员不能为空!')
        }
        if (parseFloat(this.checkCount) > 0) {
        if (parseFloat(this.checkqty) <= 0) {
          return this.$message.info('检验数量必须要大于零!')
        }
        if (this.JYTableData.length < 1) {
@@ -622,6 +661,7 @@
          type: 'warning'
        }).then(() => {
          const arr = []
          this.JYTableData = this.JYTableData.filter(item => item.code !== '')
          this.JYTableData.forEach((item, index) => {
            arr.push({
              code: item.code,
@@ -637,6 +677,7 @@
            'stepcode': this.form.stepcode, // 工序编码
            'checkstanedcode': this.checkStandard, // 检验标准编码
            'checkusercode': this.checkUser, // 检验人员编码
            'checkqty': this.checkqty, // 检验数量
            'checktypecode': val, // 检验类型编码
            'checkresult': this.checkResult, // 检验结果(OK(合格) NG(不良))
            'checkdescr': this.checkdescr, // 检验描述
@@ -665,7 +706,7 @@
      this.multipleSelection = []
      this.checkdescr = ''
      this.checkUser = ''
      this.checkCount = 0
      this.checkqty = 0
      this.checkResult = ''
      this.checkStandard = ''
      this.form.orderstepqrcode = ''