feat: 更新数据获取逻辑并添加数据使用情况展示
This commit is contained in:
@@ -370,8 +370,8 @@ function fnGetList(pageNum?: number) {
|
||||
});
|
||||
|
||||
// 取最大值ID用作实时累加
|
||||
if (res.total > 0) {
|
||||
modalState.maxId = Number(res.rows[0].id);
|
||||
if (total > 0) {
|
||||
modalState.maxId = Number(rows[0].id);
|
||||
}
|
||||
}
|
||||
tableState.loading = false;
|
||||
|
||||
@@ -295,6 +295,8 @@ let state = reactive({
|
||||
total: 0,
|
||||
/**表格加载状态 */
|
||||
loading: false,
|
||||
/**数据总量 up,down */
|
||||
dataUsage: ['0 B', '0 B'],
|
||||
});
|
||||
|
||||
/**查询列表, pageNum初始页数 */
|
||||
@@ -330,10 +332,11 @@ function fnGetList(pageNum?: number) {
|
||||
|
||||
listSMFDataCDR(toRaw(queryParams))
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
state.total = res.total;
|
||||
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data.rows)) {
|
||||
const { total, rows } = res.data;
|
||||
state.total = total;
|
||||
// 遍历处理cdr字符串数据
|
||||
state.data = res.rows
|
||||
state.data = rows
|
||||
.map((item: any) => {
|
||||
let cdrJSON = item.cdrJSON;
|
||||
if (!cdrJSON) {
|
||||
@@ -455,6 +458,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),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -669,6 +684,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