From 35b92e62a6ba557f7feeea1a344e104d8db7ffb4 Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期二, 12 十二月 2023 16:59:44 +0800
Subject: [PATCH] A01启动 B01启动 增加plc地址 单独写入

---
 CanadaMes-ui/src/views/Electrical/ManualonePosition.vue |  238 +++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 158 insertions(+), 80 deletions(-)

diff --git a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
index 4845706..3a20c2c 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
@@ -54,7 +54,16 @@
           <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
             <div class="item-row">
               <span class="name" style="width:300px;">{{ item.name }}</span>
-              <el-input style="width:250px;" v-if="item.state != 0 && item.type === '0'" v-model="item.value"
+
+                <el-input style="width:250px;"  v-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 === 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'" v-model="item.value"
                 class="input-box"></el-input>
             </div>
           </div>
@@ -75,11 +84,10 @@
         </el-card>
       </el-col>
     </el-row>
-
-    <div class="container">
-    <!-- 杩欓噷鏄敤浜庢樉绀哄唴宓� Vue 椤甸潰鐨勫尯鍩� -->
+ <div class="container">
+ 
     <component :is="embeddedComponent"></component>
-  </div>
+  </div> 
 
     <!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
   </div>
@@ -136,20 +144,114 @@
 
 
     },
+    A01start(){
+
+      const data = [];
+
+for (let i = 0; i < 1; i++) {
+  const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+    return { value: item.value };
+  });
+
+  const values = inputData.map(item => item.value);
+
+  data.push(values);
+}
+data.push([], [], [],[],[],[]);
+
+
+
+const jsonObject = { data };
+
+// 鎻愪氦鏁版嵁鍒板悗绔�
+const jsonString = JSON.stringify(jsonObject);
+console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+socket?.send(jsonString);
+
+    },
+    A02start(){
+      const data = [];
+
+for (let i = 1; i < 2; i++) {
+  const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+    return { value: item.value };
+  });
+
+  const values = inputData.map(item => item.value);
+  data.unshift([]);
+  data.push(values);
+}
+data.push([], [], [],[],[]);
+
+
+
+const jsonObject = { data };
+
+// 鎻愪氦鏁版嵁鍒板悗绔�
+const jsonString = JSON.stringify(jsonObject);
+console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+socket?.send(jsonString);
+
+    },
+    B01start(){
+      const data = [];
+
+for (let i = 2; i < 3; i++) {
+  const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+    return { value: item.value };
+  });
+
+  const values = inputData.map(item => item.value);
+  data.unshift([], []);
+  data.push(values);
+}
+//data.unshift([]);
+
+data.push([], [], [],[]);
+
+
+const jsonObject = { data };
+
+// 鎻愪氦鏁版嵁鍒板悗绔�
+const jsonString = JSON.stringify(jsonObject);
+console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+socket?.send(jsonString);
+
+    },
+    B02start(){
+      const data = [];
+
+for (let i = 3; i < 4; i++) {
+  const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
+    return { value: item.value };
+  });
+
+  const values = inputData.map(item => item.value);
+  data.unshift([], [], []);
+  data.push(values);
+}
+
+data.push([], [],[]);
+
+
+
+const jsonObject = { data };
+
+// 鎻愪氦鏁版嵁鍒板悗绔�
+const jsonString = JSON.stringify(jsonObject);
+console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+socket?.send(jsonString);
+
+    },
     submitDataToBackend (currentButtonName) {
       if (currentButtonName === 'A01鍚姩' || currentButtonName === 'A01 Start') {
         const data = [];
 
-        for (let i = 0; i < 1; i++) {
-          const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
-            return { value: item.value };
-          });
-
-          const values = inputData.map(item => item.value);
+  const values = [this.jsonData[0][3].button.value]
 
           data.push(values);
-        }
-        data.push([], [], [],[],[],[]);
+       
+        data.unshift([], [], [],[],[],[],[]);
 
 
 
@@ -165,77 +267,60 @@
       if (currentButtonName === 'A02鍚姩' || currentButtonName === 'A02 Start') {
         const data = [];
 
-        for (let i = 1; i < 2; i++) {
-          const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
-            return { value: item.value };
-          });
+const values = [this.jsonData[1][3].button.value]
 
-          const values = inputData.map(item => item.value);
-          data.unshift([]);
-          data.push(values);
-        }
-        data.push([], [], [],[],[]);
+        data.push(values);
+     
+      data.unshift([], [], [],[],[],[],[],[]);
 
 
 
-        const jsonObject = { data };
+      const jsonObject = { data };
 
-        // 鎻愪氦鏁版嵁鍒板悗绔�
-        const jsonString = JSON.stringify(jsonObject);
-        console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
-        socket?.send(jsonString);
+      // 鎻愪氦鏁版嵁鍒板悗绔�
+      const jsonString = JSON.stringify(jsonObject);
+      console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+      socket?.send(jsonString);
 
       }
 
       if (currentButtonName === 'B01鍚姩' || currentButtonName === 'B01 Start') {
         const data = [];
 
-        for (let i = 2; i < 3; i++) {
-          const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
-            return { value: item.value };
-          });
+const values = [this.jsonData[2][3].button.value]
 
