openatc-components 0.0.80 → 0.0.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/.babelrc +18 -18
  2. package/.editorconfig +9 -9
  3. package/.eslintignore +5 -5
  4. package/.eslintrc.js +29 -29
  5. package/.postcssrc.js +10 -10
  6. package/README.md +30 -30
  7. package/build/build.js +41 -41
  8. package/build/check-versions.js +54 -54
  9. package/build/package.config.js +58 -58
  10. package/build/package.dev.config.js +107 -107
  11. package/build/package.prod.config.js +160 -160
  12. package/build/utils.js +101 -101
  13. package/build/vue-loader.conf.js +22 -22
  14. package/build/webpack.base.conf.js +114 -114
  15. package/build/webpack.dev.conf.js +95 -95
  16. package/build/webpack.prod.conf.js +149 -149
  17. package/config/dev.env.js +8 -8
  18. package/config/index.js +91 -91
  19. package/config/prod.env.js +5 -5
  20. package/config/test.env.js +7 -7
  21. package/index.html +12 -12
  22. package/package/kisscomps/components/BoardCard/BoardCard.vue +89 -89
  23. package/package/kisscomps/components/BoardCard/index.js +2 -2
  24. package/package/kisscomps/components/CommonKanban/CommonKanban.vue +118 -118
  25. package/package/kisscomps/components/CommonKanban/index.js +2 -2
  26. package/package/kisscomps/components/ExpendConfig/ExpendConfig.vue +114 -114
  27. package/package/kisscomps/components/ExpendConfig/index.js +2 -2
  28. package/package/kisscomps/components/FaultDetailModal/FaultDetailModal.vue +170 -170
  29. package/package/kisscomps/components/FaultDetailModal/index.js +2 -2
  30. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/CrossRoadsSvg.vue +497 -497
  31. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/CustomRoadsSvg.vue +46 -46
  32. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/PedSectionEWSvg.vue +300 -300
  33. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/PedSectionSNSvg.vue +288 -288
  34. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampEastSvg.vue +391 -391
  35. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampNorthSvg.vue +336 -336
  36. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampSouthSvg.vue +345 -345
  37. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampWestSvg.vue +389 -389
  38. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/SidewalkSvg.vue +1179 -1179
  39. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeEastRoadsSvg.vue +402 -402
  40. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeNorthRoadsSvg.vue +361 -361
  41. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeSouthRoadsSvg.vue +368 -368
  42. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeWestRoadsSvg.vue +475 -475
  43. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LCrossRoadsSvg.vue +494 -494
  44. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeEastRoadsSvg.vue +401 -401
  45. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeNorthRoadsSvg.vue +360 -360
  46. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeSouthRoadsSvg.vue +367 -367
  47. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeWestRoadsSvg.vue +476 -476
  48. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/refreshSvg.vue +63 -63
  49. package/package/kisscomps/components/IntersectionMap/crossDirection/busIcon/busMapSvg.vue +50 -50
  50. package/package/kisscomps/components/IntersectionMap/crossDirection/busIcon/eastBusSvg.vue +167 -167
  51. package/package/kisscomps/components/IntersectionMap/crossDirection/busIcon/northBusSvg.vue +168 -168
  52. package/package/kisscomps/components/IntersectionMap/crossDirection/busIcon/southBusSvg.vue +168 -168
  53. package/package/kisscomps/components/IntersectionMap/crossDirection/busIcon/westBusSvg.vue +169 -169
  54. package/package/kisscomps/components/IntersectionMap/crossDirection/crossDiagram.vue +912 -912
  55. package/package/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/LphaseIconSvg.vue +112 -112
  56. package/package/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/phaseIconSvg.vue +112 -112
  57. package/package/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/rampPhaseIconSvg.vue +111 -111
  58. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/busPos.json +196 -196
  59. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/busPos.left.json +196 -196
  60. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/phasePos.json +99 -99
  61. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/phasePos.left.json +99 -99
  62. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/rampPos.json +52 -52
  63. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/sidePos.json +99 -99
  64. package/package/kisscomps/components/IntersectionMap/crossDirection/utils.js +78 -78
  65. package/package/kisscomps/components/IntersectionMap/index.js +2 -2
  66. package/package/kisscomps/components/IntersectionMap/intersectionmap.vue +153 -153
  67. package/package/kisscomps/components/IntersectionWithInterface/IntersectionWithInterface.vue +518 -518
  68. package/package/kisscomps/components/IntersectionWithInterface/index.js +2 -2
  69. package/package/kisscomps/components/KanBan/index.js +2 -2
  70. package/package/kisscomps/components/KanBan/kanban.vue +219 -219
  71. package/package/kisscomps/components/OverLap/OverLap.vue +207 -207
  72. package/package/kisscomps/components/OverLap/index.js +2 -2
  73. package/package/kisscomps/components/PatternStatus/PatternStatus.vue +888 -886
  74. package/package/kisscomps/components/PatternStatus/index.js +2 -2
  75. package/package/kisscomps/components/PatternWalkSvg/PatternWalkSvg.vue +424 -418
  76. package/package/kisscomps/components/PatternWalkSvg/index.js +2 -2
  77. package/package/kisscomps/components/PhaseMarker/index.js +6 -6
  78. package/package/kisscomps/components/PhaseMarker/phasemarker.vue +215 -215
  79. package/package/kisscomps/components/PhaseMarker/svg/patternSvg.vue +121 -121
  80. package/package/kisscomps/components/PhaseMarker/svg/phase.vue +60 -60
  81. package/package/kisscomps/components/PhaseMarker/svg/phaseCount.vue +62 -62
  82. package/package/kisscomps/components/PhaseMarker/svg/phaseCountCycle.vue +62 -62
  83. package/package/kisscomps/components/PhaseMarker/svg/phaseSvg.vue +117 -117
  84. package/package/kisscomps/components/SchemeConfig/SchemeConfig.vue +739 -739
  85. package/package/kisscomps/components/SchemeConfig/closePhaselControlModal/index.vue +195 -195
  86. package/package/kisscomps/components/SchemeConfig/index.js +2 -2
  87. package/package/kisscomps/components/SchemeConfig/lockingPhaselControlModal/index.vue +198 -198
  88. package/package/kisscomps/components/SchemeConfig/manualControlModal/index.vue +219 -219
  89. package/package/kisscomps/components/SchemeConfig/realtimeStatusModal/index.vue +263 -263
  90. package/package/kisscomps/components/SchemeConfig/tentativeplancontrolmodal/index.vue +1384 -1384
  91. package/package/kisscomps/components/StageBord/StageBord.vue +242 -242
  92. package/package/kisscomps/components/StageBord/index.js +2 -2
  93. package/package/kisscomps/components/StageStatus/StageStatus.vue +306 -306
  94. package/package/kisscomps/components/StageStatus/index.js +2 -2
  95. package/package/kisscomps/components/Stages/index.vue +139 -139
  96. package/package/kisscomps/components/SvgIcon/SvgIcon.vue +53 -53
  97. package/package/kisscomps/components/SvgIcon/index.js +2 -2
  98. package/package/kisscomps/components/XRDDirSelector/XRDDirSelector.vue +522 -522
  99. package/package/kisscomps/components/XRDDirSelector/index.js +2 -2
  100. package/package/kisscomps/components/overView/index.vue +676 -676
  101. package/package/kisscomps/components/patternList/index.js +2 -2
  102. package/package/kisscomps/components/patternList/patternList.vue +562 -562
  103. package/package/kisscomps/index.js +92 -92
  104. package/package/kissui.min.js +1 -1
  105. package/package.json +1 -1
  106. package/src/App.vue +24 -24
  107. package/src/EdgeMgr/EdgeModelBase.js +16 -16
  108. package/src/EdgeMgr/controller/crossDiagramMgr.js +120 -120
  109. package/src/api/authapi.js +31 -31
  110. package/src/api/config.js +21 -21
  111. package/src/api/control.js +76 -76
  112. package/src/api/fault.js +66 -66
  113. package/src/api/index.js +24 -24
  114. package/src/api/login.js +46 -46
  115. package/src/api/optimize.js +72 -72
  116. package/src/api/param.js +154 -154
  117. package/src/api/passwdAssest.js +101 -101
  118. package/src/api/template.js +27 -27
  119. package/src/i18n/index.js +26 -26
  120. package/src/i18n/language/en.js +1111 -1111
  121. package/src/i18n/language/index.js +25 -25
  122. package/src/i18n/language/zh.js +1110 -1110
  123. package/src/icons/demo.css +539 -539
  124. package/src/icons/iconfont.css +835 -835
  125. package/src/icons/iconfont.json +1444 -1444
  126. package/src/icons/index.js +20 -20
  127. package/src/icons/svg/bendi.svg +110 -110
  128. package/src/icons/svg/bujin.svg +36 -36
  129. package/src/icons/svg/connectBlue.svg +7 -7
  130. package/src/icons/svg/currentvolume.svg +0 -0
  131. package/src/icons/svg/cutRed.svg +7 -7
  132. package/src/icons/svg/cycle.svg +0 -0
  133. package/src/icons/svg/dingzhouqi.svg +34 -34
  134. package/src/icons/svg/ganyingkongzhi.svg +30 -30
  135. package/src/icons/svg/guandeng.svg +81 -81
  136. package/src/icons/svg/huangshan.svg +71 -71
  137. package/src/icons/svg/maincontrol.svg +0 -0
  138. package/src/icons/svg/manualcontrolbackground.svg +51 -51
  139. package/src/icons/svg/manualcontrolbackground1.svg +62 -62
  140. package/src/icons/svg/manualcontrolbackgrounden.svg +62 -62
  141. package/src/icons/svg/model.svg +0 -0
  142. package/src/icons/svg/phasediff.svg +0 -0
  143. package/src/icons/svg/quanhong.svg +86 -86
  144. package/src/icons/svg/shanghe.svg +11 -11
  145. package/src/icons/svg/shoudong.svg +103 -103
  146. package/src/icons/svg/time.svg +0 -0
  147. package/src/icons/svg/wuxianlan.svg +46 -46
  148. package/src/icons/svg/xiala.svg +11 -11
  149. package/src/icons/svg/xingrenguojie.svg +33 -33
  150. package/src/icons/svg/xitong.svg +89 -89
  151. package/src/icons/svg/youxian.svg +41 -41
  152. package/src/icons/svg/zizhukongzhi.svg +43 -43
  153. package/src/kisscomps/components/BoardCard/BoardCard.vue +89 -89
  154. package/src/kisscomps/components/BoardCard/index.js +2 -2
  155. package/src/kisscomps/components/CommonKanban/CommonKanban.vue +118 -118
  156. package/src/kisscomps/components/CommonKanban/index.js +2 -2
  157. package/src/kisscomps/components/ExpendConfig/ExpendConfig.vue +114 -114
  158. package/src/kisscomps/components/ExpendConfig/index.js +2 -2
  159. package/src/kisscomps/components/FaultDetailModal/FaultDetailModal.vue +170 -170
  160. package/src/kisscomps/components/FaultDetailModal/index.js +2 -2
  161. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/CrossRoadsSvg.vue +497 -497
  162. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/CustomRoadsSvg.vue +46 -46
  163. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/PedSectionEWSvg.vue +300 -300
  164. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/PedSectionSNSvg.vue +288 -288
  165. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampEastSvg.vue +391 -391
  166. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampNorthSvg.vue +336 -336
  167. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampSouthSvg.vue +345 -345
  168. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampWestSvg.vue +389 -389
  169. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/SidewalkSvg.vue +1179 -1179
  170. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeEastRoadsSvg.vue +402 -402
  171. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeNorthRoadsSvg.vue +361 -361
  172. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeSouthRoadsSvg.vue +368 -368
  173. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeWestRoadsSvg.vue +475 -475
  174. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LCrossRoadsSvg.vue +494 -494
  175. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeEastRoadsSvg.vue +401 -401
  176. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeNorthRoadsSvg.vue +360 -360
  177. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeSouthRoadsSvg.vue +367 -367
  178. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeWestRoadsSvg.vue +476 -476
  179. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/refreshSvg.vue +63 -63
  180. package/src/kisscomps/components/IntersectionMap/crossDirection/busIcon/busMapSvg.vue +50 -50
  181. package/src/kisscomps/components/IntersectionMap/crossDirection/busIcon/eastBusSvg.vue +167 -167
  182. package/src/kisscomps/components/IntersectionMap/crossDirection/busIcon/northBusSvg.vue +168 -168
  183. package/src/kisscomps/components/IntersectionMap/crossDirection/busIcon/southBusSvg.vue +168 -168
  184. package/src/kisscomps/components/IntersectionMap/crossDirection/busIcon/westBusSvg.vue +169 -169
  185. package/src/kisscomps/components/IntersectionMap/crossDirection/crossDiagram.vue +912 -912
  186. package/src/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/LphaseIconSvg.vue +112 -112
  187. package/src/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/phaseIconSvg.vue +112 -112
  188. package/src/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/rampPhaseIconSvg.vue +111 -111
  189. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/busPos.json +196 -196
  190. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/busPos.left.json +196 -196
  191. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/phasePos.json +99 -99
  192. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/phasePos.left.json +99 -99
  193. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/rampPos.json +52 -52
  194. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/sidePos.json +99 -99
  195. package/src/kisscomps/components/IntersectionMap/crossDirection/utils.js +78 -78
  196. package/src/kisscomps/components/IntersectionMap/index.js +2 -2
  197. package/src/kisscomps/components/IntersectionMap/intersectionmap.vue +153 -153
  198. package/src/kisscomps/components/IntersectionWithInterface/IntersectionWithInterface.vue +518 -518
  199. package/src/kisscomps/components/IntersectionWithInterface/index.js +2 -2
  200. package/src/kisscomps/components/KanBan/index.js +2 -2
  201. package/src/kisscomps/components/KanBan/kanban.vue +219 -219
  202. package/src/kisscomps/components/OverLap/OverLap.vue +207 -207
  203. package/src/kisscomps/components/OverLap/index.js +2 -2
  204. package/src/kisscomps/components/PatternStatus/PatternStatus.vue +888 -886
  205. package/src/kisscomps/components/PatternStatus/index.js +2 -2
  206. package/src/kisscomps/components/PatternWalkSvg/PatternWalkSvg.vue +424 -418
  207. package/src/kisscomps/components/PatternWalkSvg/index.js +2 -2
  208. package/src/kisscomps/components/PhaseMarker/index.js +6 -6
  209. package/src/kisscomps/components/PhaseMarker/phasemarker.vue +215 -215
  210. package/src/kisscomps/components/PhaseMarker/svg/patternSvg.vue +121 -121
  211. package/src/kisscomps/components/PhaseMarker/svg/phase.vue +60 -60
  212. package/src/kisscomps/components/PhaseMarker/svg/phaseCount.vue +62 -62
  213. package/src/kisscomps/components/PhaseMarker/svg/phaseCountCycle.vue +62 -62
  214. package/src/kisscomps/components/PhaseMarker/svg/phaseSvg.vue +117 -117
  215. package/src/kisscomps/components/SchemeConfig/SchemeConfig.vue +739 -739
  216. package/src/kisscomps/components/SchemeConfig/closePhaselControlModal/index.vue +195 -195
  217. package/src/kisscomps/components/SchemeConfig/index.js +2 -2
  218. package/src/kisscomps/components/SchemeConfig/lockingPhaselControlModal/index.vue +198 -198
  219. package/src/kisscomps/components/SchemeConfig/manualControlModal/index.vue +219 -219
  220. package/src/kisscomps/components/SchemeConfig/realtimeStatusModal/index.vue +263 -263
  221. package/src/kisscomps/components/SchemeConfig/tentativeplancontrolmodal/index.vue +1384 -1384
  222. package/src/kisscomps/components/StageBord/StageBord.vue +242 -242
  223. package/src/kisscomps/components/StageBord/index.js +2 -2
  224. package/src/kisscomps/components/StageStatus/StageStatus.vue +306 -306
  225. package/src/kisscomps/components/StageStatus/index.js +2 -2
  226. package/src/kisscomps/components/Stages/index.vue +139 -139
  227. package/src/kisscomps/components/SvgIcon/SvgIcon.vue +53 -53
  228. package/src/kisscomps/components/SvgIcon/index.js +2 -2
  229. package/src/kisscomps/components/XRDDirSelector/XRDDirSelector.vue +522 -522
  230. package/src/kisscomps/components/XRDDirSelector/index.js +2 -2
  231. package/src/kisscomps/components/overView/index.vue +676 -676
  232. package/src/kisscomps/components/patternList/index.js +2 -2
  233. package/src/kisscomps/components/patternList/patternList.vue +562 -562
  234. package/src/kisscomps/index.js +92 -92
  235. package/src/lib/publicjs/ArryListUtil.js +38 -38
  236. package/src/lib/publicjs/HttpurlMgr.js +45 -45
  237. package/src/lib/publicjs/KissApi.js +158 -158
  238. package/src/lib/publicjs/KissWSSub/Heartcheck.js +128 -128
  239. package/src/lib/publicjs/KissWSSub/KissWsSub.js +91 -91
  240. package/src/lib/publicjs/KissWSSub/KissWsSubByType.js +152 -152
  241. package/src/lib/publicjs/KissWSSub/SimuWsSubByType.js +44 -44
  242. package/src/lib/publicjs/KissWSSub/Sub.js +51 -51
  243. package/src/lib/publicjs/KissWSSub/SubChannel.js +119 -119
  244. package/src/lib/publicjs/basecomponents.js +65 -65
  245. package/src/lib/publicjs/localStorage.js +112 -112
  246. package/src/lib/publicjs/objdeepcopy.js +32 -32
  247. package/src/lib/publicjs/pageScroll.js +30 -30
  248. package/src/lib/publicjs/passwdAssest.js +101 -101
  249. package/src/lib/publicjs/styleclassfactory.js +32 -32
  250. package/src/main.js +47 -47
  251. package/src/router/index.js +36 -36
  252. package/src/store/getters.js +16 -16
  253. package/src/store/index.js +26 -26
  254. package/src/store/modules/globalParam.js +27 -27
  255. package/src/utils/ControlFormat.js +68 -68
  256. package/src/utils/RingDataModel.js +180 -180
  257. package/src/utils/auth.js +111 -111
  258. package/src/utils/dateFormat.js +41 -41
  259. package/src/utils/errorcode.js +224 -224
  260. package/src/utils/fault.js +195 -195
  261. package/src/utils/faultcode.js +209 -209
  262. package/src/utils/index.js +69 -69
  263. package/src/utils/pedphasedesc.js +119 -119
  264. package/src/utils/phasedesc.js +124 -124
  265. package/src/utils/responseMessage.js +21 -21
  266. package/src/utils/validate.js +43 -43
  267. package/src/views/home.1.vue +479 -479
  268. package/src/views/home.vue +78 -78
  269. package/src/views/intersection.vue +276 -276
  270. package/src/views/overView.vue +41 -41
  271. package/src/views/schemeconfig.vue +154 -154
  272. package/static/apiconfig.json +336 -336
  273. package/static/styles/common.scss +19 -19
  274. package/static/styles/commonkanban.scss +87 -87
  275. package/static/styles/dark/index.scss +2 -2
  276. package/static/styles/dark/theme/element-dark.scss +42 -42
  277. package/static/styles/index.scss +84 -84
  278. package/static/styles/intersection.scss +170 -170
  279. package/static/styles/light/index.scss +2 -2
  280. package/static/styles/light/theme/element-light.scss +42 -42
  281. package/static/styles/overview.scss +371 -371
  282. package/static/styles/schemeconfig.scss +405 -405
  283. package/static/styles/stages.scss +64 -64
  284. package/static/token.json +2 -2
  285. package/test/e2e/custom-assertions/elementCount.js +27 -27
  286. package/test/e2e/nightwatch.conf.js +46 -46
  287. package/test/e2e/runner.js +48 -48
  288. package/test/e2e/specs/test.js +19 -19
  289. package/test/unit/.eslintrc +7 -7
  290. package/test/unit/jest.conf.js +30 -30
  291. package/test/unit/setup.js +3 -3
  292. package/test/unit/specs/HelloWorld.spec.js +11 -11
  293. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/PatternWalkSvg.vue +0 -429
  294. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/PatternWalkSvg.vue +0 -429
