From d930b15104c7b2849a227367fa03742d8cf0e29f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Tue, 4 Jul 2023 15:50:36 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E5=9B=BE=E8=A1=A8=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=B7=9F=E9=9A=8F=E5=B1=8F=E5=B9=95=E5=A4=A7=E5=B0=8F=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/monitor/cache/index.vue | 97 ++++++++++++++++--------------- 1 file changed, 50 insertions(+), 47 deletions(-) diff --git a/src/views/monitor/cache/index.vue b/src/views/monitor/cache/index.vue index 8fd3bde..5cc2be5 100644 --- a/src/views/monitor/cache/index.vue +++ b/src/views/monitor/cache/index.vue @@ -134,56 +134,59 @@ const usedmemory = ref(); const { proxy } = getCurrentInstance() as ComponentInternalInstance; const getList = async () => { - proxy?.$modal.loading("正在加载缓存监控数据,请稍候!"); - const res = await getCache(); - proxy?.$modal.closeLoading(); - cache.value = res.data; - const commandstatsIntance = echarts.init(commandstats.value, "macarons"); - commandstatsIntance.setOption({ - tooltip: { - trigger: "item", - formatter: "{a}
{b} : {c} ({d}%)" + proxy?.$modal.loading("正在加载缓存监控数据,请稍候!"); + const res = await getCache(); + proxy?.$modal.closeLoading(); + cache.value = res.data; + const commandstatsIntance = echarts.init(commandstats.value, "macarons"); + commandstatsIntance.setOption({ + tooltip: { + trigger: "item", + formatter: "{a}
{b} : {c} ({d}%)" + }, + series: [ + { + name: "命令", + type: "pie", + roseType: "radius", + radius: [15, 95], + center: ["50%", "38%"], + data: res.data.commandStats, + animationEasing: "cubicInOut", + animationDuration: 1000 + } + ] + }); + const usedmemoryInstance = echarts.init(usedmemory.value, "macarons"); + usedmemoryInstance.setOption({ + tooltip: { + formatter: "{b}
{a} : " + cache.value.info.used_memory_human + }, + series: [ + { + name: "峰值", + type: "gauge", + min: 0, + max: 1000, + detail: { + formatter: cache.value.info.used_memory_human }, - series: [ - { - name: "命令", - type: "pie", - roseType: "radius", - radius: [15, 95], - center: ["50%", "38%"], - data: res.data.commandStats, - animationEasing: "cubicInOut", - animationDuration: 1000 - } + data: [ + { + value: parseFloat(cache.value.info.used_memory_human), + name: "内存消耗" + } ] - }); - - const usedmemoryInstance = echarts.init(usedmemory.value, "macarons"); - usedmemoryInstance.setOption({ - tooltip: { - formatter: "{b}
{a} : " + cache.value.info.used_memory_human - }, - series: [ - { - name: "峰值", - type: "gauge", - min: 0, - max: 1000, - detail: { - formatter: cache.value.info.used_memory_human - }, - data: [ - { - value: parseFloat(cache.value.info.used_memory_human), - name: "内存消耗" - } - ] - } - ] - }) + } + ] + }) + window.addEventListener("resize",()=>{ + commandstatsIntance.resize() + usedmemoryInstance.resize() + }); } onMounted(() => { - getList(); + getList(); }) - \ No newline at end of file +