-          const values = inputData.map(item => item.value);
-          data.unshift([], []);
-          data.push(values);
-        }
-        //data.unshift([]);
-
-        data.push([], [], [],[]);
+        data.push(values);
+     
+      data.unshift([], [], [],[],[],[],[],[],[]);
 
 
-        const jsonObject = { data };
 
-        // 鎻愪氦鏁版嵁鍒板悗绔�
-        const jsonString = JSON.stringify(jsonObject);
-        console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
-        socket?.send(jsonString);
+      const jsonObject = { data };
+
+      // 鎻愪氦鏁版嵁鍒板悗绔�
+      const jsonString = JSON.stringify(jsonObject);
+      console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+      socket?.send(jsonString);
 
       }
 
       if (currentButtonName === 'B02鍚姩' || currentButtonName === 'B02 Start') {
         const data = [];
 
-        for (let i = 3; i < 4; i++) {
-          const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => {
-            return { value: item.value };
-          });
+const values = [this.jsonData[3][3].button.value]
 
-          const values = inputData.map(item => item.value);
-          data.unshift([], [], []);
-          data.push(values);
-        }
-
-        data.push([], [],[]);
+        data.push(values);
+     
+      data.unshift([], [], [],[],[],[],[],[],[],[]);
 
 
 
-        const jsonObject = { data };
+      const jsonObject = { data };
 
-        // 鎻愪氦鏁版嵁鍒板悗绔�
-        const jsonString = JSON.stringify(jsonObject);
-        console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
-        socket?.send(jsonString);
+      // 鎻愪氦鏁版嵁鍒板悗绔�
+      const jsonString = JSON.stringify(jsonObject);
+      console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
+      socket?.send(jsonString);
 
       }
 
@@ -345,7 +430,7 @@
           }
 
           let obj = JSON.parse(msg.data);
-          // console.log(obj);
+        // console.log(obj);
           const jsonData2 = this.jsonData;
           const weihuiling = obj.weihuiling;
           const handleMouseMove = throttle(function (event) {
@@ -363,24 +448,6 @@
 
              
 
-              //鏀瑰彉鐘舵�佹枃瀛�
-// for (let i = 2; i < jsonData2.length; i++) {
-//   let arr6 = jsonData2[i];
-//   for (let j = 2; j < arr6.length; j++) {
-//     let obj6 = arr6[j];
-//     if (obj6.button&& (obj6.button.name === "鏈洖闆�" || obj6.button.name === "NotZero")) {
-//       if ( obj6.button.name.includes("鏈�")&& this.language==="zh-CN") {
-//         console.log(obj6.button.name)
-//       obj6.button.name =obj6.button.name.replace("鏈�","宸�") ;
-//     }
-//     if ( obj6.button.name.includes("NotZero")) {
-//       obj6.button.name =obj6.button.name.replace("NotZero","Zero") ;
-//     }
-//   }
-
-     
-// }
-// }
 
 
 
@@ -390,6 +457,8 @@
 
           document.addEventListener('mouseover', handleMouseMove);
 
+
+if(obj.zuhe1){
 
 
            //鏇存柊瀹炴椂浣嶇疆
@@ -441,7 +510,7 @@
                 for (let j = 2; j < arr2.length; j++) {
                   let obj3 = arr2[j];
                   if (obj3.button) {
-                    if (obj3.button && (obj3.button.name === "鏈洖闆�" || obj3.button.name === "NotZero")) {
+                    if (obj3.button && (obj3.button.name === "鏈洖闆�" || obj3.button.name === "NotZero" || obj3.button.name === "宸插洖闆�" || obj3.button.name === "Zero")) {
                       obj3.button.value = weihuiling[0][i];
                       //  console.log(obj3.button.value)
                     }
@@ -460,11 +529,19 @@
   for (let j = 0; j < arr.length; j++) {
     let obj = arr[j];
     if (obj.button && obj.button.value===1) {
-      if ( obj.button.name.includes("鏈洖闆�")&& this.language==="zh-CN") {
+      if ( obj.button.name==="鏈洖闆�" && this.language==="zh-CN") {
       obj.button.name =obj.button.name.replace("鏈洖闆�","宸插洖闆�") ;
     }
-    if ( obj.button.name.includes("NotZero")) {
+    if ( obj.button.name==="NotZero") {
       obj.button.name =obj.button.name.replace("NotZero","Zero") ;
+    }
+  }
+  if (obj.button && obj.button.value===0) {
+      if ( obj.button.name==="宸插洖闆�"&& this.language==="zh-CN") {
+      obj.button.name =obj.button.name.replace("宸插洖闆�","鏈洖闆�") ;
+    }
+    if ( obj.button.name==="Zero") {
+      obj.button.name =obj.button.name.replace("Zero","NotZero") ;
     }
   }
 
@@ -472,6 +549,7 @@
 }
 }
 
+}
 
 
         };

--
Gitblit v1.8.0