openatc-components 0.0.12 → 0.0.15

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