From 50122609dfab86da64df82396a30a30455e5bd67 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期三, 27 十二月 2023 08:31:08 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes

---
 CanadaMes-ui/src/layout/index.vue |  152 ++++++++++++++++++++++++++++----------------------
 1 files changed, 86 insertions(+), 66 deletions(-)

diff --git a/CanadaMes-ui/src/layout/index.vue b/CanadaMes-ui/src/layout/index.vue
index f52efa3..40fce67 100644
--- a/CanadaMes-ui/src/layout/index.vue
+++ b/CanadaMes-ui/src/layout/index.vue
@@ -66,23 +66,24 @@
               <el-menu-item index="1-1" @click="logout">{{ $t('exit') }}</el-menu-item>
               <el-menu-item index="1-2" @click="showChangePasswordDialog">{{ $t('changePassword') }}</el-menu-item>
             </el-submenu>
+            
           </template>
           <template>
-            <el-dialog title="淇敼瀵嗙爜" :visible.sync="dialogVisible" width="30%">
-              <el-form ref="form" :model="formData" label-width="100px">
-                <el-form-item label="鏃у瘑鐮�">
+            <el-dialog :title="$t('changePassword')" :visible.sync="dialogVisible" width="30%">
+              <el-form ref="form" :model="formData" label-width="200px">
+                <el-form-item :label="$t('Old password')">
                   <el-input v-model="formData.oldPassword" type="password" show-password></el-input>
                 </el-form-item>
-                <el-form-item label="鏂板瘑鐮�">
+                <el-form-item :label="$t('New password')">
                   <el-input v-model="formData.newPassword" type="password" show-password></el-input>
                 </el-form-item>
-                <el-form-item label="纭鏂板瘑鐮�">
+                <el-form-item :label="$t('Confirm password')">
                   <el-input v-model="formData.confirmPassword" type="password" show-password></el-input>
                 </el-form-item>
               </el-form>
               <div slot="footer" class="dialog-footer">
-                <el-button @click="dialogVisible = false">鍙栨秷</el-button>
-                <el-button type="primary" @click="savePassword">淇濆瓨</el-button>
+                <el-button @click="dialogVisible = false">{{ $t('cancel') }}</el-button>
+                <el-button type="primary" @click="savePassword">{{ $t('confirm') }}</el-button>
               </div>
             </el-dialog>
           </template>
@@ -101,12 +102,13 @@
         <el-table-column prop="timeons" :label="$t('timeon')"></el-table-column>
       </el-table>
     </el-dialog>
-    <el-dialog :visible.sync="dialogFormCountDown" :title="$t('Approximately resettable time')" top="5vh">
-            <div :style="'font-size: ' + PromptSize + 'px;text-align: center;'">
-                <!-- {{ this.CountDowns }} -->
-                {{ this.CountDowns }}
-            </div>
-        </el-dialog>
+    <el-dialog :visible.sync="dialogFormVisible3" >
+     
+      <el-button :class="{ 'blue-button': receivedData === 1 }" @click="toggleButtonValue(1)">{{ $t('A01Abort/ResumeTasks') }}</el-button>
+    <el-button :class="{ 'blue-button': receivedData2 === 1 }" @click="toggleButtonValue(2)">{{ $t('A02Abort/ResumeTasks') }}</el-button>
+      
+    </el-dialog>
+
   </el-container>
 </template>
 
@@ -115,6 +117,7 @@
 import { changePassword } from '../api/user'
 import { removeToken } from "../utils/auth";
 import LanguageMixin from '../lang/LanguageMixin'
+import { MessageBox } from 'element-ui';
 // import { mapState, mapMutations } from 'vuex';
 // import Tag from '../layout/tag.vue';
 // import store from '../store';
