联调app
This commit is contained in:
@@ -201,6 +201,7 @@ export default {
|
||||
this.echartsDataA1 = this.initEcharts('#DAA520', 1, 'A相(A)')
|
||||
this.echartsDataA2 = this.initEcharts('#2E8B57', 1, 'B相(A)')
|
||||
this.echartsDataA3 = this.initEcharts('#A52a2a', 1, 'C相(A)')
|
||||
this.loading = false
|
||||
this.$nextTick(() => {
|
||||
this.setMqtt(0)
|
||||
this.initMqtt()
|
||||
@@ -224,7 +225,7 @@ export default {
|
||||
}
|
||||
})
|
||||
clearInterval(this.timer)
|
||||
this.client.end()
|
||||
this.client && this.client.end()
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -590,7 +591,7 @@ export default {
|
||||
// 刷新
|
||||
handleRefresh() {
|
||||
this.disabled = true
|
||||
this.client.end()
|
||||
this.client && this.client.end()
|
||||
this.setMqtt(1)
|
||||
this.initMqtt()
|
||||
if (this.numTimer) {
|
||||
@@ -611,7 +612,12 @@ export default {
|
||||
}, 1000)
|
||||
},
|
||||
async setMqtt(e) {
|
||||
uni.showLoading({
|
||||
title: '连接中,请稍等...',
|
||||
mask: true,
|
||||
})
|
||||
this.clear()
|
||||
|
||||
await getBaseRealData(this.lineId)
|
||||
.then((res) => {
|
||||
if (res.code == 'A0000') {
|
||||
@@ -620,7 +626,7 @@ export default {
|
||||
clearInterval(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
this.loading = false
|
||||
|
||||
this.timer = setInterval(() => {
|
||||
getBaseRealData(this.lineId).then((res) => {
|
||||
console.log(res, '获取基础实时数据')
|
||||
@@ -629,12 +635,9 @@ export default {
|
||||
} else {
|
||||
this.countdown = 60 // 重置倒计时
|
||||
this.disabled = false
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
|
||||
initMqtt() {
|
||||
@@ -852,13 +855,13 @@ export default {
|
||||
})
|
||||
},
|
||||
// 监测点变化
|
||||
lineChange(e) {
|
||||
this.clear()
|
||||
async lineChange(e) {
|
||||
await this.clear()
|
||||
this.lineKey = e.detail.value
|
||||
this.lineId = this.lineList[e.detail.value].lineId
|
||||
this.client.end()
|
||||
this.setMqtt(0)
|
||||
this.initMqtt()
|
||||
await (this.client && this.client.end())
|
||||
await this.setMqtt(0)
|
||||
await this.initMqtt()
|
||||
},
|
||||
},
|
||||
|
||||
@@ -957,6 +960,7 @@ export default {
|
||||
display: flex;
|
||||
position: relative;
|
||||
height: 600rpx;
|
||||
margin: 0 10rpx;
|
||||
flex: 1;
|
||||
.echart1 {
|
||||
position: absolute;
|
||||
@@ -967,6 +971,7 @@ export default {
|
||||
.chart {
|
||||
width: 170rpx;
|
||||
height: 200rpx;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
.text {
|
||||
text-align: center;
|
||||
|
||||
Reference in New Issue
Block a user