chore: 调整工作台页面样式-ui稿一致

This commit is contained in:
lzh
2025-12-22 17:15:55 +08:00
parent 6bb7219fe5
commit 2f848f3ac2
5 changed files with 482 additions and 301 deletions

View File

@@ -0,0 +1,66 @@
<script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, onUnmounted, ref, watch } from 'vue';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
interface Props {
/** 图表配置选项 */
options: any;
/** 图表透明度 */
opacity?: number;
/** 图表容器底部内边距 */
paddingBottom?: string;
}
const props = withDefaults(defineProps<Props>(), {
opacity: 0.6,
paddingBottom: '1.5rem',
});
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);
// 初始化图表
function initChart() {
if (props.options) {
renderEcharts(props.options);
}
}
// 监听配置变化
watch(
() => props.options,
() => {
initChart();
},
{ deep: true },
);
// 窗口大小变化时调整图表
const handleResize = () => {
if (chartRef.value) {
chartRef.value.resize?.();
}
};
onMounted(() => {
initChart();
window.addEventListener('resize', handleResize);
});
onUnmounted(() => {
window.removeEventListener('resize', handleResize);
});
</script>
<template>
<div
class="absolute inset-x-0 bottom-0 top-0 z-0 overflow-visible rounded-lg"
:style="{ paddingBottom: paddingBottom }"
>
<EchartsUI ref="chartRef" :style="{ opacity: opacity }" class="h-full w-full" />
</div>
</template>

View File

@@ -0,0 +1,2 @@
export { default as BackgroundChart } from './BackgroundChart.vue';