From 02f278480f7cdf0c31182e5550d38c2c1e6808b0 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期四, 27 六月 2024 08:50:02 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override
---
north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 53 insertions(+), 5 deletions(-)
diff --git a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
index 8517983..d066014 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
@@ -1,5 +1,5 @@
<script setup>
-import {computed, nextTick, onMounted, reactive, ref, toRefs} from "vue";
+import {computed, nextTick, onMounted, onUnmounted, reactive, ref, toRefs} from "vue";
import {useRouter,useRoute} from 'vue-router'
import request from "@/utils/request";
import {ElMessage} from "element-plus";
@@ -82,10 +82,7 @@
})
-/*onMounted(() => {
- //鍚敤琛ㄦ牸鎷栧姩閫変腑
- addListener(xGrid.value, gridOptions)
-})*/
+
let inputDisabled = ref(false)
onMounted(() =>{
@@ -1050,6 +1047,57 @@
const $grid = xGrid.value
this.$grid.commitProxy('data', yourData)
}
+onMounted(() => {
+ window.addEventListener('keypress', qrcodeScanner);
+})
+
+// 鍦ㄧ粍浠跺嵏杞芥椂绉婚櫎閿洏浜嬩欢鐩戝惉
+onUnmounted(() => {
+ window.removeEventListener('keypress', qrcodeScanner);
+})
+
+let code = '';
+let codeArr = [];
+let lastTime,nextTime = ''
+let lastCode,nextCode = ''
+const qrcodeScanner = (e) =>{
+
+ nextCode = e.key;
+
+
+ // 褰撳墠瑙﹀彂鏃堕棿
+ nextTime = new Date().getTime();
+ // 绗竴娆¤幏鍙�
+ if(!lastTime && !lastCode && e.key !== 'Enter'){
+ codeArr = []
+ codeArr.push(e.key)
+ }
+
+ if(lastCode && lastTime && (nextTime - lastTime > 50)){
+ // 鐩搁殧鏃堕棿澶т簬30 璇存槑涓嶆槸鎵爜鏋壂鎻忕殑 娓呯┖閲嶆柊
+ codeArr = []
+ // 褰撴壂鐮佸墠鏈塳eypress浜嬩欢鏃�,闃叉棣栧瓧缂哄け
+ } else if(lastCode && lastTime && e.key !== 'Enter'){
+ codeArr.push(e.key)
+ }
+ lastCode = nextCode
+ lastTime = nextTime
+ // 鎵弿缁撴潫
+ if(e.keyCode === 13){
+ // 鍙繘琛屼笅涓�姝ユ搷浣�
+ /* 涓嬩竴姝ユ搷浣� */
+ if(codeArr.length!==0){
+ titleUploadData.value.processId = codeArr.join('')
+ }
+
+ codeArr=[]
+ lastTime = ''
+ nextTime = ''
+ lastCode = ''
+ nextCode = ''
+ }
+
+}
</script>
--
Gitblit v1.8.0