From ea46f28356e2acb3bc7cc69b9af3c52fab38c0b0 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期四, 18 一月 2024 16:56:47 +0800
Subject: [PATCH] 终止任务功能测试

---
 CanadaMes-ui/src/views/Electrical/Sign.vue |  206 ++++++++++++++++++++++++++++-----------------------
 1 files changed, 112 insertions(+), 94 deletions(-)

diff --git a/CanadaMes-ui/src/views/Electrical/Sign.vue b/CanadaMes-ui/src/views/Electrical/Sign.vue
index a3ef53f..160e9f0 100644
--- a/CanadaMes-ui/src/views/Electrical/Sign.vue
+++ b/CanadaMes-ui/src/views/Electrical/Sign.vue
@@ -2,24 +2,32 @@
   <div class="app">
     <!--闈㈠寘灞戝鑸尯鍩�-->
     <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>
-      <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>
-      <router-link to="/Electrical/State" tag="el-button" type="text">State</router-link>
-      <router-link to="/Electrical/alarm" tag="el-button" type="text">Alarm</router-link>
+
+      <router-link to="/Electrical/alarm" 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/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('Parameter')
+        }}</router-link>
+
     </el-breadcrumb>
-    <div>Sign</div>
+    <div>{{ $t('Sign') }}</div>
     <div style="padding-right: 30px;display: flex;flex-wrap: wrap;" class="neir">
       <div class="kuai_sb" v-for="item in record.xyData" :key="item.name">
-        <el-col class="deng" :class="getStatusClass(item.value, item.name)">
-          <!-- <el-input v-model="item.zhuangtai" style="width: 280px;display: none;"
-            class="in_mc"></el-input>-->
-        </el-col>
-        <el-input v-model="item.name" style="width: 280px;" class="in_mc"></el-input>
+        <el-col class="deng" :class="getStatusClass(item.value)"></el-col>
+        <span  style="width: 100%;" class="in_mc">{{
+                item.unit
+              }}</span>
+        <span  style="width: 100%;" class="in_mc">{{
+                item.name
+              }}</span>
 
-        <!-- <el-switch v-model="item.zhuangtai" active-color="#13ce66" active-value="1" inactive-value="2"></el-switch> -->
       </div>
 
     </div>
@@ -28,56 +36,20 @@
 </template>
 
 <script >
+import LanguageMixin from '../../lang/LanguageMixin'
+import data from '../../configuration/Sign'
 let socket;
 export default {
   name: "Sign",
+  mixins: [LanguageMixin],
   data () {
     return {
+      jsonData: data,
+      activeButton: '',
       record: {
-        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, 0, 0, 0, 0, 0, 0,],
-        xyData: [
-          { name: 'D01.SR dec', value: 0 },
-          { name: "D01.SR in pos", value: 0 },
-          { name: "D02.SR dec", value: 0 },
-          { name: "D02.SR in pos", value: 0 },
-          { name: "D03.SR dec", value: 0 },
-          { name: "D03.SR in pos", value: 0 },
-        ],
-        canshu: [
-          'D01.SR dec',
-          'D01.SR in pos',
-          'D02.SR dec',
-          'D02.SR in pos',
-          'D03.SR into',
-          'D03.SR dec',
-          'D03.SR in pos',
-          'D04.SR dec',
-          'D04.SR in pos',
-          'D05.SR dec',
-          'D05.SR in pos',
-          'D06.SR dec',
-          'D06.SR in pos',
-          'B01.SR out dec',
-          'B01.SR out in pos',
-          'B01.SR in dec',
-          'B01.SR in in pos',
-          'B01.SR turn on',
-          'B01.SR turn off',
-          'B01.SR up',
-          'B01.SR down',
-          'B02.SR out dec',
-          'B02.SR out in pos',
-          'B02.SR in dec',
-          'B02.SR in in pos',
-          'B02.SR turn on',
-          'B02.SR turn off',
-          'B02.SR up',
-          'B02.SR down',
-          'LED.red',
-          'LED.green',
-          'LED.yellow',
-        ],
-
+        //瀹氫箟鏁扮粍
+        params: [],
+        xyData: [],
       },
 
 
@@ -92,30 +64,42 @@
     }
   },
   created () {
-    this.init();
+    
+    //this.showdata();
   },
