From a5a49ece3191bf8210c42b522503687cedb420c2 Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期二, 26 十二月 2023 16:55:40 +0800
Subject: [PATCH] 修改input通过光标焦点是否在input内控制是否更新数据,回车下发参数让input失去焦点更新数据

---
 CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue                          |   38 +++--
 springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java |    5 
 CanadaMes-ui/src/views/Electrical/Positioning1.vue                                |   30 ++-
 springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java  |   34 ++--
 CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue                   |  167 ++++++++++++-----------
 CanadaMes-ui/src/views/Electrical/ManualonePosition.vue                           |   53 ++++---
 CanadaMes-ui/src/views/Electrical/Parameter2.vue                                  |   33 ++--
 CanadaMes-ui/src/lang/locales/en-US.json                                          |    6 
 CanadaMes-ui/src/views/Electrical/ServoManualone.vue                              |   35 ++--
 springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java       |    7 
 CanadaMes-ui/src/layout/index.vue                                                 |    6 
 11 files changed, 225 insertions(+), 189 deletions(-)

diff --git a/CanadaMes-ui/src/lang/locales/en-US.json b/CanadaMes-ui/src/lang/locales/en-US.json
index 72526fd..54a8dee 100644
--- a/CanadaMes-ui/src/lang/locales/en-US.json
+++ b/CanadaMes-ui/src/lang/locales/en-US.json
@@ -375,9 +375,9 @@
           "D01鎵嬪姩鐘舵��": "D01 Manual Status",
           "娓呴櫎ID": "Clear ID",
           "ID": "ID",
-          "A02ID": "ID",
-          "B01ID": "ID",
-          "B02ID": "ID",
+          "A02ID": "A02ID",
+          "B01ID": "B01ID",
+          "B02ID": "B02ID",
           "D02鎵嬪姩鐘舵��": "D02 Manual Status",
           "D03鎵嬪姩鐘舵��": "D03 Manual Status",
           "D04鎵嬪姩鐘舵��": "D04 Manual Status",
diff --git a/CanadaMes-ui/src/layout/index.vue b/CanadaMes-ui/src/layout/index.vue
index 7a0c9e5..cf312f9 100644
--- a/CanadaMes-ui/src/layout/index.vue
+++ b/CanadaMes-ui/src/layout/index.vue
@@ -258,12 +258,9 @@
 
           
           
-          this.$forceUpdate();
+         
 
 if(obj.Abort){
-
-
-
 
           if (obj.Abort[0].length > 0) {
             this.receivedData=obj.Abort[0][0];
@@ -271,6 +268,7 @@
            this.dialogFormVisible3 = true;
           }
         }
+        this.$forceUpdate();
 
         }.bind(this);
         //鍏抽棴浜嬩欢
diff --git a/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue b/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
index 360f01a..c1831cb 100644
--- a/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
+++ b/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
@@ -64,7 +64,7 @@
             v-model="item.value"
             class="input-box"
             :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"
-            @keyup.enter.native="submitDataToBackend">
+            @keyup.enter.native="submitDataToBackend($event)">
   </el-input>
 
   <!-- <el-input v-if="item.type === '0'"
@@ -114,6 +114,7 @@
 
 
   },
