|
@@ -63,10 +63,14 @@ export default {
|
|
|
localStorage.setItem('mqttUrl', 'wss://'+Decrypt(config.mqttExtranetUrl))
|
|
localStorage.setItem('mqttUrl', 'wss://'+Decrypt(config.mqttExtranetUrl))
|
|
|
localStorage.setItem('mqttUser', Decrypt(config.mqttExtranetUser))
|
|
localStorage.setItem('mqttUser', Decrypt(config.mqttExtranetUser))
|
|
|
localStorage.setItem('mqttPassword', Decrypt(config.mqttExtranetPassword))
|
|
localStorage.setItem('mqttPassword', Decrypt(config.mqttExtranetPassword))
|
|
|
|
|
+ localStorage.setItem('fileBrowseEnvironment',urlText+Decrypt(obj.fileBrowseEnvironmentExtranet))
|
|
|
|
|
+ localStorage.setItem('fileBrowseEnvironmentExtranet',urlText+Decrypt(obj.fileBrowseEnvironmentExtranet))
|
|
|
}else{
|
|
}else{
|
|
|
localStorage.setItem('mqttUrl', 'ws://'+Decrypt(config.mqttIntranetUrl))
|
|
localStorage.setItem('mqttUrl', 'ws://'+Decrypt(config.mqttIntranetUrl))
|
|
|
localStorage.setItem('mqttUser', Decrypt(config.mqttIntranetUser))
|
|
localStorage.setItem('mqttUser', Decrypt(config.mqttIntranetUser))
|
|
|
localStorage.setItem('mqttPassword', Decrypt(config.mqttIntranetPassword))
|
|
localStorage.setItem('mqttPassword', Decrypt(config.mqttIntranetPassword))
|
|
|
|
|
+ localStorage.setItem('fileBrowseEnvironment',urlText+Decrypt(obj.fileBrowseEnvironment))
|
|
|
|
|
+ localStorage.setItem('fileBrowseEnvironmentExtranet',urlText+Decrypt(obj.fileBrowseEnvironmentExtranet))
|
|
|
}
|
|
}
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
console.error('获取MQTT配置失败:', e)
|
|
console.error('获取MQTT配置失败:', e)
|
|
@@ -98,31 +102,8 @@ export default {
|
|
|
this.mqttClient.on('message', async (topic, message) => {
|
|
this.mqttClient.on('message', async (topic, message) => {
|
|
|
try {
|
|
try {
|
|
|
const payload = JSON.parse(message.toString())
|
|
const payload = JSON.parse(message.toString())
|
|
|
- console.log('payload',payload);
|
|
|
|
|
if (payload) {
|
|
if (payload) {
|
|
|
- const res = await getTriggerInfo()
|
|
|
|
|
- const list = res.data || []
|
|
|
|
|
- if (list.length > 0) {
|
|
|
|
|
- const e = list[0]
|
|
|
|
|
- const obj = JSON.parse(e.triggerUploadData)[0]
|
|
|
|
|
- const deviceValue = obj.deviceValue
|
|
|
|
|
- const unit = obj.unit
|
|
|
|
|
- this.$refs.alertModal.show({
|
|
|
|
|
- lab: e.subName + (e.roomNum ? `(${e.roomNum})` : ''),
|
|
|
|
|
- building: [e.schoolName, e.buildName, e.floorName].filter(Boolean).join(' · '),
|
|
|
|
|
- unit: e.deptName,
|
|
|
|
|
- param: e.eventName,
|
|
|
|
|
- value: deviceValue+''+(unit=='-'?'':unit),
|
|
|
|
|
- person: e.adminName,
|
|
|
|
|
- phone: e.adminPhone,
|
|
|
|
|
- time: e.eventStartTime ? e.eventStartTime.replace('T', ' ') : '',
|
|
|
|
|
- buildId:e.buildId,
|
|
|
|
|
- floorId:e.floorId,
|
|
|
|
|
- subId:e.subId,
|
|
|
|
|
- })
|
|
|
|
|
- }else{
|
|
|
|
|
- this.$refs.alertModal.close();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.getTriggerInfo();
|
|
|
}
|
|
}
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
console.error('MQTT消息处理失败:', e)
|
|
console.error('MQTT消息处理失败:', e)
|
|
@@ -132,6 +113,31 @@ export default {
|
|
|
this.mqttClient.on('error', (err) => {
|
|
this.mqttClient.on('error', (err) => {
|
|
|
console.error('MQTT连接错误:', err)
|
|
console.error('MQTT连接错误:', err)
|
|
|
})
|
|
})
|
|
|
|
|
+ },
|
|
|
|
|
+ async getTriggerInfo() {
|
|
|
|
|
+ const res = await getTriggerInfo()
|
|
|
|
|
+ const list = res.data || []
|
|
|
|
|
+ if (list.length > 0) {
|
|
|
|
|
+ const e = list[0]
|
|
|
|
|
+ const obj = JSON.parse(e.triggerUploadData)[0]
|
|
|
|
|
+ const deviceValue = obj.deviceValue
|
|
|
|
|
+ const unit = obj.unit
|
|
|
|
|
+ this.$refs.alertModal.show({
|
|
|
|
|
+ lab: e.subName + (e.roomNum ? `(${e.roomNum})` : ''),
|
|
|
|
|
+ building: [e.schoolName, e.buildName, e.floorName].filter(Boolean).join(' · '),
|
|
|
|
|
+ unit: e.deptName,
|
|
|
|
|
+ param: e.eventName,
|
|
|
|
|
+ value: deviceValue+''+(unit=='-'?'':unit),
|
|
|
|
|
+ person: e.adminName,
|
|
|
|
|
+ phone: e.adminPhone,
|
|
|
|
|
+ time: e.eventStartTime ? e.eventStartTime.replace('T', ' ') : '',
|
|
|
|
|
+ buildId:e.buildId,
|
|
|
|
|
+ floorId:e.floorId,
|
|
|
|
|
+ subId:e.subId,
|
|
|
|
|
+ })
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.$refs.alertModal.close();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|