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