From 477b4071ccf45b6d15280d37a4a002307aa2271c Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期四, 07 九月 2023 17:11:09 +0800
Subject: [PATCH] Merge branch 'master' of ssh://10.153.19.150:29418/CanadaMes

---
 CanadaMes-ui/src/views/Electrical/alarm.vue |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/CanadaMes-ui/src/views/Electrical/alarm.vue b/CanadaMes-ui/src/views/Electrical/alarm.vue
index db22d18..f3dd37c 100644
--- a/CanadaMes-ui/src/views/Electrical/alarm.vue
+++ b/CanadaMes-ui/src/views/Electrical/alarm.vue
@@ -3,7 +3,7 @@
     <!--闈㈠寘灞戝鑸尯鍩�-->
     <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
       <router-link to="/home" tag="el-button" type="text">{{ $t('langHome') }}</router-link>
-      <el-button type="text">璁惧绠$悊</el-button>
+      <el-button type="text">Electrical</el-button>
       <router-link to="/Electrical/Parameter" tag="el-button" type="text">Parameter</router-link>
       <router-link to="/Electrical/Action" tag="el-button" type="text">Action</router-link>
       <router-link to="/Electrical/Sign" tag="el-button" type="text">Sign</router-link>
@@ -18,7 +18,7 @@
         </div>
       </el-form> -->
 
-    <el-table :data="tableData" style="width: 100%;" height="590">
+    <el-table :data="localizedRoles" style="width: 100%;" height="590">
       <el-table-column prop="id" label="id" width="80">
       </el-table-column>
       <el-table-column prop="content" label="content">
@@ -33,9 +33,11 @@
 
 <script >
 import { setAll } from "../../api/alarm";
+import LanguageMixin from '../../lang/LanguageMixin'
 let socket;
 export default {
   name: "alarm",
+  mixins: [LanguageMixin],
   data () {
     return {
       record: {
@@ -44,8 +46,8 @@
         // xyData: [],
 
       },
-      tableData: [],
-
+      roles: [],
+      localizedRoles: [],
       messagepack: {
         data: { taskname: "" }
       },
@@ -59,15 +61,28 @@
   created () {
     this.init();
     this.load();
+
   },
   methods: {
     load () {
       setAll().then(res => {
-        this.tableData = res.data.list;
-        //console.log(this.tableData);
-
+        this.roles = res.data.list;
+        const language = this.$i18n.locale;
+        if (language === 'zh-CN') {
+          this.replaceChineseWithEnglish();
+        } else {
+          this.localizedRoles = [...this.roles];
+        }
+        console.log(this.localizedRoles);
       });
     },
+    replaceChineseWithEnglish () {
+      const translation = this.$t('translation');
+      this.localizedRoles = this.roles.map(role => ({
+        ...role,
+        content: translation[role.content] || role.content
+      }));
+    },
     init () {
       let viewname = "alarm";
 

--
Gitblit v1.8.0