fix:修复加载显示

This commit is contained in:
zhongzm
2024-11-18 18:15:23 +08:00
parent 851e8a461e
commit 256802e698

View File

@@ -31,7 +31,7 @@ interface ChartDataItem {
date: string; // 将存储完整的时间字符串包含时分秒 date: string; // 将存储完整的时间字符串包含时分秒
[kpiId: string]: string | number; // 动态指标 [kpiId: string]: string | number; // 动态指标
} }
const tableLoading = ref(false);
//网元类型定义 //网元类型定义
const ALL_NE_TYPES = ['AMF','SMF','UPF','MME','IMS','SMSC'] as const; const ALL_NE_TYPES = ['AMF','SMF','UPF','MME','IMS','SMSC'] as const;
type NeType= typeof ALL_NE_TYPES[number]; type NeType= typeof ALL_NE_TYPES[number];
@@ -107,6 +107,7 @@ const fnRealTimeSwitch = (bool: boolean) => {
} }
chartData.value = []; chartData.value = [];
tableLoading.value =true;
const options: OptionsType = { const options: OptionsType = {
url: '/ws', url: '/ws',
params: { params: {
@@ -119,6 +120,7 @@ const fnRealTimeSwitch = (bool: boolean) => {
} else if (ws.value) { } else if (ws.value) {
ws.value.close(); //断开链接 ws.value.close(); //断开链接
ws.value = null; //清空链接 ws.value = null; //清空链接
tableLoading.value = false;
} }
}; };
@@ -142,6 +144,9 @@ const handleWebSocketMessage = (kpiEvent:any)=>{
// 更新数据 // 更新数据
updateChartData(newData); updateChartData(newData);
if(tableLoading.value){
tableLoading.value=false;
}
}; };
//成功回调 //成功回调
const wsMessage = (res:Record<string,any>)=>{ const wsMessage = (res:Record<string,any>)=>{
@@ -606,6 +611,7 @@ const updateChartLegendSelect = (selectedKpiId?: string) => {
:pagination="false" :pagination="false"
:scroll="{ y: 250 }" :scroll="{ y: 250 }"
size="small" size="small"
:loading="tableLoading"
:custom-row="(record) => ({ :custom-row="(record) => ({
onClick: () => handleRowClick(record), onClick: () => handleRowClick(record),
class: record.kpiId === selectedRow ? 'selected-row' : '' class: record.kpiId === selectedRow ? 'selected-row' : ''