+  activated(){
+    this.init();
+    this.record.xyData = this.jsonData.sign;
+    const language = this.$i18n.locale;
+    if (language === 'zh-CN') {
+            this.replaceChineseWithEnglish();
+          } else {
+            this.localizedRoles = [...this.record.xyData];
+          }
+ },
   methods: {
-    getStatusClass (zhuangtai, mc) {
+    showdata () {
+      console.log(1111);
+      console.log(this.jsonData.sign[0].name);
+      // console.log(this.record.xyData);
 
-      if (mc === "LED.red" && zhuangtai === 0) {
-        return "red";
-      }
-      if (mc === "LED.green" && zhuangtai === 0) {
-        return "green";
-      }
-      if (mc === "LED.yellow" && zhuangtai === 0) {
-        return "yellow"
-      }
+    },
+
+    onButtonClick () {
+      this.isButtonClicked = true; // 灏嗘寜閽鑹茶缃负钃濊壊
+      setTimeout(() => {
+        this.isButtonClicked = false; // 閲嶇疆鎸夐挳棰滆壊
+      }, 500); // 杩欓噷鐨�500姣鏄牴鎹偍甯屾湜鎸夐挳棰滆壊鎸佺画澶氶暱鏃堕棿鏉ュ畾鐨勶紝鍙互鏍规嵁闇�姹傝繘琛岃皟鏁�
+    },
+    //鏍规嵁璇诲彇PLC鐨勫�硷紝鏍规嵁鍚嶇О鏀瑰彉棰滆壊
+    getStatusClass (zhuangtai) {
+      // console.log(this.record.xyData);
       if (zhuangtai === 0) {
         return "op";
       }
       else {
         return "dow";
       }
-
-
-
-
 
     },
     init () {
@@ -126,7 +110,7 @@
       } else {
         //console.log("鎮ㄧ殑娴忚鍣ㄦ敮鎸乄ebSocket");
 
-        let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
+        let socketUrl = "ws://" + this.$t('ip')+":8888" + "/springboot-vue3/api/talk/" + viewname;
         if (socket != null) {
           socket.close();
           socket = null;
@@ -142,14 +126,30 @@
 
           //console.log("鏀跺埌鏁版嵁====" + msg.data);
           let obj = JSON.parse(msg.data);
-          //this.$set(this.record.params, 0, obj.params[0]);
           this.record.params[0] = obj.sig[0];
-          for (let a = 0; a <= this.record.params.length - 1; a++) {
-            //this.record.xyData[a] = [this.record.params[0][a], this.record.canshu[a]];
-            this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
+
+          this.record.xyData = this.jsonData.sign;
+          console.log(this.jsonData.sign)
+          for (let a = 0; a < this.record.xyData.length; a++) {
+            this.record.xyData[a].value = this.record.params[0][a];
 
           }
+
+          this.record.xyData = this.jsonData.sign.filter(item => {
+            return item.state != 0;
+          }
+
+          );
+
+
+          const language = this.$i18n.locale;
+          if (language === 'zh-CN') {
+            this.replaceChineseWithEnglish();
+          } else {
+            this.localizedRoles = [...this.record.xyData];
+          }
           this.$forceUpdate();
+          this.replaceChineseWithEnglish();
 
         }.bind(this);
         //鍏抽棴浜嬩欢
@@ -162,9 +162,16 @@
         }
       }
     },
-    send () {
-      this.messagepack.data = { taskname: "鍓嶇鍒板悗鍙�" };
-      socket?.send(JSON.stringify(this.messagepack));  // 灏嗙粍瑁呭ソ鐨刯son鍙戦�佺粰鏈嶅姟绔紝鐢辨湇鍔$杩涜杞彂
+    //璇█杞崲
+    replaceChineseWithEnglish () {
+
+      const translation = this.$t('Signlang');
+
+      if (translation != null) {
+        this.record.xyData = this.record.xyData.map(item => { return { name: translation[item.name] || item.name, value: item.value,unit:item.unit }; });
+        //console.log(translation);
+      }
+
     }
   }
 
@@ -176,16 +183,21 @@
 
 </script>
 
-<style>
+<style >
 * {
   margin: 0;
   padding: 0;
 }
 
-/* .neir {
+.app {
   height: 100%;
+}
+
+.neir {
+  /* height: 580px; */
+  height: 90%;
   overflow-y: auto;
-} */
+}
 
 .el-input__inner {
   text-align: center;
@@ -193,9 +205,9 @@
 }
 
 .kuai_sb {
-  text-align: center;
-  width: 25%;
-  margin-bottom: 15px;
+  text-align: left;
+  width:18%;
+  margin-bottom: 5px;
 }
 
 .el-input {
@@ -208,19 +220,17 @@
 }
 
 .in_mc {
-  .el-input__inner {
-    border: none;
-  }
+  font-size: 13px;
 }
 
 .deng {
-  margin-left: 40%;
+  margin-left: 1%;
   display: inline-block;
   background: #A0A0A0;
   border: 0.1875em solid white;
   border-radius: 50%;
-  height: 5em;
-  width: 5em;
+  height: 2em;
+  width: 2em;
   box-shadow: 0.375em 0.375em 0 0 rgba(214, 214, 214, 0.125);
 }
 
@@ -236,11 +246,19 @@
   background-color: red;
 }
 
-.geeen {
+.green {
   background-color: #00ff22;
 }
 
 .yellow {
   background-color: yellow;
 }
+
+.blue-button {
+  background-color: skyblue;
+}
+
+.dark-theme {
+  display: none;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.8.0