feat:语音仪表盘mos和cct显示修复和样式调整
This commit is contained in:
@@ -1096,7 +1096,7 @@ export default {
|
||||
"tips":"Voice Call Statistics Per Minute",
|
||||
"ne":"NE",
|
||||
"now":"Now",
|
||||
"last":"Last",
|
||||
"last":"Past",
|
||||
"calls":"Calls",
|
||||
"activeCall":"Active Calls",
|
||||
"callMOMT":"MO/MT Call Success Rate",
|
||||
|
||||
@@ -218,7 +218,7 @@
|
||||
import { ref, onMounted, onBeforeUnmount, watch,nextTick } from 'vue'
|
||||
import * as echarts from 'echarts/core'
|
||||
import { LineChart } from 'echarts/charts'
|
||||
import { GridComponent } from 'echarts/components'
|
||||
import { GridComponent ,GraphicComponent} from 'echarts/components'
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
import useNeInfoStore from '@/store/modules/neinfo'
|
||||
import { WS } from '@/plugins/ws-websocket'
|
||||
@@ -226,7 +226,7 @@ import { listKPIData ,getbusyhour, getMosHour, getCctHour} from '@/api/perfManag
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
const { t } = useI18n();
|
||||
echarts.use([LineChart, GridComponent, CanvasRenderer])
|
||||
echarts.use([LineChart, GridComponent, CanvasRenderer, GraphicComponent])
|
||||
|
||||
const callsChartRef = ref<HTMLDivElement | null>(null)
|
||||
const mosChartRef = ref<HTMLDivElement | null>(null)
|
||||
@@ -407,10 +407,14 @@ async function fetchMosData(neId: string) {
|
||||
} else {
|
||||
console.warn('获取MOS数据失败或数据为空')
|
||||
mosData.value = null
|
||||
// 确保图表也更新为空状态
|
||||
updateMosChart()
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取MOS数据出错:', error)
|
||||
mosData.value = null
|
||||
// 确保图表也更新为空状态
|
||||
updateMosChart()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,10 +448,14 @@ async function fetchCctData(neId: string) {
|
||||
} else {
|
||||
console.warn('获取CCT数据失败或数据为空')
|
||||
cctData.value = null
|
||||
// 确保图表也更新为空状态
|
||||
updateCctChart()
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取CCT数据出错:', error)
|
||||
cctData.value = null
|
||||
// 确保图表也更新为空状态
|
||||
updateCctChart()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,6 +465,9 @@ async function onImsNeChange() {
|
||||
|
||||
// 切换网元时,先清空旧数据
|
||||
imsRealtimeRawData.value = []
|
||||
busyHourData.value = null
|
||||
mosData.value = null
|
||||
cctData.value = null
|
||||
|
||||
// 强制触发Vue响应式更新,确保所有计算值立即更新为默认状态
|
||||
await nextTick()
|
||||
@@ -466,6 +477,10 @@ async function onImsNeChange() {
|
||||
updateFailedCallsChart()
|
||||
updateActiveRegistrationsChart()
|
||||
updateFailedRegistrationsChart()
|
||||
updateCallAttemptsChart()
|
||||
updateCallCompletionsChart()
|
||||
updateMosChart()
|
||||
updateCctChart()
|
||||
|
||||
// 先获取历史数据和Busy Hour数据,再订阅实时数据
|
||||
await fetchHistoryData(selectedImsNeId.value)
|
||||
@@ -1518,7 +1533,8 @@ function updateMosChart() {
|
||||
type: 'line', symbol: 'none',
|
||||
lineStyle: { width: 2, color: '#d9d9d9' },
|
||||
areaStyle: { color: 'rgba(217,217,217,0.1)' }
|
||||
}]
|
||||
}],
|
||||
graphic: [] // 清除任何ECharts图形元素
|
||||
})
|
||||
|
||||
// 清除所有旧标注
|
||||
@@ -1531,7 +1547,7 @@ function updateMosChart() {
|
||||
}
|
||||
|
||||
// 从MOS数据中提取MOS值
|
||||
const chartData = mosData.value.map((item: any) => Number(item.mosAverage) || 0)
|
||||
const chartData = mosData.value.map((item: any) => Number(item.mosSum) || 0)
|
||||
|
||||
// 生成时间轴数据
|
||||
const xAxisData = Array.from({ length: chartData.length }, (_, i) => i + 1)
|
||||
@@ -1617,7 +1633,8 @@ function updateMosChart() {
|
||||
z-index: 10;
|
||||
`
|
||||
// 使用第一个数据点的时间戳计算相对时间
|
||||
const oldestTime = Number(mosData.value[0]?.timeGroup) || Date.now()
|
||||
// MOS时间戳是秒级,需要转换为毫秒级
|
||||
const oldestTime = (Number(mosData.value[0]?.timeGroup) || 0) * 1000 || Date.now()
|
||||
oldestTimeLabel.textContent = calculateRelativeTime(oldestTime)
|
||||
|
||||
const nowTimeLabel = document.createElement('div')
|
||||
@@ -1678,7 +1695,7 @@ function updateCctChart() {
|
||||
}
|
||||
|
||||
// 从CCT数据中提取CCT值
|
||||
const chartData = cctData.value.map((item: any) => Number(item.callConnectionTime) || 0)
|
||||
const chartData = cctData.value.map((item: any) => Number(item.cctSum) || 0)
|
||||
|
||||
// 生成时间轴数据
|
||||
const xAxisData = Array.from({ length: chartData.length }, (_, i) => i + 1)
|
||||
@@ -1764,7 +1781,8 @@ function updateCctChart() {
|
||||
z-index: 10;
|
||||
`
|
||||
// 使用第一个数据点的时间戳计算相对时间
|
||||
const oldestTime = Number(cctData.value[0]?.timeGroup) || Date.now()
|
||||
// CCT时间戳是秒级,需要转换为毫秒级
|
||||
const oldestTime = (Number(cctData.value[0]?.timeGroup) || 0) * 1000 || Date.now()
|
||||
oldestTimeLabel.textContent = calculateRelativeTime(oldestTime)
|
||||
|
||||
const nowTimeLabel = document.createElement('div')
|
||||
@@ -1880,60 +1898,10 @@ onMounted(() => {
|
||||
chart.setOption(defaultChartOption)
|
||||
}
|
||||
|
||||
// MOS - 保持原有的模拟数据
|
||||
// MOS
|
||||
if (mosChartRef.value) {
|
||||
const chart = echarts.init(mosChartRef.value)
|
||||
const mosData = [4.62, 4.50, 4.40, 4.35, 4.30]
|
||||
const maxValue = Math.max(...mosData)
|
||||
const minValue = Math.min(...mosData)
|
||||
const latestValue = mosData[mosData.length - 1]
|
||||
|
||||
chart.setOption({
|
||||
grid: { left: 0, right: 30, top: 10, bottom: 10 }, // 增加右侧边距
|
||||
xAxis: { type: 'category', show: false, data: [1,2,3,4,5] },
|
||||
yAxis: { type: 'value', show: false },
|
||||
series: [{
|
||||
data: mosData,
|
||||
type: 'line', symbol: 'none',
|
||||
lineStyle: { width: 2, color: '#52c41a' },
|
||||
areaStyle: { color: 'rgba(82,196,26,0.1)' }
|
||||
}],
|
||||
graphic: [
|
||||
{
|
||||
type: 'text',
|
||||
right: 8,
|
||||
top: 8,
|
||||
style: {
|
||||
text: maxValue.toFixed(2),
|
||||
fontSize: 12,
|
||||
fill: '#666',
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
right: 8,
|
||||
top: '50%',
|
||||
style: {
|
||||
text: latestValue.toFixed(2),
|
||||
fontSize: 12,
|
||||
fill: '#52c41a',
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
right: 8,
|
||||
bottom: 8,
|
||||
style: {
|
||||
text: minValue.toFixed(2),
|
||||
fontSize: 12,
|
||||
fill: '#666',
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
chart.setOption(defaultChartOption)
|
||||
}
|
||||
|
||||
// failed calls
|
||||
@@ -2017,13 +1985,13 @@ function calculateMTValue() {
|
||||
|
||||
// 计算MO变化值(完善版本)
|
||||
function calculateMOChange() {
|
||||
if (imsRealtimeRawData.value.length < 2) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (imsRealtimeRawData.value.length < 2) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
// 获取最新和上一个数据点
|
||||
const latestData = imsRealtimeRawData.value[imsRealtimeRawData.value.length - 1]
|
||||
const previousData = imsRealtimeRawData.value[imsRealtimeRawData.value.length - 2]
|
||||
|
||||
if (!latestData?.data || !previousData?.data) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (!latestData?.data || !previousData?.data) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
const latestKpi = latestData.data
|
||||
const previousKpi = previousData.data
|
||||
@@ -2032,31 +2000,31 @@ function calculateMOChange() {
|
||||
const previousMO = calculateMOValueFromData(previousKpi)
|
||||
|
||||
// 检查MO是否有有效值
|
||||
if (latestMO === '-' || previousMO === '-') return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (latestMO === '-' || previousMO === '-') return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
// 计算变化幅度
|
||||
const change = latestMO - previousMO
|
||||
|
||||
// 检查是否有变化
|
||||
if (change === 0) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (change === 0) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
const changeText = change > 0 ? `+${change.toFixed(2)}%` : `${change.toFixed(2)}%`
|
||||
|
||||
// 计算时间差
|
||||
const timeDiff = calculateTimeDifference(latestData, previousData)
|
||||
|
||||
return `${changeText} ${t('views.perfManage.voiceOverView.last')} ${timeDiff}`
|
||||
return `${t('views.perfManage.voiceOverView.last')} ${timeDiff} ${changeText}`
|
||||
}
|
||||
|
||||
// 计算MT变化值(完善版本)
|
||||
function calculateMTChange() {
|
||||
if (imsRealtimeRawData.value.length < 2) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (imsRealtimeRawData.value.length < 2) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
// 获取最新和上一个数据点
|
||||
const latestData = imsRealtimeRawData.value[imsRealtimeRawData.value.length - 1]
|
||||
const previousData = imsRealtimeRawData.value[imsRealtimeRawData.value.length - 2]
|
||||
|
||||
if (!latestData?.data || !previousData?.data) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (!latestData?.data || !previousData?.data) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
const latestKpi = latestData.data
|
||||
const previousKpi = previousData.data
|
||||
@@ -2065,20 +2033,20 @@ function calculateMTChange() {
|
||||
const previousMT = calculateMTValueFromData(previousKpi)
|
||||
|
||||
// 检查MT是否有有效值
|
||||
if (latestMT === '-' || previousMT === '-') return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (latestMT === '-' || previousMT === '-') return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
// 计算变化幅度
|
||||
const change = latestMT - previousMT
|
||||
|
||||
// 检查是否有变化
|
||||
if (change === 0) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (change === 0) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
const changeText = change > 0 ? `+${change.toFixed(2)}%` : `${change.toFixed(2)}%`
|
||||
|
||||
// 计算时间差
|
||||
const timeDiff = calculateTimeDifference(latestData, previousData)
|
||||
|
||||
return `${changeText} ${t('views.perfManage.voiceOverView.last')} ${timeDiff}`
|
||||
return `${t('views.perfManage.voiceOverView.last')} ${timeDiff} ${changeText}`
|
||||
}
|
||||
|
||||
// 计算时间差函数
|
||||
@@ -2119,11 +2087,39 @@ function calculateRelativeTime(timestamp: number) {
|
||||
const diffHours = Math.floor(diffMinutes / 60)
|
||||
|
||||
if (diffHours >= 1) {
|
||||
return `${diffHours}h`
|
||||
return `${diffHours} Hour`
|
||||
} else if (diffMinutes >= 1) {
|
||||
return `${diffMinutes} Min`
|
||||
} else {
|
||||
return '1 Min'
|
||||
}
|
||||
}
|
||||
|
||||
// 计算MOS/CCT时间差函数(处理秒级时间戳)
|
||||
function calculateMosCctTimeDifference(latestData: any, previousData: any) {
|
||||
// MOS/CCT的时间戳是秒级,需要转换为毫秒级
|
||||
const latestTime = (Number(latestData.timeGroup) || 0) * 1000
|
||||
const previousTime = (Number(previousData.timeGroup) || 0) * 1000
|
||||
|
||||
// 计算时间差(毫秒)
|
||||
const diffMs = Math.abs(latestTime - previousTime)
|
||||
|
||||
// 转换为秒
|
||||
const diffSeconds = Math.floor(diffMs / 1000)
|
||||
|
||||
// 转换为分钟
|
||||
const diffMinutes = Math.floor(diffSeconds / 60)
|
||||
|
||||
// 转换为小时
|
||||
const diffHours = Math.floor(diffMinutes / 60)
|
||||
|
||||
// 根据时间差返回合适的格式
|
||||
if (diffHours > 0) {
|
||||
return `${diffHours}h`
|
||||
} else if (diffMinutes > 0) {
|
||||
return `${diffMinutes}m`
|
||||
} else {
|
||||
return '1m'
|
||||
return `${diffSeconds}s`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2161,13 +2157,13 @@ function calculateRegSuccessValue() {
|
||||
|
||||
// 计算registration success变化值
|
||||
function calculateRegSuccessChange() {
|
||||
if (imsRealtimeRawData.value.length < 2) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (imsRealtimeRawData.value.length < 2) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
// 获取最新和上一个数据点
|
||||
const latestData = imsRealtimeRawData.value[imsRealtimeRawData.value.length - 1]
|
||||
const previousData = imsRealtimeRawData.value[imsRealtimeRawData.value.length - 2]
|
||||
|
||||
if (!latestData?.data || !previousData?.data) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (!latestData?.data || !previousData?.data) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
const latestKpi = latestData.data
|
||||
const previousKpi = previousData.data
|
||||
@@ -2176,20 +2172,20 @@ function calculateRegSuccessChange() {
|
||||
const previousRegSuccess = calculateRegSuccessValueFromData(previousKpi)
|
||||
|
||||
// 检查registration success是否有有效值
|
||||
if (latestRegSuccess === '-' || previousRegSuccess === '-') return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (latestRegSuccess === '-' || previousRegSuccess === '-') return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
// 计算变化幅度
|
||||
const change = latestRegSuccess - previousRegSuccess
|
||||
|
||||
// 检查是否有变化
|
||||
if (change === 0) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (change === 0) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
const changeText = change > 0 ? `+${change.toFixed(2)}%` : `${change.toFixed(2)}%`
|
||||
|
||||
// 计算时间差
|
||||
const timeDiff = calculateTimeDifference(latestData, previousData)
|
||||
|
||||
return `${changeText} ${t('views.perfManage.voiceOverView.last')} ${timeDiff}`
|
||||
return ` ${t('views.perfManage.voiceOverView.last')} ${timeDiff} ${changeText}`
|
||||
}
|
||||
|
||||
// 辅助函数:从数据中计算registration success值
|
||||
@@ -2265,13 +2261,13 @@ function calculateActiveCallsArrow() {
|
||||
|
||||
// 计算active calls变化值
|
||||
function calculateActiveCallsChange() {
|
||||
if (imsRealtimeRawData.value.length < 2) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (imsRealtimeRawData.value.length < 2) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
// 获取最新和上一个数据点
|
||||
const latestData = imsRealtimeRawData.value[imsRealtimeRawData.value.length - 1]
|
||||
const previousData = imsRealtimeRawData.value[imsRealtimeRawData.value.length - 2]
|
||||
|
||||
if (!latestData?.data || !previousData?.data) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (!latestData?.data || !previousData?.data) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
const latestKpi = latestData.data
|
||||
const previousKpi = previousData.data
|
||||
@@ -2284,14 +2280,14 @@ function calculateActiveCallsChange() {
|
||||
const change = latestActiveCalls - previousActiveCalls
|
||||
|
||||
// 检查是否有变化
|
||||
if (change === 0) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (change === 0) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
const changeText = change > 0 ? `+${change.toFixed(0)}` : `${change.toFixed(0)}`
|
||||
|
||||
// 计算时间差
|
||||
const timeDiff = calculateTimeDifference(latestData, previousData)
|
||||
|
||||
return `${changeText} ${t('views.perfManage.voiceOverView.last')} ${timeDiff}`
|
||||
return ` ${t('views.perfManage.voiceOverView.last')} ${timeDiff} ${changeText}`
|
||||
}
|
||||
|
||||
// 计算failed calls值
|
||||
@@ -2370,13 +2366,13 @@ function calculateFailedCallsArrow() {
|
||||
|
||||
// 计算failed calls变化值
|
||||
function calculateFailedCallsChange() {
|
||||
if (imsRealtimeRawData.value.length < 2) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (imsRealtimeRawData.value.length < 2) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
// 获取最新和上一个数据点
|
||||
const latestData = imsRealtimeRawData.value[imsRealtimeRawData.value.length - 1]
|
||||
const previousData = imsRealtimeRawData.value[imsRealtimeRawData.value.length - 2]
|
||||
|
||||
if (!latestData?.data || !previousData?.data) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (!latestData?.data || !previousData?.data) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
const latestKpi = latestData.data
|
||||
const previousKpi = previousData.data
|
||||
@@ -2393,14 +2389,14 @@ function calculateFailedCallsChange() {
|
||||
const change = latestFailedCalls - previousFailedCalls
|
||||
|
||||
// 检查是否有变化
|
||||
if (change === 0) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (change === 0) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
const changeText = change > 0 ? `+${change.toFixed(0)}` : `${change.toFixed(0)}`
|
||||
|
||||
// 计算时间差
|
||||
const timeDiff = calculateTimeDifference(latestData, previousData)
|
||||
|
||||
return `${changeText} ${t('views.perfManage.voiceOverView.last')} ${timeDiff}`
|
||||
return `${t('views.perfManage.voiceOverView.last')} ${timeDiff} ${changeText}`
|
||||
}
|
||||
|
||||
// 计算active registrations值
|
||||
@@ -2469,13 +2465,13 @@ function calculateActiveRegistrationsArrow() {
|
||||
|
||||
// 计算active registrations变化值
|
||||
function calculateActiveRegistrationsChange() {
|
||||
if (imsRealtimeRawData.value.length < 2) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (imsRealtimeRawData.value.length < 2) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
// 获取最新和上一个数据点
|
||||
const latestData = imsRealtimeRawData.value[imsRealtimeRawData.value.length - 1]
|
||||
const previousData = imsRealtimeRawData.value[imsRealtimeRawData.value.length - 2]
|
||||
|
||||
if (!latestData?.data || !previousData?.data) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (!latestData?.data || !previousData?.data) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
const latestKpi = latestData.data
|
||||
const previousKpi = previousData.data
|
||||
@@ -2488,14 +2484,14 @@ function calculateActiveRegistrationsChange() {
|
||||
const change = latestActiveRegistrations - previousActiveRegistrations
|
||||
|
||||
// 检查是否有变化
|
||||
if (change === 0) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (change === 0) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
const changeText = change > 0 ? `+${change.toFixed(0)}` : `${change.toFixed(0)}`
|
||||
|
||||
// 计算时间差
|
||||
const timeDiff = calculateTimeDifference(latestData, previousData)
|
||||
|
||||
return `${changeText} ${t('views.perfManage.voiceOverView.last')} ${timeDiff}`
|
||||
return `${t('views.perfManage.voiceOverView.last')} ${timeDiff} ${changeText}`
|
||||
}
|
||||
|
||||
// 计算failed registrations值
|
||||
@@ -2574,13 +2570,13 @@ function calculateFailedRegistrationsArrow() {
|
||||
|
||||
// 计算failed registrations变化值
|
||||
function calculateFailedRegistrationsChange() {
|
||||
if (imsRealtimeRawData.value.length < 2) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (imsRealtimeRawData.value.length < 2) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
// 获取最新和上一个数据点
|
||||
const latestData = imsRealtimeRawData.value[imsRealtimeRawData.value.length - 1]
|
||||
const previousData = imsRealtimeRawData.value[imsRealtimeRawData.value.length - 2]
|
||||
|
||||
if (!latestData?.data || !previousData?.data) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (!latestData?.data || !previousData?.data) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
const latestKpi = latestData.data
|
||||
const previousKpi = previousData.data
|
||||
@@ -2597,14 +2593,14 @@ function calculateFailedRegistrationsChange() {
|
||||
const change = latestFailedRegistrations - previousFailedRegistrations
|
||||
|
||||
// 检查是否有变化
|
||||
if (change === 0) return '±0.00%' +t('views.perfManage.voiceOverView.last') +'1m'
|
||||
if (change === 0) return t('views.perfManage.voiceOverView.last') +' 1 Min'+' Smooth'
|
||||
|
||||
const changeText = change > 0 ? `+${change.toFixed(0)}` : `${change.toFixed(0)}`
|
||||
|
||||
// 计算时间差
|
||||
const timeDiff = calculateTimeDifference(latestData, previousData)
|
||||
|
||||
return `${changeText} ${t('views.perfManage.voiceOverView.last')} ${timeDiff}`
|
||||
return `${t('views.perfManage.voiceOverView.last')} ${timeDiff} ${changeText}`
|
||||
}
|
||||
|
||||
// Call Attempts相关计算函数
|
||||
@@ -2642,16 +2638,16 @@ function calculateCallAttemptsArrow() {
|
||||
}
|
||||
|
||||
function calculateCallAttemptsChange() {
|
||||
if (!busyHourData.value || busyHourData.value.length < 2) return '±0 ' + t('views.perfManage.voiceOverView.last') + ' 1h'
|
||||
if (!busyHourData.value || busyHourData.value.length < 2) return t('views.perfManage.voiceOverView.last') +' 1 Hour'+' Smooth'
|
||||
|
||||
const latestValue = Number(busyHourData.value[busyHourData.value.length - 1].callAttempts) || 0
|
||||
const previousValue = Number(busyHourData.value[busyHourData.value.length - 2].callAttempts) || 0
|
||||
|
||||
const change = latestValue - previousValue
|
||||
if (change === 0) return '±0 ' + t('views.perfManage.voiceOverView.last') + ' 1h'
|
||||
if (change === 0) return t('views.perfManage.voiceOverView.last') +' 1 Hour'+' Smooth'
|
||||
|
||||
const changeText = change > 0 ? `+${change}` : `${change}`
|
||||
return `${changeText} ` + t('views.perfManage.voiceOverView.last') + ' 1h'
|
||||
return t('views.perfManage.voiceOverView.last') + ' 1 Hour'+ ` ${changeText}`
|
||||
}
|
||||
|
||||
// Call Completions相关计算函数
|
||||
@@ -2689,16 +2685,16 @@ function calculateCallCompletionsArrow() {
|
||||
}
|
||||
|
||||
function calculateCallCompletionsChange() {
|
||||
if (!busyHourData.value || busyHourData.value.length < 2) return '±0 ' + t('views.perfManage.voiceOverView.last') + ' 1h'
|
||||
if (!busyHourData.value || busyHourData.value.length < 2) return t('views.perfManage.voiceOverView.last') +' 1 Hour'+' Smooth'
|
||||
|
||||
const latestValue = Number(busyHourData.value[busyHourData.value.length - 1].callCompletions) || 0
|
||||
const previousValue = Number(busyHourData.value[busyHourData.value.length - 2].callCompletions) || 0
|
||||
|
||||
const change = latestValue - previousValue
|
||||
if (change === 0) return '±0 ' + t('views.perfManage.voiceOverView.last') + ' 1h'
|
||||
if (change === 0) return t('views.perfManage.voiceOverView.last') +' 1 Hour'+' Smooth'
|
||||
|
||||
const changeText = change > 0 ? `+${change}` : `${change}`
|
||||
return `${changeText} ` + t('views.perfManage.voiceOverView.last') + ' 1h'
|
||||
return t('views.perfManage.voiceOverView.last') + ' 1 Hour' +` ${changeText}`
|
||||
}
|
||||
|
||||
// MOS相关计算函数
|
||||
@@ -2707,15 +2703,15 @@ function calculateMosValue() {
|
||||
|
||||
// 获取最新的MOS值(数组最后一个元素)
|
||||
const latestData = mosData.value[mosData.value.length - 1]
|
||||
const mosValue = Number(latestData.mosAverage) || 0
|
||||
const mosValue = Number(latestData.mosAvg) || 0
|
||||
return mosValue.toFixed(2)
|
||||
}
|
||||
|
||||
function calculateMosArrowDirection() {
|
||||
if (!mosData.value || mosData.value.length < 2) return 'up'
|
||||
|
||||
const latestValue = Number(mosData.value[mosData.value.length - 1].mosAverage) || 0
|
||||
const previousValue = Number(mosData.value[mosData.value.length - 2].mosAverage) || 0
|
||||
const latestValue = Number(mosData.value[mosData.value.length - 1].mosAvg) || 0
|
||||
const previousValue = Number(mosData.value[mosData.value.length - 2].mosAvg) || 0
|
||||
|
||||
const change = latestValue - previousValue
|
||||
if (change > 0) return 'up'
|
||||
@@ -2726,8 +2722,8 @@ function calculateMosArrowDirection() {
|
||||
function calculateMosArrow() {
|
||||
if (!mosData.value || mosData.value.length < 2) return '→'
|
||||
|
||||
const latestValue = Number(mosData.value[mosData.value.length - 1].mosAverage) || 0
|
||||
const previousValue = Number(mosData.value[mosData.value.length - 2].mosAverage) || 0
|
||||
const latestValue = Number(mosData.value[mosData.value.length - 1].mosAvg) || 0
|
||||
const previousValue = Number(mosData.value[mosData.value.length - 2].mosAvg) || 0
|
||||
|
||||
const change = latestValue - previousValue
|
||||
if (change > 0) return '↗'
|
||||
@@ -2736,16 +2732,23 @@ function calculateMosArrow() {
|
||||
}
|
||||
|
||||
function calculateMosChange() {
|
||||
if (!mosData.value || mosData.value.length < 2) return '±0.00 ' + t('views.perfManage.voiceOverView.last') + ' 1h'
|
||||
if (!mosData.value || mosData.value.length < 2) return t('views.perfManage.voiceOverView.last') +' 1 Hour'+' Smooth'
|
||||
|
||||
const latestValue = Number(mosData.value[mosData.value.length - 1].mosAverage) || 0
|
||||
const previousValue = Number(mosData.value[mosData.value.length - 2].mosAverage) || 0
|
||||
const latestData = mosData.value[mosData.value.length - 1]
|
||||
const previousData = mosData.value[mosData.value.length - 2]
|
||||
|
||||
const latestValue = Number(latestData.mosAvg) || 0
|
||||
const previousValue = Number(previousData.mosAvg) || 0
|
||||
|
||||
const change = latestValue - previousValue
|
||||
if (change === 0) return '±0.00 ' + t('views.perfManage.voiceOverView.last') + ' 1h'
|
||||
if (change === 0) return t('views.perfManage.voiceOverView.last') +' 1 Hour'+' Smooth'
|
||||
|
||||
const changeText = change > 0 ? `+${change.toFixed(2)}` : `${change.toFixed(2)}`
|
||||
return `${changeText} ` + t('views.perfManage.voiceOverView.last') + ' 1h'
|
||||
|
||||
// 计算实际时间差
|
||||
const timeDiff = calculateMosCctTimeDifference(latestData, previousData)
|
||||
|
||||
return t('views.perfManage.voiceOverView.last') + ' ' + timeDiff +` ${changeText}`
|
||||
}
|
||||
|
||||
// CCT相关计算函数
|
||||
@@ -2754,15 +2757,15 @@ function calculateCctValue() {
|
||||
|
||||
// 获取最新的CCT值(数组最后一个元素)
|
||||
const latestData = cctData.value[cctData.value.length - 1]
|
||||
const cctValue = Number(latestData.callConnectionTime) || 0
|
||||
const cctValue = Number(latestData.cctAvg) || 0
|
||||
return cctValue.toFixed(2)
|
||||
}
|
||||
|
||||
function calculateCctArrowDirection() {
|
||||
if (!cctData.value || cctData.value.length < 2) return 'up'
|
||||
|
||||
const latestValue = Number(cctData.value[cctData.value.length - 1].callConnectionTime) || 0
|
||||
const previousValue = Number(cctData.value[cctData.value.length - 2].callConnectionTime) || 0
|
||||
const latestValue = Number(cctData.value[cctData.value.length - 1].cctAvg) || 0
|
||||
const previousValue = Number(cctData.value[cctData.value.length - 2].cctAvg) || 0
|
||||
|
||||
const change = latestValue - previousValue
|
||||
if (change > 0) return 'up'
|
||||
@@ -2773,8 +2776,8 @@ function calculateCctArrowDirection() {
|
||||
function calculateCctArrow() {
|
||||
if (!cctData.value || cctData.value.length < 2) return '→'
|
||||
|
||||
const latestValue = Number(cctData.value[cctData.value.length - 1].callConnectionTime) || 0
|
||||
const previousValue = Number(cctData.value[cctData.value.length - 2].callConnectionTime) || 0
|
||||
const latestValue = Number(cctData.value[cctData.value.length - 1].cctAvg) || 0
|
||||
const previousValue = Number(cctData.value[cctData.value.length - 2].cctAvg) || 0
|
||||
|
||||
const change = latestValue - previousValue
|
||||
if (change > 0) return '↗'
|
||||
@@ -2783,16 +2786,23 @@ function calculateCctArrow() {
|
||||
}
|
||||
|
||||
function calculateCctChange() {
|
||||
if (!cctData.value || cctData.value.length < 2) return '±0.00 ' + t('views.perfManage.voiceOverView.last') + ' 1h'
|
||||
if (!cctData.value || cctData.value.length < 2) return t('views.perfManage.voiceOverView.last') +' 1 Hour'+' Smooth'
|
||||
|
||||
const latestValue = Number(cctData.value[cctData.value.length - 1].callConnectionTime) || 0
|
||||
const previousValue = Number(cctData.value[cctData.value.length - 2].callConnectionTime) || 0
|
||||
const latestData = cctData.value[cctData.value.length - 1]
|
||||
const previousData = cctData.value[cctData.value.length - 2]
|
||||
|
||||
const latestValue = Number(latestData.cctAvg) || 0
|
||||
const previousValue = Number(previousData.cctAvg) || 0
|
||||
|
||||
const change = latestValue - previousValue
|
||||
if (change === 0) return '±0.00 ' + t('views.perfManage.voiceOverView.last') + ' 1h'
|
||||
if (change === 0) return t('views.perfManage.voiceOverView.last') +' 1 Hour'+' Smooth'
|
||||
|
||||
const changeText = change > 0 ? `+${change.toFixed(2)}` : `${change.toFixed(2)}`
|
||||
return `${changeText} ` + t('views.perfManage.voiceOverView.last') + ' 1h'
|
||||
|
||||
// 计算实际时间差
|
||||
const timeDiff = calculateMosCctTimeDifference(latestData, previousData)
|
||||
|
||||
return t('views.perfManage.voiceOverView.last') + ' ' + timeDiff + ` ${changeText}`
|
||||
}
|
||||
|
||||
// 测试数据更新
|
||||
|
||||
Reference in New Issue
Block a user