ProjectManagement.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <div class="model-management">
  3. <!-- 页面头部 -->
  4. <PageHeader />
  5. <!-- 主要内容区域 -->
  6. <main class="main-content">
  7. <!-- 左侧垂直菜单 -->
  8. <aside class="left-sidebar">
  9. <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)">
  10. <el-menu-item-group>
  11. <template #title><span style="font-size: 1.45rem; font-weight: 600; color: #303133;">项目分类</span></template>
  12. <!-- 数字孪生分类 -->
  13. <el-sub-menu index="1">
  14. <template #title>
  15. <el-icon><Menu /></el-icon>
  16. <span>数字孪生</span>
  17. </template>
  18. <el-menu-item index="1-1">数字孪生太浦河</el-menu-item>
  19. <el-menu-item index="1-2">数字孪生水文站</el-menu-item>
  20. <el-menu-item index="1-3">数字孪生灌区</el-menu-item>
  21. </el-sub-menu>
  22. </el-menu-item-group>
  23. </el-menu>
  24. </aside>
  25. <!-- 右侧内容区域 -->
  26. <section class="right-content">
  27. <!-- 面包屑导航已移除 -->
  28. <component :is="activeComponent" />
  29. </section>
  30. </main>
  31. </div>
  32. </template>
  33. <script setup>
  34. import PageHeader from './PageHeader.vue'
  35. import { ref, shallowRef, markRaw } from 'vue'
  36. import { Menu, Setting, House } from '@element-plus/icons-vue'
  37. import ShuiliGongcheng from './content/ShuiliGongcheng.vue'
  38. import JidianShebei from './content/JidianShebei.vue'
  39. import ShuiliSheshi from './content/ShuiliSheshi.vue'
  40. // 使用markRaw标记组件,避免Vue将其转换为响应式对象
  41. const ShuiliGongchengRaw = markRaw(ShuiliGongcheng)
  42. const JidianShebeiRaw = markRaw(JidianShebei)
  43. const ShuiliSheshiRaw = markRaw(ShuiliSheshi)
  44. const activeMenu = ref('1')
  45. const activeMenuName = ref('数字孪生')
  46. const activeComponent = ref(ShuiliGongchengRaw)
  47. const handleOpen = (key, keyPath) => {
  48. console.log('Menu opened:', key, keyPath)
  49. if (key === '1') {
  50. activeMenu.value = key
  51. activeMenuName.value = '数字孪生'
  52. activeComponent.value = ShuiliGongchengRaw
  53. console.log('Set active component to ShuiliGongcheng')
  54. }
  55. }
  56. const handleClose = (key, keyPath) => {
  57. console.log(key, keyPath)
  58. }
  59. const handleMenuSelect = (key) => {
  60. console.log('Menu selected:', key)
  61. activeMenu.value = key
  62. // 根据选择的菜单项更新活动菜单名称和组件
  63. if (key === '1') {
  64. activeMenuName.value = '数字孪生'
  65. activeComponent.value = ShuiliGongchengRaw
  66. } else if (key === '1-1') {
  67. activeMenuName.value = '数字孪生太浦河'
  68. activeComponent.value = ShuiliGongchengRaw
  69. } else if (key === '1-2') {
  70. activeMenuName.value = '数字孪生水文站'
  71. activeComponent.value = ShuiliGongchengRaw
  72. } else if (key === '1-3') {
  73. activeMenuName.value = '数字孪生灌区'
  74. activeComponent.value = ShuiliGongchengRaw
  75. } else {
  76. activeMenuName.value = '数字孪生'
  77. activeComponent.value = ShuiliGongchengRaw
  78. }
  79. console.log('Active component:', activeComponent.value)
  80. }
  81. </script>
  82. <style scoped>
  83. .model-management {
  84. width: 100%;
  85. height: 100%;
  86. display: flex;
  87. flex-direction: column;
  88. font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  89. overflow: hidden;
  90. background: #f8f9fa;
  91. }
  92. /* 主要内容区域 */
  93. .main-content {
  94. flex: 1;
  95. width: 100%;
  96. padding: 0;
  97. overflow-y: auto;
  98. height: 100%;
  99. display: flex;
  100. }
  101. /* 左侧垂直菜单 */
  102. .left-sidebar {
  103. width: 280px;
  104. background: #f8f9fa;
  105. box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
  106. height: 100%;
  107. border-radius: 0;
  108. margin: 0;
  109. overflow: hidden;
  110. }
  111. .el-menu-vertical-demo {
  112. border-right: none;
  113. font-size: 1rem !important;
  114. }
  115. .el-menu-vertical-demo .el-menu-item-group__title {
  116. font-weight: 600;
  117. color: #303133 !important;
  118. line-height: 1.5;
  119. }
  120. .el-menu-vertical-demo .el-sub-menu .el-menu-item {
  121. color: #909399 !important;
  122. font-size: 0.875rem !important;
  123. line-height: 1.5;
  124. }
  125. .menu-title-text {
  126. font-size: 1rem !important;
  127. font-weight: 600;
  128. }
  129. .tree-menu {
  130. padding: 1.5rem;
  131. height: 100%;
  132. display: flex;
  133. flex-direction: column;
  134. border-radius: 12px;
  135. background-color: #f8f9fa;
  136. }
  137. .menu-title {
  138. font-size: 1.125rem;
  139. color: #2c3e50;
  140. margin-bottom: 1.5rem;
  141. font-weight: 600;
  142. line-height: 1.5;
  143. }
  144. .menu-items {
  145. display: flex;
  146. flex-direction: column;
  147. gap: 0;
  148. flex-grow: 1;
  149. }
  150. .menu-item {
  151. display: flex;
  152. align-items: center;
  153. gap: 0.8rem;
  154. padding: 1rem 1.5rem;
  155. cursor: pointer;
  156. transition: all 0.3s ease;
  157. font-size: 1rem;
  158. color: #577cf3;
  159. font-weight: 400;
  160. line-height: 1.6;
  161. }
  162. .menu-item:hover {
  163. background: #f0f5ff;
  164. }
  165. .menu-icon {
  166. font-size: 1.25rem;
  167. }
  168. /* 右侧内容区域 */
  169. .right-content {
  170. flex: 1;
  171. padding: 1rem;
  172. overflow-y: auto;
  173. }
  174. .model-section {
  175. padding: 0 1rem;
  176. margin-bottom: 2.5rem;
  177. }
  178. .section-title {
  179. font-size: 1.5rem;
  180. color: #2c3e50;
  181. margin-bottom: 2rem;
  182. font-weight: 600;
  183. line-height: 1.4;
  184. }
  185. .model-grid {
  186. display: grid;
  187. grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  188. gap: 2rem;
  189. }
  190. .model-card {
  191. background: white;
  192. padding: 2.5rem;
  193. border-radius: 16px;
  194. box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  195. transition: all 0.3s ease;
  196. }
  197. .model-card:hover {
  198. transform: translateY(-10px);
  199. box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  200. }
  201. .model-name {
  202. font-size: 1.25rem;
  203. color: #2c3e50;
  204. margin-bottom: 1rem;
  205. font-weight: 600;
  206. line-height: 1.4;
  207. }
  208. .model-description {
  209. font-size: 1rem;
  210. color: #7f8c8d;
  211. line-height: 1.6;
  212. margin-bottom: 2rem;
  213. font-weight: 400;
  214. }
  215. .model-actions {
  216. display: flex;
  217. gap: 1rem;
  218. }
  219. .btn {
  220. padding: 0.8rem 1.5rem;
  221. border: none;
  222. border-radius: 50px;
  223. font-size: 1rem;
  224. font-weight: 400;
  225. cursor: pointer;
  226. transition: all 0.3s ease;
  227. text-decoration: none;
  228. display: inline-block;
  229. white-space: nowrap;
  230. line-height: 1.6;
  231. }
  232. .btn-primary {
  233. background: #577cf3;
  234. color: white;
  235. }
  236. .btn-primary:hover {
  237. transform: translateY(-3px);
  238. box-shadow: 0 15px 30px rgba(87, 124, 243, 0.4);
  239. }
  240. .btn-secondary {
  241. background: white;
  242. color: #577cf3;
  243. border: 2px solid #577cf3;
  244. }
  245. .btn-secondary:hover {
  246. background: #577cf3;
  247. color: white;
  248. transform: translateY(-3px);
  249. }
  250. /* 页面底部 */
  251. .page-footer {
  252. background: white;
  253. color: #577cf3;
  254. text-align: center;
  255. padding: 1.5rem 0;
  256. height: 10px;
  257. display: flex;
  258. align-items: center;
  259. justify-content: center;
  260. border-top: 1px solid #f0f5ff;
  261. }
  262. .menu-bar {
  263. height: 100%;
  264. background: #f0f5ff;
  265. }
  266. .page-footer p {
  267. margin: 0;
  268. font-size: 0.875rem;
  269. line-height: 1.5;
  270. font-weight: 400;
  271. }
  272. </style>