From 4c70d9f0656bbec48fa619f2ec9aa0ee12fca2c1 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期一, 04 十二月 2023 09:04:51 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes

---
 CanadaMes-ui/src/views/Electrical/Action.vue |  106 ++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 76 insertions(+), 30 deletions(-)

diff --git a/CanadaMes-ui/src/views/Electrical/Action.vue b/CanadaMes-ui/src/views/Electrical/Action.vue
index f27af2a..6fbb39c 100644
--- a/CanadaMes-ui/src/views/Electrical/Action.vue
+++ b/CanadaMes-ui/src/views/Electrical/Action.vue
@@ -2,21 +2,20 @@
   <div class="app">
     <!--闈㈠寘灞戝鑸尯鍩�-->
     <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
-      <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
+      <router-link to="/Electrical/ServoManualone" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
       }}</router-link>
       <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
       }}</router-link>
       <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
       }}</router-link>
-      <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
-      }}</router-link>
+      <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
+      }}</router-link> -->
       <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')
+       <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual')
       }}</router-link>
     </el-breadcrumb>
-
+    
     <div>Action</div>
     <el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="{ messagepack }">
       <!-- <div class="kuai_div" v-for="item in record.xyData" :key="item.value">
@@ -48,10 +47,62 @@
       jsonData: data,
       activeButton: '',
       record: {
-        params: [],
-
+        params: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+        canshu: [
+          'D01 VFD conveyor',
+          'D02 VFD conveyor',
+          'D03 VFD conveyor',
+          'D04 VFD conveyor',
+          'D05 VFD conveyor',
+          'D06 VFD conveyor',
+          'A01 VFD conveyor',
+          'A02 VFD conveyor',
+          'B01 VFD conveyor',
+          'B02 VFD conveyor',
+          'A01 SERVE TURN JOG+',
+          'A02 SERVE TURN JOG-',
+          'A01 SERVE TRAVEL JOG+',
+          'A02 SERVE TRAVEL JOG-',
+          'B01 SERVE TRAVEL JOG+',
+          'B02 SERVE TRAVEL JOG-',
+          'A01 SERVE TURN POS',
+          'A02 SERVE TURN POS',
+          'A01 SERVE TRAVEL POS',
+          'A02 SERVE TRAVEL POS',
+          'B01 SERVE TRAVEL POS',
+          'B02 SERVE TRAVEL POS',
+          'B01 YV TURN',
+          'B01 YV UP DOWN',
+          'B02 YV TURN',
+          'B02 YV UP DOWN',
+        ],
         xyData: [
-
+          { name: 'D01 VFD conveyor', value: "0" },
+          { name: 'D02 VFD conveyor', value: "0" },
+          { name: 'D03 VFD conveyor', value: "0" },
+          { name: 'D04 VFD conveyor', value: "0" },
+          { name: 'D05 VFD conveyor', value: "0" },
+          { name: 'D06 VFD conveyor', value: "0" },
+          { name: 'A01 VFD conveyor', value: "0" },
+          { name: 'A02 VFD conveyor', value: "0" },
+          { name: 'B01 VFD conveyor', value: "0" },
+          { name: 'B02 VFD conveyor', value: "0" },
+          { name: 'A01 SERVE TURN JOG+', value: "0" },
+          { name: 'A02 SERVE TURN JOG-', value: "0" },
+          { name: 'A01 SERVE TRAVEL JOG+', value: "0" },
+          { name: 'A02 SERVE TRAVEL JOG-', value: "0" },
+          { name: 'B01 SERVE TRAVEL JOG+', value: "0" },
+          { name: 'B02 SERVE TRAVEL JOG-', value: "0" },
+          { name: 'A01 SERVE TURN POS', value: "0" },
+          { name: 'A02 SERVE TURN POS', value: "0" },
+          { name: 'A01 SERVE TRAVEL POS', value: "0" },
+          { name: 'A02 SERVE TRAVEL POS', value: "0" },
+          { name: 'B01 SERVE TRAVEL POS', value: "0" },
+          { name: 'B02 SERVE TRAVEL POS', value: "0" },
+          { name: 'B01 YV TURN', value: "0" },
+          { name: 'B01 YV UP DOWN', value: "0" },
+          { name: 'B02 YV TURN', value: "0" },
+          { name: 'B02 YV UP DOWN', value: "0" },
         ]
         ,
       },
@@ -67,9 +118,13 @@
 
     }
   },
-  created () {
+  // created () {
+  //   this.init();
+  // },
+  activated(){
+   
     this.init();
-  },
+ },
   methods: {
 
     setActiveButton (buttonName) {
@@ -102,25 +157,13 @@
           }
 
           let obj = JSON.parse(msg.data);
-          this.record.params[0] = obj.params[0];
-          // console.log(obj.params);
+
           if (obj.params) {
-
-            this.record.xyData = this.jsonData.action;
-
-            for (let a = 0; a < this.record.xyData.length; a++) {
-              if (this.record.params[0][a]) {
-                this.record.xyData[a].value = this.record.params[0][a].toString();
-              }
-
+            this.record.params[0] = obj.params[0];
+            for (let a = 0; a <= this.record.params[0].length - 1; a++) {
+              this.record.xyData[a].name = this.jsonData.action[a].name;
+              this.record.xyData[a].value = this.record.params[0][a].toString();
             }
-
-            this.record.xyData = this.jsonData.action.filter(item => {
-              return item.state != 0;
-            }
-
-            );
-
             const language = this.$i18n.locale;
             if (language === 'en-US') {
               this.replaceChineseWithEnglish();
@@ -140,19 +183,22 @@
         socket.onerror = function () {
           console.log("websocket鍙戠敓浜嗛敊璇�");
         }
+        this.$router.afterEach(function(){
+          socket.close();
+        })
       }
 
     },
     send () {
       this.messagepack.data = this.record.xyData.map(item => parseInt(item.value)); // 杞崲涓烘暣鏁版暟缁�
-      console.log(this.messagepack);
+      //console.log(this.messagepack);
       socket?.send(JSON.stringify(this.messagepack));
     },
     //璇█杞崲
     replaceChineseWithEnglish () {
       const translation = this.$t('langActions');
       this.record.xyData = this.record.xyData.map(item => { return { name: translation[item.name] || item.name, value: item.value }; });
-
+      console.log(translation);
     },
 
   }

--
Gitblit v1.8.0