提交app代码

This commit is contained in:
guanj
2026-04-01 10:00:04 +08:00
parent 66cee2922d
commit 966d6d342c
12 changed files with 234 additions and 149 deletions

View File

@@ -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())