From 9bd51d030e865cebc58847882a5141ed755b2c2b Mon Sep 17 00:00:00 2001 From: xt12321 <1499410095@qq.com> Date: Sat, 24 Apr 2021 12:00:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=8F=98=E5=8C=96(=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E7=9B=91=E6=8E=A7):=20=E6=8C=89=E9=92=AE=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0title=EF=BC=9B=E5=88=A0=E9=99=A4=E6=A8=A1=E6=8B=9F?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/vadmin/monitor/server/index.vue | 64 ++++++++----------- 1 file changed, 26 insertions(+), 38 deletions(-) diff --git a/dvadmin-ui/src/views/vadmin/monitor/server/index.vue b/dvadmin-ui/src/views/vadmin/monitor/server/index.vue index 684e4db..b20b946 100755 --- a/dvadmin-ui/src/views/vadmin/monitor/server/index.vue +++ b/dvadmin-ui/src/views/vadmin/monitor/server/index.vue @@ -9,13 +9,14 @@ v-model="isOpeningMonitor" active-color="#13ce66" inactive-color="#ff4949" + title="控制所有监控项" @change="changeMonitorStatus" >
- 更新频率: + 监控频率: 更改
- 清空记录 + 清空记录 +
@@ -71,7 +78,12 @@ > - 更改 + 更改 +
@@ -176,9 +188,9 @@ const CHART_KEY_NAME_MAPPING = { // 仪表盘字段映射 const INSTRUMENT_BOARD_KEY_TO_NAME_MAPPING = { - cpu: "CPU使用率", - memory: "内存使用率", - disk: "磁盘使用率" + cpu: 'CPU使用率', + memory: '内存使用率', + disk: '磁盘使用率' } // 仪表盘颜色范围 @@ -297,8 +309,8 @@ export default { }, /**修改服务器信息*/ updateServerInfo() { - updateServerInfo(this.currentServer.id, this.currentServer).then(results => { - this.msgSuccess(results.msg || '修改服务器信息成功!') + updateServerInfo(this.currentServer.id, this.currentServer).then(() => { + this.msgSuccess('修改服务器信息成功!') }).catch(error => { this.$message.error(error.msg || '提交修改服务器信息出错!') }) @@ -306,27 +318,7 @@ export default { /** 获取服务器最新监控信息 */ getServerLatestLogInfo(serverId) { getServerLatestLog(serverId).then(results => { - // this.instrumentBoardData = results.data - this.instrumentBoardData = { - cpu: { - total: 2, - used: '', // cpu核心 可不传,如指cpu当前主频,该值可以传 - rate: 12, - unit: '核心' // 默认单位 核心 - }, - memory: { - total: 1024, - used: 512, - rate: 70, - unit: 'MB' // 默认单位 MB - }, - disk: { - total: 50, - used: 30, - rate: 90, - unit: 'GB' // 默认单位 GB - } - } + this.instrumentBoardData = results.data }).catch(error => { this.msgError(error.msg || '获取服务器最新监控信息错误!') }) @@ -334,11 +326,7 @@ export default { /** 获取监控日志信息 */ getCurrentServerMonitorLogs() { getMonitorLogs(this.currentServer.id, { as: { 'create_datetime__range': this.timeRange } }).then(results => { - // this.lineChartData = results.data - this.lineChartData = { - cpu: [0.5, 0.43, 0.56, 0.89, 0.5, 0.43, 0.56, 0.89, 0.5, 0.43, 0.56, 0.89, 0.5, 0.43, 0.56, 0.89], - memory: [0.6, 0.43, 0.56, 0.56, 0.89, 0.5, 0.43, 0.43, 0.56, 0.56, 0.5, 0.43, 0.56, 0.89, 0.5] - } + this.lineChartData = results.data }).catch(error => { this.msgError(error.msg || '获取监控日志信息出错误!') }) @@ -356,9 +344,9 @@ export default { /** 获取监控配置信息 */ getMonitorStatusSettingsInfo() { getMonitorStatusInfo().then(results => { - let { enabled, interval, save_days } = results + let { enabled, interval, save_days } = results.data this.isOpeningMonitor = enabled - this.monitorLogSavingDays = parseInt(save_days || 30) + this.monitorLogSavingDays = parseInt(save_days) this.formatInterval(parseInt(interval)) }).catch(error => { this.msgError(error.msg || '获取服务器监控配置信息出错误!') @@ -366,8 +354,8 @@ export default { }, /** 更新监控配置信息 */ updateMonitorStatusSettingsInfo() { - updateMonitorStatusInfo(this.monitorStatusInfo).then(result => { - this.msgSuccess(result.msg || '更新配置成功!') + updateMonitorStatusInfo(this.monitorStatusInfo).then(() => { + this.msgSuccess('更新配置成功!') }).catch((error) => { this.msgError(error.msg || '更新服务器监控配置信息出错误!') })