fix: 网元总览接口变更
This commit is contained in:
@@ -2,8 +2,7 @@
|
|||||||
import { PageContainer } from 'antdv-pro-layout';
|
import { PageContainer } from 'antdv-pro-layout';
|
||||||
import { ColumnsType } from 'ant-design-vue/lib/table';
|
import { ColumnsType } from 'ant-design-vue/lib/table';
|
||||||
import { message } from 'ant-design-vue/lib';
|
import { message } from 'ant-design-vue/lib';
|
||||||
import { reactive, toRaw, ref, onMounted, onBeforeUnmount, markRaw } from 'vue';
|
import { reactive, ref, onMounted, onBeforeUnmount, markRaw } from 'vue';
|
||||||
import { listMain } from '@/api/index';
|
|
||||||
import useI18n from '@/hooks/useI18n';
|
import useI18n from '@/hooks/useI18n';
|
||||||
import { TooltipComponent } from 'echarts/components';
|
import { TooltipComponent } from 'echarts/components';
|
||||||
import { GaugeChart } from 'echarts/charts';
|
import { GaugeChart } from 'echarts/charts';
|
||||||
@@ -15,6 +14,8 @@ import { LabelLayout } from 'echarts/features';
|
|||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import useAppStore from '@/store/modules/app';
|
import useAppStore from '@/store/modules/app';
|
||||||
import useDictStore from '@/store/modules/dict';
|
import useDictStore from '@/store/modules/dict';
|
||||||
|
import { listAllNeInfo } from '@/api/ne/neInfo';
|
||||||
|
import { parseDateToStr } from '@/utils/date-utils';
|
||||||
const { getDict } = useDictStore();
|
const { getDict } = useDictStore();
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@@ -52,44 +53,55 @@ let indexColor = ref<DictType[]>([
|
|||||||
let tableColumns: ColumnsType = [
|
let tableColumns: ColumnsType = [
|
||||||
{
|
{
|
||||||
title: t('views.index.object'),
|
title: t('views.index.object'),
|
||||||
dataIndex: 'name',
|
dataIndex: 'neName',
|
||||||
align: 'center',
|
align: 'left',
|
||||||
key: 'status',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('views.index.realNeStatus'),
|
title: t('views.index.realNeStatus'),
|
||||||
dataIndex: 'status',
|
dataIndex: 'serverState',
|
||||||
align: 'center',
|
align: 'left',
|
||||||
customRender(opt) {
|
key: 'status',
|
||||||
if (opt.value == 'Normal') return t('views.index.normal');
|
|
||||||
return t('views.index.abnormal');
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('views.index.reloadTime'),
|
title: t('views.index.reloadTime'),
|
||||||
dataIndex: 'refresh',
|
dataIndex: 'serverState',
|
||||||
align: 'center',
|
align: 'left',
|
||||||
|
customRender(opt) {
|
||||||
|
if (opt.value?.refreshTime) return parseDateToStr(opt.value?.refreshTime);
|
||||||
|
return '-';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('views.index.version'),
|
title: t('views.index.version'),
|
||||||
dataIndex: 'version',
|
dataIndex: 'serverState',
|
||||||
align: 'center',
|
align: 'left',
|
||||||
|
customRender(opt) {
|
||||||
|
return opt.value?.version || '-';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('views.index.serialNum'),
|
title: t('views.index.serialNum'),
|
||||||
dataIndex: 'serialNum',
|
dataIndex: 'serverState',
|
||||||
align: 'center',
|
align: 'left',
|
||||||
|
customRender(opt) {
|
||||||
|
return opt.value?.sn || '-';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('views.index.expiryDate'),
|
title: t('views.index.expiryDate'),
|
||||||
dataIndex: 'expiryDate',
|
dataIndex: 'serverState',
|
||||||
align: 'center',
|
align: 'left',
|
||||||
|
customRender(opt) {
|
||||||
|
return opt.value?.expire || '-';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('views.index.ipAddress'),
|
title: t('views.index.ipAddress'),
|
||||||
dataIndex: 'ipAddress',
|
dataIndex: 'serverState',
|
||||||
key: 'groupName',
|
align: 'left',
|
||||||
align: 'center',
|
customRender(opt) {
|
||||||
|
return opt.value?.neIP || '-';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
/**表格状态类型 */
|
/**表格状态类型 */
|
||||||
@@ -130,12 +142,8 @@ type nfStateType = {
|
|||||||
hostName: string;
|
hostName: string;
|
||||||
/**操作系统信息 */
|
/**操作系统信息 */
|
||||||
osInfo: string;
|
osInfo: string;
|
||||||
/**数据库信息 */
|
|
||||||
dbInfo: string;
|
|
||||||
/**IP地址 */
|
/**IP地址 */
|
||||||
ipAddress: string;
|
ipAddress: string;
|
||||||
/**端口 */
|
|
||||||
port: number;
|
|
||||||
/**版本 */
|
/**版本 */
|
||||||
version: string;
|
version: string;
|
||||||
/**CPU利用率 */
|
/**CPU利用率 */
|
||||||
@@ -154,9 +162,7 @@ type nfStateType = {
|
|||||||
let pronInfo: nfStateType = reactive({
|
let pronInfo: nfStateType = reactive({
|
||||||
hostName: '5gc',
|
hostName: '5gc',
|
||||||
osInfo: 'Linux 5gc 4.15.0-112-generic 2020 x86_64 GNU/Linux',
|
osInfo: 'Linux 5gc 4.15.0-112-generic 2020 x86_64 GNU/Linux',
|
||||||
dbInfo: 'db v9.9.9',
|
|
||||||
ipAddress: '-',
|
ipAddress: '-',
|
||||||
port: 33030,
|
|
||||||
version: '-',
|
version: '-',
|
||||||
cpuUse: '-',
|
cpuUse: '-',
|
||||||
memoryUse: '-',
|
memoryUse: '-',
|
||||||
@@ -169,8 +175,8 @@ let pronInfo: nfStateType = reactive({
|
|||||||
function fnGetList(one: boolean) {
|
function fnGetList(one: boolean) {
|
||||||
if (tableState.loading) return;
|
if (tableState.loading) return;
|
||||||
one && (tableState.loading = true);
|
one && (tableState.loading = true);
|
||||||
listMain().then(res => {
|
listAllNeInfo({ bandStatus: true }).then(res => {
|
||||||
tableState.data = res;
|
tableState.data = res.data;
|
||||||
tableState.loading = false;
|
tableState.loading = false;
|
||||||
var rightNum = 0;
|
var rightNum = 0;
|
||||||
var errorNum = 0;
|
var errorNum = 0;
|
||||||
@@ -253,17 +259,14 @@ const closeDrawer = () => {
|
|||||||
function rowClick(record: any, index: any) {
|
function rowClick(record: any, index: any) {
|
||||||
return {
|
return {
|
||||||
onClick: (event: any) => {
|
onClick: (event: any) => {
|
||||||
if (
|
let pronData = JSON.parse(JSON.stringify(record.serverState));
|
||||||
toRaw(record).status == '异常' ||
|
if (!pronData.online) {
|
||||||
toRaw(record).status == 'Abnormal'
|
|
||||||
) {
|
|
||||||
message.error(t('views.index.neStatus'), 2);
|
message.error(t('views.index.neStatus'), 2);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
let pronData = toRaw(record);
|
const totalMemInKB = pronData.mem?.totalMem;
|
||||||
const totalMemInKB = pronData.memUsage?.totalMem;
|
const nfUsedMemInKB = pronData.mem?.nfUsedMem;
|
||||||
const nfUsedMemInKB = pronData.memUsage?.nfUsedMem;
|
const sysMemUsageInKB = pronData.mem?.sysMemUsage;
|
||||||
const sysMemUsageInKB = pronData.memUsage?.sysMemUsage;
|
|
||||||
|
|
||||||
// 将KB转换为MB
|
// 将KB转换为MB
|
||||||
const totalMemInMB = Math.round((totalMemInKB / 1024) * 100) / 100;
|
const totalMemInMB = Math.round((totalMemInKB / 1024) * 100) / 100;
|
||||||
@@ -273,19 +276,17 @@ function rowClick(record: any, index: any) {
|
|||||||
|
|
||||||
//渲染详细信息
|
//渲染详细信息
|
||||||
pronInfo = {
|
pronInfo = {
|
||||||
hostName: pronData.hostName,
|
hostName: pronData.hostname,
|
||||||
osInfo: pronData.osInfo,
|
osInfo: pronData.os,
|
||||||
dbInfo: pronData.dbInfo,
|
ipAddress: pronData.neIP,
|
||||||
ipAddress: pronData.ipAddress,
|
|
||||||
port: pronData.port,
|
|
||||||
version: pronData.version,
|
version: pronData.version,
|
||||||
cpuUse:
|
cpuUse:
|
||||||
pronData.name +
|
pronData.neName +
|
||||||
':' +
|
':' +
|
||||||
pronData.cpuUsage?.nfCpuUsage / 100 +
|
pronData.cpu?.nfCpuUsage / 100 +
|
||||||
'%; ' +
|
'%; ' +
|
||||||
'SYS:' +
|
'SYS:' +
|
||||||
pronData.cpuUsage?.sysCpuUsage / 100 +
|
pronData.cpu?.sysCpuUsage / 100 +
|
||||||
'%',
|
'%',
|
||||||
memoryUse:
|
memoryUse:
|
||||||
'Total:' +
|
'Total:' +
|
||||||
@@ -298,8 +299,8 @@ function rowClick(record: any, index: any) {
|
|||||||
sysMemUsageInMB +
|
sysMemUsageInMB +
|
||||||
'MB',
|
'MB',
|
||||||
capability: pronData.capability,
|
capability: pronData.capability,
|
||||||
serialNum: pronData.serialNum,
|
serialNum: pronData.sn,
|
||||||
expiryDate: pronData.expiryDate,
|
expiryDate: pronData.expire,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
@@ -388,11 +389,11 @@ onBeforeUnmount(() => {
|
|||||||
>
|
>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="column.key === 'status'">
|
<template v-if="column.key === 'status'">
|
||||||
<div v-if="record.status == '正常' || record.status == 'Normal'">
|
<div v-if="record.serverState.online">
|
||||||
<a-tag color="blue">{{ record.name }}</a-tag>
|
<a-tag color="blue">{{ t('views.index.normal') }}</a-tag>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<a-tag color="pink">{{ record.name }}</a-tag>
|
<a-tag color="pink">{{ t('views.index.abnormal') }}</a-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user