From 0b14225915932f0f5c88bc3e44302bf1c309de1a Mon Sep 17 00:00:00 2001
From: yyt <306727702@qq.com>
Date: 星期一, 19 二月 2024 04:23:38 +0800
Subject: [PATCH] CVT看板介面,新增SNCode写入功能,扫码功能更新.

---
 jcdm-ui/src/views/main/kb/cvt/index.vue |   50 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/jcdm-ui/src/views/main/kb/cvt/index.vue b/jcdm-ui/src/views/main/kb/cvt/index.vue
index fe2341d..af3c07e 100644
--- a/jcdm-ui/src/views/main/kb/cvt/index.vue
+++ b/jcdm-ui/src/views/main/kb/cvt/index.vue
@@ -27,7 +27,7 @@
              <el-form ref="form" :model="form"  label-width="25%"   >
                <el-form-item prop="engineNo" style="margin-top: 16px">
       	     <span slot="label" style="font-size:22px;color:black;"><strong>鍙戝姩鏈哄彿</strong></span>
-                 <el-input style="font-size:20px" v-model="form.engineNo" placeholder="璇疯緭鍏ュ彂鍔ㄦ満鍙�" clearable  @keyup.enter.native="EngineNohandleChange">
+                 <el-input style="font-size:20px" v-model="form.engineNo" placeholder="璇疯緭鍏ュ彂鍔ㄦ満鍙�" clearable  @input="EngineNohandleChange">
                    <el-button slot="append" plain type="info" @click="EngineNohandleChange" icon="el-icon-search"></el-button>
                  </el-input>
                </el-form-item>
@@ -80,6 +80,7 @@
 import { listOrderScheduling, getOrderScheduling, delOrderScheduling, addOrderScheduling, updateOrderScheduling } from "@/api/main/bs/orderScheduling/orderScheduling";
 import { listPassingStationCollection, getPassingStationCollection, delPassingStationCollection, addPassingStationCollection, updatePassingStationCollection } from "@/api/main/da/passingStationCollection/passingStationCollection";
 import {listLineInfo} from "@/api/main/bs/lineInfo/lineInfo";
+import { setSNCode } from "@/api/main/da/opcuaconfig/opcuaconfig";
 import {getIp, listStationConf} from "@/api/main/sc/stationConf";
 
 export default {
@@ -95,6 +96,15 @@
       buttondisabled:true,
       locationCode: "鏈厤缃�",
       locationName: "鏈厤缃伐浣�",
+
+      codeValue: "",
+      code: "",
+      lastTime: "",
+      nextTime: "",
+      lastCode: "",
+      nextCode: "",
+      dtmainId: "",
+
       // 鏌ヨ鍙傛暟
       queryParams: {
         pageNum: 1,
@@ -122,7 +132,36 @@
   },
   computed: {},
   watch: {},
-  created() {},
+  created() {
+    window.document.onkeypress = (e) => {
+      if (window.event) {
+        this.nextCode = e.keyCode;
+      } else if (e.which) {
+        this.nextCode = e.which;
+      }
+      if (e.which === 13) {
+        // 閿洏鍥炶溅浜嬩欢
+        if (this.code.length < 3) return; // 鎵爜鏋殑閫熷害寰堝揩锛屾墜鍔ㄨ緭鍏ョ殑鏃堕棿涓嶄細璁ヽode鐨勯暱搴﹀ぇ浜�2锛屾墍浠ヨ繖閲屼笉浼氬鎵爜鏋湁鏁�
+        this.parseQRCode(this.code); // 鑾峰彇鍒版壂鐮佹灙杈撳叆鐨勫唴瀹癸紝鍋氬埆鐨勬搷浣�
+        this.lastCode = "";
+        this.lastTime = "";
+        return;
+      }
+      this.nextTime = new Date().getTime();
+      if (!this.lastTime && !this.lastCode) {
+        this.code = ""; // 娓呯┖涓婃鐨勬潯褰㈢爜
+        this.code += e.key;
+      }
+      if (this.lastCode && this.lastTime && this.nextTime - this.lastTime > 500) {
+        // 褰撴壂鐮佸墠鏈塳eypress浜嬩欢鏃�,闃叉棣栧瓧缂哄け
+        this.code = e.key;
+      } else if (this.lastCode && this.lastTime) {
+        this.code += e.key;
+      }
+      this.lastCode = this.nextCode;
+      this.lastTime = this.nextTime;
+    };
+  },
   mounted() {
     this.getStationConf();
   },
@@ -154,7 +193,8 @@
     },
     EngineNohandleChange(){
       if(this.form.engineNo !== null && this.form.engineNo !== undefined){
-        let OrderSchedulingParam = {engineNo: null}
+        //let OrderSchedulingParam = {engineNo: null}
+        setSNCode(this.form.engineNo,this.locationCode)
         //OrderSchedulingParam.engineNo = this.form.engineNo;
      /*   listOrderScheduling(OrderSchedulingParam).then(response => {
           if(response.total === 1 ){
@@ -202,7 +242,9 @@
       }
     },
 
-
+    parseQRCode(code) {
+      this.form.engineNo = code;
+    },
   },
   }
 

--
Gitblit v1.9.3