修改实时数据loading状态

This commit is contained in:
zhujiyan
2024-10-24 18:02:27 +08:00
parent afbc86cf3a
commit 1451225ebe

View File

@@ -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服务器成功!')