refactor:基于 lint 处理排版

This commit is contained in:
YunaiV
2025-04-22 22:10:33 +08:00
parent 3fe36fd823
commit fb785894b6
322 changed files with 4781 additions and 2093 deletions

View File

@@ -1,13 +1,14 @@
<script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import type { InfraRedisApi } from '#/api/infra/redis';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import type { InfraRedisApi } from '#/api/infra/redis';
import { onMounted, ref, watch } from 'vue';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
const props = defineProps<{
redisData?: InfraRedisApi.InfraRedisMonitorInfo;
redisData?: InfraRedisApi.RedisMonitorInfo;
}>();
const chartRef = ref<EchartsUIType>();
@@ -22,8 +23,8 @@ const parseMemoryValue = (memStr: string | undefined): number => {
// 从字符串中提取数字部分,例如 "1.2M" 中的 1.2
const str = String(memStr); // 显式转换为字符串类型
const match = str.match(/^([\d.]+)/);
return match ? parseFloat(match[1] as string) : 0;
} catch (e) {
return match ? Number.parseFloat(match[1] as string) : 0;
} catch {
return 0;
}
};
@@ -45,7 +46,7 @@ const renderMemoryChart = () => {
left: 'center',
},
tooltip: {
formatter: '{b} <br/>{a} : ' + usedMemory
formatter: `{b} <br/>{a} : ${usedMemory}`,
},
series: [
{
@@ -64,59 +65,63 @@ const renderMemoryChart = () => {
color: [
[0.2, '#7FFF00'],
[0.8, '#00FFFF'],
[1, '#FF0000']
[1, '#FF0000'],
],
width: 10
}
width: 10,
},
},
axisTick: {
length: 5,
lineStyle: {
color: '#76D9D7'
}
color: '#76D9D7',
},
},
splitLine: {
length: 20,
lineStyle: {
color: '#76D9D7'
}
color: '#76D9D7',
},
},
axisLabel: {
color: '#76D9D7',
distance: 15,
fontSize: 15
fontSize: 15,
},
pointer: {
width: 7,
show: true
show: true,
},
detail: {
show: true,
offsetCenter: [0, '50%'],
color: 'auto',
fontSize: 30,
formatter: usedMemory
formatter: usedMemory,
},
progress: {
show: true
show: true,
},
data: [
{
value: memoryValue,
name: '内存消耗'
}
]
}
]
name: '内存消耗',
},
],
},
],
});
};
/** 监听数据变化,重新渲染图表 */
watch(() => props.redisData, (newVal) => {
if (newVal) {
renderMemoryChart();
}
}, { deep: true });
watch(
() => props.redisData,
(newVal) => {
if (newVal) {
renderMemoryChart();
}
},
{ deep: true },
);
onMounted(() => {
if (props.redisData) {