From f53ba3a3e10df08aa0d23114fae200a99ade23f4 Mon Sep 17 00:00:00 2001
From: clll <1320612696@qq.com>
Date: 星期三, 13 九月 2023 09:37:53 +0800
Subject: [PATCH] 拉取

---
 CanadaMes-ui/src/views/Electrical/State.vue |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/CanadaMes-ui/src/views/Electrical/State.vue b/CanadaMes-ui/src/views/Electrical/State.vue
index 9cfb3b3..cc82022 100644
--- a/CanadaMes-ui/src/views/Electrical/State.vue
+++ b/CanadaMes-ui/src/views/Electrical/State.vue
@@ -67,7 +67,7 @@
 
       },
 
-
+      localizedRoles: [],
       messagepack: {
         data: { taskname: "" }
       },
@@ -107,7 +107,6 @@
           //console.log("鏀跺埌鏁版嵁====" + msg.data);
           let obj = JSON.parse(msg.data);
           this.record.params[0] = obj.sta[0];
-          console.log(this.record.params[0]);
           //灏嗚鍙栧埌鐨凱LC鐨勬暟鎹紝涓庡畾涔夌殑xyData锛岀粍鍚堟垚鏂扮殑鏁扮粍
           for (let a = 0; a < this.record.params[0].length; a++) {
             if (!this.record.xyData[a]) {
@@ -117,6 +116,13 @@
             }
 
           }
+          const language = this.$i18n.locale;
+          if (language === 'en-US') {
+            this.replaceChineseWithEnglish();
+          } else {
+            this.localizedRoles = [...this.record.xyData];
+          }
+          //console.log(this.localizedRoles);
           this.$forceUpdate();
 
         }.bind(this);
@@ -130,19 +136,15 @@
         }
       }
     },
-    send () {
-      this.messagepack.data = this.record.xyData.map((item) => parseInt(item.value)); // 杞崲涓烘暣鏁版暟缁�
-      console.log(this.messagepack);
-      socket?.send(JSON.stringify(this.messagepack));
+    //璇█杞崲
+    replaceChineseWithEnglish () {
+      const translation = this.$t('dvstate');
+      this.localizedRoles = this.record.xyData.map(role => ({
+        ...role,
+        content: translation[role.content] || role.content
+      }));
+      console.log(this.localizedRoles);
     },
-    valuezhi (zhi) {
-      if (zhi == 1) {
-        return "鑷姩";
-      }
-      else {
-        return "鎵嬪姩";
-      }
-    }
 
 
   }

--
Gitblit v1.8.0