DashboardLayout.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <template>
  2. <div class="fluid-dashboard">
  3. <div class="frame-top">
  4. <div class="top-logo">
  5. <img src="@/assets/images/logo.png" />
  6. </div>
  7. <div class="title breathe-glow-text ">{{ title }}</div>
  8. <div class="top-right-user">
  9. <UserProfile />
  10. </div>
  11. </div>
  12. <div class="frame-left"></div>
  13. <div class="frame-right">
  14. </div>
  15. <div class="frame-bottom"></div>
  16. <slot name="map"></slot>
  17. <div class="ui-layer">
  18. <header class="top-header">
  19. <div class="header-left">
  20. <slot name="header-left"></slot>
  21. </div>
  22. <div class="header-right">
  23. <slot name="header-right"></slot>
  24. </div>
  25. </header>
  26. <main class="main-layout" :class="layoutClass">
  27. <aside class="left-sidebar">
  28. <slot name="left"></slot>
  29. </aside>
  30. <section class="center-area">
  31. <slot name="center"></slot>
  32. <!-- 底部dock菜单-->
  33. <BottomDock />
  34. </section>
  35. <aside class="right-sidebar">
  36. <slot name="right"></slot>
  37. </aside>
  38. </main>
  39. </div>
  40. <!-- 弹窗层:由 Layout 统一渲染 -->
  41. <SmartDialog
  42. ref="dialogs"
  43. v-for="dialog in activeDialogs"
  44. :key="dialog.id"
  45. :id="dialog.id"
  46. :visible.sync="dialog.visible"
  47. :title="dialog.title"
  48. :defaultWidth="dialog.width || 400"
  49. :defaultHeight="dialog.height || 300"
  50. :center="dialog.center !== false"
  51. :position="dialog.position"
  52. :showClose="dialog.showClose"
  53. :enableDblclickExpand="dialog.enableDblclickExpand"
  54. :noPadding="dialog.noPadding"
  55. :draggable="dialog.draggable"
  56. :resizable="dialog.resizable"
  57. :minWidth="dialog.minWidth"
  58. :minHeight="dialog.minHeight"
  59. @close="handleDialogClose(dialog.id)"
  60. @expand="handleDialogExpand(dialog)">
  61. <template #header v-if="dialog.headerComponent">
  62. <component :is="dialog.headerComponent" v-bind="dialog.headerProps" />
  63. </template>
  64. <component :is="dialog.componentName" v-bind="dialog.data" />
  65. </SmartDialog>
  66. </div>
  67. </template>
  68. <script>
  69. import BottomDock from '@/components/ui/BottomDock.vue';
  70. import SmartDialog from '@/components/ui/SmartDialog.vue';
  71. import dialogManager from '@/mixins/dialogManager';
  72. import UserProfile from '@/components/ui/UserProfile.vue';
  73. // 注册所有可能在弹窗中使用的内容组件
  74. import DeviceStatusPanel from '@/components/ui/DeviceStatusPanel.vue';
  75. import SecurityRoutePanel from '@/components/ui/SecurityRoutePanel.vue';
  76. import IntersectionMapVideos from '@/components/ui/IntersectionMapVideos.vue';
  77. import TrafficTimeSpace from '@/components/ui/TrafficTimeSpace.vue';
  78. import RingDonutChart from '@/components/ui/RingDonutChart.vue';
  79. import CrossingPanel from '@/components/ui/CrossingPanel.vue';
  80. import CrossingDetailPanel from '@/components/ui/CrossingDetailPanel.vue';
  81. import CrossingListPanel from '@/components/ui/CrossingListPanel.vue';
  82. import SecurityRoutePanelSwitch from '@/components/ui/SecurityRoutePanelSwitch.vue';
  83. import SecurityRoutePanelSwitchSmall from '@/components/ui/SecurityRoutePanelSwitchSmall.vue';
  84. import DeviceRestart from '@/components/ui/DeviceRestart.vue';
  85. import DeviceUpgrade from '@/components/ui/DeviceUpgrade.vue';
  86. import OnlineStatusTabs from '@/components/ui/OnlineStatusTabs.vue';
  87. import DeviceStatusTabs from '@/components/ui/DeviceStatusTabs.vue';
  88. import TaskMonitorHeader from '@/components/ui/TaskMonitorHeader.vue';
  89. import SpecialTaskMonitorPanel from '@/components/ui/SpecialTaskMonitorPanel.vue';
  90. import ChangePassword from '@/components/ui/ChangePassword.vue';
  91. export default {
  92. name: 'DashboardLayout',
  93. mixins: [dialogManager],
  94. components: {
  95. BottomDock,
  96. SmartDialog,
  97. UserProfile,
  98. DeviceStatusPanel,
  99. SecurityRoutePanel,
  100. IntersectionMapVideos,
  101. TrafficTimeSpace,
  102. RingDonutChart,
  103. CrossingPanel,
  104. CrossingDetailPanel,
  105. CrossingListPanel,
  106. SecurityRoutePanelSwitch,
  107. SecurityRoutePanelSwitchSmall,
  108. DeviceRestart,
  109. DeviceUpgrade,
  110. OnlineStatusTabs,
  111. DeviceStatusTabs,
  112. TaskMonitorHeader,
  113. SpecialTaskMonitorPanel,
  114. ChangePassword
  115. },
  116. provide() {
  117. return {
  118. dialogManager: {
  119. openDialog: this.openDialog,
  120. closeDialog: this.handleDialogClose,
  121. clearDialogs: this.clearDialogs,
  122. getDialogs: () => this.activeDialogs,
  123. }
  124. };
  125. },
  126. props: {
  127. // 接收外部传入的 class,用于动态切换 CSS 网格布局
  128. // 例如传入 "special-situation-monitoring"
  129. layoutClass: {
  130. type: String,
  131. default: ''
  132. }
  133. },
  134. data() {
  135. return {
  136. title: '灵智交通信号控制平台',
  137. }
  138. },
  139. methods: {
  140. handleDialogExpand(dialog) {
  141. if (dialog.data && typeof dialog.data.onExpand === 'function') {
  142. dialog.data.onExpand(dialog.data);
  143. }
  144. }
  145. }
  146. }
  147. </script>
  148. <style scoped>
  149. /* ================= 根容器 ================= */
  150. .fluid-dashboard {
  151. width: 100vw;
  152. height: 100vh;
  153. position: relative;
  154. overflow: hidden;
  155. background: #050a17;
  156. /* 兜底深色背景 */
  157. }
  158. /* ================= 大屏装饰边框 ================= */
  159. .frame-top,
  160. .frame-left,
  161. .frame-right,
  162. .frame-bottom {
  163. position: absolute;
  164. pointer-events: none;
  165. /* 【核心】鼠标事件穿透,不挡底层交互 */
  166. z-index: 50;
  167. /* 层级高于 UI,低于弹窗 */
  168. }
  169. .frame-top {
  170. top: 0;
  171. left: 0;
  172. width: 100%;
  173. height: 100px;
  174. background: url('@/assets/images/layout-top.png') no-repeat center top;
  175. background-size: 100% 100%;
  176. }
  177. .frame-top .title {
  178. font-family: var(--title-font-family);
  179. font-size: 48px;
  180. color: #ffffff;
  181. line-height: 63px;
  182. text-align: center;
  183. font-style: normal;
  184. text-transform: none;
  185. }
  186. .frame-left {
  187. top: 10px;
  188. left: 0;
  189. width: 16px;
  190. height: calc(100% - 10px - 40px);
  191. background: url('@/assets/images/layout-left.png') no-repeat left center;
  192. background-size: 100% 100%;
  193. }
  194. .frame-right {
  195. top: 10px;
  196. right: 0;
  197. width: 16px;
  198. height: calc(100% - 10px - 40px);
  199. background: url('@/assets/images/layout-right.png') no-repeat right center;
  200. background-size: 100% 100%;
  201. }
  202. .frame-bottom {
  203. bottom: 0;
  204. left: 0;
  205. width: 100%;
  206. height: 17px;
  207. /* background: url('@/assets/images/layout-bottom.png') no-repeat center bottom; */
  208. background-size: 100% 100%;
  209. }
  210. /* ================= UI 层与网格布局 ================= */
  211. .ui-layer {
  212. position: absolute;
  213. top: 0;
  214. left: 0;
  215. width: 100%;
  216. height: 100%;
  217. z-index: 2;
  218. pointer-events: none;
  219. /* 让鼠标穿透点到下层的地图 */
  220. display: grid;
  221. grid-template-rows: 80px 1fr;
  222. /* 头部 80px,其余给主体 */
  223. }
  224. /* 恢复具体功能区域的鼠标交互 */
  225. .top-header {
  226. pointer-events: auto;
  227. }
  228. /* --- 头部 --- */
  229. .top-header {
  230. display: flex;
  231. justify-content: space-between;
  232. align-items: flex-end;
  233. padding: 0 50px;
  234. /* 左右内边距,避开边框图片 */
  235. position: relative;
  236. }
  237. .header-right {
  238. position: absolute;
  239. right: 50px;
  240. bottom: 0;
  241. }
  242. /* --- 主体网格 --- */
  243. .main-layout {
  244. display: grid;
  245. /* 默认网格:左400,中间自适应,右400 */
  246. grid-template-columns: 400px 1fr 400px;
  247. gap: 20px;
  248. /* 【关键】给四周留出 padding,防止里面的图表被外围的装饰边框挡住! */
  249. padding: 20px 50px 60px 50px;
  250. height: 100%;
  251. box-sizing: border-box;
  252. }
  253. /* 特殊模式下的网格变体 (通过 layoutClass 触发) */
  254. .main-layout.special-situation-monitoring {
  255. grid-template-columns: 500px 1fr 480px;
  256. }
  257. /* --- 区域容器设定 --- */
  258. .left-sidebar,
  259. .right-sidebar {
  260. height: 100%;
  261. display: flex;
  262. flex-direction: column;
  263. }
  264. /* --- 中心区域保持事件穿透,让出地图的拖拽控制权 --- */
  265. .center-area {
  266. position: relative;
  267. height: 100%;
  268. pointer-events: none;
  269. }
  270. /* --- 恢复中心区域内部具体组件(如 BottomDock 和 slot 里的内容)的交互 --- */
  271. .left-sidebar > *,
  272. .right-sidebar > *,
  273. .center-area > * {
  274. pointer-events: auto;
  275. }
  276. .top-right-user {
  277. position: absolute;
  278. top: 2px; /* 距离顶部的高度,可根据背景图微调 */
  279. right: 50px; /* 距离右侧的距离 */
  280. pointer-events: auto; /* 【关键】因为 frame-top 是 none,必须在这里恢复鼠标交互,否则无法点击下拉 */
  281. z-index: 100; /* 保证层级最高,下拉菜单不被遮挡 */
  282. }
  283. .top-logo {
  284. position: absolute;
  285. top: 10px;
  286. left: 100px;
  287. height: 30px;
  288. }
  289. .top-logo img {
  290. width: 100%;
  291. height: 100%;
  292. object-fit: contain;
  293. }
  294. </style>