@@ -1,912 +1,912 @@
1
- /**
2
- * Copyright (c) 2020 kedacom
3
- * OpenATC is licensed under Mulan PSL v2.
4
- * You can use this software according to the terms and conditions of the Mulan PSL v2.
5
- * You may obtain a copy of Mulan PSL v2 at:
6
- * http://license.coscl.org.cn/MulanPSL2
7
- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9
- * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10
- * See the Mulan PSL v2 for more details.
11
- **/
12
- <template>
13
- <div class="crossImg">
14
- <div v-show="isShowState">
15
- <div class="stateText">
16
- <div style="border:0px solid red;float:right;">
17
- {{stateName }}
18
- </div>
19
- </div>
20
- </div>
21
- <div v-show="isShowMode">
22
- <div class="controlText">
23
- <div style="border:0px solid red;float:right;">
24
- {{controlName }}
25
- </div>
26
- </div>
27
- <div class="modeText">
28
- {{modeName }}
29
- </div>
30
- </div>
31
- <!-- 右行道路 B-->
32
- <div class="right-dir-road" v-if="roadDir === 'right'">
33
- <div class="centerText" v-if="crossType !== 'Customroads' && isHasPhase">
34
- <!-- 相位倒计时 -->
35
- <div class="phaseCountdown" v-show="isShowInterval" v-if="devStatus === 3 && isLoaded && isHasPhase" :class="{'countdownBg': isLoaded}">
36
- <div v-for="curPhase in phaseCountdownList" :key="curPhase.id" :style="{color: curPhase.phaseCountdownColor}">
37
- <div v-if="curPhase.phaseCountdown !== -1">
38
- <span style="float: left;font-size: 20px;color: #fff;width: 70px;">{{$t('openatccomponents.overview.phase')}}{{curPhase.id}}:</span>
39
- <span style="float: left;">{{curPhase.phaseCountdown}}</span>
40
- </div>
41
- </div>
42
- </div>
43
- <!-- 手动刷新 -->
44
- <div v-if="!isLoaded">
45
- <RefreshSvg @click.native="refresh"/>
46
- <span class="text">{{$t('openatccomponents.overview.getintersectionmapagain')}}</span>
47
- </div>
48
- </div>
49
- <!-- 路口底图 -->
50
- <div class="baseImg">
51
- <!-- 城市道路 -->
52
- <CrossRoadsSvg v-if="crossType === 'Crossroads'"/>
53
- <TShapeEastRoadsSvg v-if="crossType === 'TypeT-east'"/>
54
- <TShapeWestRoadsSvg v-if="crossType === 'TypeT-west'"/>
55
- <TShapeNorthRoadsSvg v-if="crossType === 'TypeT-north'"/>
56
- <TShapeSouthRoadsSvg v-if="crossType === 'TypeT-south'"/>
57
- <!-- 其他路口 -->
58
- <CustomRoadsSvg v-if="crossType === 'Customroads'"/>
59
- <!-- 匝道 -->
60
- <RampEastRoadsSvg v-if="crossType === 'ramp-east'" />
61
- <RampWestRoadsSvg v-if="crossType === 'ramp-west'" />
62
- <RampNorthRoadsSvg v-if="crossType === 'ramp-north'" />
63
- <RampSouthRoadsSvg v-if="crossType === 'ramp-south'" />
64
- <!-- 路段行人过街 -->
65
- <PedSectionSNSvg v-if="crossType === 'ped-section-south-north'" />
66
- <PedSectionEWSvg v-if="crossType === 'ped-section-east-west'" />
67
- </div>
68
- <!-- 城市道路状态-->
69
- <div v-if="mainType === '100' || mainType === '101' || mainType === '104'">
70
- <!-- 人行道 -->
71
- <div class="sidewalk" v-if="resetflag && isLoaded">
72
- <SidewalkSvg v-for="(side, index) in compSidewalkPhaseData" :key="side.key + '-' + index" :Data="side" :crossType="crossType" />
73
- </div>
74
- <!-- 车道相位 -->
75
- <div v-if="resetflag" class="phaseIcon">
76
- <PhaseIconSvg v-for="(item, index) in compLanePhaseData" :key="item.key + '-' + index" :Data="item"/>
77
- </div>
78
- <!-- 公交相位 -->
79
- <div v-if="resetflag" class="busIcon">
80
- <BusMapSvg v-for="(item, index) in comdireBusPhaseData" :key="'Busmap-' + item.key + '-' + index" :Data="item" />
81
- <PhaseIconSvg v-for="(item, index) in comdireBusPhaseData" :key="item.key + '-' + index" :Data="item"/>
82
- </div>
83
- </div>
84
- <!-- 匝道状态 -->
85
- <!-- 车道相位 -->
86
- <div v-if="resetflag && mainType === '103'">
87
- <RampPhaseIconSvg v-for="(item, index) in LanePhaseData" :key="item.key + '-' + index" :Data="item" />
88
- </div>
89
- </div>
90
- <!-- 右行道路 E-->
91
-
92
- <!-- 左行道路 B-->
93
- <div class="left-dir-road" v-if="roadDir === 'left'">
94
- <div class="centerText" v-if="mainType === '100' || mainType === '101'" :class="{'countdownBg': isLoaded}">
95
- <!-- 相位倒计时 -->
96
- <div class="phaseCountdown" v-if="devStatus === 3 && isLoaded && isHasPhase">
97
- <div v-for="curPhase in phaseCountdownList" :key="curPhase.id" :style="{color: curPhase.phaseCountdownColor}">
98
- <div v-if="curPhase.phaseCountdown !== -1">
99
- <span style="float: left;font-size: 20px;color: #fff;width: 70px;">{{$t('openatccomponents.overview.phase')}}{{curPhase.id}}:</span>
100
- <span style="float: left;">{{curPhase.phaseCountdown}}</span>
101
- </div>
102
- </div>
103
- </div>
104
- <!-- 手动刷新 -->
105
- <div v-if="!isLoaded">
106
- <RefreshSvg @click.native="refresh"/>
107
- <span class="text">{{$t('openatccomponents.overview.getintersectionmapagain')}}</span>
108
- </div>
109
- </div>
110
- <!-- 路口底图 -->
111
- <div class="baseImg">
112
- <!-- 城市道路 -->
113
- <LCrossRoadsSvg v-if="crossType === 'Crossroads'"/>
114
- <LTShapeEastRoadsSvg v-if="crossType === 'TypeT-east'"/>
115
- <LTShapeWestRoadsSvg v-if="crossType === 'TypeT-west'"/>
116
- <LTShapeNorthRoadsSvg v-if="crossType === 'TypeT-north'"/>
117
- <LTShapeSouthRoadsSvg v-if="crossType === 'TypeT-south'"/>
118
- <!-- 其他路口 -->
119
- <CustomRoadsSvg v-if="mainType !== '100' && mainType !== '101'"/>
120
- </div>
121
- <!-- 城市道路状态-->
122
- <div v-if="mainType === '100' || mainType === '101'">
123
- <!-- 人行道 -->
124
- <div class="sidewalk" v-if="resetflag && isLoaded">
125
- <SidewalkSvg v-for="side in compSidewalkPhaseData" :key="side.key" :Data="side" :crossType="crossType" />
126
- </div>
127
- <!-- 车道相位 -->
128
- <div v-if="resetflag" class="phaseIcon">
129
- <LPhaseIconSvg v-for="item in compLanePhaseData" :key="item.key" :Data="item"/>
130
- </div>
131
- <!-- 公交相位 -->
132
- <div v-if="resetflag" class="busIcon">
133
- <BusMapSvg v-for="(item, index) in comdireBusPhaseData" :key="'Busmap-' + item.key + '-' + index" :Data="item" />
134
- <LPhaseIconSvg v-for="(item, index) in comdireBusPhaseData" :key="item.key + '-' + index" :Data="item"/>
135
- </div>
136
- </div>
137
- </div>
138
- <!-- 左行道路 E-->
139
- </div>
140
- </template>
141
- <script>
142
- import PhaseIconSvg from './phaseIcon/phaseIconSvg'
143
- import PhaseDataModel from './utils.js'
144
- import { getIntersectionInfo } from '../../../../api/template.js'
145
- import CrossRoadsSvg from './baseImg/CrossRoadsSvg'
146
- import TShapeEastRoadsSvg from './baseImg/TShapeEastRoadsSvg'
147
- import TShapeWestRoadsSvg from './baseImg/TShapeWestRoadsSvg.vue'
148
- import TShapeNorthRoadsSvg from './baseImg/TShapeNorthRoadsSvg.vue'
149
- import TShapeSouthRoadsSvg from './baseImg/TShapeSouthRoadsSvg.vue'
150
- import CustomRoadsSvg from './baseImg/CustomRoadsSvg.vue'
151
- import RefreshSvg from './baseImg/refreshSvg'
152
- import SidewalkSvg from './baseImg/SidewalkSvg'
153
- import RampEastRoadsSvg from './baseImg/RampEastSvg'
154
- import RampWestRoadsSvg from './baseImg/RampWestSvg'
155
- import RampNorthRoadsSvg from './baseImg/RampNorthSvg'
156
- import RampSouthRoadsSvg from './baseImg/RampSouthSvg'
157
- import RampPhaseIconSvg from './phaseIcon/rampPhaseIconSvg'
158
- import PedSectionEWSvg from './baseImg/PedSectionEWSvg'
159
- import PedSectionSNSvg from './baseImg/PedSectionSNSvg'
160
- // import { mapState } from 'vuex'
161
- import LCrossRoadsSvg from './baseImg/leftroad/LCrossRoadsSvg'
162
- import LTShapeEastRoadsSvg from './baseImg/leftroad/LTShapeEastRoadsSvg'
163
- import LTShapeWestRoadsSvg from './baseImg/leftroad/LTShapeWestRoadsSvg.vue'
164
- import LTShapeNorthRoadsSvg from './baseImg/leftroad/LTShapeNorthRoadsSvg.vue'
165
- import LTShapeSouthRoadsSvg from './baseImg/leftroad/LTShapeSouthRoadsSvg.vue'
166
- import LPhaseIconSvg from './phaseIcon/LphaseIconSvg'
167
- import CrossDiagramMgr from '../../../../EdgeMgr/controller/crossDiagramMgr.js'
168
- import BusMapSvg from './busIcon/busMapSvg'
169
- import { getMessageByCode } from '../../../../utils/responseMessage.js'
170
- export default {
171
- name: 'crossDiagram',
172
- components: {
173
- PhaseIconSvg,
174
- CrossRoadsSvg,
175
- TShapeEastRoadsSvg,
176
- TShapeWestRoadsSvg,
177
- TShapeNorthRoadsSvg,
178
- TShapeSouthRoadsSvg,
179
- CustomRoadsSvg,
180
- RefreshSvg,
181
- SidewalkSvg,
182
- RampEastRoadsSvg,
183
- RampWestRoadsSvg,
184
- RampNorthRoadsSvg,
185
- RampSouthRoadsSvg,
186
- RampPhaseIconSvg,
187
- PedSectionEWSvg,
188
- PedSectionSNSvg,
189
- LCrossRoadsSvg,
190
- LTShapeEastRoadsSvg,
191
- LTShapeWestRoadsSvg,
192
- LTShapeNorthRoadsSvg,
193
- LTShapeSouthRoadsSvg,
194
- LPhaseIconSvg,
195
- BusMapSvg
196
- },
197
- props: {
198
- crossStatusData: {
199
- type: Object
200
- },
201
- agentId: {
202
- type: String
203
- },
204
- devStatus: {
205
- type: Number
206
- },
207
- isShowInterval: {
208
- type: Boolean,
209
- devault: true
210
- },
211
- roadDirection: {
212
- type: String
213
- },
214
- isShowState: {
215
- type: Boolean,
216
- devault: false
217
- },
218
- isShowMode: {
219
- type: Boolean,
220
- devault: false
221
- },
222
- modeName: {
223
- type: String,
224
- default: ''
225
- },
226
- controlName: {
227
- type: String,
228
- default: ''
229
- }
230
- },
231
- // computed: {
232
- // ...mapState({
233
- // roadDirection: state => state.globalParam.roadDirection
234
- // })
235
- // },
236
- watch: {
237
- tempType: {
238
- handler: function (val) {
239
- this.getCrossType()
240
- }
241
- },
242
- crossStatusData: {
243
- handler: function (val, oldVal) {
244
- // 路口状态数据
245
- this.statusData = JSON.parse(JSON.stringify(val))
246
- this.phaseStatusList = val.phase
247
- this.overlapStatusList = val.overlap
248
- // 默认显示相位数据(包括黄闪、全红、关灯状态下,或者匝道,均不做比对跟随相位的处理)
249
- this.compLanePhaseData = JSON.parse(JSON.stringify(this.LanePhaseData))
250
- this.compSidewalkPhaseData = JSON.parse(JSON.stringify(this.sidewalkPhaseData))
251
- this.comdireBusPhaseData = JSON.parse(JSON.stringify(this.busPhaseData))
252
- if (val.control === 1 || val.control === 2 || val.control === 3) {
253
- // 黄闪、全红、关灯属于特殊控制,优先级最高,直接改变灯色,不用判断phase里的type,也不需要考虑跟随相位的灯色优先级
254
- this.SpecialControl(val)
255
- return
256
- }
257
- if (!val.phase && !this.overlapStatusList) {
258
- // 非特殊控制,相位和跟随相位不存在的情况下,灯色恢复默认
259
- this.handleSpecialControlStatus('默认')
260
- this.isHasPhase = false
261
- return
262
- }
263
- this.curPhase = val.current_phase
264
- this.isHasPhase = true
265
- this.createPhaseStatusMap()
266
- // 正常情况下,获取车道相位、车道跟随相位、相位倒计时、行人相位、行人跟随相位 的状态
267
- this.getPhaseStatus()
268
- this.getOverlapPhaseStatus()
269
- this.getCurPhaseCountdown()
270
- this.getBusPhaseStatus()
271
- if (this.mainType === '100' || this.mainType === '101' || this.mainType === '104') {
272
- // 城市道路和路段行人过街才显示人行道状态
273
- this.getpedStatus()
274
- this.getOverlapPedStatus()
275
- // 算法对比行人相位与行人跟随相位的状态
276
- this.comparePedStatus()
277
- // 算法对比车道相位与车道跟随相位的状态
278
- this.comparePhaseStatus()
279
- }
280
- // console.log('this.phaseStatusMap 相位状态映射', this.phaseStatusMap)
281
- // console.log('LanePhaseData 车道相位', this.LanePhaseData)
282
- // console.log('sidewalkPhaseData 行人相位', this.sidewalkPhaseData)
283
- // console.log('overlapPhaseStatusMap 跟随相位状态映射', this.overlapPhaseStatusMap)
284
- // console.log('overlapLanePhaseData 车道跟随相位', this.overlapLanePhaseData)
285
- // console.log('this.overlapsidewalkPhaseData 行人跟随相位', this.overlapsidewalkPhaseData)
286
- },
287
- // 深度观察监听
288
- deep: true
289
- },
290
- devStatus: {
291
- handler: function (val) {
292
- if (val === 3) return
293
- this.handleDefaultStatus()
294
- }
295
- },
296
- roadDirection: {
297
- handler: function (val1, val2) {
298
- if (val1 !== val2) {
299
- this.init()
300
- }
301
- }
302
- },
303
- agentId: {
304
- handler: function (val1, val2) {
305
- if (val1 !== val2) {
306
- this.init()
307
- }
308
- }
309
- }
310
- },
311
- data () {
312
- return {
313
- stateName: '',
314
- roadDir: 'right', // 道路行车方向,默认右行
315
- phaseCountdownList: [], // 相位倒计时列表
316
- statusData: null, // 信号机状态
317
- LanePhaseData: [], // 车道相位数据
318
- overlapLanePhaseData: [], // 车道跟随相位数据
319
- curPhase: [], // 当前相位列表
320
- phaseStatusList: [], // 相位状态列表
321
- phaseStatusMap: new Map(), // 相位状态映射
322
- overlapPhaseStatusMap: new Map(), // 跟随相位状态映射
323
- ColorMap: new Map([[0, '#828282'], [1, '#ff2828'], [2, '#f7b500'], [3, '#77fb65'], [4, '#77fb65'], [5, '#f7b500']]), // 当前相位状态 --- 0:关灯, 1:红, 2:黄, 3:绿, 4:绿闪, 5:黄闪
324
- SidewalkColorMap: new Map([[0, '#828282'], [1, '#e24b4b'], [3, '#7bd66b']]),
325
- tempType: '', // 模版类型
326
- mainType: '101', // 路口形状
327
- mainDirection: '000', // 路口方向
328
- crossType: '', // 路口底图类型
329
- isLoaded: false, // 是否成功加载底图
330
- isHasPhase: true, // 是否有相位状态数据
331
- phaseControlColorMap: new Map([['黄闪', '#f7b500'], ['全红', '#ff2828'], ['关灯', '#828282'], ['默认', '#fff']]),
332
- sidewalkPhaseData: [], // 行人相位
333
- overlapsidewalkPhaseData: [], // 行人跟随相位
334
- resetflag: true, // 离线后,控制行人相位、车道相位reset标识
335
- compLanePhaseData: [], // 对比车道相位和车道跟随相位后,显示的数据
336
- compSidewalkPhaseData: [], // // 对比行人相位和车道跟随相位后,显示的数据
337
- comdirePhaseData: [], // 对比相同方向车道相位数据后,被删减的唯一direction的数组
338
- comdireOverlapPhaseData: [], // 对比相同方向车道跟随相位数据后,被删减的唯一direction的数组
339
- busPhaseData: [], // 公交相位数据
340
- comdireBusPhaseData: [] // 对比相同方向公交车道数据后,被删减的唯一direction的数组
341
- }
342
- },
343
- methods: {
344
- init () {
345
- this.CrossDiagramMgr = new CrossDiagramMgr()
346
- this.getRoadDirection()
347
- this.PhaseDataModel = new PhaseDataModel(this.roadDirection)
348
- this.getIntersectionInfo() // 获取路口信息
349
- },
350
- comparePhaseStatus () {
351
- // 对比车道: 跟随相位和相位的状态数据(此处判断是为了保证被比较的数据direction都是唯一的)
352
- if (!this.comdirePhaseData && !this.comdireOverlapPhaseData) {
353
- this.compLanePhaseData = this.CrossDiagramMgr.compare(this.LanePhaseData, this.overlapLanePhaseData, 'type')
354
- } else if (!this.comdireOverlapPhaseData) {
355
- this.compLanePhaseData = this.CrossDiagramMgr.compare(this.comdirePhaseData, this.overlapLanePhaseData, 'type')
356
- } else if (!this.comdirePhaseData) {
357
- this.compLanePhaseData = this.CrossDiagramMgr.compare(this.LanePhaseData, this.comdireOverlapPhaseData, 'type')
358
- } else {
359
- this.compLanePhaseData = this.CrossDiagramMgr.compare(this.comdirePhaseData, this.comdireOverlapPhaseData, 'type')
360
- }
361
- },
362
- comparePedStatus () {
363
- // 对比人行道: 跟随相位和相位的状态数据
364
- this.compSidewalkPhaseData = this.CrossDiagramMgr.compare(this.sidewalkPhaseData, this.overlapsidewalkPhaseData, 'pedtype')
365
- },
366
- resetPhaseStatus () {
367
- // 车道相位、行人相位恢复默认状态
368
- this.resetflag = false
369
- this.$nextTick(() => {
370
- this.resetflag = true
371
- })
372
- },
373
- SpecialControl (data) {
374
- switch (data.control) {
375
- case 1: this.handleSpecialControlStatus('黄闪')
376
- break
377
- case 2: this.handleSpecialControlStatus('全红')
378
- break
379
- case 3: this.handleSpecialControlStatus('关灯')
380
- break
381
- default: this.handleSpecialControlStatus('默认')
382
- }
383
- this.isHasPhase = false
384
- },
385
- handleDefaultStatus () {
386
- // 恢复默认状态
387
- if (this.compLanePhaseData.length) {
388
- this.phaseCountdown = ''
389
- this.phaseCountdownColor = '#fff'
390
- this.compLanePhaseData.forEach(data => {
391
- data.color = '#fff'
392
- })
393
- }
394
- if (this.compSidewalkPhaseData.length) {
395
- this.compSidewalkPhaseData.forEach(data => {
396
- data.color = '#fff'
397
- })
398
- }
399
- if (this.comdireBusPhaseData.length) {
400
- this.comdireBusPhaseData.forEach(data => {
401
- data.color = '#fff'
402
- })
403
- }
404
- this.phaseCountdownList = []
405
- this.resetPhaseStatus()
406
- },
407
- handleSpecialControlStatus (Control) {
408
- this.resetPhaseStatus()
409
- // 控制黄闪、全红、关灯、默认情况下的车道相位颜色和倒计时颜色
410
- if (Control === '默认') {
411
- // 倒计时恢复默认颜色
412
- this.phaseCountdownList.forEach(item => {
413
- item.phaseCountdown = ''
414
- item.id = ''
415
- item.phaseCountdownColor = '#fff'
416
- })
417
- }
418
- if (this.compLanePhaseData.length) {
419
- const compLanePhaseData = this.compLanePhaseData.map(data => ({
420
- ...data,
421
- color: this.phaseControlColorMap.get(Control)
422
- }))
423
- this.compLanePhaseData = JSON.parse(JSON.stringify(compLanePhaseData))
424
- }
425
- if (this.compSidewalkPhaseData.length) {
426
- const compSidewalkPhaseData = this.compSidewalkPhaseData.map(data => ({
427
- ...data,
428
- color: this.phaseControlColorMap.get(Control)
429
- }))
430
- this.compSidewalkPhaseData = JSON.parse(JSON.stringify(compSidewalkPhaseData))
431
- }
432
- if (this.comdireBusPhaseData.length) {
433
- const comdireBusPhaseData = this.comdireBusPhaseData.map(data => ({
434
- ...data,
435
- color: this.phaseControlColorMap.get(Control)
436
- }))
437
- this.comdireBusPhaseData = JSON.parse(JSON.stringify(comdireBusPhaseData))
438
- }
439
- if (this.mainType === '103') {
440
- if (this.LanePhaseData.length) {
441
- const LanePhaseData = this.LanePhaseData.map(data => ({
442
- ...data,
443
- color: this.phaseControlColorMap.get(Control)
444
- }))
445
- this.LanePhaseData = JSON.parse(JSON.stringify(LanePhaseData))
446
- }
447
- }
448
- },
449
- createPhaseStatusMap () {
450
- // 生成相位id和相位状态对应数据结构
451
- this.phaseStatusList.map(phase => {
452
- let phaseId = phase.id
453
- let phaseInfo = {
454
- type: phase.type,
455
- phaseCountdown: phase.countdown,
456
- pedtype: phase.pedtype
457
- }
458
- this.phaseStatusMap.set(phaseId, phaseInfo)
459
- })
460
- },
461
- getPhaseStatus () {
462
- // 得到车道相位状态(颜色)
463
- this.comdirePhaseData = []
464
- let curLanePhaseData = []
465
- for (let i = 0; i < this.LanePhaseData.length; i++) {
466
- let curPhaseStatus = this.phaseStatusMap.get(this.LanePhaseData[i].phaseid)
467
- if (!curPhaseStatus) continue
468
- const data = {
469
- ...this.LanePhaseData[i],
470
- type: curPhaseStatus.type,
471
- color: this.ColorMap.get(curPhaseStatus.type),
472
- phaseCountdown: curPhaseStatus.phaseCountdown,
473
- flag: 'phase' // 车道相位数据标识
474
- }
475
- curLanePhaseData.push(data)
476
- }
477
- this.LanePhaseData = JSON.parse(JSON.stringify(curLanePhaseData))
478
- // 处理相位数据中,方向direction重复的情况:相同direction下,按照状态的优先级显示该方向的灯色:绿灯(3) > 绿闪(4) > 黄灯(2) > 红灯(1)
479
- // 如果有相同direction,处理后会改变原数组长度,导致第二次无法正确比较状态,因此需要中间变量存储
480
- this.comdirePhaseData = JSON.parse(JSON.stringify(this.CrossDiagramMgr.compareRepeatDirection(this.LanePhaseData, 'type', 'phase')))
481
- },
482
- getOverlapPhaseStatus () {
483
- // 得到车道跟随相位状态(颜色)
484
- this.comdireOverlapPhaseData = []
485
- if (this.overlapStatusList) {
486
- this.overlapStatusList.map(phase => {
487
- let phaseId = phase.id
488
- let phaseInfo = {
489
- type: phase.type,
490
- phaseCountdown: phase.countdown,
491
- pedtype: phase.pedtype
492
- }
493
- this.overlapPhaseStatusMap.set(phaseId, phaseInfo)
494
- })
495
- }
496
- let curLanePhaseData = []
497
- for (let i = 0; i < this.overlapLanePhaseData.length; i++) {
498
- let curPhaseStatus = this.overlapPhaseStatusMap.get(this.overlapLanePhaseData[i].phaseid)
499
- if (!curPhaseStatus) continue
500
- const data = {
501
- ...this.overlapLanePhaseData[i],
502
- type: curPhaseStatus.type,
503
- color: this.ColorMap.get(curPhaseStatus.type),
504
- phaseCountdown: curPhaseStatus.phaseCountdown,
505
- flag: 'overlapphase' // 车道跟随相位数据标识
506
- }
507
- curLanePhaseData.push(data)
508
- }
509
- this.overlapLanePhaseData = JSON.parse(JSON.stringify(curLanePhaseData))
510
- // 处理跟随相位数据中,方向direction重复的情况:相同direction下,按照状态的优先级显示该方向的灯色:绿灯(3) > 绿闪(4) > 黄灯(2) > 红灯(1)
511
- // 如果有相同direction,处理后会改变原数组长度,导致第二次无法正确比较状态,因此需要中间变量存储
512
- this.comdireOverlapPhaseData = JSON.parse(JSON.stringify(this.CrossDiagramMgr.compareRepeatDirection(this.overlapLanePhaseData, 'type', 'overlapphase')))
513
- },
514
- getBusPhaseStatus () {
515
- // 得到公交车道相位状态(颜色)
516
- this.comdireBusPhaseData = []
517
- let curLanePhaseData = []
518
- for (let i = 0; i < this.busPhaseData.length; i++) {
519
- let curPhaseStatus = this.phaseStatusMap.get(this.busPhaseData[i].phaseid)
520
- if (!curPhaseStatus) continue
521
- const data = {
522
- ...this.busPhaseData[i],
523
- type: curPhaseStatus.type,
524
- color: this.ColorMap.get(curPhaseStatus.type),
525
- phaseCountdown: curPhaseStatus.phaseCountdown,
526
- flag: 'busphase' // 车道相位数据标识
527
- }
528
- curLanePhaseData.push(data)
529
- }
530
- this.busPhaseData = JSON.parse(JSON.stringify(curLanePhaseData))
531
- // 处理相位数据中,方向direction重复的情况:相同direction下,按照状态的优先级显示该方向的灯色:绿灯(3) > 绿闪(4) > 黄灯(2) > 红灯(1)
532
- // 如果有相同direction,处理后会改变原数组长度,导致第二次无法正确比较状态,因此需要中间变量存储
533
- this.comdireBusPhaseData = JSON.parse(JSON.stringify(this.CrossDiagramMgr.compareRepeatDirection(this.busPhaseData, 'type', 'busphase')))
534
- },
535
- getCurPhaseCountdown () {
536
- // 获取当前相位倒计时颜色
537
- this.phaseCountdownList = []
538
- this.curPhase.forEach(curP => {
539
- this.phaseStatusList.forEach(phaseInfo => {
540
- if (phaseInfo.id === curP) {
541
- let countdownObj = {}
542
- countdownObj.id = phaseInfo.id
543
- countdownObj.phaseCountdown = phaseInfo.countdown
544
- countdownObj.phaseCountdownColor = this.ColorMap.get(phaseInfo.type)
545
- this.phaseCountdownList.push(countdownObj)
546
- }
547
- })
548
- })
549
- },
550
- getIntersectionInfo () {
551
- // 获取路口信息
552
- const agentid = this.agentId || '0'
553
- getIntersectionInfo(agentid).then(res => {
554
- if (!res.data.success) {
555
- this.isLoaded = false
556
- this.stateName = this.$t('openatccomponents.overview.offline')
557
- let parrenterror = getMessageByCode(res.data.code, this.$i18n.locale)
558
- if (res.data.data) {
559
- // 子类型错误
560
- let childErrorCode = res.data.data.errorCode
561
- if (childErrorCode) {
562
- let childerror = getMessageByCode(res.data.data.errorCode, this.$i18n.locale)
563
- this.$message.error(parrenterror + ',' + childerror)
564
- }
565
- } else {
566
- this.$message.error(parrenterror)
567
- }
568
- return
569
- }
570
- this.stateName = this.$t('openatccomponents.overview.online')
571
- this.isLoaded = true
572
- this.crossInfo = res.data.data.param
573
- this.tempType = res.data.data.type
574
- // 获取车道相位、行人相位信息(坐标、名称)
575
- this.mainType = this.tempType.split('-')[0]
576
- this.mainDirection = this.tempType.split('-')[1]
577
- if (this.mainType === '100' || this.mainType === '101' || this.mainType === '104') {
578
- // 城市道路加载车道相位坐标和人行道坐标
579
- this.getPhasePos()
580
- this.getOverlapPhasePos()
581
- this.getPedPhasePos()
582
- this.getOverlapPedPhasePos()
583
- this.getBusPos()
584
- }
585
- if (this.mainType === '103') {
586
- // 获取匝道道路的主路和支路的相位坐标
587
- this.getRampPhasePos()
588
- }
589
- })
590
- },
591
- getBusPos () {
592
- // 公交相位信息
593
- this.busPhaseData = []
594
- this.crossInfo.phaseList.forEach((ele, i) => {
595
- if (ele.controltype >= 3 && ele.controltype <= 6) {
596
- ele.direction.forEach((dir, index) => {
597
- // 车道相位
598
- this.busPhaseData.push({
599
- key: this.CrossDiagramMgr.getUniqueKey('busphase'),
600
- phaseid: ele.id, // 相位id,用于对应相位状态
601
- id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
602
- name: this.PhaseDataModel.getBusPhasePos(dir).name,
603
- left: this.PhaseDataModel.getBusPhasePos(dir).x,
604
- top: this.PhaseDataModel.getBusPhasePos(dir).y,
605
- busleft: this.PhaseDataModel.getBusMapPos(dir).x,
606
- bustop: this.PhaseDataModel.getBusMapPos(dir).y,
607
- controltype: ele.controltype
608
- })
609
- })
610
- }
611
- })
612
- },
613
- createRandomType () {
614
- for (var i = 3; i <= 5; i++) {
615
- return Math.floor(Math.random() * (5 - 3)) + 3
616
- }
617
- },
618
- getPhasePos () {
619
- // 车道相位信息
620
- this.LanePhaseData = []
621
- this.crossInfo.phaseList.forEach((ele, i) => {
622
- if (ele.controltype === undefined || ele.controltype <= 2) {
623
- ele.direction.forEach((dir, index) => {
624
- // 车道相位
625
- this.LanePhaseData.push({
626
- key: this.CrossDiagramMgr.getUniqueKey('phase'),
627
- phaseid: ele.id, // 相位id,用于对应相位状态
628
- id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
629
- name: this.PhaseDataModel.getPhase(dir).name,
630
- left: this.PhaseDataModel.getPhase(dir).x,
631
- top: this.PhaseDataModel.getPhase(dir).y
632
- })
633
- })
634
- }
635
- })
636
- },
637
- getOverlapPhasePos () {
638
- // 车道跟随相位信息
639
- if (!this.crossInfo.overlaplList) return
640
- this.overlapLanePhaseData = []
641
- this.crossInfo.overlaplList.forEach((ele, i) => {
642
- if (ele.direction) {
643
- ele.direction.forEach((dir, index) => {
644
- this.overlapLanePhaseData.push({
645
- key: this.CrossDiagramMgr.getUniqueKey('overlapphase'),
646
- phaseid: ele.id, // 相位id,用于对应相位状态
647
- id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
648
- name: this.PhaseDataModel.getPhase(dir).name,
649
- left: this.PhaseDataModel.getPhase(dir).x,
650
- top: this.PhaseDataModel.getPhase(dir).y
651
- })
652
- })
653
- }
654
- })
655
- },
656
- getRampPhasePos () {
657
- // 匝道车道相位信息
658
- this.LanePhaseData = []
659
- this.crossInfo.phaseList.forEach((ele, i) => {
660
- ele.direction.forEach((dir, index) => {
661
- if (ele.controltype === 0) {
662
- this.handleRampPhasePosData(`${i}-${index}`, ele, dir, this.PhaseDataModel.getMainPhasePos)
663
- }
664
- if (ele.controltype === 1) {
665
- this.handleRampPhasePosData(`${i}-${index}`, ele, dir, this.PhaseDataModel.getSidePhasePos)
666
- }
667
- })
668
- })
669
- },
670
- handleRampPhasePosData (key, phase, dir) {
671
- let posInfo = phase.controltype === 0 ? this.PhaseDataModel.getMainPhasePos(dir) : this.PhaseDataModel.getSidePhasePos(dir)
672
- this.LanePhaseData.push({
673
- key,
674
- controlType: phase.controltype,
675
- phaseid: phase.id, // 相位id,用于对应相位状态
676
- id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
677
- name: posInfo.name,
678
- left: posInfo.x,
679
- top: posInfo.y
680
- })
681
- },
682
- getPedPhasePos () {
683
- // 行人相位信息
684
- this.sidewalkPhaseData = []
685
- this.crossInfo.phaseList.forEach((ele, i) => {
686
- if (ele.peddirection) {
687
- ele.peddirection.forEach((dir, index) => {
688
- // 行人相位
689
- if (this.PhaseDataModel.getSidePos(dir)) {
690
- this.sidewalkPhaseData.push({
691
- key: this.CrossDiagramMgr.getUniqueKey('pedphase'),
692
- phaseid: ele.id, // 相位id,用于对应相位状态
693
- id: dir,
694
- name: this.PhaseDataModel.getSidePos(dir).name,
695
- left: this.PhaseDataModel.getSidePos(dir).x,
696
- top: this.PhaseDataModel.getSidePos(dir).y
697
- })
698
- }
699
- })
700
- }
701
- })
702
- // 行人相位无,也要显示人行横道,与车道相位显示与否逻辑不同
703
- // this.handleCompleteSidewalkPhase()
704
- },
705
- getOverlapPedPhasePos () {
706
- // 行人跟随相位信息
707
- if (!this.crossInfo.overlaplList) return
708
- this.overlapsidewalkPhaseData = []
709
- this.crossInfo.overlaplList.forEach((ele, i) => {
710
- if (ele.peddirection) {
711
- ele.peddirection.forEach((dir, index) => {
712
- if (this.PhaseDataModel.getSidePos(dir)) {
713
- this.overlapsidewalkPhaseData.push({
714
- key: this.CrossDiagramMgr.getUniqueKey('overlappedphase'),
715
- phaseid: ele.id, // 相位id,用于对应相位状态
716
- id: dir,
717
- name: this.PhaseDataModel.getSidePos(dir).name,
718
- left: this.PhaseDataModel.getSidePos(dir).x,
719
- top: this.PhaseDataModel.getSidePos(dir).y
720
- })
721
- }
722
- })
723
- }
724
- })
725
- },
726
- // handleCompleteSidewalkPhase () {
727
- // // 没有相位状态的车道也要显示,默认白色
728
- // let hasDirIds = this.sidewalkPhaseData.map(data => data.id)
729
- // let allIds = []
730
- // for (let key of this.PhaseDataModel.SidePosMap.keys()) {
731
- // allIds.push(key)
732
- // }
733
- // let diffIds = allIds.filter(function (val) { return hasDirIds.indexOf(val) === -1 })
734
- // diffIds.forEach(id => {
735
- // this.sidewalkPhaseData.push({
736
- // key: `${this.sidewalkPhaseData.length + 1}`,
737
- // phaseid: undefined, // 相位id,用于对应相位状态
738
- // id,
739
- // name: this.PhaseDataModel.getSidePos(id).name,
740
- // left: this.PhaseDataModel.getSidePos(id).x,
741
- // top: this.PhaseDataModel.getSidePos(id).y
742
- // })
743
- // })
744
- // },
745
- getCrossType () {
746
- // 路口类型对应底图决策
747
- if (this.mainType === '101') {
748
- // 十字路口
749
- this.crossType = 'Crossroads'
750
- }
751
- if (this.mainType === '100') {
752
- // T型路口
753
- switch (this.mainDirection) {
754
- case '001': this.crossType = 'TypeT-east'
755
- break
756
- case '002': this.crossType = 'TypeT-south'
757
- break
758
- case '003': this.crossType = 'TypeT-west'
759
- break
760
- case '004': this.crossType = 'TypeT-north'
761
- break
762
- }
763
- }
764
- if (this.mainType === '103') {
765
- // 匝道
766
- switch (this.mainDirection) {
767
- case '001': this.crossType = 'ramp-east'
768
- break
769
- case '002': this.crossType = 'ramp-south'
770
- break
771
- case '003': this.crossType = 'ramp-west'
772
- break
773
- case '004': this.crossType = 'ramp-north'
774
- break
775
- }
776
- }
777
- if (this.mainType === '104') {
778
- // 路段行人过街
779
- switch (this.mainDirection) {
780
- case '006': this.crossType = 'ped-section-east-west'
781
- break
782
- case '005': this.crossType = 'ped-section-south-north'
783
- break
784
- }
785
- }
786
- if (this.mainType === '999') {
787
- // 其他路口
788
- this.crossType = 'Customroads'
789
- }
790
- },
791
- refresh () {
792
- this.getIntersectionInfo()
793
- },
794
- getpedStatus () {
795
- // 行人相位状态
796
- let curPedStatus = []
797
- for (let i = 0; i < this.sidewalkPhaseData.length; i++) {
798
- if (this.sidewalkPhaseData[i].phaseid) {
799
- let curPhaseStatus = this.phaseStatusMap.get(this.sidewalkPhaseData[i].phaseid)
800
- if (!curPhaseStatus) continue
801
- const data = {
802
- ...this.sidewalkPhaseData[i],
803
- pedtype: curPhaseStatus.pedtype,
804
- color: this.SidewalkColorMap.get(curPhaseStatus.pedtype),
805
- flag: 'ped' // 行人相位数据标识
806
- }
807
- curPedStatus.push(data)
808
- } else {
809
- // 无状态的行人道
810
- const data = {
811
- ...this.sidewalkPhaseData[i],
812
- pedtype: undefined
813
- }
814
- curPedStatus.push(data)
815
- }
816
- }
817
- this.sidewalkPhaseData = JSON.parse(JSON.stringify(curPedStatus))
818
- },
819
- getOverlapPedStatus () {
820
- // 行人跟随相位状态
821
- let curPedStatus = []
822
- for (let i = 0; i < this.overlapsidewalkPhaseData.length; i++) {
823
- if (this.overlapsidewalkPhaseData[i].phaseid) {
824
- let curPhaseStatus = this.overlapPhaseStatusMap.get(this.overlapsidewalkPhaseData[i].phaseid)
825
- if (!curPhaseStatus) {
826
- // 无状态的行人道,也显示出来
827
- const data = {
828
- ...this.overlapsidewalkPhaseData[i],
829
- pedtype: undefined
830
- }
831
- curPedStatus.push(data)
832
- continue
833
- }
834
- const data = {
835
- ...this.overlapsidewalkPhaseData[i],
836
- pedtype: curPhaseStatus.pedtype,
837
- color: this.SidewalkColorMap.get(curPhaseStatus.pedtype),
838
- flag: 'overlapped' // 行人跟随相位数据标识
839
- }
840
- curPedStatus.push(data)
841
- } else {
842
- // 无状态的行人道
843
- const data = {
844
- ...this.overlapsidewalkPhaseData[i],
845
- pedtype: undefined
846
- }
847
- curPedStatus.push(data)
848
- }
849
- }
850
- this.overlapsidewalkPhaseData = JSON.parse(JSON.stringify(curPedStatus))
851
- },
852
- getRoadDirection () {
853
- // 获取行车方向(从平台或配置工具的配置文件中读取)
854
- this.roadDir = this.roadDirection
855
- }
856
- },
857
- mounted () {
858
- this.init()
859
- }
860
- }
861
- </script>
862
- <style scoped>
863
- .invisible {
864
- visibility: hidden;
865
- }
866
- .crossImg{
867
- position: relative;
868
- width: 870px;
869
- height: 650px;
870
- left: 50%;
871
- transform: translateX(-50%);
872
- }
873
- .centerText {
874
- position: absolute;
875
- width: 140px;
876
- height: 140px;
877
- left: 50%;
878
- top: 50%;
879
- transform: translateX(-50%) translateY(-50%);
880
- /* text-align: center; */
881
- z-index: 9;
882
- display: flex;
883
- align-items: center;
884
- /* padding-left: 16px; */
885
- }
886
- .phaseCountdown {
887
- line-height: 40px;
888
- font-size: 30px;
889
- font-weight: normal;
890
- font-stretch: normal;
891
- letter-spacing: 0px;
892
- color: #fff;
893
- width: 150px;
894
- margin: 0 auto;
895
- }
896
- .countdownBg {
897
- border-radius: 10px;
898
- background-color: rgba(94, 90, 90, 0.8);
899
- padding-left: 16px;
900
- }
901
- .centerText .text {
902
- display: inline-block;
903
- color: #409eff;
904
- margin-top: 20px;
905
- }
906
-
907
- .baseImg {
908
- width: 100%;
909
- height: 650px;
910
- position: relative;
911
- }
912
- </style>
1
+ /**
2
+ * Copyright (c) 2020 kedacom
3
+ * OpenATC is licensed under Mulan PSL v2.
4
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5
+ * You may obtain a copy of Mulan PSL v2 at:
6
+ * http://license.coscl.org.cn/MulanPSL2
7
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10
+ * See the Mulan PSL v2 for more details.
11
+ **/
12
+ <template>
13
+ <div class="crossImg">
14
+ <div v-show="isShowState">
15
+ <div class="stateText">
16
+ <div style="border:0px solid red;float:right;">
17
+ {{stateName }}
18
+ </div>
19
+ </div>
20
+ </div>
21
+ <div v-show="isShowMode">
22
+ <div class="controlText">
23
+ <div style="border:0px solid red;float:right;">
24
+ {{controlName }}
25
+ </div>
26
+ </div>
27
+ <div class="modeText">
28
+ {{modeName }}
29
+ </div>
30
+ </div>
31
+ <!-- 右行道路 B-->
32
+ <div class="right-dir-road" v-if="roadDir === 'right'">
33
+ <div class="centerText" v-if="crossType !== 'Customroads' && isHasPhase">
34
+ <!-- 相位倒计时 -->
35
+ <div class="phaseCountdown" v-show="isShowInterval" v-if="devStatus === 3 && isLoaded && isHasPhase" :class="{'countdownBg': isLoaded}">
36
+ <div v-for="curPhase in phaseCountdownList" :key="curPhase.id" :style="{color: curPhase.phaseCountdownColor}">
37
+ <div v-if="curPhase.phaseCountdown !== -1">
38
+ <span style="float: left;font-size: 20px;color: #fff;width: 70px;">{{$t('openatccomponents.overview.phase')}}{{curPhase.id}}:</span>
39
+ <span style="float: left;">{{curPhase.phaseCountdown}}</span>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ <!-- 手动刷新 -->
44
+ <div v-if="!isLoaded">
45
+ <RefreshSvg @click.native="refresh"/>
46
+ <span class="text">{{$t('openatccomponents.overview.getintersectionmapagain')}}</span>
47
+ </div>
48
+ </div>
49
+ <!-- 路口底图 -->
50
+ <div class="baseImg">
51
+ <!-- 城市道路 -->
52
+ <CrossRoadsSvg v-if="crossType === 'Crossroads'"/>
53
+ <TShapeEastRoadsSvg v-if="crossType === 'TypeT-east'"/>
54
+ <TShapeWestRoadsSvg v-if="crossType === 'TypeT-west'"/>
55
+ <TShapeNorthRoadsSvg v-if="crossType === 'TypeT-north'"/>
56
+ <TShapeSouthRoadsSvg v-if="crossType === 'TypeT-south'"/>
57
+ <!-- 其他路口 -->
58
+ <CustomRoadsSvg v-if="crossType === 'Customroads'"/>
59
+ <!-- 匝道 -->
60
+ <RampEastRoadsSvg v-if="crossType === 'ramp-east'" />
61
+ <RampWestRoadsSvg v-if="crossType === 'ramp-west'" />
62
+ <RampNorthRoadsSvg v-if="crossType === 'ramp-north'" />
63
+ <RampSouthRoadsSvg v-if="crossType === 'ramp-south'" />
64
+ <!-- 路段行人过街 -->
65
+ <PedSectionSNSvg v-if="crossType === 'ped-section-south-north'" />
66
+ <PedSectionEWSvg v-if="crossType === 'ped-section-east-west'" />
67
+ </div>
68
+ <!-- 城市道路状态-->
69
+ <div v-if="mainType === '100' || mainType === '101' || mainType === '104'">
70
+ <!-- 人行道 -->
71
+ <div class="sidewalk" v-if="resetflag && isLoaded">
72
+ <SidewalkSvg v-for="(side, index) in compSidewalkPhaseData" :key="side.key + '-' + index" :Data="side" :crossType="crossType" />
73
+ </div>
74
+ <!-- 车道相位 -->
75
+ <div v-if="resetflag" class="phaseIcon">
76
+ <PhaseIconSvg v-for="(item, index) in compLanePhaseData" :key="item.key + '-' + index" :Data="item"/>
77
+ </div>
78
+ <!-- 公交相位 -->
79
+ <div v-if="resetflag" class="busIcon">
80
+ <BusMapSvg v-for="(item, index) in comdireBusPhaseData" :key="'Busmap-' + item.key + '-' + index" :Data="item" />
81
+ <PhaseIconSvg v-for="(item, index) in comdireBusPhaseData" :key="item.key + '-' + index" :Data="item"/>
82
+ </div>
83
+ </div>
84
+ <!-- 匝道状态 -->
85
+ <!-- 车道相位 -->
86
+ <div v-if="resetflag && mainType === '103'">
87
+ <RampPhaseIconSvg v-for="(item, index) in LanePhaseData" :key="item.key + '-' + index" :Data="item" />
88
+ </div>
89
+ </div>
90
+ <!-- 右行道路 E-->
91
+
92
+ <!-- 左行道路 B-->
93
+ <div class="left-dir-road" v-if="roadDir === 'left'">
94
+ <div class="centerText" v-if="mainType === '100' || mainType === '101'" :class="{'countdownBg': isLoaded}">
95
+ <!-- 相位倒计时 -->
96
+ <div class="phaseCountdown" v-if="devStatus === 3 && isLoaded && isHasPhase">
97
+ <div v-for="curPhase in phaseCountdownList" :key="curPhase.id" :style="{color: curPhase.phaseCountdownColor}">
98
+ <div v-if="curPhase.phaseCountdown !== -1">
99
+ <span style="float: left;font-size: 20px;color: #fff;width: 70px;">{{$t('openatccomponents.overview.phase')}}{{curPhase.id}}:</span>
100
+ <span style="float: left;">{{curPhase.phaseCountdown}}</span>
101
+ </div>
102
+ </div>
103
+ </div>
104
+ <!-- 手动刷新 -->
105
+ <div v-if="!isLoaded">
106
+ <RefreshSvg @click.native="refresh"/>
107
+ <span class="text">{{$t('openatccomponents.overview.getintersectionmapagain')}}</span>
108
+ </div>
109
+ </div>
110
+ <!-- 路口底图 -->
111
+ <div class="baseImg">
112
+ <!-- 城市道路 -->
113
+ <LCrossRoadsSvg v-if="crossType === 'Crossroads'"/>
114
+ <LTShapeEastRoadsSvg v-if="crossType === 'TypeT-east'"/>
115
+ <LTShapeWestRoadsSvg v-if="crossType === 'TypeT-west'"/>
116
+ <LTShapeNorthRoadsSvg v-if="crossType === 'TypeT-north'"/>
117
+ <LTShapeSouthRoadsSvg v-if="crossType === 'TypeT-south'"/>
118
+ <!-- 其他路口 -->
119
+ <CustomRoadsSvg v-if="mainType !== '100' && mainType !== '101'"/>
120
+ </div>
121
+ <!-- 城市道路状态-->
122
+ <div v-if="mainType === '100' || mainType === '101'">
123
+ <!-- 人行道 -->
124
+ <div class="sidewalk" v-if="resetflag && isLoaded">
125
+ <SidewalkSvg v-for="side in compSidewalkPhaseData" :key="side.key" :Data="side" :crossType="crossType" />
126
+ </div>
127
+ <!-- 车道相位 -->
128
+ <div v-if="resetflag" class="phaseIcon">
129
+ <LPhaseIconSvg v-for="item in compLanePhaseData" :key="item.key" :Data="item"/>
130
+ </div>
131
+ <!-- 公交相位 -->
132
+ <div v-if="resetflag" class="busIcon">
133
+ <BusMapSvg v-for="(item, index) in comdireBusPhaseData" :key="'Busmap-' + item.key + '-' + index" :Data="item" />
134
+ <LPhaseIconSvg v-for="(item, index) in comdireBusPhaseData" :key="item.key + '-' + index" :Data="item"/>
135
+ </div>
136
+ </div>
137
+ </div>
138
+ <!-- 左行道路 E-->
139
+ </div>
140
+ </template>
141
+ <script>
142
+ import PhaseIconSvg from './phaseIcon/phaseIconSvg'
143
+ import PhaseDataModel from './utils.js'
144
+ import { getIntersectionInfo } from '../../../../api/template.js'
145
+ import CrossRoadsSvg from './baseImg/CrossRoadsSvg'
146
+ import TShapeEastRoadsSvg from './baseImg/TShapeEastRoadsSvg'
147
+ import TShapeWestRoadsSvg from './baseImg/TShapeWestRoadsSvg.vue'
148
+ import TShapeNorthRoadsSvg from './baseImg/TShapeNorthRoadsSvg.vue'
149
+ import TShapeSouthRoadsSvg from './baseImg/TShapeSouthRoadsSvg.vue'
150
+ import CustomRoadsSvg from './baseImg/CustomRoadsSvg.vue'
151
+ import RefreshSvg from './baseImg/refreshSvg'
152
+ import SidewalkSvg from './baseImg/SidewalkSvg'
153
+ import RampEastRoadsSvg from './baseImg/RampEastSvg'
154
+ import RampWestRoadsSvg from './baseImg/RampWestSvg'
155
+ import RampNorthRoadsSvg from './baseImg/RampNorthSvg'
156
+ import RampSouthRoadsSvg from './baseImg/RampSouthSvg'
157
+ import RampPhaseIconSvg from './phaseIcon/rampPhaseIconSvg'
158
+ import PedSectionEWSvg from './baseImg/PedSectionEWSvg'
159
+ import PedSectionSNSvg from './baseImg/PedSectionSNSvg'
160
+ // import { mapState } from 'vuex'
161
+ import LCrossRoadsSvg from './baseImg/leftroad/LCrossRoadsSvg'
162
+ import LTShapeEastRoadsSvg from './baseImg/leftroad/LTShapeEastRoadsSvg'
163
+ import LTShapeWestRoadsSvg from './baseImg/leftroad/LTShapeWestRoadsSvg.vue'
164
+ import LTShapeNorthRoadsSvg from './baseImg/leftroad/LTShapeNorthRoadsSvg.vue'
165
+ import LTShapeSouthRoadsSvg from './baseImg/leftroad/LTShapeSouthRoadsSvg.vue'
166
+ import LPhaseIconSvg from './phaseIcon/LphaseIconSvg'
167
+ import CrossDiagramMgr from '../../../../EdgeMgr/controller/crossDiagramMgr.js'
168
+ import BusMapSvg from './busIcon/busMapSvg'
169
+ import { getMessageByCode } from '../../../../utils/responseMessage.js'
170
+ export default {
171
+ name: 'crossDiagram',
172
+ components: {
173
+ PhaseIconSvg,
174
+ CrossRoadsSvg,
175
+ TShapeEastRoadsSvg,
176
+ TShapeWestRoadsSvg,
177
+ TShapeNorthRoadsSvg,
178
+ TShapeSouthRoadsSvg,
179
+ CustomRoadsSvg,
180
+ RefreshSvg,
181
+ SidewalkSvg,
182
+ RampEastRoadsSvg,
183
+ RampWestRoadsSvg,
184
+ RampNorthRoadsSvg,
185
+ RampSouthRoadsSvg,
186
+ RampPhaseIconSvg,
187
+ PedSectionEWSvg,
188
+ PedSectionSNSvg,
189
+ LCrossRoadsSvg,
190
+ LTShapeEastRoadsSvg,
191
+ LTShapeWestRoadsSvg,
192
+ LTShapeNorthRoadsSvg,
193
+ LTShapeSouthRoadsSvg,
194
+ LPhaseIconSvg,
195
+ BusMapSvg
196
+ },
197
+ props: {
198
+ crossStatusData: {
199
+ type: Object
200
+ },
201
+ agentId: {
202
+ type: String
203
+ },
204
+ devStatus: {
205
+ type: Number
206
+ },
207
+ isShowInterval: {
208
+ type: Boolean,
209
+ devault: true
210
+ },
211
+ roadDirection: {
212
+ type: String
213
+ },
214
+ isShowState: {
215
+ type: Boolean,
216
+ devault: false
217
+ },
218
+ isShowMode: {
219
+ type: Boolean,
220
+ devault: false
221
+ },
222
+ modeName: {
223
+ type: String,
224
+ default: ''
225
+ },
226
+ controlName: {
227
+ type: String,
228
+ default: ''
229
+ }
230
+ },
231
+ // computed: {
232
+ // ...mapState({
233
+ // roadDirection: state => state.globalParam.roadDirection
234
+ // })
235
+ // },
236
+ watch: {
237
+ tempType: {
238
+ handler: function (val) {
239
+ this.getCrossType()
240
+ }
241
+ },
242
+ crossStatusData: {
243
+ handler: function (val, oldVal) {
244
+ // 路口状态数据
245
+ this.statusData = JSON.parse(JSON.stringify(val))
246
+ this.phaseStatusList = val.phase
247
+ this.overlapStatusList = val.overlap
248
+ // 默认显示相位数据(包括黄闪、全红、关灯状态下,或者匝道,均不做比对跟随相位的处理)
249
+ this.compLanePhaseData = JSON.parse(JSON.stringify(this.LanePhaseData))
250
+ this.compSidewalkPhaseData = JSON.parse(JSON.stringify(this.sidewalkPhaseData))
251
+ this.comdireBusPhaseData = JSON.parse(JSON.stringify(this.busPhaseData))
252
+ if (val.control === 1 || val.control === 2 || val.control === 3) {
253
+ // 黄闪、全红、关灯属于特殊控制,优先级最高,直接改变灯色,不用判断phase里的type,也不需要考虑跟随相位的灯色优先级
254
+ this.SpecialControl(val)
255
+ return
256
+ }
257
+ if (!val.phase && !this.overlapStatusList) {
258
+ // 非特殊控制,相位和跟随相位不存在的情况下,灯色恢复默认
259
+ this.handleSpecialControlStatus('默认')
260
+ this.isHasPhase = false
261
+ return
262
+ }
263
+ this.curPhase = val.current_phase
264
+ this.isHasPhase = true
265
+ this.createPhaseStatusMap()
266
+ // 正常情况下,获取车道相位、车道跟随相位、相位倒计时、行人相位、行人跟随相位 的状态
267
+ this.getPhaseStatus()
268
+ this.getOverlapPhaseStatus()
269
+ this.getCurPhaseCountdown()
270
+ this.getBusPhaseStatus()
271
+ if (this.mainType === '100' || this.mainType === '101' || this.mainType === '104') {
272
+ // 城市道路和路段行人过街才显示人行道状态
273
+ this.getpedStatus()
274
+ this.getOverlapPedStatus()
275
+ // 算法对比行人相位与行人跟随相位的状态
276
+ this.comparePedStatus()
277
+ // 算法对比车道相位与车道跟随相位的状态
278
+ this.comparePhaseStatus()
279
+ }
280
+ // console.log('this.phaseStatusMap 相位状态映射', this.phaseStatusMap)
281
+ // console.log('LanePhaseData 车道相位', this.LanePhaseData)
282
+ // console.log('sidewalkPhaseData 行人相位', this.sidewalkPhaseData)
283
+ // console.log('overlapPhaseStatusMap 跟随相位状态映射', this.overlapPhaseStatusMap)
284
+ // console.log('overlapLanePhaseData 车道跟随相位', this.overlapLanePhaseData)
285
+ // console.log('this.overlapsidewalkPhaseData 行人跟随相位', this.overlapsidewalkPhaseData)
286
+ },
287
+ // 深度观察监听
288
+ deep: true
289
+ },
290
+ devStatus: {
291
+ handler: function (val) {
292
+ if (val === 3) return
293
+ this.handleDefaultStatus()
294
+ }
295
+ },
296
+ roadDirection: {
297
+ handler: function (val1, val2) {
298
+ if (val1 !== val2) {
299
+ this.init()
300
+ }
301
+ }
302
+ },
303
+ agentId: {
304
+ handler: function (val1, val2) {
305
+ if (val1 !== val2) {
306
+ this.init()
307
+ }
308
+ }
309
+ }
310
+ },
311
+ data () {
312
+ return {
313
+ stateName: '',
314
+ roadDir: 'right', // 道路行车方向,默认右行
315
+ phaseCountdownList: [], // 相位倒计时列表
316
+ statusData: null, // 信号机状态
317
+ LanePhaseData: [], // 车道相位数据
318
+ overlapLanePhaseData: [], // 车道跟随相位数据
319
+ curPhase: [], // 当前相位列表
320
+ phaseStatusList: [], // 相位状态列表
321
+ phaseStatusMap: new Map(), // 相位状态映射
322
+ overlapPhaseStatusMap: new Map(), // 跟随相位状态映射
323
+ ColorMap: new Map([[0, '#828282'], [1, '#ff2828'], [2, '#f7b500'], [3, '#77fb65'], [4, '#77fb65'], [5, '#f7b500']]), // 当前相位状态 --- 0:关灯, 1:红, 2:黄, 3:绿, 4:绿闪, 5:黄闪
324
+ SidewalkColorMap: new Map([[0, '#828282'], [1, '#e24b4b'], [3, '#7bd66b']]),
325
+ tempType: '', // 模版类型
326
+ mainType: '101', // 路口形状
327
+ mainDirection: '000', // 路口方向
328
+ crossType: '', // 路口底图类型
329
+ isLoaded: false, // 是否成功加载底图
330
+ isHasPhase: true, // 是否有相位状态数据
331
+ phaseControlColorMap: new Map([['黄闪', '#f7b500'], ['全红', '#ff2828'], ['关灯', '#828282'], ['默认', '#fff']]),
332
+ sidewalkPhaseData: [], // 行人相位
333
+ overlapsidewalkPhaseData: [], // 行人跟随相位
334
+ resetflag: true, // 离线后,控制行人相位、车道相位reset标识
335
+ compLanePhaseData: [], // 对比车道相位和车道跟随相位后,显示的数据
336
+ compSidewalkPhaseData: [], // // 对比行人相位和车道跟随相位后,显示的数据
337
+ comdirePhaseData: [], // 对比相同方向车道相位数据后,被删减的唯一direction的数组
338
+ comdireOverlapPhaseData: [], // 对比相同方向车道跟随相位数据后,被删减的唯一direction的数组
339
+ busPhaseData: [], // 公交相位数据
340
+ comdireBusPhaseData: [] // 对比相同方向公交车道数据后,被删减的唯一direction的数组
341
+ }
342
+ },
343
+ methods: {
344
+ init () {
345
+ this.CrossDiagramMgr = new CrossDiagramMgr()
346
+ this.getRoadDirection()
347
+ this.PhaseDataModel = new PhaseDataModel(this.roadDirection)
348
+ this.getIntersectionInfo() // 获取路口信息
349
+ },
350
+ comparePhaseStatus () {
351
+ // 对比车道: 跟随相位和相位的状态数据(此处判断是为了保证被比较的数据direction都是唯一的)
352
+ if (!this.comdirePhaseData && !this.comdireOverlapPhaseData) {
353
+ this.compLanePhaseData = this.CrossDiagramMgr.compare(this.LanePhaseData, this.overlapLanePhaseData, 'type')
354
+ } else if (!this.comdireOverlapPhaseData) {
355
+ this.compLanePhaseData = this.CrossDiagramMgr.compare(this.comdirePhaseData, this.overlapLanePhaseData, 'type')
356
+ } else if (!this.comdirePhaseData) {
357
+ this.compLanePhaseData = this.CrossDiagramMgr.compare(this.LanePhaseData, this.comdireOverlapPhaseData, 'type')
358
+ } else {
359
+ this.compLanePhaseData = this.CrossDiagramMgr.compare(this.comdirePhaseData, this.comdireOverlapPhaseData, 'type')
360
+ }
361
+ },
362
+ comparePedStatus () {
363
+ // 对比人行道: 跟随相位和相位的状态数据
364
+ this.compSidewalkPhaseData = this.CrossDiagramMgr.compare(this.sidewalkPhaseData, this.overlapsidewalkPhaseData, 'pedtype')
365
+ },
366
+ resetPhaseStatus () {
367
+ // 车道相位、行人相位恢复默认状态
368
+ this.resetflag = false
369
+ this.$nextTick(() => {
370
+ this.resetflag = true
371
+ })
372
+ },
373
+ SpecialControl (data) {
374
+ switch (data.control) {
375
+ case 1: this.handleSpecialControlStatus('黄闪')
376
+ break
377
+ case 2: this.handleSpecialControlStatus('全红')
378
+ break
379
+ case 3: this.handleSpecialControlStatus('关灯')
380
+ break
381
+ default: this.handleSpecialControlStatus('默认')
382
+ }
383
+ this.isHasPhase = false
384
+ },
385
+ handleDefaultStatus () {
386
+ // 恢复默认状态
387
+ if (this.compLanePhaseData.length) {
388
+ this.phaseCountdown = ''
389
+ this.phaseCountdownColor = '#fff'
390
+ this.compLanePhaseData.forEach(data => {
391
+ data.color = '#fff'
392
+ })
393
+ }
394
+ if (this.compSidewalkPhaseData.length) {
395
+ this.compSidewalkPhaseData.forEach(data => {
396
+ data.color = '#fff'
397
+ })
398
+ }
399
+ if (this.comdireBusPhaseData.length) {
400
+ this.comdireBusPhaseData.forEach(data => {
401
+ data.color = '#fff'
402
+ })
403
+ }
404
+ this.phaseCountdownList = []
405
+ this.resetPhaseStatus()
406
+ },
407
+ handleSpecialControlStatus (Control) {
408
+ this.resetPhaseStatus()
409
+ // 控制黄闪、全红、关灯、默认情况下的车道相位颜色和倒计时颜色
410
+ if (Control === '默认') {
411
+ // 倒计时恢复默认颜色
412
+ this.phaseCountdownList.forEach(item => {
413
+ item.phaseCountdown = ''
414
+ item.id = ''
415
+ item.phaseCountdownColor = '#fff'
416
+ })
417
+ }
418
+ if (this.compLanePhaseData.length) {
419
+ const compLanePhaseData = this.compLanePhaseData.map(data => ({
420
+ ...data,
421
+ color: this.phaseControlColorMap.get(Control)
422
+ }))
423
+ this.compLanePhaseData = JSON.parse(JSON.stringify(compLanePhaseData))
424
+ }
425
+ if (this.compSidewalkPhaseData.length) {
426
+ const compSidewalkPhaseData = this.compSidewalkPhaseData.map(data => ({
427
+ ...data,
428
+ color: this.phaseControlColorMap.get(Control)
429
+ }))
430
+ this.compSidewalkPhaseData = JSON.parse(JSON.stringify(compSidewalkPhaseData))
431
+ }
432
+ if (this.comdireBusPhaseData.length) {
433
+ const comdireBusPhaseData = this.comdireBusPhaseData.map(data => ({
434
+ ...data,
435
+ color: this.phaseControlColorMap.get(Control)
436
+ }))
437
+ this.comdireBusPhaseData = JSON.parse(JSON.stringify(comdireBusPhaseData))
438
+ }
439
+ if (this.mainType === '103') {
440
+ if (this.LanePhaseData.length) {
441
+ const LanePhaseData = this.LanePhaseData.map(data => ({
442
+ ...data,
443
+ color: this.phaseControlColorMap.get(Control)
444
+ }))
445
+ this.LanePhaseData = JSON.parse(JSON.stringify(LanePhaseData))
446
+ }
447
+ }
448
+ },
449
+ createPhaseStatusMap () {
450
+ // 生成相位id和相位状态对应数据结构
451
+ this.phaseStatusList.map(phase => {
452
+ let phaseId = phase.id
453
+ let phaseInfo = {
454
+ type: phase.type,
455
+ phaseCountdown: phase.countdown,
456
+ pedtype: phase.pedtype
457
+ }
458
+ this.phaseStatusMap.set(phaseId, phaseInfo)
459
+ })
460
+ },
461
+ getPhaseStatus () {
462
+ // 得到车道相位状态(颜色)
463
+ this.comdirePhaseData = []
464
+ let curLanePhaseData = []
465
+ for (let i = 0; i < this.LanePhaseData.length; i++) {
466
+ let curPhaseStatus = this.phaseStatusMap.get(this.LanePhaseData[i].phaseid)
467
+ if (!curPhaseStatus) continue
468
+ const data = {
469
+ ...this.LanePhaseData[i],
470
+ type: curPhaseStatus.type,
471
+ color: this.ColorMap.get(curPhaseStatus.type),
472
+ phaseCountdown: curPhaseStatus.phaseCountdown,
473
+ flag: 'phase' // 车道相位数据标识
474
+ }
475
+ curLanePhaseData.push(data)
476
+ }
477
+ this.LanePhaseData = JSON.parse(JSON.stringify(curLanePhaseData))
478
+ // 处理相位数据中,方向direction重复的情况:相同direction下,按照状态的优先级显示该方向的灯色:绿灯(3) > 绿闪(4) > 黄灯(2) > 红灯(1)
479
+ // 如果有相同direction,处理后会改变原数组长度,导致第二次无法正确比较状态,因此需要中间变量存储
480
+ this.comdirePhaseData = JSON.parse(JSON.stringify(this.CrossDiagramMgr.compareRepeatDirection(this.LanePhaseData, 'type', 'phase')))
481
+ },
482
+ getOverlapPhaseStatus () {
483
+ // 得到车道跟随相位状态(颜色)
484
+ this.comdireOverlapPhaseData = []
485
+ if (this.overlapStatusList) {
486
+ this.overlapStatusList.map(phase => {
487
+ let phaseId = phase.id
488
+ let phaseInfo = {
489
+ type: phase.type,
490
+ phaseCountdown: phase.countdown,
491
+ pedtype: phase.pedtype
492
+ }
493
+ this.overlapPhaseStatusMap.set(phaseId, phaseInfo)
494
+ })
495
+ }
496
+ let curLanePhaseData = []
497
+ for (let i = 0; i < this.overlapLanePhaseData.length; i++) {
498
+ let curPhaseStatus = this.overlapPhaseStatusMap.get(this.overlapLanePhaseData[i].phaseid)
499
+ if (!curPhaseStatus) continue
500
+ const data = {
501
+ ...this.overlapLanePhaseData[i],
502
+ type: curPhaseStatus.type,
503
+ color: this.ColorMap.get(curPhaseStatus.type),
504
+ phaseCountdown: curPhaseStatus.phaseCountdown,
505
+ flag: 'overlapphase' // 车道跟随相位数据标识
506
+ }
507
+ curLanePhaseData.push(data)
508
+ }
509
+ this.overlapLanePhaseData = JSON.parse(JSON.stringify(curLanePhaseData))
510
+ // 处理跟随相位数据中,方向direction重复的情况:相同direction下,按照状态的优先级显示该方向的灯色:绿灯(3) > 绿闪(4) > 黄灯(2) > 红灯(1)
511
+ // 如果有相同direction,处理后会改变原数组长度,导致第二次无法正确比较状态,因此需要中间变量存储
512
+ this.comdireOverlapPhaseData = JSON.parse(JSON.stringify(this.CrossDiagramMgr.compareRepeatDirection(this.overlapLanePhaseData, 'type', 'overlapphase')))
513
+ },
514
+ getBusPhaseStatus () {
515
+ // 得到公交车道相位状态(颜色)
516
+ this.comdireBusPhaseData = []
517
+ let curLanePhaseData = []
518
+ for (let i = 0; i < this.busPhaseData.length; i++) {
519
+ let curPhaseStatus = this.phaseStatusMap.get(this.busPhaseData[i].phaseid)
520
+ if (!curPhaseStatus) continue
521
+ const data = {
522
+ ...this.busPhaseData[i],
523
+ type: curPhaseStatus.type,
524
+ color: this.ColorMap.get(curPhaseStatus.type),
525
+ phaseCountdown: curPhaseStatus.phaseCountdown,
526
+ flag: 'busphase' // 车道相位数据标识
527
+ }
528
+ curLanePhaseData.push(data)
529
+ }
530
+ this.busPhaseData = JSON.parse(JSON.stringify(curLanePhaseData))
531
+ // 处理相位数据中,方向direction重复的情况:相同direction下,按照状态的优先级显示该方向的灯色:绿灯(3) > 绿闪(4) > 黄灯(2) > 红灯(1)
532
+ // 如果有相同direction,处理后会改变原数组长度,导致第二次无法正确比较状态,因此需要中间变量存储
533
+ this.comdireBusPhaseData = JSON.parse(JSON.stringify(this.CrossDiagramMgr.compareRepeatDirection(this.busPhaseData, 'type', 'busphase')))
534
+ },
535
+ getCurPhaseCountdown () {
536
+ // 获取当前相位倒计时颜色
537
+ this.phaseCountdownList = []
538
+ this.curPhase.forEach(curP => {
539
+ this.phaseStatusList.forEach(phaseInfo => {
540
+ if (phaseInfo.id === curP) {
541
+ let countdownObj = {}
542
+ countdownObj.id = phaseInfo.id
543
+ countdownObj.phaseCountdown = phaseInfo.countdown
544
+ countdownObj.phaseCountdownColor = this.ColorMap.get(phaseInfo.type)
545
+ this.phaseCountdownList.push(countdownObj)
546
+ }
547
+ })
548
+ })
549
+ },
550
+ getIntersectionInfo () {
551
+ // 获取路口信息
552
+ const agentid = this.agentId || '0'
553
+ getIntersectionInfo(agentid).then(res => {
554
+ if (!res.data.success) {
555
+ this.isLoaded = false
556
+ this.stateName = this.$t('openatccomponents.overview.offline')
557
+ let parrenterror = getMessageByCode(res.data.code, this.$i18n.locale)
558
+ if (res.data.data) {
559
+ // 子类型错误
560
+ let childErrorCode = res.data.data.errorCode
561
+ if (childErrorCode) {
562
+ let childerror = getMessageByCode(res.data.data.errorCode, this.$i18n.locale)
563
+ this.$message.error(parrenterror + ',' + childerror)
564
+ }
565
+ } else {
566
+ this.$message.error(parrenterror)
567
+ }
568
+ return
569
+ }
570
+ this.stateName = this.$t('openatccomponents.overview.online')
571
+ this.isLoaded = true
572
+ this.crossInfo = res.data.data.param
573
+ this.tempType = res.data.data.type
574
+ // 获取车道相位、行人相位信息(坐标、名称)
575
+ this.mainType = this.tempType.split('-')[0]
576
+ this.mainDirection = this.tempType.split('-')[1]
577
+ if (this.mainType === '100' || this.mainType === '101' || this.mainType === '104') {
578
+ // 城市道路加载车道相位坐标和人行道坐标
579
+ this.getPhasePos()
580
+ this.getOverlapPhasePos()
581
+ this.getPedPhasePos()
582
+ this.getOverlapPedPhasePos()
583
+ this.getBusPos()
584
+ }
585
+ if (this.mainType === '103') {
586
+ // 获取匝道道路的主路和支路的相位坐标
587
+ this.getRampPhasePos()
588
+ }
589
+ })
590
+ },
591
+ getBusPos () {
592
+ // 公交相位信息
593
+ this.busPhaseData = []
594
+ this.crossInfo.phaseList.forEach((ele, i) => {
595
+ if (ele.controltype >= 3 && ele.controltype <= 6) {
596
+ ele.direction.forEach((dir, index) => {
597
+ // 车道相位
598
+ this.busPhaseData.push({
599
+ key: this.CrossDiagramMgr.getUniqueKey('busphase'),
600
+ phaseid: ele.id, // 相位id,用于对应相位状态
601
+ id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
602
+ name: this.PhaseDataModel.getBusPhasePos(dir).name,
603
+ left: this.PhaseDataModel.getBusPhasePos(dir).x,
604
+ top: this.PhaseDataModel.getBusPhasePos(dir).y,
605
+ busleft: this.PhaseDataModel.getBusMapPos(dir).x,
606
+ bustop: this.PhaseDataModel.getBusMapPos(dir).y,
607
+ controltype: ele.controltype
608
+ })
609
+ })
610
+ }
611
+ })
612
+ },
613
+ createRandomType () {
614
+ for (var i = 3; i <= 5; i++) {
615
+ return Math.floor(Math.random() * (5 - 3)) + 3
616
+ }
617
+ },
618
+ getPhasePos () {
619
+ // 车道相位信息
620
+ this.LanePhaseData = []
621
+ this.crossInfo.phaseList.forEach((ele, i) => {
622
+ if (ele.controltype === undefined || ele.controltype <= 2) {
623
+ ele.direction.forEach((dir, index) => {
624
+ // 车道相位
625
+ this.LanePhaseData.push({
626
+ key: this.CrossDiagramMgr.getUniqueKey('phase'),
627
+ phaseid: ele.id, // 相位id,用于对应相位状态
628
+ id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
629
+ name: this.PhaseDataModel.getPhase(dir).name,
630
+ left: this.PhaseDataModel.getPhase(dir).x,
631
+ top: this.PhaseDataModel.getPhase(dir).y
632
+ })
633
+ })
634
+ }
635
+ })
636
+ },
637
+ getOverlapPhasePos () {
638
+ // 车道跟随相位信息
639
+ if (!this.crossInfo.overlaplList) return
640
+ this.overlapLanePhaseData = []
641
+ this.crossInfo.overlaplList.forEach((ele, i) => {
642
+ if (ele.direction) {
643
+ ele.direction.forEach((dir, index) => {
644
+ this.overlapLanePhaseData.push({
645
+ key: this.CrossDiagramMgr.getUniqueKey('overlapphase'),
646
+ phaseid: ele.id, // 相位id,用于对应相位状态
647
+ id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
648
+ name: this.PhaseDataModel.getPhase(dir).name,
649
+ left: this.PhaseDataModel.getPhase(dir).x,
650
+ top: this.PhaseDataModel.getPhase(dir).y
651
+ })
652
+ })
653
+ }
654
+ })
655
+ },
656
+ getRampPhasePos () {
657
+ // 匝道车道相位信息
658
+ this.LanePhaseData = []
659
+ this.crossInfo.phaseList.forEach((ele, i) => {
660
+ ele.direction.forEach((dir, index) => {
661
+ if (ele.controltype === 0) {
662
+ this.handleRampPhasePosData(`${i}-${index}`, ele, dir, this.PhaseDataModel.getMainPhasePos)
663
+ }
664
+ if (ele.controltype === 1) {
665
+ this.handleRampPhasePosData(`${i}-${index}`, ele, dir, this.PhaseDataModel.getSidePhasePos)
666
+ }
667
+ })
668
+ })
669
+ },
670
+ handleRampPhasePosData (key, phase, dir) {
671
+ let posInfo = phase.controltype === 0 ? this.PhaseDataModel.getMainPhasePos(dir) : this.PhaseDataModel.getSidePhasePos(dir)
672
+ this.LanePhaseData.push({
673
+ key,
674
+ controlType: phase.controltype,
675
+ phaseid: phase.id, // 相位id,用于对应相位状态
676
+ id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
677
+ name: posInfo.name,
678
+ left: posInfo.x,
679
+ top: posInfo.y
680
+ })
681
+ },
682
+ getPedPhasePos () {
683
+ // 行人相位信息
684
+ this.sidewalkPhaseData = []
685
+ this.crossInfo.phaseList.forEach((ele, i) => {
686
+ if (ele.peddirection) {
687
+ ele.peddirection.forEach((dir, index) => {
688
+ // 行人相位
689
+ if (this.PhaseDataModel.getSidePos(dir)) {
690
+ this.sidewalkPhaseData.push({
691
+ key: this.CrossDiagramMgr.getUniqueKey('pedphase'),
692
+ phaseid: ele.id, // 相位id,用于对应相位状态
693
+ id: dir,
694
+ name: this.PhaseDataModel.getSidePos(dir).name,
695
+ left: this.PhaseDataModel.getSidePos(dir).x,
696
+ top: this.PhaseDataModel.getSidePos(dir).y
697
+ })
698
+ }
699
+ })
700
+ }
701
+ })
702
+ // 行人相位无,也要显示人行横道,与车道相位显示与否逻辑不同
703
+ // this.handleCompleteSidewalkPhase()
704
+ },
705
+ getOverlapPedPhasePos () {
706
+ // 行人跟随相位信息
707
+ if (!this.crossInfo.overlaplList) return
708
+ this.overlapsidewalkPhaseData = []
709
+ this.crossInfo.overlaplList.forEach((ele, i) => {
710
+ if (ele.peddirection) {
711
+ ele.peddirection.forEach((dir, index) => {
712
+ if (this.PhaseDataModel.getSidePos(dir)) {
713
+ this.overlapsidewalkPhaseData.push({
714
+ key: this.CrossDiagramMgr.getUniqueKey('overlappedphase'),
715
+ phaseid: ele.id, // 相位id,用于对应相位状态
716
+ id: dir,
717
+ name: this.PhaseDataModel.getSidePos(dir).name,
718
+ left: this.PhaseDataModel.getSidePos(dir).x,
719
+ top: this.PhaseDataModel.getSidePos(dir).y
720
+ })
721
+ }
722
+ })
723
+ }
724
+ })
725
+ },
726
+ // handleCompleteSidewalkPhase () {
727
+ // // 没有相位状态的车道也要显示,默认白色
728
+ // let hasDirIds = this.sidewalkPhaseData.map(data => data.id)
729
+ // let allIds = []
730
+ // for (let key of this.PhaseDataModel.SidePosMap.keys()) {
731
+ // allIds.push(key)
732
+ // }
733
+ // let diffIds = allIds.filter(function (val) { return hasDirIds.indexOf(val) === -1 })
734
+ // diffIds.forEach(id => {
735
+ // this.sidewalkPhaseData.push({
736
+ // key: `${this.sidewalkPhaseData.length + 1}`,
737
+ // phaseid: undefined, // 相位id,用于对应相位状态
738
+ // id,
739
+ // name: this.PhaseDataModel.getSidePos(id).name,
740
+ // left: this.PhaseDataModel.getSidePos(id).x,
741
+ // top: this.PhaseDataModel.getSidePos(id).y
742
+ // })
743
+ // })
744
+ // },
745
+ getCrossType () {
746
+ // 路口类型对应底图决策
747
+ if (this.mainType === '101') {
748
+ // 十字路口
749
+ this.crossType = 'Crossroads'
750
+ }
751
+ if (this.mainType === '100') {
752
+ // T型路口
753
+ switch (this.mainDirection) {
754
+ case '001': this.crossType = 'TypeT-east'
755
+ break
756
+ case '002': this.crossType = 'TypeT-south'
757
+ break
758
+ case '003': this.crossType = 'TypeT-west'
759
+ break
760
+ case '004': this.crossType = 'TypeT-north'
761
+ break
762
+ }
763
+ }
764
+ if (this.mainType === '103') {
765
+ // 匝道
766
+ switch (this.mainDirection) {
767
+ case '001': this.crossType = 'ramp-east'
768
+ break
769
+ case '002': this.crossType = 'ramp-south'
770
+ break
771
+ case '003': this.crossType = 'ramp-west'
772
+ break
773
+ case '004': this.crossType = 'ramp-north'
774
+ break
775
+ }
776
+ }
777
+ if (this.mainType === '104') {
778
+ // 路段行人过街
779
+ switch (this.mainDirection) {
780
+ case '006': this.crossType = 'ped-section-east-west'
781
+ break
782
+ case '005': this.crossType = 'ped-section-south-north'
783
+ break
784
+ }
785
+ }
786
+ if (this.mainType === '999') {
787
+ // 其他路口
788
+ this.crossType = 'Customroads'
789
+ }
790
+ },
791
+ refresh () {
792
+ this.getIntersectionInfo()
793
+ },
794
+ getpedStatus () {
795
+ // 行人相位状态
796
+ let curPedStatus = []
797
+ for (let i = 0; i < this.sidewalkPhaseData.length; i++) {
798
+ if (this.sidewalkPhaseData[i].phaseid) {
799
+ let curPhaseStatus = this.phaseStatusMap.get(this.sidewalkPhaseData[i].phaseid)
800
+ if (!curPhaseStatus) continue
801
+ const data = {
802
+ ...this.sidewalkPhaseData[i],
803
+ pedtype: curPhaseStatus.pedtype,
804
+ color: this.SidewalkColorMap.get(curPhaseStatus.pedtype),
805
+ flag: 'ped' // 行人相位数据标识
806
+ }
807
+ curPedStatus.push(data)
808
+ } else {
809
+ // 无状态的行人道
810
+ const data = {
811
+ ...this.sidewalkPhaseData[i],
812
+ pedtype: undefined
813
+ }
814
+ curPedStatus.push(data)
815
+ }
816
+ }
817
+ this.sidewalkPhaseData = JSON.parse(JSON.stringify(curPedStatus))
818
+ },
819
+ getOverlapPedStatus () {
820
+ // 行人跟随相位状态
821
+ let curPedStatus = []
822
+ for (let i = 0; i < this.overlapsidewalkPhaseData.length; i++) {
823
+ if (this.overlapsidewalkPhaseData[i].phaseid) {
824
+ let curPhaseStatus = this.overlapPhaseStatusMap.get(this.overlapsidewalkPhaseData[i].phaseid)
825
+ if (!curPhaseStatus) {
826
+ // 无状态的行人道,也显示出来
827
+ const data = {
828
+ ...this.overlapsidewalkPhaseData[i],
829
+ pedtype: undefined
830
+ }
831
+ curPedStatus.push(data)
832
+ continue
833
+ }
834
+ const data = {
835
+ ...this.overlapsidewalkPhaseData[i],
836
+ pedtype: curPhaseStatus.pedtype,
837
+ color: this.SidewalkColorMap.get(curPhaseStatus.pedtype),
838
+ flag: 'overlapped' // 行人跟随相位数据标识
839
+ }
840
+ curPedStatus.push(data)
841
+ } else {
842
+ // 无状态的行人道
843
+ const data = {
844
+ ...this.overlapsidewalkPhaseData[i],
845
+ pedtype: undefined
846
+ }
847
+ curPedStatus.push(data)
848
+ }
849
+ }
850
+ this.overlapsidewalkPhaseData = JSON.parse(JSON.stringify(curPedStatus))
851
+ },
852
+ getRoadDirection () {
853
+ // 获取行车方向(从平台或配置工具的配置文件中读取)
854
+ this.roadDir = this.roadDirection
855
+ }
856
+ },
857
+ mounted () {
858
+ this.init()
859
+ }
860
+ }
861
+ </script>
862
+ <style scoped>
863
+ .invisible {
864
+ visibility: hidden;
865
+ }
866
+ .crossImg{
867
+ position: relative;
868
+ width: 870px;
869
+ height: 650px;
870
+ left: 50%;
871
+ transform: translateX(-50%);
872
+ }
873
+ .centerText {
874
+ position: absolute;
875
+ width: 140px;
876
+ height: 140px;
877
+ left: 50%;
878
+ top: 50%;
879
+ transform: translateX(-50%) translateY(-50%);
880
+ /* text-align: center; */
881
+ z-index: 9;
882
+ display: flex;
883
+ align-items: center;
884
+ /* padding-left: 16px; */
885
+ }
886
+ .phaseCountdown {
887
+ line-height: 40px;
888
+ font-size: 30px;
889
+ font-weight: normal;
890
+ font-stretch: normal;
891
+ letter-spacing: 0px;
892
+ color: #fff;
893
+ width: 150px;
894
+ margin: 0 auto;
895
+ }
896
+ .countdownBg {
897
+ border-radius: 10px;
898
+ background-color: rgba(94, 90, 90, 0.8);
899
+ padding-left: 16px;
900
+ }
901
+ .centerText .text {
902
+ display: inline-block;
903
+ color: #409eff;
904
+ margin-top: 20px;
905
+ }
906
+
907
+ .baseImg {
908
+ width: 100%;
909
+ height: 650px;
910
+ position: relative;
911
+ }
912
+ </style>