This commit is contained in:
lai
2024-11-19 11:30:13 +08:00

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>)=>{
@@ -286,10 +291,9 @@ const updateChart = () => {
}, },
grid: { grid: {
//网格配置 //网格配置
left: '3%', left: '6%',
right: '4%', right: '6%',
bottom: '3%', bottom: '3%',
top: 100,
containLabel: true, containLabel: true,
}, },
xAxis: { xAxis: {
@@ -607,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' : ''
@@ -643,7 +648,7 @@ const updateChartLegendSelect = (selectedKpiId?: string) => {
} }
.chart-container { .chart-container {
height: calc(100vh - 550px); height: 400px;
width: 100%; width: 100%;
} }