ZengTao
2023-12-26 7677ec6038c661951fcd74a2acfce65f2e83a01e
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')