StatusMonitoring.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template>
  2. <DashboardLayout ref="layout" layoutClass="special-situation-monitoring">
  3. <template #header-left>
  4. </template>
  5. <template #header-right>
  6. <!-- 日期 -->
  7. <DateTimeWidget />
  8. </template>
  9. <template #map>
  10. <!-- 地图 -->
  11. <TongzhouTrafficMap amapKey="db2da7e3e248c3b2077d53fc809be63f"
  12. securityJsCode="a7413c674852c5eaf01d90813c5b7ef6" />
  13. </template>
  14. <template #left>
  15. <!-- 左侧Tab菜单栏 -->
  16. <div class="left-sidebar-wrap">
  17. <TechTabs v-model="activeLeftTab" type="underline" @tab-click="handleTabClick">
  18. <TechTabPane label="总览" name="overview" class="menu-scroll-view">
  19. <MenuItem theme="tech" v-for="item in menuData" :key="item.id" :node="item" :level="0"
  20. @node-click="handleMenuClick" />
  21. </TechTabPane>
  22. <TechTabPane label="路口" name="crossing" class="menu-scroll-view">
  23. <MenuItem theme="tech" v-for="item in menuData" :key="item.id" :node="item" :level="0"
  24. @node-click="handleMenuClick" />
  25. </TechTabPane>
  26. <TechTabPane label="干线" name="trunkLine" class="menu-scroll-view">
  27. <MenuItem v-for="item in menuData" :key="item.id" :node="item" :level="0"
  28. @node-click="handleMenuClick" />
  29. </TechTabPane>
  30. <TechTabPane label="特勤" name="specialDuty" class="menu-scroll-view">
  31. <MenuItem v-for="item in menuData" :key="item.id" :node="item" :level="0"
  32. @node-click="handleMenuClick" />
  33. </TechTabPane>
  34. </TechTabs>
  35. </div>
  36. </template>
  37. <template #right>
  38. <!-- 模式切换按钮组 -->
  39. <div class="mode-switch" v-if="activeLeftTab === 'crossing'">
  40. <ButtonGroup v-model="currentView" :options="viewOptions" @select="onViewSelect" />
  41. </div>
  42. </template>
  43. <template #center>
  44. </template>
  45. </DashboardLayout>
  46. </template>
  47. <script>
  48. import DashboardLayout from '@/layouts/DashboardLayout.vue';
  49. import DateTimeWidget from '@/components/ui/DateTimeWidget.vue';
  50. import TechTabs from '@/components/ui/TechTabs.vue';
  51. import TechTabPane from '@/components/ui/TechTabPane.vue';
  52. import TongzhouTrafficMap from '@/components/TongzhouTrafficMap.vue';
  53. import MenuItem from '@/components/ui/MenuItem.vue';
  54. import ButtonGroup from '@/components/ui/ButtonGroup.vue';
  55. import { makeTrafficTimeSpaceData } from '@/mock/data';
  56. export default {
  57. name: "HomePage",
  58. components: {
  59. DashboardLayout,
  60. DateTimeWidget,
  61. TechTabs,
  62. TechTabPane,
  63. TongzhouTrafficMap,
  64. MenuItem,
  65. ButtonGroup,
  66. },
  67. data() {
  68. return {
  69. // 左侧边栏数据
  70. activeLeftTab: 'overview',
  71. menuData: [
  72. {
  73. id: 'root-1',
  74. label: '主控中心',
  75. icon: 'el-icon-monitor', // 这里可以替换为你项目用的图标类名,比如 iconfont
  76. children: [
  77. {
  78. id: 'team-1',
  79. label: '北京市交警总队',
  80. children:
  81. [
  82. {
  83. id: 'dist-1',
  84. label: '通州区',
  85. children: [
  86. {
  87. id: 'street-1',
  88. label: '中仓街道',
  89. children: [
  90. { id: 'node-1', label: '新华东街 - 新华南路' },
  91. { id: 'node-2', label: '玉带河东街 - 车站路' },
  92. { id: 'node-3', label: '赵登禹大街 - 新华东街' }
  93. ]
  94. },
  95. {
  96. id: 'street-2',
  97. label: '新华街道',
  98. children: [
  99. { id: 'node-4', label: '新华南北街交叉口' },
  100. { id: 'node-5', label: '通胡大街 - 紫运中路' },
  101. { id: 'node-6', label: '芙蓉东路 - 通胡大街' }
  102. ]
  103. },
  104. {
  105. id: 'street-3',
  106. label: '北苑街道',
  107. children: [
  108. { id: 'node-7', label: '北苑路口' },
  109. { id: 'node-8', label: '新华西街 - 北苑南路' },
  110. { id: 'node-9', label: '新城南街 - 新华西街' }
  111. ]
  112. },
  113. {
  114. id: 'street-4',
  115. label: '玉桥街道',
  116. children: [
  117. { id: 'node-10', label: '玉桥西路 - 玉桥西里中街' },
  118. { id: 'node-11', label: '运河西大街 - 玉桥中路' },
  119. { id: 'node-12', label: '梨园南街 - 运河西大街' }
  120. ]
  121. },
  122. {
  123. id: 'street-5',
  124. label: '杨庄街道',
  125. children: [
  126. { id: 'node-13', label: '怡乐中街 - 九棵树西路' },
  127. { id: 'node-14', label: '翠屏西路 - 怡乐中街' },
  128. { id: 'node-15', label: '杨庄路 - 新华西街' }
  129. ]
  130. },
  131. {
  132. id: 'street-6',
  133. label: '九棵树街道',
  134. children: [
  135. { id: 'node-16', label: '九棵树东路 - 九棵树西路' },
  136. { id: 'node-17', label: '云景东路 - 九棵树东路' },
  137. { id: 'node-18', label: '群芳南街 - 云景东路' }
  138. ]
  139. },
  140. {
  141. id: 'street-7',
  142. label: '临河里街道',
  143. children: [
  144. { id: 'node-19', label: '梨园中街 - 九棵树东路' },
  145. { id: 'node-20', label: '临河里路 - 梨园中街' },
  146. { id: 'node-21', label: '万盛南街 - 临河里路' }
  147. ]
  148. },
  149. {
  150. id: 'street-8',
  151. label: '潞邑街道',
  152. children: [
  153. { id: 'node-22', label: '潞苑北大街 - 潞邑西路' },
  154. { id: 'node-23', label: '潞苑南大街 - 潞邑三路' },
  155. { id: 'node-24', label: '东六环 - 潞苑北大街' }
  156. ]
  157. },
  158. {
  159. id: 'street-9',
  160. label: '通运街道',
  161. children: [
  162. { id: 'node-25', label: '通胡大街 - 东六环' },
  163. { id: 'node-26', label: '运河东大街 - 通胡大街' },
  164. { id: 'node-27', label: '紫运中路 - 运河东大街' }
  165. ]
  166. },
  167. {
  168. id: 'street-10',
  169. label: '潞源街道',
  170. children: [
  171. { id: 'node-28', label: '宋梁路 - 运河东大街' },
  172. { id: 'node-29', label: '东六环 - 运河东大街' },
  173. { id: 'node-30', label: '潞源北街 - 宋梁路' }
  174. ]
  175. },
  176. {
  177. id: 'street-11',
  178. label: '文景街道',
  179. children: [
  180. { id: 'node-31', label: '环球大道 - 九棵树东路' },
  181. { id: 'node-32', label: '颐瑞东路 - 环球大道' },
  182. { id: 'node-33', label: '万盛南街 - 颐瑞东路' }
  183. ]
  184. }
  185. ]
  186. }
  187. ]
  188. }
  189. ]
  190. }
  191. ],
  192. // 地图模式切换数据
  193. currentView: 'map-mode',
  194. viewOptions: [
  195. { label: '列表模式', value: 'list-mode' },
  196. { label: '地图模式', value: 'map-mode' },
  197. ]
  198. };
  199. },
  200. created() {
  201. },
  202. mounted() {
  203. this.showTopChartDalogs();
  204. // this.$refs.layout.openDialog({
  205. // id: 'test', // 这里的 ID 可以根据实际业务场景动态生成,例如 'dev-security-route' 代表特勤安保路线弹窗
  206. // title: 'dddd',
  207. // component: 'CrossingListPanel',
  208. // width: 1315,
  209. // height: 682,
  210. // center: true,
  211. // showClose: true,
  212. // // position: { x: 750, y: 130 },
  213. // noPadding: false,
  214. // enableDblclickExpand: false,
  215. // data: {}
  216. // });
  217. },
  218. methods: {
  219. // 模式切换
  220. onViewSelect(item) {
  221. console.log('你点击了:', item.label);
  222. this.currentView = item.value;
  223. this.$refs.layout.clearDialogs(); // 清空全部弹窗
  224. // 列表模式弹窗
  225. if (this.currentView === 'list-mode') {
  226. this.$refs.layout.openDialog({
  227. id: 'crossing-list', // 这里的 ID 可以根据实际业务场景动态生成
  228. title: '',
  229. component: 'CrossingListPanel',
  230. width: 1720,
  231. height: 682,
  232. center: false,
  233. showClose: true,
  234. noPadding: false,
  235. enableDblclickExpand: false,
  236. position: { x: 100, y: 150 },
  237. data: {
  238. onViewDetail: (rowData) => this.handleCrossingViewDetail(rowData)
  239. }
  240. });
  241. } else {
  242. this.showCrossingTopDialogs();
  243. }
  244. },
  245. // 处理tab点击
  246. handleTabClick(tabName) {
  247. console.log('父组件接收到了tab点击事件:', tabName);
  248. this.$refs.layout.clearDialogs(); // 清空全部弹窗
  249. this.showTopChartDalogs(); // 根据当前Tab显示对应的顶部常驻图表
  250. },
  251. // 处理菜单点击
  252. handleMenuClick(nodeData) {
  253. console.log('父组件接收到了最底层路口点击事件:', nodeData);
  254. // 根据Tab来显示不同的弹窗内容
  255. if (this.activeLeftTab === 'overview') { // 总览
  256. this.showOverviewDalogs(nodeData);
  257. } else if (this.activeLeftTab === 'crossing') { // 路口
  258. this.showCrossingDalogs(nodeData);
  259. } else if (this.activeLeftTab === 'trunkLine') { // 干线
  260. this.showTrunkLineDalogs(nodeData);
  261. } else if (this.activeLeftTab === 'specialDuty') { // 特勤
  262. this.showSpecialDutyDalogs(nodeData);
  263. }
  264. },
  265. // 处理弹窗双击展开(通过 onExpand 回调从 Layout 传入)
  266. handleDoubleClickExpend(nodeData) {
  267. console.log('处理弹窗双击事件', nodeData);
  268. if (this.activeLeftTab === 'crossing') {
  269. this.showCrossingDetailDialogs(nodeData);
  270. }
  271. },
  272. // 显示顶部常驻图表(根据当前Tab状态)
  273. showTopChartDalogs() {
  274. if (this.activeLeftTab === 'overview') { // 总览
  275. this.showOverviewTopDialogs();
  276. } else if (this.activeLeftTab === 'crossing') { // 路口
  277. this.showCrossingTopDialogs();
  278. } else if (this.activeLeftTab === 'trunkLine') { // 干线
  279. // TODO: 干线Tab的顶部图表
  280. } else if (this.activeLeftTab === 'specialDuty') { // 特勤
  281. // TODO: 特勤Tab的顶部图表
  282. }
  283. },
  284. // 显示总览弹窗组
  285. showOverviewDalogs(nodeData) {
  286. console.log('显示总览弹窗组', nodeData.id, nodeData.label);
  287. },
  288. showOverviewTopDialogs() {
  289. this.$refs.layout.openDialog({
  290. id: 'top-chart-overview-1',
  291. title: '',
  292. component: 'OnlineStatusTabs',
  293. width: 300,
  294. height: 160,
  295. center: false,
  296. showClose: false,
  297. draggable: false,
  298. resizable: false,
  299. position: { x: 630, y: 130 },
  300. noPadding: true,
  301. data: {}
  302. });
  303. this.$refs.layout.openDialog({
  304. id: 'top-chart-overview-2',
  305. title: '',
  306. component: 'DeviceStatusTabs',
  307. width: 300,
  308. height: 160,
  309. center: false,
  310. showClose: false,
  311. draggable: false,
  312. resizable: false,
  313. position: { x: 980, y: 130 },
  314. noPadding: true,
  315. data: {}
  316. });
  317. },
  318. // 显示路口弹窗组
  319. showCrossingDalogs(nodeData) {
  320. console.log('显示路口弹窗组', nodeData.id, nodeData.label);
  321. // 路口弹窗
  322. this.$refs.layout.openDialog({
  323. id: 'crossing3_' + nodeData.id, // 这里的 ID 可以根据实际业务场景动态生成
  324. title: nodeData.label,
  325. component: 'CrossingPanel',
  326. width: 260,
  327. height: 260,
  328. center: false,
  329. showClose: true,
  330. position: { x: 950, y: 430 },
  331. noPadding: false,
  332. data: {
  333. ...nodeData,
  334. onExpand: (data) => this.handleDoubleClickExpend(data)
  335. },
  336. onClose: () => {
  337. this.$refs.layout.handleDialogClose('top-chart-crossing-1');
  338. this.$refs.layout.handleDialogClose('top-chart-crossing-2');
  339. }
  340. });
  341. },
  342. showCrossingDetailDialogs(nodeData) {
  343. console.log('显示干线弹窗组', nodeData.id, nodeData.label);
  344. this.$refs.layout.openDialog({
  345. id: 'crossing_detail' + nodeData.id, // 这里的 ID 可以根据实际业务场景动态生成,例如 'dev-security-route' 代表特勤安保路线弹窗
  346. title: nodeData.label || nodeData.name,
  347. component: 'CrossingDetailPanel',
  348. width: 1315,
  349. height: 682,
  350. center: true,
  351. showClose: true,
  352. // position: { x: 750, y: 130 },
  353. noPadding: false,
  354. enableDblclickExpand: false,
  355. data: nodeData
  356. });
  357. },
  358. showCrossingTopDialogs() {
  359. this.$refs.layout.openDialog({
  360. id: 'top-chart-crossing-1',
  361. title: '',
  362. component: 'RingDonutChart',
  363. width: 228,
  364. height: 124,
  365. center: false,
  366. showClose: false,
  367. draggable: false,
  368. resizable: false,
  369. position: { x: 730, y: 130 },
  370. noPadding: true,
  371. data: {
  372. chartData: [
  373. { name: '在线', value: 38, color: '#4DF5F8' },
  374. { name: '离线', value: 3, color: '#FFD369' }
  375. ],
  376. centerTitle: "98%",
  377. centerSubTitle: "38/41"
  378. }
  379. });
  380. this.$refs.layout.openDialog({
  381. id: 'top-chart-crossing-2',
  382. title: '',
  383. component: 'RingDonutChart',
  384. width: 228,
  385. height: 124,
  386. center: false,
  387. showClose: false,
  388. draggable: false,
  389. resizable: false,
  390. position: { x: 980, y: 130 },
  391. noPadding: true,
  392. data: {
  393. chartData: [
  394. { name: '通信', value: 10, color: '#4DF5F8' },
  395. { name: '检测器', value: 8, color: '#FFA033' },
  396. { name: '灯控', value: 15, color: '#FFF587' },
  397. { name: '冲突', value: 5, color: '#FF4D4F' }
  398. ],
  399. centerTitle: "98%",
  400. centerSubTitle: "38/41"
  401. }
  402. });
  403. },
  404. // 路口列表模式下弹窗
  405. handleCrossingViewDetail(rowData) {
  406. console.log('显示路口列表查看', rowData);
  407. this.showCrossingDetailDialogs(rowData);
  408. },
  409. // 显示干线弹窗组
  410. showTrunkLineDalogs(nodeData) {
  411. console.log('显示干线弹窗组', nodeData.id, nodeData.label);
  412. this.$refs.layout.openDialog({
  413. id: nodeData.id, // 这里的 ID 可以根据实际业务场景动态生成,例如 'dev-security-route' 代表特勤安保路线弹窗
  414. title: nodeData.label,
  415. component: 'TrafficTimeSpace',
  416. width: 1000,
  417. height: 500,
  418. center: true,
  419. showClose: true,
  420. // position: { x: 400, y: 450 },
  421. data: makeTrafficTimeSpaceData(),
  422. });
  423. },
  424. // 显示特勤弹窗组
  425. showSpecialDutyDalogs(nodeData) {
  426. console.log('显示干线弹窗组', nodeData.id, nodeData.label);
  427. },
  428. }
  429. }
  430. </script>
  431. <style scoped>
  432. .mode-switch {
  433. display: flex;
  434. flex-direction: row;
  435. justify-content: flex-end;
  436. }
  437. .mode-switch>div {
  438. width: 200px;
  439. }
  440. </style>