fix: 概览界面监控 chart 样式修改

This commit is contained in:
ssongliu 2023-02-03 14:43:33 +08:00
parent 37dd3d859f
commit bfce9ffc94
6 changed files with 52 additions and 19 deletions

View file

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<el-card> <el-card :style="{ height: height }">
<el-divider direction="vertical" /> <el-divider direction="vertical" />
<span style="font-size: 16px; font-weight: 700">{{ header }}</span> <span style="font-size: 16px; font-weight: 700">{{ header }}</span>
<div style="margin-top: 20px"><slot name="body" /></div> <div style="margin-top: 20px"><slot name="body" /></div>
@ -12,6 +12,7 @@
defineOptions({ name: 'CardWithHeader' }); defineOptions({ name: 'CardWithHeader' });
defineProps({ defineProps({
header: String, header: String,
height: String,
}); });
</script> </script>

View file

@ -4,7 +4,7 @@ import { Layout } from '@/routers/constant';
const modules = import.meta.globEager('./modules/*.ts'); const modules = import.meta.globEager('./modules/*.ts');
const homeRouter: RouteRecordRaw = { const homeRouter: RouteRecordRaw = {
path: '/home', path: '/',
component: Layout, component: Layout,
redirect: '/home/index', redirect: '/home/index',
meta: { meta: {

View file

@ -1,6 +1,6 @@
<template> <template>
<div v-loading="loading"> <div v-loading="loading">
<LayoutContent :title="'Mysql ' + $t('menu.database')" :class="{ mask: mysqlStatus != 'Running' }"> <LayoutContent :title="'Mysql ' + $t('menu.database')">
<template #app> <template #app>
<AppStatus <AppStatus
:app-key="'mysql'" :app-key="'mysql'"

View file

@ -1,7 +1,6 @@
<template> <template>
<div v-loading="loading"> <div v-loading="loading">
<AppStatus <AppStatus
:class="{ mask: redisStatus != 'Running' }"
:app-key="'redis'" :app-key="'redis'"
style="margin-top: 20px" style="margin-top: 20px"
@before="onBefore" @before="onBefore"

View file

@ -10,7 +10,7 @@
/> />
<el-row :gutter="20" style="margin-top: 20px"> <el-row :gutter="20" style="margin-top: 20px">
<el-col :span="16"> <el-col :span="16">
<CardWithHeader :header="$t('home.overview')"> <CardWithHeader :header="$t('home.overview')" height="150px">
<template #body> <template #body>
<el-form label-position="top" label-width="100px"> <el-form label-position="top" label-width="100px">
<el-row :gutter="20"> <el-row :gutter="20">
@ -50,12 +50,12 @@
</el-form> </el-form>
</template> </template>
</CardWithHeader> </CardWithHeader>
<CardWithHeader :header="$t('commons.table.status')" style="margin-top: 20px"> <CardWithHeader :header="$t('commons.table.status')" style="margin-top: 20px" height="280px">
<template #body> <template #body>
<Status ref="statuRef" /> <Status ref="statuRef" />
</template> </template>
</CardWithHeader> </CardWithHeader>
<CardWithHeader :header="$t('menu.monitor')" style="margin-top: 20px"> <CardWithHeader :header="$t('menu.monitor')" style="margin-top: 20px" height="450px">
<template #body> <template #body>
<el-radio-group <el-radio-group
style="float: right; margin-left: 5px" style="float: right; margin-left: 5px"
@ -119,7 +119,7 @@
</CardWithHeader> </CardWithHeader>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<CardWithHeader :header="$t('home.systemInfo')"> <CardWithHeader :header="$t('home.systemInfo')" height="370px">
<template #body> <template #body>
<el-form style="margin-left: 10px"> <el-form style="margin-left: 10px">
<el-form-item style="margin-top: 15px" :label="$t('home.hostname')"> <el-form-item style="margin-top: 15px" :label="$t('home.hostname')">
@ -140,7 +140,7 @@
</template> </template>
</CardWithHeader> </CardWithHeader>
<CardWithHeader :header="$t('home.app')" style="margin-top: 20px"> <CardWithHeader :header="$t('home.app')" style="margin-top: 20px" height="532px">
<template #body> <template #body>
<App ref="appRef" /> <App ref="appRef" />
</template> </template>
@ -401,9 +401,17 @@ const loadData = async () => {
let ioReadYDatas = { let ioReadYDatas = {
name: i18n.global.t('monitor.read'), name: i18n.global.t('monitor.read'),
type: 'line', type: 'line',
smooth: true,
areaStyle: { areaStyle: {
color: '#ebdee3', color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(27, 143, 60, 1)',
},
{
offset: 1,
color: 'rgba(27, 143, 60, 0)',
},
]),
}, },
data: ioReadBytes.value, data: ioReadBytes.value,
showSymbol: false, showSymbol: false,
@ -411,9 +419,17 @@ const loadData = async () => {
let ioWriteYDatas = { let ioWriteYDatas = {
name: i18n.global.t('monitor.write'), name: i18n.global.t('monitor.write'),
type: 'line', type: 'line',
smooth: true,
areaStyle: { areaStyle: {
color: '#ebdee3', color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(0, 94, 235, 1)',
},
{
offset: 1,
color: 'rgba(0, 94, 235, 0)',
},
]),
}, },
data: ioWriteBytes.value, data: ioWriteBytes.value,
showSymbol: false, showSymbol: false,
@ -430,9 +446,17 @@ const loadData = async () => {
let netTxYDatas = { let netTxYDatas = {
name: i18n.global.t('monitor.up'), name: i18n.global.t('monitor.up'),
type: 'line', type: 'line',
smooth: true,
areaStyle: { areaStyle: {
color: '#ebdee3', color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(0, 94, 235, .5)',
},
{
offset: 1,
color: 'rgba(0, 94, 235, 0)',
},
]),
}, },
data: netBytesRecvs.value, data: netBytesRecvs.value,
showSymbol: false, showSymbol: false,
@ -440,9 +464,17 @@ const loadData = async () => {
let netRxYDatas = { let netRxYDatas = {
name: i18n.global.t('monitor.down'), name: i18n.global.t('monitor.down'),
type: 'line', type: 'line',
smooth: true,
areaStyle: { areaStyle: {
color: '#ebdee3', color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(27, 143, 60, .5)',
},
{
offset: 1,
color: 'rgba(27, 143, 60, 0)',
},
]),
}, },
data: netBytesSents.value, data: netBytesSents.value,
showSymbol: false, showSymbol: false,
@ -491,6 +523,7 @@ function freshChart(chartName: string, legendDatas: any, xDatas: any, yDatas: an
xAxis: { data: xDatas, boundaryGap: false }, xAxis: { data: xDatas, boundaryGap: false },
yAxis: { name: '( ' + formatStr + ' )' }, yAxis: { name: '( ' + formatStr + ' )' },
series: yDatas, series: yDatas,
dataZoom: [{ startValue: xDatas[0] }],
}; };
itemChart?.setOption(option, true); itemChart?.setOption(option, true);
} }

View file

@ -59,7 +59,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import LayoutContent from '@/layout/layout-content.vue'; import LayoutContent from '@/layout/layout-content.vue';
import { getSettingInfo, loadUpgradeInfoByOSS, upgrade } from '@/api/modules/setting'; import { getSettingInfo, loadUpgradeInfo, upgrade } from '@/api/modules/setting';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import MdEditor from 'md-editor-v3'; import MdEditor from 'md-editor-v3';
import 'md-editor-v3/lib/style.css'; import 'md-editor-v3/lib/style.css';
@ -96,7 +96,7 @@ const handleClose = () => {
}; };
const onLoadUpgradeInfo = async () => { const onLoadUpgradeInfo = async () => {
const res = await loadUpgradeInfoByOSS(); const res = await loadUpgradeInfo();
if (!res.data) { if (!res.data) {
ElMessage.success(i18n.global.t('setting.noUpgrade')); ElMessage.success(i18n.global.t('setting.noUpgrade'));
return; return;