Merge remote-tracking branch 'origin/main-v2' into main-v2

This commit is contained in:
zhongzm
2025-07-30 18:34:50 +08:00
22 changed files with 276 additions and 527 deletions

View File

@@ -66,12 +66,19 @@ onMounted(() => {
<div class="activty">
<template v-for="item in eventData" :key="item.eId">
<!-- CDR事件IMS -->
<div class="card-cdr" :class="{ active: item.eId === eventId }" v-if="item.eType === 'ims_cdr'">
<div
class="card-cdr"
:class="{ active: item.eId === eventId }"
v-if="item.eType === 'ims_cdr'"
>
<div class="card-cdr-item">
<div>
{{ t('views.dashboard.overview.userActivity.type') }}:&nbsp;
<span>
<DictTag :options="dict.cdrCallType" :value="item.data.callType" />
<DictTag
:options="dict.cdrCallType"
:value="item.data.callType"
/>
</span>
</div>
<div></div>
@@ -109,8 +116,17 @@ onMounted(() => {
<div>
{{ t('views.dashboard.overview.userActivity.result') }}:&nbsp;
<span v-if="item.data.callType !== 'sms'">
<DictTag :options="dict.cdrSipCode" :value="item.data.cause" value-default="0" />&nbsp;&nbsp;
<DictTag :options="dict.cdrSipCodeCause" :value="item.data.cause" value-default="0" />
<DictTag
:options="dict.cdrSipCode"
:value="item.data.cause"
value-default="0"
/>
&nbsp;-&nbsp;
<DictTag
:options="dict.cdrSipCodeCause"
:value="item.data.cause"
value-default="0"
/>
</span>
<span v-else>
{{ t('views.dashboard.overview.userActivity.resultOK') }}
@@ -145,7 +161,7 @@ onMounted(() => {
flex-direction: row;
justify-content: flex-start;
&>div {
& > div {
width: 50%;
white-space: nowrap;
text-align: start;
@@ -159,7 +175,7 @@ onMounted(() => {
flex-direction: row;
justify-content: flex-start;
&>div {
& > div {
width: 33%;
}
}
@@ -181,7 +197,7 @@ onMounted(() => {
flex-direction: row;
justify-content: flex-start;
&>div {
& > div {
flex: 1;
white-space: nowrap;
text-align: start;
@@ -207,7 +223,7 @@ onMounted(() => {
&-item {
display: block;
&>div {
& > div {
width: 100%;
}
}
@@ -217,7 +233,7 @@ onMounted(() => {
&-item {
display: block;
&>div {
& > div {
width: 100%;
}
}

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import { onMounted, ref, nextTick, watch } from 'vue';
import * as echarts from 'echarts/core';
import { GridComponent, GridComponentOption, TooltipComponent } from 'echarts/components';
import { GridComponent, TooltipComponent } from 'echarts/components';
import { CanvasRenderer } from 'echarts/renderers';
import { graphNodeClickID, graphNodeState } from '../../hooks/useTopology';
import useI18n from '@/hooks/useI18n';
@@ -13,8 +13,6 @@ const { t } = useI18n();
echarts.use([GridComponent, TooltipComponent, CanvasRenderer]);
type EChartsOption = echarts.ComposeOption<GridComponentOption>;
/**图DOM节点实例对象 */
const neResourcesDom = ref<HTMLElement | undefined>(undefined);
@@ -29,7 +27,7 @@ const resourceData = ref({
neCpu: 1,
sysCpu: 1,
sysMem: 1,
sysDisk: 1
sysDisk: 1,
});
// 获取颜色
@@ -47,14 +45,14 @@ function getColorByValue(value: number) {
const optionData: any = {
tooltip: {
trigger: 'item',
formatter: '{b}: {c}%'
formatter: '{b}: {c}%',
},
grid: {
top: '10%',
bottom: '5%',
left: '5%',
right: '5%',
containLabel: true
containLabel: true,
},
series: [
{
@@ -65,27 +63,29 @@ const optionData: any = {
name: t('views.dashboard.overview.resources.neCpu'),
color: getColorByValue(resourceData.value.neCpu),
backgroundStyle: {
color: 'rgba(10, 60, 160, 0.1)'
color: 'rgba(10, 60, 160, 0.1)',
},
label: {
normal: {
formatter: () => {
return `${t('views.dashboard.overview.resources.neCpu')}\n${resourceData.value.neCpu}%`;
return `${t('views.dashboard.overview.resources.neCpu')}\n${
resourceData.value.neCpu
}%`;
},
textStyle: {
fontSize: 12,
color: '#fff'
}
}
color: '#fff',
},
},
},
outline: {
show: true,
borderDistance: 2,
itemStyle: {
borderColor: '#0a3ca0',
borderWidth: 1
}
}
borderWidth: 1,
},
},
},
{
type: 'liquidFill',
@@ -95,27 +95,29 @@ const optionData: any = {
name: t('views.dashboard.overview.resources.sysCpu'),
color: getColorByValue(resourceData.value.sysCpu),
backgroundStyle: {
color: 'rgba(10, 60, 160, 0.1)'
color: 'rgba(10, 60, 160, 0.1)',
},
label: {
normal: {
formatter: () => {
return `${t('views.dashboard.overview.resources.sysCpu')}\n${resourceData.value.sysCpu}%`;
return `${t('views.dashboard.overview.resources.sysCpu')}\n${
resourceData.value.sysCpu
}%`;
},
textStyle: {
fontSize: 12,
color: '#fff'
}
}
color: '#fff',
},
},
},
outline: {
show: true,
borderDistance: 2,
itemStyle: {
borderColor: '#0a3ca0',
borderWidth: 1
}
}
borderWidth: 1,
},
},
},
{
type: 'liquidFill',
@@ -125,27 +127,29 @@ const optionData: any = {
name: t('views.dashboard.overview.resources.sysMem'),
color: getColorByValue(resourceData.value.sysMem),
backgroundStyle: {
color: 'rgba(10, 60, 160, 0.1)'
color: 'rgba(10, 60, 160, 0.1)',
},
label: {
normal: {
formatter: () => {
return `${t('views.dashboard.overview.resources.sysMem')}\n${resourceData.value.sysMem}%`;
return `${t('views.dashboard.overview.resources.sysMem')}\n${
resourceData.value.sysMem
}%`;
},
textStyle: {
fontSize: 12,
color: '#fff'
}
}
color: '#fff',
},
},
},
outline: {
show: true,
borderDistance: 2,
itemStyle: {
borderColor: '#0a3ca0',
borderWidth: 1
}
}
borderWidth: 1,
},
},
},
{
type: 'liquidFill',
@@ -155,36 +159,35 @@ const optionData: any = {
name: t('views.dashboard.overview.resources.sysDisk'),
color: getColorByValue(resourceData.value.sysDisk),
backgroundStyle: {
color: 'rgba(10, 60, 160, 0.1)'
color: 'rgba(10, 60, 160, 0.1)',
},
label: {
normal: {
formatter: () => {
return `${t('views.dashboard.overview.resources.sysDisk')}\n${resourceData.value.sysDisk}%`;
return `${t('views.dashboard.overview.resources.sysDisk')}\n${
resourceData.value.sysDisk
}%`;
},
textStyle: {
fontSize: 12,
color: '#fff'
}
}
color: '#fff',
},
},
},
outline: {
show: true,
borderDistance: 2,
itemStyle: {
borderColor: '#0a3ca0',
borderWidth: 1
}
}
}
]
borderWidth: 1,
},
},
},
],
};
/**图数据渲染 */
function handleRanderChart(
container: HTMLElement | undefined,
option: any
) {
function handleRanderChart(container: HTMLElement | undefined, option: any) {
if (!container) return;
neResourcesChart.value = markRaw(echarts.init(container));
option && neResourcesChart.value.setOption(option);
@@ -235,7 +238,10 @@ function fnChangeData(data: any[], itemID: string) {
}
let sysDiskUsage = 0;
if (info.neStateMap[neID].disk && Array.isArray(info.neStateMap[neID].disk.partitionInfo)) {
if (
info.neStateMap[neID].disk &&
Array.isArray(info.neStateMap[neID].disk.partitionInfo)
) {
let disks: any[] = info.neStateMap[neID].disk.partitionInfo;
disks = disks.sort((a, b) => +b.used - +a.used);
if (disks.length > 0) {
@@ -248,7 +254,7 @@ function fnChangeData(data: any[], itemID: string) {
neCpu: nfCpuUsage,
sysCpu: sysCpuUsage,
sysMem: sysMemUsage,
sysDisk: sysDiskUsage
sysDisk: sysDiskUsage,
};
// 更新图表数据
@@ -260,10 +266,12 @@ function fnChangeData(data: any[], itemID: string) {
label: {
normal: {
formatter: () => {
return `${t('views.dashboard.overview.resources.neCpu')}\n${resourceData.value.neCpu}%`;
}
}
}
return `${t('views.dashboard.overview.resources.neCpu')}\n${
resourceData.value.neCpu
}%`;
},
},
},
},
{
data: [resourceData.value.sysCpu / 100],
@@ -271,10 +279,12 @@ function fnChangeData(data: any[], itemID: string) {
label: {
normal: {
formatter: () => {
return `${t('views.dashboard.overview.resources.sysCpu')}\n${resourceData.value.sysCpu}%`;
}
}
}
return `${t('views.dashboard.overview.resources.sysCpu')}\n${
resourceData.value.sysCpu
}%`;
},
},
},
},
{
data: [resourceData.value.sysMem / 100],
@@ -282,10 +292,12 @@ function fnChangeData(data: any[], itemID: string) {
label: {
normal: {
formatter: () => {
return `${t('views.dashboard.overview.resources.sysMem')}\n${resourceData.value.sysMem}%`;
}
}
}
return `${t('views.dashboard.overview.resources.sysMem')}\n${
resourceData.value.sysMem
}%`;
},
},
},
},
{
data: [resourceData.value.sysDisk / 100],
@@ -293,12 +305,14 @@ function fnChangeData(data: any[], itemID: string) {
label: {
normal: {
formatter: () => {
return `${t('views.dashboard.overview.resources.sysDisk')}\n${resourceData.value.sysDisk}%`;
}
}
}
}
]
return `${t('views.dashboard.overview.resources.sysDisk')}\n${
resourceData.value.sysDisk
}%`;
},
},
},
},
],
});
}