@@ -128,6 +131,8 @@
     return {
       activeTag: '', // 褰撳墠婵�娲荤殑鏍囩
       dialogVisible: false,
+      receivedData:0,
+      receivedData2:0,
       formData: {
         oldPassword: '',
         newPassword: '',
@@ -142,19 +147,18 @@
         pageNum: -1
       },
       dialogFormVisible2: false,
-      dialogFormCountDown:false,
+      dialogFormVisible3: false,
       alarm: [],
-      alarm2: [],
-      CountDowns: "0",
-      EmergencyStop: false,
-      PromptSize:500,
-      reset:false
+      alarm2: []
     }
   },
   // components: {
   //   Tag
   // },
   created() {
+
+   
+ 
     selectList(this.menuListForm).then(res => {
       this.menuList = res.data
 
@@ -171,6 +175,48 @@
     // ...mapState('tags', ['tags'])
   },
   methods: {
+    toggleButtonValue(buttonNumber) {
+
+      MessageBox.confirm(this.$t('Are you sure to perform this operation?'), this.$t('prompt'), {
+    confirmButtonText: this.$t('confirm'),
+    cancelButtonText: this.$t('cancel'),
+    type: 'warning'
+  }).then(() => {
+    // 鐐瑰嚮纭鎸夐挳鍚庢墽琛岀殑鎿嶄綔
+      if (buttonNumber === 1) {
+        this.receivedData = this.receivedData === 0 ? 1 : 0;
+      } else if (buttonNumber === 2) {
+        this.receivedData2 = this.receivedData2 === 0 ? 1 : 0;
+      }
+console.log(this.receivedData,this.receivedData2)
+
+
+        const data3 = [];
+        const resetButtonValues3 = [this.receivedData,this.receivedData2];
+
+        // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
+        data3.push(resetButtonValues3.flat());
+      
+        // 鍦� data3 鏁扮粍鍓嶉潰娣诲姞涓や釜绌烘暟缁�
+
+        // 鍒涘缓 jsonObject3 瀵硅薄锛屽苟娣诲姞 data3 灞炴��
+        const jsonObject3 = { data: data3 };
+
+        // 鎻愪氦鏁版嵁鍒板悗绔�
+        const jsonString3 = JSON.stringify(jsonObject3);
+        console.log("鎬ュ仠鍚庝腑姝�/缁х画閫夋嫨:", jsonString3);
+        socket?.send(jsonString3);
+        setTimeout(() => {
+      this.dialogFormVisible3 = false;
+    }, 1000); // 寤惰繜鏃堕棿涓�1绉掞紙1000姣锛�
+      }).catch(() => {
+    // 鐐瑰嚮鍙栨秷鎸夐挳鍚庢墽琛岀殑鎿嶄綔
+  });
+     
+      
+
+
+    },
     init() {
       let viewname = "Home";
       if (typeof (WebSocket) == "undefined") {
@@ -192,10 +238,12 @@
         socket.onmessage = function (msg) {
           //console.log("鏀跺埌鏁版嵁====" + msg.data);
           let obj = JSON.parse(msg.data);
+          if(obj.alarmmg){
 
+         
           if (obj.alarmmg[0].length > 0) {
             if (this.alarm.length > 0) {
-              if (this.alarm[this.alarm.length - 1].id != obj.alarmmg[0][obj.alarmmg[0].length - 1].id) {
+              if (this.alarm[this.alarm.length - 1].id != obj.alarmmg[0][obj.alarmmg[0].length-1].id) {
                 this.alarm = obj.alarmmg[0];
                 this.dialogFormVisible2 = true;
               }
@@ -207,24 +255,23 @@
               this.alarm = obj.alarmmg[0];
               this.dialogFormVisible2 = false;
           }
-          //鏄惁鎬ュ仠
-          if (obj.emergencystop != null) {
-            this.EmergencyStop = obj.emergencystop[0];
-          }
+        }
 
-          //澶嶄綅鍊掕鏃�
-          if (obj.countdown != null) {
-            if ((obj.countdown[0] == true && this.CountDowns == 0) || this.EmergencyStop == true) {
-              this.CountDown();
-            }
-          }
 
-          //澶嶄綅瀹屾垚淇″彿
-          if (obj.reset != null) {
-            this.reset = obj.reset[0];
-          }
 
-          this.$forceUpdate();
+          
+          
+         
+
+if(obj.Abort){
+
+          if (obj.Abort[0].length > 0) {
+            this.receivedData=obj.Abort[0][0];
+            this.receivedData2=obj.Abort[0][1];
+           this.dialogFormVisible3 = true;
+          }
+        }
+        this.$forceUpdate();
 
         }.bind(this);
         //鍏抽棴浜嬩欢
@@ -236,35 +283,6 @@
           console.log("websocket鍙戠敓浜嗛敊璇�");
         }
       }
-    },
-    //45绉掑浣嶅�掓暟璁℃椂
-    CountDown() {
-      let count = 45;
-      let timer = setInterval(
-        () => {
-          if (this.EmergencyStop == true) {
-            this.dialogFormCountDown = false;
-            clearInterval(timer);
-            this.CountDowns = "0";
-          } else {
-            if (count > 0) {
-              this.PromptSize = 500;
-              this.CountDowns = count;
-              count--;
-              this.dialogFormCountDown = true;
-            }
-            else {
-              this.PromptSize = 200;
-              this.CountDowns = "Waiting for reset";
-              if (this.reset == true) {
-                clearInterval(timer);
-                this.dialogFormCountDown = false;
-              }
-            }
-          }
-        },
-        1000
-      );
     },
     logout: function () {
       removeToken()
@@ -286,7 +304,6 @@
       //   this.$store.commit('tags/addTag', tag);
       // }
     },
-
 
     removeTag() {
       // this.$store.commit('tags/removeTag', index); // 浠� Vuex Store 涓Щ闄ゆ爣绛�
@@ -419,7 +436,10 @@
     margin-left: 10px;
   }
 }
-
+.blue-button {
+  background-color: green;
+  color: white;
+}
 .el-header {
 
   background-color: #576574;

--
Gitblit v1.8.0