StatusMonitoring.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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 { getIntersectionData, 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.$refs.layout.openDialog({
  204. // id: 'test', // 这里的 ID 可以根据实际业务场景动态生成,例如 'dev-security-route' 代表特勤安保路线弹窗
  205. // title: 'dddd',
  206. // component: 'CrossingListPanel',
  207. // width: 1315,
  208. // height: 682,
  209. // center: true,
  210. // showClose: true,
  211. // // position: { x: 750, y: 130 },
  212. // noPadding: false,
  213. // enableDblclickExpand: false,
  214. // data: {}
  215. // });
  216. },
  217. methods: {
  218. // 模式切换
  219. onViewSelect(item) {
  220. console.log('你点击了:', item.label);
  221. this.currentView = item.value;
  222. this.$refs.layout.clearDialogs(); // 清空全部弹窗
  223. // 列表模式弹窗
  224. if (this.currentView === 'list-mode') {
  225. this.$refs.layout.openDialog({
  226. id: 'crossing-list', // 这里的 ID 可以根据实际业务场景动态生成
  227. title: '',
  228. component: 'CrossingListPanel',
  229. width: 1720,
  230. height: 682,
  231. center: false,
  232. showClose: true,
  233. noPadding: false,
  234. enableDblclickExpand: false,
  235. position: {x: 100, y:150},
  236. data: {
  237. onViewDetail: (rowData) => this.handleCrossingViewDetail(rowData)
  238. }
  239. });
  240. }
  241. },
  242. // 处理tab点击
  243. handleTabClick(nodeData) {
  244. console.log('父组件接收到了tab点击事件:', nodeData);
  245. this.$refs.layout.clearDialogs(); // 清空全部弹窗
  246. },
  247. // 处理菜单点击
  248. handleMenuClick(nodeData) {
  249. console.log('父组件接收到了最底层路口点击事件:', nodeData);
  250. // 这里可以根据 nodeData 的经纬度来控制地图组件的视角
  251. // this.testOpenDeviceStatus();
  252. // this.testOpenSecurityRoute();
  253. // this.testOpenSecurityRoute2();
  254. // this.testOpenTrafficTimeSpace();
  255. // 根据Tab来显示不同的弹窗内容
  256. if (this.activeLeftTab === 'overview') { // 总览
  257. this.showOverviewDalogs(nodeData);
  258. } else if (this.activeLeftTab === 'crossing') { // 路口
  259. this.showCrossingDalogs(nodeData);
  260. } else if (this.activeLeftTab === 'trunkLine') { // 干线
  261. this.showTrunkLineDalogs(nodeData);
  262. } else if (this.activeLeftTab === 'specialDuty') { // 特勤
  263. this.showSpecialDutyDalogs(nodeData);
  264. }
  265. },
  266. // 处理弹窗双击展开(通过 onExpand 回调从 Layout 传入)
  267. handleDoubleClickExpend(nodeData) {
  268. console.log('处理弹窗双击事件', nodeData);
  269. if (this.activeLeftTab === 'crossing') {
  270. this.showCrossingDetailDialogs(nodeData);
  271. }
  272. },
  273. // 显示总览弹窗组
  274. showOverviewDalogs(nodeData) {
  275. console.log('显示总览弹窗组', nodeData.id, nodeData.label);
  276. },
  277. // 显示路口弹窗组
  278. showCrossingDalogs(nodeData) {
  279. console.log('显示路口弹窗组', nodeData.id, nodeData.label);
  280. this.$refs.layout.openDialog({
  281. id: 'crossing_' + nodeData.id, // 这里的 ID 可以根据实际业务场景动态生成
  282. title: '',
  283. component: 'RingDonutChart',
  284. width: 228,
  285. height: 124,
  286. center: false,
  287. showClose: false,
  288. position: { x: 730, y: 130 },
  289. noPadding: true,
  290. resizable: false,
  291. data: {
  292. chartData: [
  293. { name: '在线', value: 38, color: '#4DF5F8' },
  294. { name: '离线', value: 3, color: '#FFD369' }
  295. ],
  296. centerTitle: "98%",
  297. centerSubTitle: "38/41"
  298. }
  299. });
  300. this.$refs.layout.openDialog({
  301. id: 'crossing2_' + nodeData.id, // 这里的 ID 可以根据实际业务场景动态生成
  302. title: '',
  303. component: 'RingDonutChart',
  304. width: 228,
  305. height: 124,
  306. center: false,
  307. showClose: false,
  308. position: { x: 980, y: 130 },
  309. noPadding: true,
  310. resizable: false,
  311. data: {
  312. chartData: [
  313. { name: '通信', value: 10, color: '#4DF5F8' },
  314. { name: '检测器', value: 8, color: '#FFA033' },
  315. { name: '灯控', value: 15, color: '#FFF587' },
  316. { name: '冲突', value: 5, color: '#FF4D4F' }
  317. ],
  318. centerTitle: "98%",
  319. centerSubTitle: "38/41"
  320. }
  321. });
  322. // 路口弹窗
  323. this.$refs.layout.openDialog({
  324. id: 'crossing3_' + nodeData.id, // 这里的 ID 可以根据实际业务场景动态生成
  325. title: nodeData.label,
  326. component: 'CrossingPanel',
  327. width: 260,
  328. height: 260,
  329. center: false,
  330. showClose: true,
  331. position: { x: 950, y: 430 },
  332. noPadding: false,
  333. data: {
  334. ...nodeData,
  335. onExpand: (data) => this.handleDoubleClickExpend(data)
  336. },
  337. onClose: () => {
  338. this.$refs.layout.handleDialogClose('crossing_' + nodeData.id);
  339. this.$refs.layout.handleDialogClose('crossing2_' + nodeData.id);
  340. }
  341. });
  342. },
  343. showCrossingDetailDialogs(nodeData) {
  344. console.log('显示干线弹窗组', nodeData.id, nodeData.label);
  345. this.$refs.layout.openDialog({
  346. id: 'crossing_detail' + nodeData.id, // 这里的 ID 可以根据实际业务场景动态生成,例如 'dev-security-route' 代表特勤安保路线弹窗
  347. title: nodeData.label || nodeData.name,
  348. component: 'CrossingDetailPanel',
  349. width: 1315,
  350. height: 682,
  351. center: true,
  352. showClose: true,
  353. // position: { x: 750, y: 130 },
  354. noPadding: false,
  355. enableDblclickExpand: false,
  356. data: nodeData
  357. });
  358. },
  359. // 路口列表模式下弹窗
  360. handleCrossingViewDetail(rowData) {
  361. console.log('显示路口列表查看', rowData);
  362. this.showCrossingDetailDialogs(rowData);
  363. },
  364. // 显示干线弹窗组
  365. showTrunkLineDalogs(nodeData) {
  366. console.log('显示干线弹窗组', nodeData.id, nodeData.label);
  367. this.$refs.layout.openDialog({
  368. id: nodeData.id, // 这里的 ID 可以根据实际业务场景动态生成,例如 'dev-security-route' 代表特勤安保路线弹窗
  369. title: nodeData.label,
  370. component: 'TrafficTimeSpace',
  371. width: 1000,
  372. height: 500,
  373. center: true,
  374. showClose: true,
  375. // position: { x: 400, y: 450 },
  376. data: makeTrafficTimeSpaceData(),
  377. });
  378. },
  379. // 显示特勤弹窗组
  380. showSpecialDutyDalogs(nodeData) {
  381. console.log('显示干线弹窗组', nodeData.id, nodeData.label);
  382. },
  383. // ================= 测试用例:模拟各种点击行为 =================
  384. // 模拟 1:打开设备状态面板
  385. testOpenDeviceStatus() {
  386. this.$refs.layout.openDialog({
  387. id: 'device-status-node-101', // 这里的 ID 可以根据实际业务场景动态生成,例如 'node-101' 代表某个路口
  388. title: '',
  389. component: 'DeviceStatusPanel', // 对应 components 里注册的名字
  390. width: 300,
  391. height: 240,
  392. center: false,
  393. position: { x: 400, y: 200 }, // 直接指定坐标,SmartDialog 内部会自动转换成 left/top
  394. showClose: false, // 是否显示关闭按钮
  395. });
  396. this.$refs.layout.openDialog({
  397. id: 'device-status-node-102', // 这里的 ID 可以根据实际业务场景动态生成,例如 'node-101' 代表某个路口
  398. title: '',
  399. component: 'DeviceStatusPanel', // 对应 components 里注册的名字
  400. width: 300,
  401. height: 240,
  402. center: false,
  403. position: { x: 1600, y: 100 }, // 直接指定坐标,SmartDialog 内部会自动转换成 left/top
  404. showClose: false, // 是否显示关闭按钮
  405. });
  406. },
  407. // 模拟 2:打开特勤安保路线面板
  408. testOpenSecurityRoute() {
  409. this.$refs.layout.openDialog({
  410. id: 'dev-security-route', // 这里的 ID 可以根据实际业务场景动态生成,例如 'dev-security-route' 代表特勤安保路线弹窗
  411. title: '特勤安保路线 未开始 一级',
  412. component: 'SecurityRoutePanel',
  413. width: 540,
  414. height: 300,
  415. center: false,
  416. position: { x: 400, y: 450 },
  417. });
  418. },
  419. // 模拟 3:打开本地协调控制面板
  420. testOpenSecurityRoute2() {
  421. const dialogId = 'dev-security-route2';
  422. this.$refs.layout.openDialog({
  423. id: dialogId,
  424. title: '长安街-府右街口 本地协调控制',
  425. component: 'IntersectionMapVideos',
  426. width: 300,
  427. height: 200,
  428. center: false,
  429. enableDblclickExpand: true,
  430. position: { x: 1100, y: 200 },
  431. data: {
  432. mapData: {},
  433. intersectionName: '长安街-府右街口',
  434. videos: [
  435. { id: 'cam-1', name: '信号机视频', url: 'https://example.com/video1' },
  436. { id: 'cam-2', name: '路口全景', url: 'https://example.com/video2' },
  437. { id: 'cam-3', name: '人行横道', url: 'https://example.com/video3' },
  438. ]
  439. }
  440. });
  441. // 异步获取数据后更新弹窗
  442. getIntersectionData().then(mapData => {
  443. const dialogs = this.$refs.layout.getDialogs();
  444. const dialog = dialogs.find(d => d.id === dialogId);
  445. if (dialog) {
  446. this.$set(dialog.data, 'mapData', mapData);
  447. }
  448. });
  449. },
  450. // 模拟 4:打开新干线协调控制面板
  451. testOpenTrafficTimeSpace() {
  452. const tsData = makeTrafficTimeSpaceData();
  453. this.$refs.layout.openDialog({
  454. id: 'dev-traffic-time-space',
  455. title: '新干线协调控制 早高峰',
  456. component: 'TrafficTimeSpace',
  457. width: 300,
  458. height: 300,
  459. center: false,
  460. position: { x: 1400, y: 500 },
  461. data: {
  462. intersections: tsData.intersections,
  463. distances: tsData.distances,
  464. waveData: tsData.waveData,
  465. greenData: tsData.greenData,
  466. }
  467. });
  468. }
  469. }
  470. }
  471. </script>
  472. <style scoped>
  473. .mode-switch {
  474. display: flex;
  475. flex-direction: row;
  476. justify-content: flex-end;
  477. }
  478. .mode-switch>div {
  479. width: 200px;
  480. }
  481. </style>