View File

@@ -208,10 +208,9 @@ function fnGetInitData() {
listKPIData({
neType: 'UPF',
neId: upfWhoId.value,
startTime: nowDate - 5 * 60 * 1000,
neId: '001',
beginTime: nowDate - 5 * 60 * 1000,
endTime: nowDate,
interval: 5, // 5秒
sortField: 'timeGroup',
sortOrder: 'asc',

View File

@@ -84,38 +84,35 @@ onMounted(() => {
<div></div>
</div>
<div class="card-ue-w33" v-if="item.type === 'auth-result'">
<div class="card-ue-w33" v-if="item.type === 'Auth'">
<div>
GNB ID: <span>{{ item.data.gNBID }}</span>
GNB ID: <span>{{ item.data.nbId }}</span>
</div>
<div>
Cell ID: <span>{{ item.data.cellID }}</span>
Cell ID: <span>{{ item.data.cellId }}</span>
</div>
<div>
TAC ID: <span>{{ item.data.tacID }}</span>
TAC ID: <span>{{ item.data.tac }}</span>
</div>
</div>
<div>
{{ t('views.dashboard.overview.userActivity.time') }}:
<template v-if="item.data?.time">
{{ parseDateToStr(item.data.time) }}
</template>
<template v-else-if="item.data?.timestamp">
{{ parseDateToStr(+item.data.timestamp * 1000) }}
<template v-if="item.data?.recordTime">
{{ parseDateToStr(item.data.recordTime) }}
</template>
<template v-else> - </template>
</div>
<div v-if="item.type === 'auth-result'">
<div v-if="item.type === 'Auth'">
{{ t('views.dashboard.overview.userActivity.result') }}:&nbsp;
<span>
<DictTag :options="dict.ueAauthCode" :value="item.data.result" />
</span>
</div>
<div v-if="item.type === 'detach'">
<div v-if="item.type === 'Detach'">
{{ t('views.dashboard.overview.userActivity.result') }}:
<span>{{ t('views.dashboard.overview.userActivity.resultOK') }}</span>
</div>
<div class="card-ue-w33" v-if="item.type === 'cm-state'">
<div class="card-ue-w33" v-if="item.type === 'CM'">
{{ t('views.dashboard.overview.userActivity.result') }}:&nbsp;
<span>
<DictTag :options="dict.ueEventCmState" :value="item.data.result" />
@@ -131,7 +128,7 @@ onMounted(() => {
<div class="card-ue-item">
<div>
{{ t('views.dashboard.overview.userActivity.type') }}:&nbsp;
<span v-if="item.type === 'cm-state'">
<span v-if="item.type === 'CM'">
{{
dict.ueEventType
.find(s => s.value === item.type)
@@ -148,42 +145,35 @@ onMounted(() => {
<div></div>
</div>
<div class="card-ue-w33" v-if="item.type === 'auth-result'">
<div class="card-ue-w33" v-if="item.type === 'Auth'">
<div>
ENB ID: <span>{{ item.data.eNBID }}</span>
ENB ID: <span>{{ item.data.nbId }}</span>
</div>
<div>
Cell ID: <span>{{ item.data.cellID }}</span>
Cell ID: <span>{{ item.data.cellId }}</span>
</div>
<div>
TAC ID: <span>{{ item.data.tacID }}</span>
TAC ID: <span>{{ item.data.tac }}</span>
</div>
</div>
<div>
{{ t('views.dashboard.overview.userActivity.time') }}:
<template v-if="item.data?.time">
{{ parseDateToStr(item.data.time) }}
</template>
<template v-else-if="item.data?.timestamp">
{{
typeof item.data?.timestamp === 'number'
? parseDateToStr(+item.data?.timestamp * 1000)
: parseDateToStr(item.data?.timestamp)
}}
<template v-if="item.data?.recordTime">
{{ parseDateToStr(item.data.recordTime) }}
</template>
<template v-else> - </template>
</div>
<div v-if="item.type === 'auth-result'">
<div v-if="item.type === 'Auth'">
{{ t('views.dashboard.overview.userActivity.result') }}:&nbsp;
<span>
<DictTag :options="dict.ueAauthCode" :value="item.data.result" />
</span>
</div>
<div v-if="item.type === 'detach'">
<div v-if="item.type === 'Detach'">
{{ t('views.dashboard.overview.userActivity.result') }}:
<span>{{ t('views.dashboard.overview.userActivity.resultOK') }}</span>
</div>
<div class="card-ue-w33" v-if="item.type === 'cm-state'">
<div class="card-ue-w33" v-if="item.type === 'CM'">
{{ t('views.dashboard.overview.userActivity.result') }}:&nbsp;
<span>
<DictTag :options="dict.ueEventCmState" :value="item.data.result" />

View File

@@ -2,7 +2,7 @@ import { addNeConfigData, editNeConfigData } from '@/api/ne/neConfig';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { readSheet } from '@/utils/execl-utils';
import { message } from 'ant-design-vue';
import { reactive, toRaw } from 'vue';
import { reactive } from 'vue';
import saveAs from 'file-saver';
/**
@@ -22,23 +22,25 @@ export default function useArrayImport({
imeiWhitelist: {
filename: 'import_amf_imeiWhitelist_template',
fileetx: '.xlsx',
itemKey: 'imeiPrefixValue',
itemKey: 'index',
item: (row: Record<string, any>) => {
const index = row['Index'] || 0;
return {
imeiPrefixValue: row['IMEI Prefix'],
index: 0,
imeiPrefixValue: `${row['IMEI Prefix']}`,
index: parseInt(index),
};
},
},
whitelist: {
filename: 'import_amf_whitelist_template',
fileetx: '.xlsx',
itemKey: 'imsiValue',
itemKey: 'index',
item: (row: Record<string, any>) => {
const index = row['Index'] || 0;
return {
imsiValue: row['IMSI Value'],
imeiValue: row['IMEI Value/Prefix'],
index: 0,
imsiValue: `${row['IMSI Value']}`,
imeiValue: `${row['IMEI Value/Prefix']}`,
index: parseInt(index),
};
},
},
@@ -47,11 +49,12 @@ export default function useArrayImport({
white_list: {
filename: 'import_mme_imeiWhitelist_template',
fileetx: '.xlsx',
itemKey: 'imei',
itemKey: 'index',
item: (row: Record<string, any>) => {
const index = row['Index'] || 0;
return {
imei: row['IMEI'],
index: 0,
imei: `${row['IMEI']}`,
index: parseInt(index),
};
},
},
@@ -125,7 +128,7 @@ export default function useArrayImport({
importState.loading = true;
for (const row of rows) {
const rowItem = importState.item(row);
const rowKey = rowItem[importState.itemKey];
const rowKey = rowItem[importState.itemKey] || -1;
let result: any = null;
// 检查index是否定义
const has = arrayState.columnsData.find(

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import { reactive, ref, onMounted, toRaw, watch } from 'vue';
import { useRoute } from 'vue-router';
import { PageContainer } from 'antdv-pro-layout';
import { ProModal } from 'antdv-pro-modal';
import { message } from 'ant-design-vue/es';
@@ -17,6 +18,7 @@ import useArrayBatchDel from './hooks/useArrayBatchDel';
import { getAllNeConfig, getNeConfigData } from '@/api/ne/neConfig';
const neListStore = useNeListStore();
const { t } = useI18n();
const route = useRoute();
const { ruleVerification, smfByUPFIdLoadData, smfByUPFIdOptions } = useOptions({
t,
});
@@ -404,10 +406,20 @@ onMounted(() => {
return;
}
// 默认选择AMF
const item = neCascaderOptions.value.find(s => s.value === 'AMF');
const queryNeType = (route.query.neType as string) || 'AMF';
const queryNeId = (route.query.neId as string) || '001';
const item = neCascaderOptions.value.find(s => s.value === queryNeType);
if (item && item.children) {
const info = item.children[0];
neTypeSelect.value = [info.neType, info.neId];
const info = item.children.find((s: any) => s.neId === queryNeId);
if (info) {
neTypeSelect.value = [info.neType, info.neId];
} else {
// 默认取第一个网元ID
const info = item.children[0];
if (info) {
neTypeSelect.value = [info.neType, info.neId];
}
}
} else {
const info = neCascaderOptions.value[0].children[0];
neTypeSelect.value = [info.neType, info.neId];

View File

@@ -865,6 +865,7 @@ onMounted(() => {
ok-text="TXT"
ok-type="default"
@confirm="fnExportList('txt')"
v-if="false"
>
<a-button type="dashed">
<template #icon><ExportOutlined /></template>
@@ -890,6 +891,7 @@ onMounted(() => {
ok-type="default"
@confirm="fnRecordExport('txt')"
:disabled="tableState.selectedRowKeys.length <= 0"
v-if="false"
>
<a-button
type="default"

View File

@@ -92,8 +92,8 @@ let tableColumns: ColumnsType = [
},
{
title: t('views.perfManage.customTarget.expression'),
dataIndex: 'exprAlias',
align: 'center',
dataIndex: 'expression',
align: 'left',
},
{
title: t('views.perfManage.customTarget.description'),
@@ -354,7 +354,6 @@ function fnModalVisibleByEdit(row?: any, id?: any) {
} else {
fnSelectPerformanceInit(row.neType);
modalState.from = Object.assign(modalState.from, row);
modalState.from.expression = modalState.from.exprAlias;
modalState.title = t('views.perfManage.customTarget.editCustom');
modalState.openByEdit = true;
}

View File

@@ -166,13 +166,14 @@ let queryParams: any = reactive({
/**网元标识 */
neId: '',
/**开始时间 */
startTime: '',
beginTime: '',
/**结束时间 */
endTime: '',
/**排序字段 */
sortField: 'created_at',
sortField: 'timeGroup',
/**排序方式 */
sortOrder: 'desc',
interval: 60,
});
/**表格分页、排序、筛选变化时触发操作, 排序方式,取值为 ascend descend */
@@ -306,7 +307,21 @@ function fnRecordExport() {
for (const key of keys) {
if (tableColumnsKeyArr[i] === key) {
const title = tableColumnsTitleArr[i];
kpiData[title] = item[key];
if (key == 'timeGroup') {
kpiData[title] = parseDateToStr(item[key]);
} else if (key === 'neName' || key === 'startIndex') {
kpiData[title] = item[key];
} else {
const v = parseFloat(item[key]);
let kpiV = v.toFixed(3); // 有小数部分,保留 3 位小数
// 判断数字是否有小数部分
if (Math.abs(v) < 0.001) {
kpiV = '0'; // 如果数字非常小,返回 0
} else if (v % 1 === 0) {
kpiV = v.toFixed(0); // 没有小数部分,保留 0 位小数
}
kpiData[title] = kpiV;
}
}
}
}
@@ -335,7 +350,7 @@ function fnGetListTitle() {
if (!state.neType[0]) return false;
// 获取表头文字
listCustom({ neType: state.neType[0], status: '1' })
listCustom({ neType: state.neType[0], status: '1', pageNum: 1, pageSize: 50 })
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
if (res.data.rows.length === 0) {
@@ -367,6 +382,16 @@ function fnGetListTitle() {
width: 100,
minWidth: 150,
maxWidth: 300,
customRender: (opt: any) => {
const num = parseFloat(opt.text);
// 判断数字是否有小数部分
if (Math.abs(num) < 0.001) {
return '0'; // 如果数字非常小,返回 0
} else if (num % 1 === 0) {
return num.toFixed(0); // 没有小数部分,保留 0 位小数
}
return num.toFixed(3); // 有小数部分,保留 3 位小数
},
});
}
columns.push({
@@ -384,6 +409,9 @@ function fnGetListTitle() {
key: 'timeGroup',
sorter: true,
width: 100,
customRender: (opt: any) => {
return parseDateToStr(opt.text);
},
});
nextTick(() => {
@@ -409,7 +437,7 @@ function fnGetList() {
tableState.loading = true;
queryParams.neType = state.neType[0];
queryParams.neId = state.neType[1];
queryParams.startTime = queryRangePicker.value[0];
queryParams.beginTime = queryRangePicker.value[0];
queryParams.endTime = queryRangePicker.value[1];
listCustomData(toRaw(queryParams))
.then(res => {
@@ -452,20 +480,53 @@ function fnGetList() {
});
// 计算总值
const total = Number(
values.reduce((sum, val) => sum + val, 0).toFixed(2)
);
const totalV = values.reduce((sum, val) => sum + val, 0);
let total = totalV.toFixed(3);
// 判断数字是否有小数部分
if (Math.abs(totalV) < 0.001) {
total = '0'; // 如果数字非常小,返回 0
} else if (totalV % 1 === 0) {
total = totalV.toFixed(0); // 没有小数部分,保留 0 位小数
}
// 计算平均值
const avg =
values.length > 0 ? Number((total / values.length).toFixed(2)) : 0;
const avgV = values.length > 0 ? totalV / values.length : 0;
let avg = avgV.toFixed(3);
// 判断数字是否有小数部分
if (Math.abs(avgV) < 0.001) {
avg = '0'; // 如果数字非常小,返回 0
} else if (avgV % 1 === 0) {
avg = avgV.toFixed(0); // 没有小数部分,保留 0 位小数
}
// 计算最大值
const maxV = values.length > 0 ? Math.max(...values) : 0;
let max = maxV.toFixed(3);
// 判断数字是否有小数部分
if (Math.abs(maxV) < 0.001) {
max = '0'; // 如果数字非常小,返回 0
} else if (maxV % 1 === 0) {
max = maxV.toFixed(0); // 没有小数部分,保留 0 位小数
}
// 计算最小值
const minV = values.length > 0 ? Math.min(...values) : 0;
let min = minV.toFixed(3);
// 判断数字是否有小数部分
if (Math.abs(minV) < 0.001) {
min = '0'; // 如果数字非常小,返回 0
} else if (minV % 1 === 0) {
min = minV.toFixed(0); // 没有小数部分,保留 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,
max,
min,
avg,
total: total,
total,
});
}
} else {
@@ -638,8 +699,17 @@ function fnRanderChartData() {
for (const y of chartDataYSeriesData) {
for (const key of keys) {
if (y.key === key) {
y.data.push(+item[key]);
chartDataXAxisData.push(item['timeGroup']);
// 计算最小值
const v = parseFloat(item[key]);
let kpiV = v.toFixed(3);
// 判断数字是否有小数部分
if (Math.abs(v) < 0.001) {
kpiV = '0'; // 如果数字非常小,返回 0
} else if (v % 1 === 0) {
kpiV = v.toFixed(0); // 没有小数部分,保留 0 位小数
}
y.data.push(kpiV);
chartDataXAxisData.push(parseDateToStr(item['timeGroup']));
}
}
}
@@ -749,7 +819,7 @@ function wsMessage(res: Record<string, any>) {
// x轴
if (key === 'timeGroup') {
// chartDataXAxisData.shift();
chartDataXAxisData.push(v);
chartDataXAxisData.push(parseDateToStr(v));
continue;
}
// y轴
@@ -879,7 +949,7 @@ watch(
onMounted(() => {
// 目前支持的 AMF AUSF MME MOCNGW NSSF SMF UDM UPF PCF
// 获取网元网元列表
listCustom({ status: '1' }).then((res: any) => {
listCustom({ status: '1', pageNum: 1, pageSize: 200 }).then((res: any) => {
if (res.code === RESULT_CODE_SUCCESS) {
if (!res.data.rows.length) {
message.warning({
@@ -925,9 +995,9 @@ onMounted(() => {
const now = new Date();
now.setMinutes(0, 0, 0);
// 设置起始时间为整点前一小时
const startTime = new Date(now);
startTime.setHours(now.getHours() - 1);
queryRangePicker.value[0] = `${startTime.getTime()}`;
const beginTime = new Date(now);
beginTime.setHours(now.getHours() - 1);
queryRangePicker.value[0] = `${beginTime.getTime()}`;
// 设置结束时间为整点
const endTime = new Date(now);
endTime.setMinutes(59, 59, 59);