From b678083e879d5773d9b1ba2ba8588360a997f82b Mon Sep 17 00:00:00 2001 From: guanj Date: Tue, 13 Jan 2026 15:20:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96mqtt=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/mt-preview-ypt/index.vue | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/components/mt-preview-ypt/index.vue b/src/components/mt-preview-ypt/index.vue index 0cd9825..d4a0df5 100644 --- a/src/components/mt-preview-ypt/index.vue +++ b/src/components/mt-preview-ypt/index.vue @@ -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) // 发送消息