---新增首页
This commit is contained in:
84
src/api/system/home.ts
Normal file
84
src/api/system/home.ts
Normal file
@@ -0,0 +1,84 @@
|
||||
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',
|
||||
});
|
||||
}
|
||||
@@ -65,6 +65,19 @@ export default {
|
||||
|
||||
// 页面
|
||||
views: {
|
||||
index:{
|
||||
hostName:"hostName",
|
||||
osInfo:"osInfo",
|
||||
dbInfo:"dbInfo",
|
||||
ipAddress:"ipAddress",
|
||||
port:"port",
|
||||
version: "version",
|
||||
cpuUse: "CPU Usage",
|
||||
memoryUse:"memoryUse",
|
||||
capability:"capability" ,
|
||||
serialNum: "serialNum",
|
||||
expiryDate:"expiryDate",
|
||||
},
|
||||
login: {
|
||||
tabPane1: 'Account password login',
|
||||
tabPane2: 'Login with phone number',
|
||||
|
||||
@@ -63,6 +63,19 @@ export default {
|
||||
|
||||
// 页面
|
||||
views: {
|
||||
index:{
|
||||
hostName:"主机名",
|
||||
osInfo:"操作系统信息",
|
||||
dbInfo:"数据库信息",
|
||||
ipAddress:"IP地址",
|
||||
port:"端口",
|
||||
version: "软件版本",
|
||||
cpuUse: "CPU利用率",
|
||||
memoryUse:"内存使用",
|
||||
capability:"用户容量" ,
|
||||
serialNum: "序列号",
|
||||
expiryDate:"许可证到期日期",
|
||||
},
|
||||
login: {
|
||||
tabPane1: '账号密码登录',
|
||||
tabPane2: '手机号登录',
|
||||
|
||||
Reference in New Issue
Block a user