| | |
| | | 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) {
|
| | |
| | | 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 = {
|
| | |
| | | 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,
|