DashboardLayout.vue 9.3 KB

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