提交app代码
This commit is contained in:
@@ -182,6 +182,7 @@ export default {
|
||||
engineeringName: '',
|
||||
equipmentName: '',
|
||||
runStatus: 1,
|
||||
connection: false,
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
@@ -617,10 +618,11 @@ export default {
|
||||
mask: true,
|
||||
})
|
||||
this.clear()
|
||||
|
||||
this.connection = false
|
||||
await getBaseRealData(this.lineId)
|
||||
.then((res) => {
|
||||
if (res.code == 'A0000') {
|
||||
this.connection = true
|
||||
this.$util.toast(e == 0 ? '连接成功!' : '刷新成功!')
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer)
|
||||
@@ -628,16 +630,24 @@ export default {
|
||||
}
|
||||
|
||||
this.timer = setInterval(() => {
|
||||
getBaseRealData(this.lineId).then((res) => {
|
||||
console.log(res, '获取基础实时数据')
|
||||
})
|
||||
getBaseRealData(this.lineId)
|
||||
.then((res) => {
|
||||
this.connection = true
|
||||
console.log(res, '获取基础实时数据')
|
||||
})
|
||||
.catch(() => {
|
||||
this.connection = false
|
||||
this.clear()
|
||||
})
|
||||
}, 30000)
|
||||
} else {
|
||||
this.countdown = 60 // 重置倒计时
|
||||
this.disabled = false
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
.catch(() => {
|
||||
this.countdown = 60 // 重置倒计时
|
||||
this.disabled = false
|
||||
this.connection = false
|
||||
this.clear()
|
||||
})
|
||||
},
|
||||
|
||||
initMqtt() {
|
||||
@@ -690,6 +700,8 @@ export default {
|
||||
.on('message', (topic, message) => {
|
||||
// console.log('接收推送信息:', JSON.parse(message.toString()), topic)
|
||||
// console.log('🚀 ~ .on ~ topic:', topic)
|
||||
if (!this.connection) return
|
||||
|
||||
if (topic === `/Web/RealData/${this.userInfo.userIndex}`) {
|
||||
let list = JSON.parse(message.toString())
|
||||
if (list.lineId == this.lineId) {
|
||||
@@ -857,6 +869,9 @@ export default {
|
||||
// 监测点变化
|
||||
async lineChange(e) {
|
||||
await this.clear()
|
||||
this.disabled = false
|
||||
this.countdown = 60
|
||||
|
||||
this.lineKey = e.detail.value
|
||||
this.lineId = this.lineList[e.detail.value].lineId
|
||||
await (this.client && this.client.end())
|
||||
|
||||
Reference in New Issue
Block a user