feat:指标尾缀neId改为neName

This commit is contained in:
zhongzm
2025-09-02 18:14:05 +08:00
parent 5d60156456
commit 357292d445
2 changed files with 28 additions and 6 deletions

View File

@@ -341,7 +341,7 @@ function fnInitGoldStatsData() {
for (const neId of state.neIds) {
kpiStats.value.push({
kpiId: `${columns.key}_${neId}`,
title: `${columns.title}(${neId})`,
title: `${columns.title}(${getNeNameById(neId, state.neType)})`,
rawKpiId: columns.key,
rawKpiTitle: columns.title,
neId: neId,
@@ -550,6 +550,16 @@ function fnRecordExport() {
/**可选网元列表 */
let availableNeIds = ref<{ label: string; value: string }[]>([]);
/**网元列表数据 - 按类型分组 */
let neList = ref<Record<string, { neId: string; neName: string }[]>>({});
/**根据neId和neType获取neName */
function getNeNameById(neId: string, neType: string): string {
const neArray = neList.value[neType] || [];
const ne = neArray.find(item => item.neId === neId);
return ne ? ne.neName : neId;
}
// 添加类型定义
interface KPIStats {
kpiId: string;
@@ -779,7 +789,7 @@ function fnCreateDefaultDataStructure() {
}
for (const neId of state.neIds) {
const kpiId = `${columns.key}_${neId}`;
const seriesName = `${columns.title}(${neId})`;
const seriesName = `${columns.title}(${getNeNameById(neId, state.neType)})`;
// 获取或生成颜色
const color = kpiColors.get(kpiId) || generateColorRGBA();
kpiColors.set(kpiId, color);
@@ -1269,7 +1279,7 @@ function wsMessage(res: Record<string, any>) {
}
const kpiId = `${columns.key}_${neId}`;
const seriesName = `${columns.title}(${neId})`;
const seriesName = `${columns.title}(${getNeNameById(neId, state.neType)})`;
// 获取或生成颜色
const color = kpiColors.get(kpiId) || generateColorRGBA();
@@ -1475,6 +1485,18 @@ onMounted(() => {
neInfoStore.fnNelist().then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
if (res.data.length > 0) {
// 构建按网元类型分组的数据结构
neList.value = {};
res.data.forEach((ne: any) => {
if (!neList.value[ne.neType]) {
neList.value[ne.neType] = [];
}
neList.value[ne.neType].push({
neId: ne.neId,
neName: ne.neName,
});
});
// 过滤不可用的网元
neCascaderOptions.value = neInfoStore.getNeCascaderOptions.filter(
(item: any) => {

View File

@@ -546,7 +546,7 @@ const updateChart = () => {
kpiColors.set(key, color);
series.push({
name: `${kpi.title}(${ne.neId})`,
name: `${kpi.title}(${ne.neName})`,
type: 'line',
data: chartData.value.map(item => item[key] || 0),
itemStyle: { color },
@@ -830,7 +830,7 @@ const updateChartData = (newData: ChartDataItem) => {
return {
type: 'line',
data: chartData.value.map(item => item[key] || 0),
name: `${kpi?.title || kpiId}(${ne.neId})`,
name: `${kpi?.title || kpiId}(${ne.neName})`,
};
})
)
@@ -871,7 +871,7 @@ function fnInitKpiStatsData() {
kpiStats.value.push({
kpiId: `${kpiId}_${ne.neId}`,
title: `${kpi.title}(${ne.neId})`,
title: `${kpi.title}(${ne.neName})`,
last1Day: '', // 空白显示loading状态表示正在获取数据
last7Days: '',
last30Days: '',