fix: 主页点击异常
This commit is contained in:
@@ -1,84 +0,0 @@
|
||||
import { request } from '@/plugins/http-fetch';
|
||||
//import * as apple from '@/utils/date-utils';
|
||||
import {parseDateToStr} from '@/utils/date-utils';
|
||||
/**
|
||||
* 查询公告列表
|
||||
* @param query 查询参数
|
||||
* @returns object
|
||||
*/
|
||||
export async function listMain() {
|
||||
var allStatus= await request({
|
||||
url: 'systemManagement/v1/elementType/all/objectType/systemState',
|
||||
method: 'get',
|
||||
});
|
||||
console.log(allStatus)
|
||||
let realData=allStatus.data.data;
|
||||
const mergedData = realData.map(obj => {
|
||||
const [key, value] = Object.entries(obj)[0];
|
||||
var time=new Date();
|
||||
//console.log([key, value])
|
||||
let mergedObj;
|
||||
if (typeof (value.error) === 'undefined'&&Object.keys(value.systemState).length !== 0){
|
||||
mergedObj = { ...value.systemState, refresh:parseDateToStr(time),ipAddress: value.ipAddress, name: key.split("/").join("_"),status:"正常" };
|
||||
|
||||
}else {
|
||||
mergedObj = {version:"-",refresh:parseDateToStr(time),ipAddress: value.ipAddress, name: key.split("/").join("_"),status:"异常" };
|
||||
|
||||
}
|
||||
return mergedObj;
|
||||
});
|
||||
|
||||
console.log(mergedData);
|
||||
// console.log(rowArr)
|
||||
return mergedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公告详细
|
||||
* @param menuId 公告ID
|
||||
* @returns object
|
||||
*/
|
||||
export function getNotice(noticeId: string | number) {
|
||||
return request({
|
||||
url: `/system/notice/${noticeId}`,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
* @param data 公告对象
|
||||
* @returns object
|
||||
*/
|
||||
export function addNotice(data: Record<string, any>) {
|
||||
return request({
|
||||
url: '/system/notice',
|
||||
method: 'post',
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
* @param data 公告对象
|
||||
* @returns object
|
||||
*/
|
||||
export function updateNotice(data: Record<string, any>) {
|
||||
return request({
|
||||
url: '/system/notice',
|
||||
method: 'put',
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除公告
|
||||
* @param noticeId 公告ID
|
||||
* @returns object
|
||||
*/
|
||||
export function delNotice(noticeId: string | number) {
|
||||
return request({
|
||||
url: `/system/notice/${noticeId}`,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { PageContainer } from '@ant-design-vue/pro-layout';
|
||||
import { onMounted } from 'vue';
|
||||
import { ColumnsType } from 'ant-design-vue/lib/table';
|
||||
import { reactive, toRaw } from 'vue';
|
||||
import { reactive, toRaw, ref, onMounted } from 'vue';
|
||||
import { listMain } from '@/api/index';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
const { t } = useI18n();
|
||||
import { TooltipComponent } from 'echarts/components';
|
||||
import { GaugeChart } from 'echarts/charts';
|
||||
import { CanvasRenderer } from 'echarts/renderers';
|
||||
@@ -11,6 +12,7 @@ import * as echarts from 'echarts/core';
|
||||
import { TitleComponent, LegendComponent } from 'echarts/components';
|
||||
import { PieChart } from 'echarts/charts';
|
||||
import { LabelLayout } from 'echarts/features';
|
||||
import message from 'ant-design-vue/lib/message';
|
||||
|
||||
echarts.use([
|
||||
TooltipComponent,
|
||||
@@ -201,16 +203,11 @@ function init(e: any) {
|
||||
var myChart = echarts.init(chartDom);
|
||||
myChart.clear(); //怕遗留以前得元素
|
||||
|
||||
var nfMenUsage =
|
||||
Math.round(
|
||||
(realData.memUsage.nfUsedMem / realData.memUsage.totalMem) * 10000
|
||||
) / 100.0;
|
||||
var nfMaxDiskSpace =
|
||||
Math.round(
|
||||
(realData.diskSpace.partitionInfo[1].used /
|
||||
realData.diskSpace.partitionInfo[1].total) *
|
||||
10000
|
||||
) / 100.0;
|
||||
let cpuUsage = realData.cpuUsage
|
||||
let memUsage = realData.memUsage
|
||||
var nfMenUsage = Math.round((memUsage?.nfUsedMem / memUsage?.totalMem) * 10000) / 100.0;
|
||||
let partitionInfo = realData.diskSpace?.partitionInfo[1]
|
||||
var nfMaxDiskSpace = Math.round((partitionInfo?.used / partitionInfo?.total) * 10000 ) / 100.0;
|
||||
let option = {
|
||||
tooltip: {
|
||||
formatter: '{a} <br/>{b} : {c}%',
|
||||
@@ -272,7 +269,7 @@ function init(e: any) {
|
||||
},
|
||||
data: [
|
||||
{
|
||||
value: realData.cpuUsage.nfCpuUsage / 100,
|
||||
value: cpuUsage?.nfCpuUsage / 100,
|
||||
name: 'CPU',
|
||||
},
|
||||
],
|
||||
@@ -327,9 +324,9 @@ const closeDrawer = () => {
|
||||
/**抽屉 网元详细信息 */
|
||||
|
||||
/**监听表格行事件*/
|
||||
function rowClick(record, index) {
|
||||
function rowClick(record:any, index:any) {
|
||||
return {
|
||||
onClick: (event) => {
|
||||
onClick: () => {
|
||||
console.log(toRaw(record), "666");
|
||||
/* console.log( index, "666");
|
||||
console.log( event, "666");*/
|
||||
@@ -340,15 +337,14 @@ function rowClick(record, index) {
|
||||
let pronData=toRaw(record);
|
||||
//渲染详细信息
|
||||
pronInfo={
|
||||
|
||||
hostName: pronData.hostName,
|
||||
osInfo:pronData.osInfo,
|
||||
dbInfo: pronData.dbInfo,
|
||||
ipAddress:pronData.ipAddress,
|
||||
port:pronData.port,
|
||||
version:pronData.version,
|
||||
cpuUse:pronData.name+":"+pronData.cpuUsage.nfCpuUsage/100+"%; "+"SYS:"+pronData.cpuUsage.sysCpuUsage / 100+"%",
|
||||
memoryUse:"Total:"+pronData.memUsage.totalMem+"KB; "+pronData.name+":"+pronData.memUsage.nfUsedMem+"KB; SYS:"+pronData.memUsage.sysMemUsage+"KB",
|
||||
cpuUse:pronData.name+":"+pronData.cpuUsage?.nfCpuUsage/100+"%; "+"SYS:"+pronData.cpuUsage?.sysCpuUsage / 100+"%",
|
||||
memoryUse:"Total:"+pronData.memUsage?.totalMem+"KB; "+pronData.name+":"+pronData.memUsage?.nfUsedMem+"KB; SYS:"+pronData.memUsage?.sysMemUsage+"KB",
|
||||
capability:pronData.capability ,
|
||||
serialNum:pronData.serialNum,
|
||||
expiryDate:pronData.expiryDate,
|
||||
|
||||
Reference in New Issue
Block a user