From 1451225ebe06b5d1b2cb02fe02d342b36d331385 Mon Sep 17 00:00:00 2001 From: zhujiyan <17812234322@163.com> Date: Thu, 24 Oct 2024 18:02:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9E=E6=97=B6=E6=95=B0?= =?UTF-8?q?=E6=8D=AEloading=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/govern/device/control/index.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/views/govern/device/control/index.vue b/src/views/govern/device/control/index.vue index d588e4e..a931f43 100644 --- a/src/views/govern/device/control/index.vue +++ b/src/views/govern/device/control/index.vue @@ -423,6 +423,7 @@ const sonTab = ref() //谐波频谱 const realTrendRef = ref() const changeTrendType = (val: any) => { + trendDataTime.value = '' activeTrendName.value = val * 1 handleTrend() } @@ -440,9 +441,11 @@ const handleTrend = async () => { if (trendTimer.value) { window.clearInterval(trendTimer.value) } + tableLoading.value = true await getHarmRealData(lineId.value, activeTrendName.value) .then((res: any) => { if (res.code == 'A0000') { + trendDataTime.value = '' ElMessage.success('装置应答成功') //每隔30s调用一下接口,通知后台推送mqtt消息 trendTimer.value = window.setInterval(() => { @@ -460,6 +463,7 @@ const handleTrend = async () => { console.log('进来聊聊吗') trendDataTime.value = obj.dataTime realTrendRef.value && realTrendRef.value.setRealTrendData(obj) + tableLoading.value = false } // else { // trendDataTime.value = obj.dataTime @@ -471,6 +475,7 @@ const handleTrend = async () => { }) .catch(e => { realTrendRef.value && realTrendRef.value.setRealTrendData(false) + tableLoading.value = false }) await getOverLimitData(lineId.value).then((res: any) => { @@ -523,7 +528,7 @@ const handleReturn = async () => { tableLoading.value = true await getBasicRealData(lineId.value).then((res: any) => { if (res.code == 'A0000') { - // ElMessage.success('装置应答成功') + ElMessage.success('装置应答成功') // mqttMessage.value = {} realDataTimer.value = window.setInterval(() => { getBasicRealData(lineId.value).then((res: any) => { @@ -662,7 +667,6 @@ const getRealDataMqttMsg = async () => { } //新的实时数据 //1.调用接口 mqtt推送数据 - tableLoading.value = true await getBasicRealData(lineId.value).then((res: any) => { if (res.code == 'A0000') { ElMessage.success('装置应答成功') @@ -824,6 +828,7 @@ const getRealDataMqttMsg = async () => { }) } else { ElMessage.success('装置应答失败') + tableLoading.value = false } }) } @@ -892,9 +897,6 @@ const handleClick = async (tab?: any) => { if (dataSet.value.includes('_realtimedata')) { //查询实时数据显示实时录波、实时趋势、谐波频谱 realTimeFlag.value = true - setTimeout(() => { - tableLoading.value = false - }, 1500) connectMqtt() mqttRef.value.on('connect', (e: any) => { // ElMessage.success('连接mqtt服务器成功!')