From 3a59de819bb1fbefc3eb4a38fb4f76a11d19a1ae Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期五, 05 一月 2024 15:05:56 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes

---
 CanadaMes-ui/src/views/Electrical/ManualonePosition.vue |   75 ++++++++++++++++++++++---------------
 1 files changed, 45 insertions(+), 30 deletions(-)

diff --git a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
index bb5400c..8d15a80 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
@@ -56,21 +56,21 @@
               <span class="name" style="width:300px;">{{ item.name }}</span>
 
                 <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"    ></el-input>
+                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"
-                class="input-box"    ></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($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"
-                class="input-box"   ></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"
-                class="input-box"   ></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"
-                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($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($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($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"    ></el-input>
+                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>
             </div>
           </div>
           <div class="button-row" style="display: flex; justify-content: space-between;">
@@ -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++) {
@@ -259,6 +259,16 @@
   });
 
   const values = inputData.map(item => item.value);
+
+  if (values.length > 0) {
+
+let firstValue = values[0];
+if (!(firstValue >= "106" && firstValue <= "210")) {
+  values.shift();
+  this.$message.error("Out of range");
+  return false;
+}
+}
   data.unshift([], [], []);
   data.push(values);
 }
@@ -273,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') {
@@ -430,7 +440,7 @@
       }
 
 
-
+    
 
     },
 
@@ -457,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);
@@ -479,7 +494,7 @@
           const weihuiling = obj.weihuiling;
 
 
-  if(obj.zuhe1&& !isMouseInInputBox){
+  if(obj.zuhe1){
 
 // console.log(obj);
   

--
Gitblit v1.8.0