From 99a010f21d278498bafd248217c584e101db2d8f Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期四, 01 九月 2022 17:27:17 +0800
Subject: [PATCH] 1.自动扫码回车功能接入
---
src/views/scgl/sckbg.vue | 132 ++++++++++++++++++++++++++++---------------
1 files changed, 86 insertions(+), 46 deletions(-)
diff --git a/src/views/scgl/sckbg.vue b/src/views/scgl/sckbg.vue
index 0736e29..9ff54a6 100644
--- a/src/views/scgl/sckbg.vue
+++ b/src/views/scgl/sckbg.vue
@@ -7,13 +7,15 @@
<div style="display: flex;align-items: center">
<div style="width: 90px">鎵弿鏉$爜锛�</div>
<!-- oninput="value=value.replace(/[^0-9a-zA-Z;_]/g,'')"-->
-
<el-input
+ id="keyWords"
v-model="form.orderstepqrcode"
name="produceCode"
style="width: 300px"
+ @keyup.native="e=>judgeIsScanning(e,'produceCode')"
@keyup.enter.native="val=>enterNative(val,'produceCode')"
/>
+
</div>
<div v-if="false" style="display: flex;padding-right: 10px">
<el-button @click="ZZstart">
@@ -39,19 +41,6 @@
:cell-style="this.$cellStyle"
@sort-change="sortChange"
>
- <!-- <el-table-column-->
- <!-- width="50"-->
- <!-- fixed-->
- <!-- >-->
- <!-- <template slot-scope="{row}">-->
- <!-- <el-radio-->
- <!-- v-model="radioSelected"-->
- <!-- :label="row.wo"-->
- <!-- style="color: #fff;padding-left: 10px; margin-right: -25px;"-->
- <!-- @change.native="getCurrentRow(row.wo)"-->
- <!-- />-->
- <!-- </template>-->
- <!-- </el-table-column>-->
<el-table-column
prop="RowNum"
width="50"
@@ -212,6 +201,7 @@
v-model="WXform.orderstepqrcode"
name="WXproduceCode"
style="width: 300px"
+ @keyup.native="e=>judgeIsScanning(e,'WXproduceCode')"
@keyup.enter.native="val=>enterNative(val,'WXproduceCode')"
/>
</div>
@@ -239,19 +229,6 @@
:cell-style="this.$cellStyle"
@sort-change="WXsortChange"
>
- <!-- <el-table-column-->
- <!-- width="50"-->
- <!-- fixed-->
- <!-- >-->
- <!-- <template slot-scope="{row}">-->
- <!-- <el-radio-->
- <!-- v-model="radioSelected"-->
- <!-- :label="row.wo_code"-->
- <!-- style="color: #fff;padding-left: 10px; margin-right: -25px;"-->
- <!-- @change.native="getWXCurrentRow(row.wo_code)"-->
- <!-- />-->
- <!-- </template>-->
- <!-- </el-table-column>-->
<el-table-column
prop="RowNum"
width="50"
@@ -399,6 +376,7 @@
v-model="badForm.orderstepqrcode"
name="badProduceCode"
style="width: 300px"
+ @keyup.native="e=>judgeIsScanning(e,'badProduceCode')"
@keyup.enter.native="val=>enterNative(val,'badProduceCode')"
/>
</div>
@@ -1326,23 +1304,37 @@
},
badTableDataDialog: [], // 涓嶈壇瀵硅瘽妗唗able琛ㄦ牸
OperationArr: [], // 浜哄憳鏁扮粍
- sendButtonIsDisabled: false// 涓嬭揪鎸夐挳鏄惁鍙偣鍑�
+ sendButtonIsDisabled: false, // 涓嬭揪鎸夐挳鏄惁鍙偣鍑�
+ judgeIsScanningArr: []// 鍒ゆ柇鏄惁鎵爜鏁扮粍
}
},
- // computed: {
- // qrLink: function() {
- // return this.$store.getters.getPreviewUrl
- // }
- // },
- // watch: {
- // qrLink: function(newVal, oldNew) {
- // if (newVal !== oldNew) {
- // this.$nextTick(() => {
- // this.bindQRCode(newVal)
- // })
- // }
- // }
- // },
+ watch: {
+ // 'form.orderstepqrcode': {
+ // handler(newValue) {
+ // this.form.orderstepqrcode = newValue
+ //
+ // // 鍦ㄨ繖閲岃皟鐢紝骞舵墽琛宼his.fnThrottle(this.search, 500, 2000)();
+ // this.fnThrottle(this.enterNative, 500, 2000, 'produceCode')()
+ // }
+ // },
+ // 'WXform.orderstepqrcode': {
+ // handler(newValue) {
+ // this.form.orderstepqrcode = newValue
+ //
+ // // 鍦ㄨ繖閲岃皟鐢紝骞舵墽琛宼his.fnThrottle(this.search, 500, 2000)();
+ // this.fnThrottle(this.enterNative, 500, 2000, 'WXproduceCode')()
+ // }
+ // },
+ // 'badForm.orderstepqrcode': {
+ // handler(newValue) {
+ // this.form.orderstepqrcode = newValue
+ //
+ // // 鍦ㄨ繖閲岃皟鐢紝骞舵墽琛宼his.fnThrottle(this.search, 500, 2000)();
+ // this.fnThrottle(this.enterNative, 500, 2000, 'badProduceCode')()
+ // }
+ // }
+ },
+
created() {
this.getMesOrderStepSearch()
this.tabClick()
@@ -1361,6 +1353,7 @@
this.getMesOrderSelectUserAll() // 鑾峰彇鎵�鏈変汉鍛�
},
methods: {
+
tableRowClassName({ row, rowIndex }) {
return 'custom-row'
},
@@ -1448,9 +1441,53 @@
})
}
},
+ // 闃叉姈 //鎵爜鐢ㄧ殑鏄槻鎶�
+ 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()
+ if (belong === 'produceCode') {
+ that.enterNative(that.form.orderstepqrcode, belong)
+ }
+ if (belong === 'WXproduceCode') {
+ that.enterNative(that.WXform.orderstepqrcode, belong)
+ }
+ if (belong === 'badProduceCode') {
+ that.enterNative(that.badForm.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) {
- console.log(val, belong)
+ console.log(val, belong, 89898989)
// 寮�宸ワ細code="200" count=0
// 鎶ュ伐锛歝ode="200" count=1
// 鍙戞枡锛歝ode="200" count=2
@@ -1745,6 +1782,10 @@
},
// 瀵硅瘽妗嗗叧闂簨浠�
handleClose() {
+ this.form.orderstepqrcode = ''
+ this.WXform.orderstepqrcode = ''
+ this.badForm.orderstepqrcode = ''
+
this.dialogForm.wo_code = '', // 宸ュ崟缂栧彿
this.dialogForm.partcode = '', // 浜у搧缂栫爜
this.dialogForm.partname = '', // 浜у搧鍚嶇О
@@ -1848,7 +1889,7 @@
if (res.code === '200') {
this.$message.success('鏀舵枡鎴愬姛锛�')
- if (this.dialogForm.nextstepcode !== '') {
+ if (this.dialogForm.nextstepcode === '') {
this.WXprint2(this.OperationArr.find(item => item.usercode === this.dialogForm.operation).username)
this.dialogVisible2 = true
}
@@ -1924,8 +1965,7 @@
if (res.code === '200') {
this.$message.success('鎶ュ伐鎴愬姛锛�')
- console.log(this.dialogForm.nextstepcode, 1)
- if (this.dialogForm.nextstepcode !== '') {
+ if (this.dialogForm.nextstepcode === '') {
this.ZZprint2(this.OperationArr.find(item => item.usercode === this.dialogForm.operation).username)
this.dialogVisible2 = true
}
--
Gitblit v1.9.3