Files
YG_FT/frontend/src/layouts/MainLayout.vue
caoxiaozhu a70cf6addd refactor: Dashboard 看板布局与图表优化
DashboardView 调整看板卡片与栅格展示,ECharts 补充图表类型,主布局 dashboard 区域由内嵌滚动改为自适应可滚动以避免内容被裁剪,回归脚本适配。
2026-07-14 16:10:59 +08:00

131 lines
2.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { onMounted, onUnmounted } from 'vue'
import { useRoute } from 'vue-router'
import AppSidebar from '@/components/AppSidebar.vue'
import AppHeader from '@/components/AppHeader.vue'
import { useSystemStore } from '@/stores/system'
import { useModelsStore } from '@/stores/models'
const systemStore = useSystemStore()
const modelsStore = useModelsStore()
const route = useRoute()
onMounted(() => {
// 启动顶部栏系统监控轮询
systemStore.start()
// 预加载模型列表缓存(列表页渲染模型名用)
modelsStore.load()
})
onUnmounted(() => {
systemStore.stop()
})
</script>
<template>
<div class="main-layout">
<AppSidebar />
<div class="layout-main">
<AppHeader />
<main class="layout-content">
<div
class="page-canvas"
:class="{ 'is-self-surface': route.meta.pageSurface === 'self' }"
>
<router-view v-slot="{ Component }">
<component :is="Component" />
</router-view>
</div>
</main>
</div>
</div>
</template>
<style scoped lang="scss">
.main-layout {
display: flex;
height: 100vh;
overflow: hidden;
}
.layout-main {
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
height: 100vh;
}
.layout-content {
flex: 1;
overflow-y: auto;
padding: 8px 8px 16px;
background-color: var(--app-shell-bg);
display: flex;
flex-direction: column;
min-height: 0;
&:has(.data-table-page),
&:has(.eval-page),
&:has(.manage-card-container) {
overflow-y: hidden;
}
&:has(.create-wizard-layout) {
overflow-y: hidden;
.page-canvas {
flex: 1 1 auto;
min-height: 0;
}
}
}
@media (min-width: 1181px) {
.layout-content:has(.dashboard-view) {
overflow-y: auto;
.page-canvas {
flex: 1 0 auto;
min-height: 0;
padding: 16px;
overflow: visible;
}
}
}
.page-canvas {
flex: 1 0 auto;
display: flex;
flex-direction: column;
width: 100%;
min-width: 0;
padding: 24px;
border-radius: 16px;
background-color: var(--app-page-bg);
box-shadow: var(--card-shadow);
}
.page-canvas.is-self-surface {
padding: 0;
border-radius: 0;
background-color: transparent;
box-shadow: none;
}
.page-canvas:has(.has-fixed-footer) {
margin-bottom: 56px;
}
/* 路由直接输出 PageCard或显式声明根卡片宿主时复用外层白色画布 */
.page-canvas:not(.is-self-surface) > :deep(.page-card),
.page-canvas:not(.is-self-surface) > :deep(.page-card-host > .page-card) {
margin-bottom: 0;
background-color: transparent;
border-radius: 0 !important;
box-shadow: none !important;
}
</style>