feat: 更新数据获取逻辑并添加数据使用情况展示
This commit is contained in:
@@ -229,7 +229,7 @@ function fnRanderChart() {
|
||||
|
||||
// 创建 ResizeObserver 实例 监听图表容器大小变化,并在变化时调整图表大小
|
||||
var observer = new ResizeObserver(entries => {
|
||||
if (cdrChart) {
|
||||
if (cdrChart && !cdrChart.isDisposed) {
|
||||
cdrChart.resize();
|
||||
}
|
||||
});
|
||||
@@ -295,6 +295,8 @@ let state = reactive({
|
||||
total: 0,
|
||||
/**表格加载状态 */
|
||||
loading: false,
|
||||
/**数据总量 up,down */
|
||||
dataUsage: ['0 B', '0 B'],
|
||||
});
|
||||
|
||||
/**查询列表, pageNum初始页数 */
|
||||
@@ -455,6 +457,18 @@ function fnRanderChartDataUpdate() {
|
||||
],
|
||||
});
|
||||
cdrChart.hideLoading();
|
||||
|
||||
// 累加总量
|
||||
let uplinkTotal = 0;
|
||||
let downlinkTotal = 0;
|
||||
for (let index = 0; index < dataVolumeUplinkYSeriesData.length; index++) {
|
||||
uplinkTotal += dataVolumeUplinkYSeriesData[index];
|
||||
downlinkTotal += dataVolumeDownlinkYSeriesData[index];
|
||||
}
|
||||
state.dataUsage = [
|
||||
parseSizeFromByte(uplinkTotal),
|
||||
parseSizeFromByte(downlinkTotal),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -549,9 +563,9 @@ onMounted(() => {
|
||||
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
|
||||
if (res.data.length > 0) {
|
||||
let arr: Record<string, any>[] = [];
|
||||
res.data.forEach(i => {
|
||||
if (i.neType === 'SMF') {
|
||||
arr.push({ value: i.neId, label: i.neName });
|
||||
res.data.forEach((v: any) => {
|
||||
if (v.neType === 'SMF') {
|
||||
arr.push({ value: v.neId, label: v.neName });
|
||||
}
|
||||
});
|
||||
neOtions.value = arr;
|
||||
@@ -669,6 +683,15 @@ onBeforeUnmount(() => {
|
||||
<a-card :bordered="false">
|
||||
<!-- 图数据 -->
|
||||
<div ref="cdrChartDom" style="height: 600px; width: 100%"></div>
|
||||
|
||||
<a-descriptions title="Data Usage" bordered :column="2">
|
||||
<a-descriptions-item label="Total Uplink">
|
||||
{{ state.dataUsage[0] }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="Total Downlink">
|
||||
{{ state.dataUsage[1] }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</a-card>
|
||||
</PageContainer>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user