From 4bd46f64a4b55beaa55b7448d6193ff8c31108ee Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Tue, 25 Mar 2025 18:00:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20KPI=E6=80=BB=E8=A7=88=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=8C=87=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/perfManage/kpiCReport/index.vue | 85 ++++++++++++++++++---- src/views/perfManage/kpiOverView/index.vue | 21 +++--- 2 files changed, 81 insertions(+), 25 deletions(-) diff --git a/src/views/perfManage/kpiCReport/index.vue b/src/views/perfManage/kpiCReport/index.vue index 7639020c..d09a7b8a 100644 --- a/src/views/perfManage/kpiCReport/index.vue +++ b/src/views/perfManage/kpiCReport/index.vue @@ -240,27 +240,33 @@ const statsColumns: TableColumnType[] = [ title: t('views.perfManage.kpiOverView.kpiName'), dataIndex: 'title', key: 'title', - width: '65%', - }, - { - 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'], }, ]; @@ -356,6 +362,7 @@ function fnGetListTitle() { dataIndex: kpiValue, align: 'left', key: kpiValue, + unit: item[`unit`], resizable: true, width: 100, minWidth: 150, @@ -416,8 +423,8 @@ function fnGetList() { duration: 2, }); tableState.data = []; - tableColumns.value = []; - tableColumnsDnd.value = []; + // tableColumns.value = []; + // tableColumnsDnd.value = []; kpiStats.value = []; //清空数据 fnRanderChartData(); return false; @@ -448,16 +455,37 @@ function fnGetList() { const total = Number( values.reduce((sum, val) => sum + val, 0).toFixed(2) ); - // 计算平均值 const avg = values.length > 0 ? Number((total / values.length).toFixed(2)) : 0; kpiStats.value.push({ kpiId: columns.key, title: columns.title, + unit: columns.unit, max: values.length > 0 ? Math.max(...values) : 0, min: values.length > 0 ? Math.min(...values) : 0, avg, + 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, }); } } @@ -606,7 +634,7 @@ function fnRanderChartData() { for (const item of orgData) { const keys = Object.keys(item); - //console.log(keys,item);// + //console.log(keys,item); for (const y of chartDataYSeriesData) { for (const key of keys) { if (y.key === key) { @@ -744,6 +772,7 @@ function wsMessage(res: Record) { // 添加一个变量来跟踪当前选中的行 const selectedRow = ref([]); +const selectedUnit = ref(null); // 添加处理行点击的方法 function handleRowClick(record: any) { const index = selectedRow.value.indexOf(record.kpiId); @@ -752,17 +781,33 @@ function handleRowClick(record: any) { if (index > -1) { selectedRow.value.splice(index, 1); chartLegendSelected[record.title] = false; + // 如果取消选中的是最后一个,重置 selectedUnit + if (selectedRow.value.length === 0) { + selectedUnit.value = null; + } } else { + // 检查单位是否一致 + if (selectedUnit.value && selectedUnit.value !== record.unit) { + message.error( + `${t('views.perfManage.customTarget.unitSelect')} ${selectedUnit.value}` + ); + return; + } + // 添加新的选中项 selectedRow.value.push(record.kpiId); + // 设置选中的单位 + if (!selectedUnit.value) { + selectedUnit.value = record.unit; + } + // 如果只有一个选中项,重置为 false if (selectedRow.value.length === 1) { Object.keys(chartLegendSelected).forEach(key => { chartLegendSelected[key] = false; }); } - chartLegendSelected[record.title] = true; } @@ -928,6 +973,7 @@ onBeforeUnmount(() => { v-model:value="state.neType" :options="neCascaderOptions" :allow-clear="false" + @change="fnGetListTitle()" :placeholder="t('common.selectPlease')" /> @@ -1015,7 +1061,6 @@ onBeforeUnmount(() => { @@ -1169,6 +1214,14 @@ onBeforeUnmount(() => { + diff --git a/src/views/perfManage/kpiOverView/index.vue b/src/views/perfManage/kpiOverView/index.vue index 435a4ae5..1788706f 100644 --- a/src/views/perfManage/kpiOverView/index.vue +++ b/src/views/perfManage/kpiOverView/index.vue @@ -120,10 +120,14 @@ const toggleRealtime = () => { // 定义要筛选的指标 ID,按网元类型组织 const TARGET_KPI_IDS: Record = { AMF: ['AMF.02', 'AMF.03'], - // SMF: ['SMF.02', 'SMF.03', 'SMF.04', 'SMF.05'], UPF: ['UPF.04', 'UPF.05'], + IMS: ['SCSCF.03', 'SCSCF.04', 'SCSCF.05', 'SCSCF.06', 'SCSCF.07', 'SCSCF.08'], + + // AMF: ['AMF.02', 'AMF.03', 'AMF.A.07', 'AMF.A.08'], + // SMF: ['SMF.02', 'SMF.03', 'SMF.04', 'SMF.05'], + // UPF: ['UPF.03', 'UPF.04', 'UPF.05', 'UPF.06'], // MME: ['MME.A.01', 'MME.A.02', 'MME.A.03'], - IMS: ['SCSCF.03', 'SCSCF.04', 'SCSCF.06'], + // IMS: ['SCSCF.01', 'SCSCF.02', 'SCSCF.05', 'SCSCF.06'], // SMSC: ['SMSC.A.01', 'SMSC.A.02', 'SMSC.A.03'], }; @@ -1000,6 +1004,7 @@ const tableRowConfig = computed(() => {