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">
|
<script setup lang="ts">
|
||||||
import { PageContainer } from '@ant-design-vue/pro-layout';
|
import { PageContainer } from '@ant-design-vue/pro-layout';
|
||||||
import { onMounted } from 'vue';
|
|
||||||
import { ColumnsType } from 'ant-design-vue/lib/table';
|
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 { listMain } from '@/api/index';
|
||||||
|
import useI18n from '@/hooks/useI18n';
|
||||||
|
const { t } = useI18n();
|
||||||
import { TooltipComponent } from 'echarts/components';
|
import { TooltipComponent } from 'echarts/components';
|
||||||
import { GaugeChart } from 'echarts/charts';
|
import { GaugeChart } from 'echarts/charts';
|
||||||
import { CanvasRenderer } from 'echarts/renderers';
|
import { CanvasRenderer } from 'echarts/renderers';
|
||||||
@@ -11,6 +12,7 @@ import * as echarts from 'echarts/core';
|
|||||||
import { TitleComponent, LegendComponent } from 'echarts/components';
|
import { TitleComponent, LegendComponent } from 'echarts/components';
|
||||||
import { PieChart } from 'echarts/charts';
|
import { PieChart } from 'echarts/charts';
|
||||||
import { LabelLayout } from 'echarts/features';
|
import { LabelLayout } from 'echarts/features';
|
||||||
|
import message from 'ant-design-vue/lib/message';
|
||||||
|
|
||||||
echarts.use([
|
echarts.use([
|
||||||
TooltipComponent,
|
TooltipComponent,
|
||||||
@@ -201,16 +203,11 @@ function init(e: any) {
|
|||||||
var myChart = echarts.init(chartDom);
|
var myChart = echarts.init(chartDom);
|
||||||
myChart.clear(); //怕遗留以前得元素
|
myChart.clear(); //怕遗留以前得元素
|
||||||
|
|
||||||
var nfMenUsage =
|
let cpuUsage = realData.cpuUsage
|
||||||
Math.round(
|
let memUsage = realData.memUsage
|
||||||
(realData.memUsage.nfUsedMem / realData.memUsage.totalMem) * 10000
|
var nfMenUsage = Math.round((memUsage?.nfUsedMem / memUsage?.totalMem) * 10000) / 100.0;
|
||||||
) / 100.0;
|
let partitionInfo = realData.diskSpace?.partitionInfo[1]
|
||||||
var nfMaxDiskSpace =
|
var nfMaxDiskSpace = Math.round((partitionInfo?.used / partitionInfo?.total) * 10000 ) / 100.0;
|
||||||
Math.round(
|
|
||||||
(realData.diskSpace.partitionInfo[1].used /
|
|
||||||
realData.diskSpace.partitionInfo[1].total) *
|
|
||||||
10000
|
|
||||||
) / 100.0;
|
|
||||||
let option = {
|
let option = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
formatter: '{a} <br/>{b} : {c}%',
|
formatter: '{a} <br/>{b} : {c}%',
|
||||||
@@ -272,7 +269,7 @@ function init(e: any) {
|
|||||||
},
|
},
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
value: realData.cpuUsage.nfCpuUsage / 100,
|
value: cpuUsage?.nfCpuUsage / 100,
|
||||||
name: 'CPU',
|
name: 'CPU',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -327,9 +324,9 @@ const closeDrawer = () => {
|
|||||||
/**抽屉 网元详细信息 */
|
/**抽屉 网元详细信息 */
|
||||||
|
|
||||||
/**监听表格行事件*/
|
/**监听表格行事件*/
|
||||||
function rowClick(record, index) {
|
function rowClick(record:any, index:any) {
|
||||||
return {
|
return {
|
||||||
onClick: (event) => {
|
onClick: () => {
|
||||||
console.log(toRaw(record), "666");
|
console.log(toRaw(record), "666");
|
||||||
/* console.log( index, "666");
|
/* console.log( index, "666");
|
||||||
console.log( event, "666");*/
|
console.log( event, "666");*/
|
||||||
@@ -340,15 +337,14 @@ function rowClick(record, index) {
|
|||||||
let pronData=toRaw(record);
|
let pronData=toRaw(record);
|
||||||
//渲染详细信息
|
//渲染详细信息
|
||||||
pronInfo={
|
pronInfo={
|
||||||
|
|
||||||
hostName: pronData.hostName,
|
hostName: pronData.hostName,
|
||||||
osInfo:pronData.osInfo,
|
osInfo:pronData.osInfo,
|
||||||
dbInfo: pronData.dbInfo,
|
dbInfo: pronData.dbInfo,
|
||||||
ipAddress:pronData.ipAddress,
|
ipAddress:pronData.ipAddress,
|
||||||
port:pronData.port,
|
port:pronData.port,
|
||||||
version:pronData.version,
|
version:pronData.version,
|
||||||
cpuUse:pronData.name+":"+pronData.cpuUsage.nfCpuUsage/100+"%; "+"SYS:"+pronData.cpuUsage.sysCpuUsage / 100+"%",
|
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",
|
memoryUse:"Total:"+pronData.memUsage?.totalMem+"KB; "+pronData.name+":"+pronData.memUsage?.nfUsedMem+"KB; SYS:"+pronData.memUsage?.sysMemUsage+"KB",
|
||||||
capability:pronData.capability ,
|
capability:pronData.capability ,
|
||||||
serialNum:pronData.serialNum,
|
serialNum:pronData.serialNum,
|
||||||
expiryDate:pronData.expiryDate,
|
expiryDate:pronData.expiryDate,
|
||||||
|
|||||||
Reference in New Issue
Block a user