openatc-components 0.0.20 → 0.0.21

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