fix: KPI总览无数据时展示title

This commit is contained in:
TsMask
2025-03-25 15:56:05 +08:00
parent 6590a0c811
commit b10aed3d14
2 changed files with 72 additions and 33 deletions

View File

@@ -240,34 +240,33 @@ const statsColumns: TableColumnType<any>[] = [
title: t('views.perfManage.kpiOverView.kpiName'),
dataIndex: 'title',
key: 'title',
width: '65%',
},
{
title: t('views.perfManage.kpiOverView.totalValue'),
dataIndex: 'total',
key: 'total',
width: '12%',
sortDirections: ['ascend', 'descend'],
},
{
title: t('views.perfManage.kpiOverView.avgValue'),
dataIndex: 'avg',
key: 'avg',
width: '24%',
sortDirections: ['ascend', 'descend'],
},
// {
// title: t('views.perfManage.kpiOverView.totalValue'),
// dataIndex: 'total',
// key: 'total',
// width: '12%',
// sortDirections: ['ascend', 'descend'],
// },
// {
// title: t('views.perfManage.kpiOverView.avgValue'),
// dataIndex: 'avg',
// key: 'avg',
// width: '24%',
// sortDirections: ['ascend', 'descend'],
// },
{
title: t('views.perfManage.kpiOverView.maxValue'),
dataIndex: 'max',
key: 'max',
width: '17%',
width: '200px',
sortDirections: ['ascend', 'descend'],
},
{
title: t('views.perfManage.kpiOverView.minValue'),
dataIndex: 'min',
key: 'min',
width: '17%',
width: '200px',
sortDirections: ['ascend', 'descend'],
},
];
@@ -424,8 +423,8 @@ function fnGetList() {
duration: 2,
});
tableState.data = [];
tableColumns.value = [];
tableColumnsDnd.value = [];
// tableColumns.value = [];
// tableColumnsDnd.value = [];
kpiStats.value = []; //清空数据
fnRanderChartData();
return false;
@@ -469,6 +468,26 @@ function fnGetList() {
total: total,
});
}
} else {
kpiStats.value = [];
for (const columns of tableColumns.value) {
if (
columns.key === 'neName' ||
columns.key === 'startIndex' ||
columns.key === 'timeGroup'
) {
continue;
}
kpiStats.value.push({
kpiId: columns.key,
title: columns.title,
unit: columns.unit,
max: 0,
min: 0,
avg: 0,
total: 0,
});
}
}
});
}
@@ -757,7 +776,6 @@ const selectedUnit = ref<string | null>(null);
// 添加处理行点击的方法
function handleRowClick(record: any) {
const index = selectedRow.value.indexOf(record.kpiId);
console.log(record);
// 如果已经选中,取消选中
if (index > -1) {
selectedRow.value.splice(index, 1);
@@ -891,7 +909,7 @@ onMounted(() => {
return;
}
// 无查询参数neType时 默认选择UPF
const queryNeType = (route.query.neType as string) || 'UPF';
const queryNeType = (route.query.neType as string) || 'IMS';
const item = neCascaderOptions.value.find(
s => s.value === queryNeType
);
@@ -954,6 +972,7 @@ onBeforeUnmount(() => {
v-model:value="state.neType"
:options="neCascaderOptions"
:allow-clear="false"
@change="fnGetListTitle()"
:placeholder="t('common.selectPlease')"
/>
</a-form-item>
@@ -1041,7 +1060,6 @@ onBeforeUnmount(() => {
</a-tooltip>
<TableColumnsDnd
v-if="tableColumns.length > 0"
:cache-id="`kpiTarget_${state.neType[0]}`"
:columns="tableColumns"
v-model:columns-dnd="tableColumnsDnd"
></TableColumnsDnd>
@@ -1129,7 +1147,7 @@ onBeforeUnmount(() => {
<div class="table-container">
<a-table
:columns="state.neType[0] !== 'UPF' ? statsColumns.filter(c => c.key !== 'total') : statsColumns"
:columns="statsColumns"
:data-source="kpiStats"
:pagination="false"
:scroll="{ y: 250 }"