优化mqtt加载问题
This commit is contained in:
@@ -492,12 +492,14 @@ const setImportJson = (exportJson: IExportJson) => {
|
|||||||
}
|
}
|
||||||
grid_cfg.value = gridCfg
|
grid_cfg.value = gridCfg
|
||||||
done_json.value = importDoneJson
|
done_json.value = importDoneJson
|
||||||
|
console.log(11111111111)
|
||||||
// 为图元添加点击事件
|
// 为图元添加点击事件
|
||||||
addClickEventsToElements()
|
addClickEventsToElements()
|
||||||
|
|
||||||
// 首页初始化的时候
|
// 首页初始化的时候
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
console.log(22222222222222)
|
||||||
|
|
||||||
done_json.value.forEach(item => {
|
done_json.value.forEach(item => {
|
||||||
//报警设备闪烁
|
//报警设备闪烁
|
||||||
if (findTransmissionDeviceIdsByKeyList(keyList.value).includes(item.id)) {
|
if (findTransmissionDeviceIdsByKeyList(keyList.value).includes(item.id)) {
|
||||||
@@ -513,10 +515,10 @@ const setImportJson = (exportJson: IExportJson) => {
|
|||||||
if (!useData.loading) {
|
if (!useData.loading) {
|
||||||
if (exportJson == null) {
|
if (exportJson == null) {
|
||||||
setDoneJson(useData.dataTree[0].kId)
|
setDoneJson(useData.dataTree[0].kId)
|
||||||
publish(useData.dataTree[0])
|
|
||||||
singlePublish(useData.dataTree[0])
|
|
||||||
} else {
|
} else {
|
||||||
executeOperations()
|
executeOperations()
|
||||||
|
publish(useData.dataTree[0])
|
||||||
|
singlePublish(useData.dataTree[0])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 如果不是true,添加监听
|
// 如果不是true,添加监听
|
||||||
@@ -526,11 +528,11 @@ const setImportJson = (exportJson: IExportJson) => {
|
|||||||
if (newVal === false) {
|
if (newVal === false) {
|
||||||
// 当loading变为true时执行操作
|
// 当loading变为true时执行操作
|
||||||
if (exportJson == null) {
|
if (exportJson == null) {
|
||||||
singlePublish(useData.dataTree[0])
|
|
||||||
setDoneJson(useData.dataTree[0].kId)
|
setDoneJson(useData.dataTree[0].kId)
|
||||||
publish(useData.dataTree[0])
|
|
||||||
} else {
|
} else {
|
||||||
executeOperations()
|
executeOperations()
|
||||||
|
singlePublish(useData.dataTree[0])
|
||||||
|
publish(useData.dataTree[0])
|
||||||
}
|
}
|
||||||
// 执行后停止监听
|
// 执行后停止监听
|
||||||
stopWatch()
|
stopWatch()
|
||||||
@@ -706,9 +708,6 @@ const setMqtt = async () => {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (done_json.value) {
|
if (done_json.value) {
|
||||||
// list.value = [
|
|
||||||
// ...new Set(msg.filter((item: any) => item.devStatus === 1).map((item: any) => item.lineId))
|
|
||||||
// ]
|
|
||||||
done_json.value?.forEach(item => {
|
done_json.value?.forEach(item => {
|
||||||
msg.forEach((msgValue: any) => {
|
msg.forEach((msgValue: any) => {
|
||||||
if (item.id == msgValue.id) {
|
if (item.id == msgValue.id) {
|
||||||
@@ -719,15 +718,9 @@ const setMqtt = async () => {
|
|||||||
) //'B相负载电流-CP95:31'
|
) //'B相负载电流-CP95:31'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// list.value.forEach((listValue: any) => {
|
|
||||||
// if (listValue == item.lineId && item.type == 'svg') {
|
|
||||||
// item.props.fill.val = '#ff0000'
|
|
||||||
// // item.common_animations.val = 'flash'
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, 100)
|
}, 500)
|
||||||
}
|
}
|
||||||
if (subscribe.split('/')[2] === 'csConfigRtData') {
|
if (subscribe.split('/')[2] === 'csConfigRtData') {
|
||||||
// 指标数据
|
// 指标数据
|
||||||
@@ -761,8 +754,6 @@ const setMqtt = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const singlePublish = async (id: string) => {
|
const singlePublish = async (id: string) => {
|
||||||
console.log(123)
|
|
||||||
|
|
||||||
if (mqttClient.value) {
|
if (mqttClient.value) {
|
||||||
await mqttClient.value.subscribe('zl/askRtData/' + storedSelectedId)
|
await mqttClient.value.subscribe('zl/askRtData/' + storedSelectedId)
|
||||||
// 发送消息
|
// 发送消息
|
||||||
|
|||||||
Reference in New Issue
Block a user