From d930b15104c7b2849a227367fa03742d8cf0e29f Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期二, 04 七月 2023 15:50:36 +0800
Subject: [PATCH] fix 修复 缓存监控图表 支持跟随屏幕大小自适应调整
---
src/views/monitor/cache/index.vue | 97 +++++++++++++++++++++++++-----------------------
1 files 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 { proxy } = getCurrentInstance() as ComponentInternalInstance;
const getList = async () => {
- proxy?.$modal.loading("姝e湪鍔犺浇缂撳瓨鐩戞帶鏁版嵁锛岃绋嶅�欙紒");
- 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} <br/>{b} : {c} ({d}%)"
+ proxy?.$modal.loading("姝e湪鍔犺浇缂撳瓨鐩戞帶鏁版嵁锛岃绋嶅�欙紒");
+ 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} <br/>{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} <br/>{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} <br/>{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();
})
-</script>
\ No newline at end of file
+</script>
--
Gitblit v1.9.3