| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319 |
- <template>
- <div class="model-management">
- <!-- 页面头部 -->
- <PageHeader />
- <!-- 主要内容区域 -->
- <main class="main-content">
- <!-- 左侧垂直菜单 -->
- <aside class="left-sidebar">
- <el-menu :default-active="activeMenu" class="el-menu-vertical-demo" background-color="#f8f9fa" text-color="#303133" active-text-color="#409eff" style="height: 100%; margin: 0;" @open="handleOpen" @close="handleClose" @select="(key) => handleMenuSelect(key)">
- <el-menu-item-group>
- <template #title><span style="font-size: 1.45rem; font-weight: 600; color: #303133;">项目分类</span></template>
-
- <!-- 数字孪生分类 -->
- <el-sub-menu index="1">
- <template #title>
- <el-icon><Menu /></el-icon>
- <span>数字孪生</span>
- </template>
- <el-menu-item index="1-1">数字孪生太浦河</el-menu-item>
- <el-menu-item index="1-2">数字孪生水文站</el-menu-item>
- <el-menu-item index="1-3">数字孪生灌区</el-menu-item>
- </el-sub-menu>
- </el-menu-item-group>
- </el-menu>
- </aside>
- <!-- 右侧内容区域 -->
- <section class="right-content">
- <!-- 面包屑导航已移除 -->
- <component :is="activeComponent" />
- </section>
- </main>
-
- </div>
- </template>
- <script setup>
- import PageHeader from './PageHeader.vue'
- import { ref, shallowRef, markRaw } from 'vue'
- import { Menu, Setting, House } from '@element-plus/icons-vue'
- import ShuiliGongcheng from './content/ShuiliGongcheng.vue'
- import JidianShebei from './content/JidianShebei.vue'
- import ShuiliSheshi from './content/ShuiliSheshi.vue'
- // 使用markRaw标记组件,避免Vue将其转换为响应式对象
- const ShuiliGongchengRaw = markRaw(ShuiliGongcheng)
- const JidianShebeiRaw = markRaw(JidianShebei)
- const ShuiliSheshiRaw = markRaw(ShuiliSheshi)
- const activeMenu = ref('1')
- const activeMenuName = ref('数字孪生')
- const activeComponent = ref(ShuiliGongchengRaw)
- const handleOpen = (key, keyPath) => {
- console.log('Menu opened:', key, keyPath)
- if (key === '1') {
- activeMenu.value = key
- activeMenuName.value = '数字孪生'
- activeComponent.value = ShuiliGongchengRaw
- console.log('Set active component to ShuiliGongcheng')
- }
- }
- const handleClose = (key, keyPath) => {
- console.log(key, keyPath)
- }
- const handleMenuSelect = (key) => {
- console.log('Menu selected:', key)
- activeMenu.value = key
-
- // 根据选择的菜单项更新活动菜单名称和组件
- if (key === '1') {
- activeMenuName.value = '数字孪生'
- activeComponent.value = ShuiliGongchengRaw
- } else if (key === '1-1') {
- activeMenuName.value = '数字孪生太浦河'
- activeComponent.value = ShuiliGongchengRaw
- } else if (key === '1-2') {
- activeMenuName.value = '数字孪生水文站'
- activeComponent.value = ShuiliGongchengRaw
- } else if (key === '1-3') {
- activeMenuName.value = '数字孪生灌区'
- activeComponent.value = ShuiliGongchengRaw
- } else {
- activeMenuName.value = '数字孪生'
- activeComponent.value = ShuiliGongchengRaw
- }
-
- console.log('Active component:', activeComponent.value)
- }
- </script>
- <style scoped>
- .model-management {
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
- overflow: hidden;
- background: #f8f9fa;
- }
- /* 主要内容区域 */
- .main-content {
- flex: 1;
- width: 100%;
- padding: 0;
- overflow-y: auto;
- height: 100%;
- display: flex;
- }
- /* 左侧垂直菜单 */
- .left-sidebar {
- width: 280px;
- background: #f8f9fa;
- box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
- height: 100%;
- border-radius: 0;
- margin: 0;
- overflow: hidden;
- }
- .el-menu-vertical-demo {
- border-right: none;
- font-size: 1rem !important;
- }
- .el-menu-vertical-demo .el-menu-item-group__title {
- font-weight: 600;
- color: #303133 !important;
- line-height: 1.5;
- }
- .el-menu-vertical-demo .el-sub-menu .el-menu-item {
- color: #909399 !important;
- font-size: 0.875rem !important;
- line-height: 1.5;
- }
- .menu-title-text {
- font-size: 1rem !important;
- font-weight: 600;
- }
- .tree-menu {
- padding: 1.5rem;
- height: 100%;
- display: flex;
- flex-direction: column;
- border-radius: 12px;
- background-color: #f8f9fa;
- }
- .menu-title {
- font-size: 1.125rem;
- color: #2c3e50;
- margin-bottom: 1.5rem;
- font-weight: 600;
- line-height: 1.5;
- }
- .menu-items {
- display: flex;
- flex-direction: column;
- gap: 0;
- flex-grow: 1;
- }
- .menu-item {
- display: flex;
- align-items: center;
- gap: 0.8rem;
- padding: 1rem 1.5rem;
- cursor: pointer;
- transition: all 0.3s ease;
- font-size: 1rem;
- color: #577cf3;
- font-weight: 400;
- line-height: 1.6;
- }
- .menu-item:hover {
- background: #f0f5ff;
- }
- .menu-icon {
- font-size: 1.25rem;
- }
- /* 右侧内容区域 */
- .right-content {
- flex: 1;
- padding: 1rem;
- overflow-y: auto;
- }
- .model-section {
- padding: 0 1rem;
- margin-bottom: 2.5rem;
- }
- .section-title {
- font-size: 1.5rem;
- color: #2c3e50;
- margin-bottom: 2rem;
- font-weight: 600;
- line-height: 1.4;
- }
- .model-grid {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
- gap: 2rem;
- }
- .model-card {
- background: white;
- padding: 2.5rem;
- border-radius: 16px;
- box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
- transition: all 0.3s ease;
- }
- .model-card:hover {
- transform: translateY(-10px);
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
- }
- .model-name {
- font-size: 1.25rem;
- color: #2c3e50;
- margin-bottom: 1rem;
- font-weight: 600;
- line-height: 1.4;
- }
- .model-description {
- font-size: 1rem;
- color: #7f8c8d;
- line-height: 1.6;
- margin-bottom: 2rem;
- font-weight: 400;
- }
- .model-actions {
- display: flex;
- gap: 1rem;
- }
- .btn {
- padding: 0.8rem 1.5rem;
- border: none;
- border-radius: 50px;
- font-size: 1rem;
- font-weight: 400;
- cursor: pointer;
- transition: all 0.3s ease;
- text-decoration: none;
- display: inline-block;
- white-space: nowrap;
- line-height: 1.6;
- }
- .btn-primary {
- background: #577cf3;
- color: white;
- }
- .btn-primary:hover {
- transform: translateY(-3px);
- box-shadow: 0 15px 30px rgba(87, 124, 243, 0.4);
- }
- .btn-secondary {
- background: white;
- color: #577cf3;
- border: 2px solid #577cf3;
- }
- .btn-secondary:hover {
- background: #577cf3;
- color: white;
- transform: translateY(-3px);
- }
- /* 页面底部 */
- .page-footer {
- background: white;
- color: #577cf3;
- text-align: center;
- padding: 1.5rem 0;
- height: 10px;
- display: flex;
- align-items: center;
- justify-content: center;
- border-top: 1px solid #f0f5ff;
- }
- .menu-bar {
- height: 100%;
- background: #f0f5ff;
- }
- .page-footer p {
- margin: 0;
- font-size: 0.875rem;
- line-height: 1.5;
- font-weight: 400;
- }
- </style>
|