From 7677ec6038c661951fcd74a2acfce65f2e83a01e Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期二, 26 十二月 2023 09:26:03 +0800
Subject: [PATCH] 修改复位倒计时为全局弹出

---
 CanadaMes-ui/src/layout/index.vue |   64 ++++++++++++++++++++++++++++++--
 1 files changed, 60 insertions(+), 4 deletions(-)

diff --git a/CanadaMes-ui/src/layout/index.vue b/CanadaMes-ui/src/layout/index.vue
index a88dd1c..fe2cd2a 100644
--- a/CanadaMes-ui/src/layout/index.vue
+++ b/CanadaMes-ui/src/layout/index.vue
@@ -101,6 +101,12 @@
         <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-container>
 </template>
 
@@ -136,8 +142,13 @@
         pageNum: -1
       },
       dialogFormVisible2: false,
+      dialogFormCountDown:false,
       alarm: [],
-      alarm2: []
+      alarm2: [],
+      CountDowns: "0",
+      EmergencyStop: false,
+      PromptSize:500,
+      reset:false
     }
   },
   // components: {
@@ -181,10 +192,10 @@
         socket.onmessage = function (msg) {
           //console.log("鏀跺埌鏁版嵁====" + msg.data);
           let obj = JSON.parse(msg.data);
-          
+
           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;
               }
@@ -193,7 +204,23 @@
               this.dialogFormVisible2 = true;
             }
           }
-          
+          //鏄惁鎬ュ仠
+          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();
 
         }.bind(this);
@@ -207,6 +234,35 @@
         }
       }
     },
+    //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()
       this.$router.push('/login')

--
Gitblit v1.8.0