loulijun2021
2022-10-29 e713b378b01d189f972cfb5b9eae749ee95a8b51
src/views/zlgl/gxjy.vue
@@ -16,37 +16,39 @@
            style="width: 300px"
            @keyup.enter.native="val=>enterNative(val,'GXproduceCode')"
          />
          <!--          @keyup.native="e=>judgeIsScanning(e,'GXproduceCode')"-->
        </div>
        <!--        六项信息      -->
        <div v-if="!isIpad" style="background:#f8f8fa ;display:flex;margin-top: 10px;align-items: center; line-height: 50px">
          <div style="display: flex; margin-left: 10px">
            <div style="display: flex;margin-right: 50px">
              <div style="width: 90px">工单编码:</div>
              <div style="width: 200px">{{ form.wo_code }}</div>
              <div style="width: 150px">{{ form.wo_code }}</div>
            </div>
            <div style="display: flex;">
              <div style="width: 90px">产品编码:</div>
              <div style="width: 100px">{{ form.partcode }}</div>
              <div style="width: 150px">{{ form.partcode }}</div>
            </div>
          </div>
          <div style="display: flex;margin-left: 30px;">
            <div style="display: flex;margin-right: 50px">
              <div style="width: 90px">产品名称:</div>
              <div style="width: 200px">{{ form.partname }}</div>
              <div style="width: 150px">{{ form.partname }}</div>
            </div>
            <div style="display: flex;">
              <div style="width: 90px">产品规格:</div>
              <div style="width: 100px">{{ form.partspec }}</div>
              <div style="width: 150px">{{ form.partspec }}</div>
            </div>
          </div>
          <div style=" display: flex;margin-left: 30px;">
            <div style="display: flex;margin-right: 50px">
              <div style="width: 90px">工序编码:</div>
              <div style="width: 100px">{{ form.stepcode }}</div>
              <div style="width: 150px">{{ form.stepcode }}</div>
            </div>
            <div style="display: flex;">
              <div style="width: 90px">工序名称:</div>
              <div style="width: 100px">{{ form.stepname }}</div>
              <div style="width: 150px">{{ form.stepname }}</div>
            </div>
          </div>
        </div>
@@ -356,6 +358,7 @@
  StepCheckItemSelect
} from '@/api/zlgl'
import { MesOrderSelectUser } from '@/api/scgl'
import { getCookie } from '@/utils/auth'
export default {
  name: 'QXDY',
@@ -379,7 +382,7 @@
      },
      checkStandard: '', // 检验标准
      checkStandardSelect: [], // 检验标准下拉数组
      checkUser: '', // 检验人员
      checkUser: getCookie('navTabId'), // 检验人员
      checkqty: 0, // 检验数量
      checkUserSelect: [], // 检验人员下拉数组
      checkResult: '', // 检验结果
@@ -396,7 +399,8 @@
      multipleSelection: [], // 表格多选框
      tabClickIndex: null, // 点击的单元格
      tabClickLabel: '', // 当前点击的列名
      isCancel: false// 是否点击取消按钮
      isCancel: false, // 是否点击取消按钮
      judgeIsScanningArr: []// 判断是否扫码数组
    }
  },
  created() {
@@ -498,6 +502,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]) < 0.1
        if (i > 0 && this.judgeIsScanningArr.length === parseInt(i) + 1) {
          if (flag) {
            this.fnThrottle(this.enterNative, 500, 2000, belong)()
            return
          }
        }
      }
    },
    // 扫码键盘回车事件
    async enterNative(val, belong) {
@@ -666,7 +706,7 @@
      this.JYTableData = []
      this.multipleSelection = []
      this.checkdescr = ''
      this.checkUser = ''
      this.checkUser = getCookie('navTabId')
      this.checkqty = 0
      this.checkResult = ''
      this.checkStandard = ''
@@ -678,6 +718,8 @@
      this.form.stepcode = ''
      this.form.stepname = ''
      this.judgeIsScanningArr = []
      this.isCancel = true
    },