style:: 网元概览详细内存CPU信息
This commit is contained in:
@@ -149,14 +149,6 @@ async function fnGetList(reload: boolean = false) {
|
|||||||
|
|
||||||
// 初始
|
// 初始
|
||||||
if (!reload) {
|
if (!reload) {
|
||||||
// 选择第一个
|
|
||||||
if (tableState.data.length > 0) {
|
|
||||||
const id = tableState.data[0].id;
|
|
||||||
fnTableSelectedRowKeys([id]);
|
|
||||||
} else {
|
|
||||||
fnTableSelectedRowKeys(tableState.selectedRowKeys);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (statusBar.value) {
|
if (statusBar.value) {
|
||||||
fnDesign(statusBar.value, rightNum, errorNum);
|
fnDesign(statusBar.value, rightNum, errorNum);
|
||||||
}
|
}
|
||||||
@@ -216,44 +208,6 @@ function fnDesign(container: HTMLElement, rightNum: number, errorNum: number) {
|
|||||||
observer.observe(container);
|
observer.observe(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**表格多选 */
|
|
||||||
function fnTableSelectedRowKeys(keys: (string | number)[]) {
|
|
||||||
if (keys.length <= 0) return;
|
|
||||||
const id = keys[0];
|
|
||||||
const row: any = tableState.data.find((item: any) => item.id === id);
|
|
||||||
if (!row) {
|
|
||||||
message.error(t('views.index.neStatus'), 2);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const neState = row.serverState;
|
|
||||||
if (!neState?.online) {
|
|
||||||
message.error(t('views.index.neStatus'), 2);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tableState.selectedRowKeys = keys;
|
|
||||||
// Mem 将KB转换为MB
|
|
||||||
const totalMemInKB = neState.mem?.totalMem;
|
|
||||||
const nfUsedMemInKB = neState.mem?.nfUsedMem;
|
|
||||||
const sysMemUsageInKB = neState.mem?.sysMemUsage;
|
|
||||||
const totalMemInMB = Math.round((totalMemInKB / 1024) * 100) / 100;
|
|
||||||
const nfUsedMemInMB = Math.round((nfUsedMemInKB / 1024) * 100) / 100;
|
|
||||||
const sysMemUsageInMB = Math.round((sysMemUsageInKB / 1024) * 100) / 100;
|
|
||||||
|
|
||||||
// CPU
|
|
||||||
const nfCpu = neState.cpu?.nfCpuUsage;
|
|
||||||
const sysCpu = neState.cpu?.sysCpuUsage;
|
|
||||||
const nfCpuP = Math.round(nfCpu) / 100;
|
|
||||||
const sysCpuP = Math.round(sysCpu) / 100;
|
|
||||||
|
|
||||||
serverState.value = Object.assign(
|
|
||||||
{
|
|
||||||
cpuUse: `NE:${nfCpuP}%; SYS:${sysCpuP}%`,
|
|
||||||
memoryUse: `Total: ${totalMemInMB}MB; NE: ${nfUsedMemInMB}MB; SYS: ${sysMemUsageInMB}MB`,
|
|
||||||
},
|
|
||||||
neState
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国际化翻译转换
|
* 国际化翻译转换
|
||||||
*/
|
*/
|
||||||
@@ -277,6 +231,7 @@ let dict: {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let timer: any;
|
let timer: any;
|
||||||
|
let timerFlag: boolean = false;
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 初始字典数据
|
// 初始字典数据
|
||||||
Promise.allSettled([getDict('ne_info_status'), getDict('index_status')])
|
Promise.allSettled([getDict('ne_info_status'), getDict('index_status')])
|
||||||
@@ -292,7 +247,7 @@ onMounted(() => {
|
|||||||
fnLocale();
|
fnLocale();
|
||||||
await fnGetList(false);
|
await fnGetList(false);
|
||||||
timer = setInterval(() => {
|
timer = setInterval(() => {
|
||||||
if (!timer) return;
|
if (timerFlag) return;
|
||||||
fnGetList(true);
|
fnGetList(true);
|
||||||
}, 10_000); // 每隔10秒执行一次
|
}, 10_000); // 每隔10秒执行一次
|
||||||
});
|
});
|
||||||
@@ -302,6 +257,7 @@ onMounted(() => {
|
|||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
timer = null;
|
timer = null;
|
||||||
|
timerFlag = true;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -319,12 +275,6 @@ onBeforeUnmount(() => {
|
|||||||
:loading="tableState.loading"
|
:loading="tableState.loading"
|
||||||
:pagination="false"
|
:pagination="false"
|
||||||
:scroll="{ x: true }"
|
:scroll="{ x: true }"
|
||||||
:row-selection="{
|
|
||||||
type: 'radio',
|
|
||||||
columnWidth: '48px',
|
|
||||||
selectedRowKeys: tableState.selectedRowKeys,
|
|
||||||
onChange: fnTableSelectedRowKeys,
|
|
||||||
}"
|
|
||||||
>
|
>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="column.key === 'status'">
|
<template v-if="column.key === 'status'">
|
||||||
@@ -341,46 +291,6 @@ onBeforeUnmount(() => {
|
|||||||
>
|
>
|
||||||
<div style="width: 100%; min-height: 200px" ref="statusBar"></div>
|
<div style="width: 100%; min-height: 200px" ref="statusBar"></div>
|
||||||
</a-card>
|
</a-card>
|
||||||
<a-card
|
|
||||||
:loading="tableState.loading"
|
|
||||||
:title="`${t('views.index.mark')} - ${serverState.neName || 'OMC'}`"
|
|
||||||
style="margin-top: 16px"
|
|
||||||
size="small"
|
|
||||||
>
|
|
||||||
<a-descriptions
|
|
||||||
bordered
|
|
||||||
:column="1"
|
|
||||||
:label-style="{ width: '160px' }"
|
|
||||||
>
|
|
||||||
<a-descriptions-item :label="t('views.index.hostName')">
|
|
||||||
{{ serverState.hostname }}
|
|
||||||
</a-descriptions-item>
|
|
||||||
<a-descriptions-item :label="t('views.index.osInfo')">
|
|
||||||
{{ serverState.os }}
|
|
||||||
</a-descriptions-item>
|
|
||||||
<a-descriptions-item :label="t('views.index.ipAddress')">
|
|
||||||
{{ serverState.neIP }}
|
|
||||||
</a-descriptions-item>
|
|
||||||
<a-descriptions-item :label="t('views.index.version')">
|
|
||||||
{{ serverState.version }}
|
|
||||||
</a-descriptions-item>
|
|
||||||
<a-descriptions-item :label="t('views.index.capability')">
|
|
||||||
{{ serverState.capability }}
|
|
||||||
</a-descriptions-item>
|
|
||||||
<a-descriptions-item :label="t('views.index.cpuUse')">
|
|
||||||
{{ serverState.cpuUse }}
|
|
||||||
</a-descriptions-item>
|
|
||||||
<a-descriptions-item :label="t('views.index.memoryUse')">
|
|
||||||
{{ serverState.memoryUse }}
|
|
||||||
</a-descriptions-item>
|
|
||||||
<a-descriptions-item :label="t('views.index.serialNum')">
|
|
||||||
{{ serverState.sn }}
|
|
||||||
</a-descriptions-item>
|
|
||||||
<a-descriptions-item :label="t('views.index.expiryDate')">
|
|
||||||
{{ serverState.expire }}
|
|
||||||
</a-descriptions-item>
|
|
||||||
</a-descriptions>
|
|
||||||
</a-card>
|
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</PageContainer>
|
</PageContainer>
|
||||||
|
|||||||
Reference in New Issue
Block a user