DashboardLayout.vue 8.4 KB

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