+ 
   methods: {
     closeSocket () {
       // 鍏抽棴 WebSocket 杩炴帴
@@ -155,7 +156,7 @@
       const jsonString = JSON.stringify(jsonObject);
       console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
       socket?.send(jsonString);
-
+      event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
 
     },
     initWebSocket () {
@@ -181,109 +182,117 @@
         };
 
         // 鏀跺埌娑堟伅
-        let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
+//         let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
 
-const inputBox = document.querySelectorAll('.input-box');
-inputBox.forEach(box => {
-  box.addEventListener('mouseenter', () => {
-    isMouseInInputBox = true;
-  });
-  box.addEventListener('mouseleave', () => {
-    isMouseInInputBox = false;
-  });
-});
+// const inputBox = document.querySelectorAll('.input-box');
+// inputBox.forEach(box => {
+//   box.addEventListener('mouseenter', () => {
+//     isMouseInInputBox = true;
+//   });
+//   box.addEventListener('mouseleave', () => {
+//     isMouseInInputBox = false;
+//   });
+// });
 
 socket.onmessage = (msg) => {
   if (!msg.data) {
     return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
   }
 
+  // 娣诲姞鍒ゆ柇鏉′欢锛氬鏋滃厜鏍囧湪杈撳叆妗嗗唴锛屽垯涓嶆墽琛屽悗缁�昏緫
+  if (document.activeElement.tagName.toLowerCase() === 'input') {
+    return;
+  }
+ 
+
   let obj = JSON.parse(msg.data);
+  
   const jsonData2 = this.jsonData;
 
   const parms = obj.params;
-      const fanzhuan = obj.fanzhuan;
-      const xiaoche = obj.xiaoche;
-      const dache = obj.dache1;
+  const fanzhuan = obj.fanzhuan;
+  const xiaoche = obj.xiaoche;
+  const dache = obj.dache1;
 
-      const parms2 = obj.params2;
-      const fanzhuan2 = obj.fanzhuan2;
-      const xiaoche2 = obj.xiaoche2;
+  const parms2 = obj.params2;
+  const fanzhuan2 = obj.fanzhuan2;
+  const xiaoche2 = obj.xiaoche2;
 
-  if(parms && !isMouseInInputBox){
-     
+  if(parms){
+    let index = 0;
+    for (let i = 0; i < jsonData2.length - 1; i++) {
+      let arr = jsonData2[i];
 
-      let index = 0;
-      for (let i = 0; i < jsonData2.length - 1; i++) {
-        let arr = jsonData2[i];
-
-        for (let j = 0; j < arr.length; j++) {
-          let obj = arr[j];
-          if (obj.type === '0' && Object.prototype.hasOwnProperty.call(obj, 'value')) {
-            if (Array.isArray(parms) && Array.isArray(parms[0]) && parms[0][index] !== undefined) {
-              obj.value = parms[0][index];
-              index++;
-            }
+      for (let j = 0; j < arr.length; j++) {
+        let obj = arr[j];
+        if (obj.type === '0' && Object.prototype.hasOwnProperty.call(obj, 'value')) {
+          if (Array.isArray(parms) && Array.isArray(parms[0]) && parms[0][index] !== undefined) {
+            obj.value = parms[0][index];
+            index++;
           }
         }
-      }
-      if (Array.isArray(fanzhuan) && Array.isArray(fanzhuan[0]) && fanzhuan[0][0] !== undefined) {
-        jsonData2[4][0]['value'] = fanzhuan[0][0];
-      }
-      if (Array.isArray(xiaoche) && Array.isArray(xiaoche[0]) && xiaoche[0][0] !== undefined) {
-        jsonData2[3][0]['value'] = xiaoche[0][0];
-      }
-      if (Array.isArray(dache) && Array.isArray(dache[0]) && dache[0][0] !== undefined) {
-        jsonData2[2][0]['value'] = dache[0][0];
-      }
-
-      let index2 = 0;
-      for (let i = 5; i < jsonData2.length; i++) {
-        let arr2 = jsonData2[i];
-
-        for (let j = 0; j < arr2.length; j++) {
-          let obj2 = arr2[j];
-          if (obj2.type === '0' && Object.prototype.hasOwnProperty.call(obj2, 'value')) {
-            if (Array.isArray(parms2) && Array.isArray(parms2[0]) && parms2[0][index2] !== undefined) {
-              obj2.value = parms2[0][index2];
-              index2++;
-            }
-          }
-        }
-      }
-
-     
-              for (let i = 0; i < jsonData2.length; i++) {
-                let arr = jsonData2[i];
-
-                for (let j = 0; j < arr.length; j++) {
-                  let obj = arr[j];
-                  if (obj.type === '0' && Object.prototype.hasOwnProperty.call(obj, 'value')) {
-                    if (Array.isArray(parms) && Array.isArray(parms[0]) && parms[0][index] !== undefined) {
-                      obj.value = parms[0][index];
-                      index++;
-                    }
-                  }
-                }
-              }
-      
-      if (Array.isArray(fanzhuan2) && Array.isArray(fanzhuan2[0]) && fanzhuan2[0][0] !== undefined) {
-        jsonData2[8][0]['value'] = fanzhuan2[0][0];
-      }
-
-      if (Array.isArray(xiaoche2) && Array.isArray(xiaoche2[0]) && xiaoche2[0][0] !== undefined) {
-        jsonData2[9][0]['value'] = xiaoche2[0][0];
       }
     }
-  
 
+    if (Array.isArray(fanzhuan) && Array.isArray(fanzhuan[0]) && fanzhuan[0][0] !== undefined) {
+      jsonData2[4][0]['value'] = fanzhuan[0][0];
+    }
+    if (Array.isArray(xiaoche) && Array.isArray(xiaoche[0]) && xiaoche[0][0] !== undefined) {
+      jsonData2[3][0]['value'] = xiaoche[0][0];
+    }
+    if (Array.isArray(dache) && Array.isArray(dache[0]) && dache[0][0] !== undefined) {
+      jsonData2[2][0]['value'] = dache[0][0];
+    }
 
+    let index2 = 0;
+    for (let i = 5; i < jsonData2.length; i++) {
+      let arr2 = jsonData2[i];
+
+      for (let j = 0; j < arr2.length; j++) {
+        let obj2 = arr2[j];
+        if (obj2.type === '0' && Object.prototype.hasOwnProperty.call(obj2, 'value')) {
+          if (Array.isArray(parms2) && Array.isArray(parms2[0]) && parms2[0][index2] !== undefined) {
+            obj2.value = parms2[0][index2];
+            index2++;
+          }
+        }
+      }
+    }
+
+    // // 娣诲姞鍒ゆ柇鏉′欢锛氬鏋滃厜鏍囧湪杈撳叆妗嗗唴锛屽垯涓嶆墽琛屽悗缁�昏緫
+    // if (document.activeElement.tagName.toLowerCase() === 'input') {
+    //   return;
+    // }
+
+    for (let i = 0; i < jsonData2.length; i++) {
+      let arr = jsonData2[i];
+
+      for (let j = 0; j < arr.length; j++) {
+        let obj = arr[j];
+        if (obj.type === '0' && Object.prototype.hasOwnProperty.call(obj, 'value')) {
+          if (Array.isArray(parms) && Array.isArray(parms[0]) && parms[0][index] !== undefined) {
+            obj.value = parms[0][index];
+            index++;
+          }
+        }
+      }
+    }
+
+    if (Array.isArray(fanzhuan2) && Array.isArray(fanzhuan2[0]) && fanzhuan2[0][0] !== undefined) {
+      jsonData2[8][0]['value'] = fanzhuan2[0][0];
+    }
+
+    if (Array.isArray(xiaoche2) && Array.isArray(xiaoche2[0]) && xiaoche2[0][0] !== undefined) {
+      jsonData2[9][0]['value'] = xiaoche2[0][0];
+    }
+  }
 };
 
 
 
 
 
+
         // 鍏抽棴浜嬩欢
         socket.onclose = function () {
           console.log("websocket宸插叧闂�");
diff --git a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
index b43fd36..8d15a80 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
@@ -58,16 +58,16 @@
                 <el-input style="width:250px;"  v-if="item.state != 0 && item.type === '0' && groupIndex === 0 && (itemIndex === 2)"  readonly v-model="item.value"  
                 class="input-box"  :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"   ></el-input>
 
-                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 0 "  v-model="item.value"  @keyup.enter.native="A01start"
+                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 0 "  v-model="item.value"  @keyup.enter.native="A01start($event)"
                 class="input-box"   :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"  ></el-input>
                 <el-input style="width: 250px;" v-else-if="(item.state !== 0) && (item.type === '0') && (itemIndex === 2)" v-model="item.value" readonly class="input-box"   ></el-input>
 
                 
-                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 1" v-model="item.value"  @keyup.enter.native="A02start"
+                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 1" v-model="item.value"  @keyup.enter.native="A02start($event)"
                 class="input-box"  :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"  ></el-input>
-                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 2" v-model="item.value"  @keyup.enter.native="B01start"
+                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 2" v-model="item.value"  @keyup.enter.native="B01start($event)"
                 class="input-box"  :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"  ></el-input>
-                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 3" v-model="item.value"  @keyup.enter.native="B02start"
+                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 3" v-model="item.value"  @keyup.enter.native="B02start($event)"
                 class="input-box"    :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></el-input>
                 <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0'" v-model="item.value"
                 class="input-box"    :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></el-input>
@@ -151,7 +151,7 @@
 
 
     },
-    A01start(){
+    A01start(event){
 
       const data = [];
 
@@ -190,9 +190,9 @@
 const jsonString = JSON.stringify(jsonObject);
 console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
 socket?.send(jsonString);
-
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
-    A02start(){
+    A02start(event){
       const data = [];
 
 for (let i = 1; i < 2; i++) {
@@ -223,9 +223,9 @@
 const jsonString = JSON.stringify(jsonObject);
 console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
 socket?.send(jsonString);
-
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
-    B01start(){
+    B01start(event){
       const data = [];
 
 for (let i = 2; i < 3; i++) {
@@ -248,9 +248,9 @@
 const jsonString = JSON.stringify(jsonObject);
 console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
 socket?.send(jsonString);
-
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
-    B02start(){
+    B02start(event){
       const data = [];
 
 for (let i = 3; i < 4; i++) {
@@ -283,7 +283,7 @@
 const jsonString = JSON.stringify(jsonObject);
 console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
 socket?.send(jsonString);
-
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
     submitDataToBackend (currentButtonName) {
       if (currentButtonName === 'A01鍚姩' || currentButtonName === 'A01 Start') {
@@ -440,7 +440,7 @@
       }
 
 
-
+    
 
     },
 
@@ -467,21 +467,26 @@
         };
 
         // 鏀跺埌娑堟伅
-        let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
+//         let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
 
-const inputBox = document.querySelectorAll('.input-box');
-inputBox.forEach(box => {
-  box.addEventListener('mouseenter', () => {
-    isMouseInInputBox = true;
-  });
-  box.addEventListener('mouseleave', () => {
-    isMouseInInputBox = false;
-  });
-});
+// const inputBox = document.querySelectorAll('.input-box');
+// inputBox.forEach(box => {
+//   box.addEventListener('mouseenter', () => {
+//     isMouseInInputBox = true;
+//   });
+//   box.addEventListener('mouseleave', () => {
+//     isMouseInInputBox = false;
+//   });
+// });
 
 socket.onmessage = (msg) => {
   if (!msg.data) {
     return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+  }
+
+   // 娣诲姞鍒ゆ柇鏉′欢锛氬鏋滃厜鏍囧湪杈撳叆妗嗗唴锛屽垯涓嶆墽琛屽悗缁�昏緫
+   if (document.activeElement.tagName.toLowerCase() === 'input') {
+    return;
   }
 
           let obj = JSON.parse(msg.data);
@@ -489,7 +494,7 @@
           const weihuiling = obj.weihuiling;
 
 
-  if(obj.zuhe1&& !isMouseInInputBox){
+  if(obj.zuhe1){
 
 // console.log(obj);
   
diff --git a/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue b/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
index 938c04f..636b9d0 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
@@ -51,11 +51,11 @@
                 <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 1 && (itemIndex === 2)"  readonly v-model="item.value"
                 class="input-box"   :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"></el-input>
 
-                <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 0 "   v-model="item.value"  @keyup.enter.native="A01start"
+                <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 0 "   v-model="item.value"  @keyup.enter.native="A01start($event)"
                 class="input-box"   :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"></el-input>
 
 
-                <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 1 "  v-model="item.value" @keyup.enter.native="A02start"
+                <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 1 "  v-model="item.value" @keyup.enter.native="A02start($event)"
                 class="input-box"   :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"></el-input>
 
 
@@ -133,7 +133,7 @@
     },
 
 
-    A01start(){
+    A01start(event){
       const data = [];
 
 for (let i = 0; i < 1; i++) {
@@ -155,10 +155,10 @@
 const jsonString = JSON.stringify(jsonObject);
 console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
 socket?.send(jsonString);
-
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
 
     },
-    A02start(){
+    A02start(event){
 
       const data = [];
 
@@ -180,6 +180,7 @@
 const jsonString = JSON.stringify(jsonObject);
 console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
 socket?.send(jsonString);
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
     //鎻愪氦鏂规硶
     submitDataToBackend (currentButtonName) {
@@ -318,22 +319,27 @@
         };
 
         // 鏀跺埌娑堟伅
-        let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
+//         let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
 
-const inputBox = document.querySelectorAll('.input-box');
-inputBox.forEach(box => {
-  box.addEventListener('mouseenter', () => {
-    isMouseInInputBox = true;
-  });
-  box.addEventListener('mouseleave', () => {
-    isMouseInInputBox = false;
-  });
-});
+// const inputBox = document.querySelectorAll('.input-box');
+// inputBox.forEach(box => {
+//   box.addEventListener('mouseenter', () => {
+//     isMouseInInputBox = true;
+//   });
+//   box.addEventListener('mouseleave', () => {
+//     isMouseInInputBox = false;
+//   });
+// });
 
 socket.onmessage = (msg) => {
   if (!msg.data) {
     return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
   }
+
+  if (document.activeElement.tagName.toLowerCase() === 'input') {
+    return;
+  }
+
 
           let obj = JSON.parse(msg.data);
           // console.log(obj)
@@ -343,7 +349,7 @@
 
 
             
-            if (obj.zuhe1&& !isMouseInInputBox ) {
+            if (obj.zuhe1 ) {
               // 鎵ц鏇存柊閫昏緫
               for (let i = 0; i < 2; i++) {
                 jsonData2[i].forEach((item, index) => {
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter2.vue b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
index ea91310..5542c24 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter2.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
@@ -186,7 +186,7 @@
   <el-input
                 v-if="item.type === '0' && groupIndex==15"
                 v-model="item.value"
-                @keyup.enter.native="timeout"
+                @keyup.enter.native="timeout($event)"
                 style="width: 300px"
                 class="input-box2"
               ></el-input>
@@ -274,7 +274,7 @@
       }
     },
     //鑼冨洿 0-100
-    timeout(){
+    timeout(event){
 
     
         const data3 = [];
@@ -306,7 +306,7 @@
         // setTimeout(()=>
         //   window.location.reload(),2000
         // )
-      
+        event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
 
 
@@ -396,22 +396,25 @@
         socket.onopen = function () {
           console.log("websocket宸叉墦寮�");
         };
-        let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
+//         let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
         let isUpdated = false;  // 瀹氫箟鏍囧織鍙橀噺
-const inputBox = document.querySelectorAll('.input-box2');
-inputBox.forEach(box => {
-  box.addEventListener('mouseenter', () => {
-    isMouseInInputBox = true;
-  });
-  box.addEventListener('mouseleave', () => {
-    isMouseInInputBox = false;
-  });
-});
+// const inputBox = document.querySelectorAll('.input-box2');
+// inputBox.forEach(box => {
+//   box.addEventListener('mouseenter', () => {
+//     isMouseInInputBox = true;
+//   });
+//   box.addEventListener('mouseleave', () => {
+//     isMouseInInputBox = false;
+//   });
+// });
         // 鏀跺埌娑堟伅
         socket.onmessage = (msg) => {
           if (!msg.data) {
             return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
           }
+          if (document.activeElement.tagName.toLowerCase() === 'input') {
+    return;
+  }
 
           let obj = JSON.parse(msg.data);
 
@@ -425,7 +428,7 @@
           // const inputBox = document.querySelectorAll('.id');
           // const target = event.target;
 
-          if (parms && !isMouseInInputBox) {
+          if (parms ) {
             //鎬ュ仠鎸夐挳
             jsonData2[13][0].button.value = obj.jiting[0][0];
             jsonData2[14][0].button.value = obj.jiting[0][1];
@@ -505,6 +508,8 @@
                 }
               }
             }
+            this.$forceUpdate();
+
             //鎵弿鏋壂鐮佺殑ID
 
             jsonData2.forEach((item) => {
diff --git a/CanadaMes-ui/src/views/Electrical/Positioning1.vue b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
index 85e73be..7b46cad 100644
--- a/CanadaMes-ui/src/views/Electrical/Positioning1.vue
+++ b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
@@ -137,7 +137,7 @@
                 v-if="item.type === '0'"
                 v-model="item.value"
                 class="input-box"  :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"
-                @keyup.enter.native="submitDataToBackend"
+                @keyup.enter.native="submitDataToBackend($event)"
               ></el-input>
               <span v-if="item.unit" :name="item.unit">{{ item.unit }}</span>
 
@@ -180,7 +180,7 @@
       this.$set(dataGroup[itemIndex].button, "value", 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
     },
     //鎻愪氦鏁版嵁鍒板悗绔�
-    submitDataToBackend() {
+    submitDataToBackend(event) {
       const inputData = this.jsonData.map((dataGroup) => {
         return dataGroup.map((item) => {
           if (item.type === "0") {
@@ -208,6 +208,7 @@
       const jsonString = JSON.stringify(jsonObject);
        console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
       socket?.send(jsonString);
+      event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
     initWebSocket() {
       let viewname = "Positioning1";
@@ -236,21 +237,24 @@
         };
 
         // 鏀跺埌娑堟伅
-        let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
+//         let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
 
-const inputBox = document.querySelectorAll('.input-box');
-inputBox.forEach(box => {
-  box.addEventListener('mouseenter', () => {
-    isMouseInInputBox = true;
-  });
-  box.addEventListener('mouseleave', () => {
-    isMouseInInputBox = false;
-  });
-});
+// const inputBox = document.querySelectorAll('.input-box');
+// inputBox.forEach(box => {
+//   box.addEventListener('mouseenter', () => {
+//     isMouseInInputBox = true;
+//   });
+//   box.addEventListener('mouseleave', () => {
+//     isMouseInInputBox = false;
+//   });
+// });
 
 socket.onmessage = (msg) => {
   if (!msg.data) {
     return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+  }
+  if (document.activeElement.tagName.toLowerCase() === 'input') {
+    return;
   }
 
   let obj = JSON.parse(msg.data);
@@ -258,7 +262,7 @@
 
   const parms = obj.params;
 
-  if(parms && !isMouseInInputBox){ // 鍙湁鍦ㄩ紶鏍囦笉鍦ㄨ緭鍏ユ鍐呮椂鎵嶆洿鏂版暟鎹�
+  if(parms ){ // 鍙湁鍦ㄩ紶鏍囦笉鍦ㄨ緭鍏ユ鍐呮椂鎵嶆洿鏂版暟鎹�
   //  console.log(parms)
    
     let index = 0;
diff --git a/CanadaMes-ui/src/views/Electrical/ServoManualone.vue b/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
index 8eb562a..e2acb21 100644
--- a/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
+++ b/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
@@ -116,7 +116,7 @@
                   <el-input
                     v-if="item.type === '0' && groupIndex === 0"
                     v-model="item.value"
-                    @keyup.enter.native="zuhe1"
+                    @keyup.enter.native="zuhe1($event)"
                     class="input-box"
                     :class="{
                       'special-class': groupIndex === 0,
@@ -127,7 +127,7 @@
                   <el-input
                     v-else-if="item.type === '0' && groupIndex === 1"
                     v-model="item.value"
-                    @keyup.enter.native="zuhe2"
+                    @keyup.enter.native="zuhe2($event)"
                     class="input-box"
                     :class="{
                       'special-class': groupIndex === 0,
@@ -317,7 +317,7 @@
         this.$set(dataGroup[itemIndex].button, "value", 1);
       }
     },
-    zuhe1() {
+    zuhe1(event) {
       const data = [];
 
       for (let i = 0; i < 1; i++) {
@@ -387,8 +387,9 @@
       const jsonString = JSON.stringify(jsonObject);
       console.log("鎵�鏈塗ype涓�0鐨剉alue:", jsonString);
       socket?.send(jsonString);
+      event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
-    zuhe2() {
+    zuhe2(event) {
       const data2 = [];
 
       for (let i = 1; i < 2; i++) {
@@ -453,6 +454,7 @@
       const jsonString = JSON.stringify(jsonObject);
       console.log("鎵�鏈塗ype涓�0鐨剉alue:", jsonString);
       socket?.send(jsonString);
+      event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
     submitDataToBackend(currentButtonName) {
       const data = [];
@@ -682,17 +684,17 @@
           console.log("websocket宸叉墦寮�");
         };
 
-        let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
+        // let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
 
-        const inputBox = document.querySelectorAll(".input-box");
-        inputBox.forEach((box) => {
-          box.addEventListener("mouseenter", () => {
-            isMouseInInputBox = true;
-          });
-          box.addEventListener("mouseleave", () => {
-            isMouseInInputBox = false;
-          });
-        });
+        // const inputBox = document.querySelectorAll(".input-box");
+        // inputBox.forEach((box) => {
+        //   box.addEventListener("mouseenter", () => {
+        //     isMouseInInputBox = true;
+        //   });
+        //   box.addEventListener("mouseleave", () => {
+        //     isMouseInInputBox = false;
+        //   });
+        // });
 
         socket.onmessage = (msg) => {
           if (!msg.data) {
@@ -703,8 +705,11 @@
           // console.log(obj)
           const weihuiling = obj.weihuiling;
           const jsonData2 = this.jsonData;
+          if (document.activeElement.tagName.toLowerCase() === 'input') {
+    return;
+  }
 
-          if (obj.zuhe1 && !isMouseInInputBox) {
+          if (obj.zuhe1 ) {
             //鍚姩鎸夐挳
 
             // 鎵ц鏇存柊閫昏緫
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java
index 92ed72d..e48d3c0 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java
@@ -49,7 +49,7 @@
             List<String> addressList1 = Arrays.asList(config.getProperty("Parameter2.id").split(","));
 
             List<String> paramlist = S7control.getinstance().readStrings(addressList1);
-
+           // System.out.println("addressList锛�" + paramlist);
 
             //鎵嬪姩鐘舵��
             List<String> addresses = Arrays.asList(config.getProperty("Parameter2.state").split(","));
@@ -215,7 +215,7 @@
                                             }
                                         }
                                     }
-                                 }
+
                                     }
                                     // 妫�鏌ュ竷灏斿�煎垪琛ㄦ槸鍚︿负绌�
                                     if (!sValue.isEmpty()) {
@@ -224,6 +224,7 @@
                                         S7control.getinstance().WriteBit(addressList0, sValue);
                                         System.out.println("Values " + sValue + " written to PLC at address " + addressList0);
                                     }
+                                    }
                                 }
                             } catch (Exception e) {
                                 System.err.println("An error occurred while writing bit to PLC: " + e.getMessage());
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
index 0cae2f5..bbff53e 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -174,7 +174,10 @@
             //缁堟缁х画鎸夐挳
             List<String> niuanaddressList3 = Arrays.asList(config.getProperty("Parameter2.stop").split(","));
             List<Boolean> anniuread = S7control.getinstance().readBits(niuanaddressList3);
-
+//            Boolean[] value4 = { false, false};
+//    List<Boolean> anniuread = new ArrayList<>(Arrays.asList(value4));
+//            Boolean[] value5 = { true};
+//            List<Boolean> resets = new ArrayList<>(Arrays.asList(value5));
             short[] anniuparams = new short[anniuread.size()];
             for (int i = 0; i < anniuread.size(); i++) {
                 boolean value = anniuread.get(i);
@@ -188,7 +191,7 @@
                 resets2[i] = value ? (short) 1 : (short) 0;
             }
 
-//            System.out.println(resets);
+           System.out.println(resets);
             for (short number : resets2) {
 
                 if (number == 1) {
diff --git a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
index a7a0260..8fc312a 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
@@ -19,22 +19,22 @@
 
  //new PlcHold().start();
 
-        new Plchome().start();
-
-           new Plcalarm().start();
-
-           new Plcsign().start();
-
-
-           new Plcstate().start();
-           new PlcPositioning1().start();
-
-          new PlcParameter2().start();
-
-           new PLCAutomaticParameterSetting().start();
-           new PlcManualonePosition().start();
-           new PlcManualonePosition2().start();
-           new PlcServoManualone().start();
-           new PLCManualJog().start();
+//        new Plchome().start();
+//
+//           new Plcalarm().start();
+//
+//           new Plcsign().start();
+//
+//
+//           new Plcstate().start();
+//           new PlcPositioning1().start();
+//
+//          new PlcParameter2().start();
+//
+//           new PLCAutomaticParameterSetting().start();
+//           new PlcManualonePosition().start();
+//           new PlcManualonePosition2().start();
+//           new PlcServoManualone().start();
+//           new PLCManualJog().start();
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0