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

---
 CanadaMes-ui/src/views/Electrical/ManualonePosition.vue |  318 ++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 229 insertions(+), 89 deletions(-)

diff --git a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
index a411b5e..3a20c2c 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
@@ -12,46 +12,58 @@
       <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
       }}</router-link>
       <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{
-        $t('ServoManual')
+        $t('Parameter')
       }}</router-link>
     </el-breadcrumb>
-
     <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
-
-      <router-link to="/Electrical/Servomanualone" tag="el-button" type="text" active-class="blue-button">{{
-        $t('Servomanualone')
-      }}</router-link>
-      <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1')
-      }}</router-link>
-      <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2')
-      }}</router-link>
-      <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{
-        $t('Positioning1')
-      }}</router-link>
-      <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{
-        $t('Positioning2')
-      }}</router-link>
-      <router-link to="/Electrical/ManualonePosition" tag="el-button" type="text" active-class="blue-button">{{
-        $t('ManualonePosition')
-      }}</router-link>
-      <router-link to="/Electrical/ManualonePosition2" tag="el-button" type="text" active-class="blue-button">{{
-        $t('ManualonePosition2')
-      }}</router-link>
-      <router-link to="/Electrical/AutomaticParameterSetting" tag="el-button" type="text" active-class="blue-button">{{
-        $t('AutomaticParameterSetting')
+      <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Automatic State')
       }}</router-link>
       <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{
         $t('ManualJog')
       }}</router-link>
+      
+       <router-link to="/Electrical/ManualonePosition" tag="el-button" type="text" active-class="blue-button">{{
+        $t('ManualonePosition')
+      }}</router-link>
+
+<router-link to="/Electrical/Servomanualone" tag="el-button" type="text" active-class="blue-button">{{
+        $t('Servomanualone')
+      }}</router-link>
+      <!-- <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1')
+      }}</router-link> -->
+     
+      <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{
+        $t('Address parameter settings')
+      }}</router-link>
+      <!-- <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{
+        $t('Positioning2')
+      }}</router-link> -->
+     
+      <!-- <router-link to="/Electrical/ManualonePosition2" tag="el-button" type="text" active-class="blue-button">{{
+        $t('ManualonePosition2')
+      }}</router-link> -->
+      <router-link to="/Electrical/AutomaticParameterSetting" tag="el-button" type="text" active-class="blue-button">{{
+        $t('Speed parameter settings')
+      }}</router-link>
+      
     </el-breadcrumb>
 
     <el-row :gutter="10">
       <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
-        <el-card class="json-block" style="width:585px;">
+        <el-card class="json-block" style="width:585px;margin-bottom: 10px;">
           <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>
@@ -59,12 +71,12 @@
             <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
               <el-button v-if="item.button && language === 'en-US' && item.state != 0" :name="item.button.name"
                 v-model="item.button.value"
-                :class="{ 'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1, 'error-button2': item.button.name === 'NotZero' && item.button.value === 0,'greenbutton': item.button.name !== 'NotZero' && item.button.name !== 'Fault' && item.button.value === 1 }"
+                :class="{ 'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1, 'error-button2': item.button.name === 'NotZero' && item.button.value === 0,'error-button3': item.button.name === 'NotZero' && item.button.value === 1,'greenbutton': item.button.name !== 'NotZero' && item.button.name !== 'Fault' && item.button.value === 1 }"
                 @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
                   item.button.name }}</el-button>
               <el-button v-if="item.button && language === 'zh-CN' && item.state != 0" :name="item.button.name"
                 v-model="item.button.value"
-                :class="{ 'action-button': true, 'error-button': item.button.name === '鏁呴殰' && item.button.value === 1, 'error-button2': item.button.name === '鏈洖闆�' && item.button.value === 0,'greenbutton': item.button.name !== '鏈洖闆�' && item.button.name !== '鏁呴殰' && item.button.value === 1 }"
+                :class="{ 'action-button': true, 'error-button': item.button.name === '鏁呴殰' && item.button.value === 1, 'error-button2': item.button.name === '鏈洖闆�' && item.button.value === 0,'error-button3': item.button.name === '鏈洖闆�' && item.button.value === 1,'greenbutton': item.button.name !== '鏈洖闆�' && item.button.name !== '鏁呴殰' && item.button.value === 1 }"
                 @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
                   item.button.name }}</el-button>
             </div>
@@ -72,14 +84,22 @@
         </el-card>
       </el-col>
     </el-row>
+ <div class="container">
+ 
+    <component :is="embeddedComponent"></component>
+  </div> 
+
     <!-- <el-button @click="submitDataToBackend">鎻愪氦鏁版嵁鍒板悗绔�</el-button> -->
   </div>
+
 </template>
+
 
 <script>
 import LanguageMixin from '../../lang/LanguageMixin'
 import data from '../../configuration/Manualoneposition'
 import { throttle } from 'lodash';
+import ManualonePosition2 from './ManualonePosition2.vue';
 let socket;
 export default {
   name: "ManualonePosition",
@@ -88,6 +108,7 @@
     return {
       jsonData: data,
       language: this.$i18n.locale,
+      embeddedComponent: ManualonePosition2,
 
       // 鍔犺浇鏁翠釜data.json鏂囦欢浣滀负jsonData
     }
@@ -123,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([], [], [],[],[],[],[]);
 
 
 
@@ -152,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);
 
       }
 
@@ -332,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) {
@@ -348,8 +446,23 @@
                 });
               }
 
-              //鏇存柊瀹炴椂浣嶇疆
-              jsonData2.forEach((item) => {
+             
+
+
+
+
+
+            }
+          }, 50);
+
+          document.addEventListener('mouseover', handleMouseMove);
+
+
+if(obj.zuhe1){
+
+
+           //鏇存柊瀹炴椂浣嶇疆
+           jsonData2.forEach((item) => {
                 item.forEach((subItem) => {
                   if (subItem.sending === 4) {
                     subItem.value = obj.shishi1[0][0];
@@ -397,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)
                     }
@@ -410,12 +523,35 @@
               }
 
 
+//鏀瑰彉鏈洖闆舵枃瀛�
+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.button && obj.button.value===1) {
+      if ( obj.button.name==="鏈洖闆�" && this.language==="zh-CN") {
+      obj.button.name =obj.button.name.replace("鏈洖闆�","宸插洖闆�") ;
+    }
+    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") ;
+    }
+  }
+
+     
+}
+}
+
+}
 
 
-            }
-          }, 200);
-
-          document.addEventListener('mouseover', handleMouseMove);
         };
 
 
@@ -503,4 +639,8 @@
 
   background-color: green;
 }
+.error-button3{
+  background-color: green;
+
+}
 </style>
\ No newline at end of file

--
Gitblit v1.8.0