zhuguifei
昨天 7941623b1fb108a154ea4270d7c7e2df6031f6e5
pages/tabBar/device.vue
@@ -208,23 +208,28 @@
            loading: true,
            // v-model绑定的这个变量不要在分页请求结束中自己赋值!!!
            dataList: [],
            curDate: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
            curDate: dayjs().format('YYYY-MM-DD HH:mm:ss'),
            isProcessing: false,
            // key->设备租户+code 
            dataMap: new Map(),
            alarmEquCount: 0,
            faultEquCount: 0,
            timer: null
            timer: null,
            mqttThrottleMs: 1000,
            lastMqttTs: 0,
            dateTimer: null
         }
      },
      onShow() {
         this.startTimer()
         this.startDateTimer()
         this.mqttData()
      },
      onHide() {
         this.stopTimer()
         this.stopDateTimer()
         uni.$off(this.$constant.MQTT_TOPIC_MESSAGE)
      },
      onTabItemTap: function(e) {
@@ -297,6 +302,14 @@
         stopTimer() {
            clearInterval(this.timer);
         },
         startDateTimer() {
            this.dateTimer = setInterval(() => {
               this.curDate = dayjs().format('YYYY-MM-DD HH:mm:ss')
            }, 1000);
         },
         stopDateTimer() {
            clearInterval(this.dateTimer);
         },
         queryRealFaultData() {
            //发送数据
            const message = {
@@ -324,6 +337,9 @@
         mqttData() {
            uni.$on(this.$constant.MQTT_TOPIC_MESSAGE, (data) => {
               try {
                  const now = Date.now();
                  if (now - this.lastMqttTs < this.mqttThrottleMs) return;
                  this.lastMqttTs = now;
                  // 1. 数据解析和验证
                  const {
                     data: wdata,