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