openatc-components 0.0.83 → 0.0.88

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 (293) hide show
  1. package/.babelrc +18 -18
  2. package/.editorconfig +9 -9
  3. package/.eslintignore +5 -5
  4. package/.eslintrc.js +29 -29
  5. package/.postcssrc.js +10 -10
  6. package/README.md +30 -30
  7. package/build/build.js +41 -41
  8. package/build/check-versions.js +54 -54
  9. package/build/package.config.js +58 -58
  10. package/build/package.dev.config.js +107 -107
  11. package/build/package.prod.config.js +160 -160
  12. package/build/utils.js +101 -101
  13. package/build/vue-loader.conf.js +22 -22
  14. package/build/webpack.base.conf.js +114 -114
  15. package/build/webpack.dev.conf.js +95 -95
  16. package/build/webpack.prod.conf.js +149 -149
  17. package/config/dev.env.js +8 -8
  18. package/config/index.js +91 -91
  19. package/config/prod.env.js +5 -5
  20. package/config/test.env.js +7 -7
  21. package/index.html +12 -12
  22. package/package/kisscomps/components/BoardCard/BoardCard.vue +89 -89
  23. package/package/kisscomps/components/BoardCard/index.js +2 -2
  24. package/package/kisscomps/components/CommonKanban/CommonKanban.vue +118 -118
  25. package/package/kisscomps/components/CommonKanban/index.js +2 -2
  26. package/package/kisscomps/components/ExpendConfig/ExpendConfig.vue +114 -114
  27. package/package/kisscomps/components/ExpendConfig/index.js +2 -2
  28. package/package/kisscomps/components/FaultDetailModal/FaultDetailModal.vue +170 -170
  29. package/package/kisscomps/components/FaultDetailModal/index.js +2 -2
  30. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/CrossRoadsSvg.vue +497 -497
  31. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/CustomRoadsSvg.vue +46 -46
  32. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/PatternWalkSvg.vue +429 -0
  33. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/PedSectionEWSvg.vue +300 -300
  34. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/PedSectionSNSvg.vue +288 -288
  35. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampEastSvg.vue +391 -391
  36. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampNorthSvg.vue +336 -336
  37. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampSouthSvg.vue +345 -345
  38. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampWestSvg.vue +389 -389
  39. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/SidewalkSvg.vue +1179 -1179
  40. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeEastRoadsSvg.vue +402 -402
  41. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeNorthRoadsSvg.vue +361 -361
  42. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeSouthRoadsSvg.vue +368 -368
  43. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeWestRoadsSvg.vue +475 -475
  44. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LCrossRoadsSvg.vue +494 -494
  45. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeEastRoadsSvg.vue +401 -401
  46. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeNorthRoadsSvg.vue +360 -360
  47. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeSouthRoadsSvg.vue +367 -367
  48. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeWestRoadsSvg.vue +476 -476
  49. package/package/kisscomps/components/IntersectionMap/crossDirection/baseImg/refreshSvg.vue +63 -63
  50. package/package/kisscomps/components/IntersectionMap/crossDirection/busIcon/busMapSvg.vue +50 -50
  51. package/package/kisscomps/components/IntersectionMap/crossDirection/busIcon/eastBusSvg.vue +167 -167
  52. package/package/kisscomps/components/IntersectionMap/crossDirection/busIcon/northBusSvg.vue +168 -168
  53. package/package/kisscomps/components/IntersectionMap/crossDirection/busIcon/southBusSvg.vue +168 -168
  54. package/package/kisscomps/components/IntersectionMap/crossDirection/busIcon/westBusSvg.vue +169 -169
  55. package/package/kisscomps/components/IntersectionMap/crossDirection/crossDiagram.vue +912 -912
  56. package/package/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/LphaseIconSvg.vue +112 -112
  57. package/package/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/phaseIconSvg.vue +112 -112
  58. package/package/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/rampPhaseIconSvg.vue +111 -111
  59. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/busPos.json +196 -196
  60. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/busPos.left.json +196 -196
  61. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/phasePos.json +99 -99
  62. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/phasePos.left.json +99 -99
  63. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/rampPos.json +52 -52
  64. package/package/kisscomps/components/IntersectionMap/crossDirection/posJson/sidePos.json +99 -99
  65. package/package/kisscomps/components/IntersectionMap/crossDirection/utils.js +78 -78
  66. package/package/kisscomps/components/IntersectionMap/index.js +2 -2
  67. package/package/kisscomps/components/IntersectionMap/intersectionmap.vue +153 -153
  68. package/package/kisscomps/components/IntersectionWithInterface/IntersectionWithInterface.vue +518 -518
  69. package/package/kisscomps/components/IntersectionWithInterface/index.js +2 -2
  70. package/package/kisscomps/components/KanBan/index.js +2 -2
  71. package/package/kisscomps/components/KanBan/kanban.vue +219 -219
  72. package/package/kisscomps/components/OverLap/OverLap.vue +207 -207
  73. package/package/kisscomps/components/OverLap/index.js +2 -2
  74. package/package/kisscomps/components/PatternStatus/PatternStatus.vue +888 -888
  75. package/package/kisscomps/components/PatternStatus/index.js +2 -2
  76. package/package/kisscomps/components/PatternWalkSvg/PatternWalkSvg.vue +423 -424
  77. package/package/kisscomps/components/PatternWalkSvg/index.js +2 -2
  78. package/package/kisscomps/components/PhaseMarker/index.js +6 -6
  79. package/package/kisscomps/components/PhaseMarker/phasemarker.vue +215 -215
  80. package/package/kisscomps/components/PhaseMarker/svg/patternSvg.vue +121 -121
  81. package/package/kisscomps/components/PhaseMarker/svg/phase.vue +60 -60
  82. package/package/kisscomps/components/PhaseMarker/svg/phaseCount.vue +62 -62
  83. package/package/kisscomps/components/PhaseMarker/svg/phaseCountCycle.vue +62 -62
  84. package/package/kisscomps/components/PhaseMarker/svg/phaseSvg.vue +117 -117
  85. package/package/kisscomps/components/SchemeConfig/SchemeConfig.vue +744 -739
  86. package/package/kisscomps/components/SchemeConfig/closePhaselControlModal/index.vue +195 -195
  87. package/package/kisscomps/components/SchemeConfig/index.js +2 -2
  88. package/package/kisscomps/components/SchemeConfig/lockingPhaselControlModal/index.vue +198 -198
  89. package/package/kisscomps/components/SchemeConfig/manualControlModal/index.vue +219 -219
  90. package/package/kisscomps/components/SchemeConfig/realtimeStatusModal/index.vue +263 -263
  91. package/package/kisscomps/components/SchemeConfig/tentativeplancontrolmodal/index.vue +1384 -1384
  92. package/package/kisscomps/components/StageBord/StageBord.vue +242 -242
  93. package/package/kisscomps/components/StageBord/index.js +2 -2
  94. package/package/kisscomps/components/StageStatus/StageStatus.vue +306 -306
  95. package/package/kisscomps/components/StageStatus/index.js +2 -2
  96. package/package/kisscomps/components/Stages/index.vue +139 -139
  97. package/package/kisscomps/components/SvgIcon/SvgIcon.vue +53 -53
  98. package/package/kisscomps/components/SvgIcon/index.js +2 -2
  99. package/package/kisscomps/components/XRDDirSelector/XRDDirSelector.vue +522 -522
  100. package/package/kisscomps/components/XRDDirSelector/index.js +2 -2
  101. package/package/kisscomps/components/overView/index.vue +676 -676
  102. package/package/kisscomps/components/patternList/index.js +2 -2
  103. package/package/kisscomps/components/patternList/patternList.vue +562 -562
  104. package/package/kisscomps/index.js +92 -92
  105. package/package/kissui.min.js +1 -1
  106. package/package.json +3 -4
  107. package/src/App.vue +24 -24
  108. package/src/EdgeMgr/EdgeModelBase.js +16 -16
  109. package/src/EdgeMgr/controller/crossDiagramMgr.js +120 -120
  110. package/src/api/authapi.js +31 -31
  111. package/src/api/config.js +21 -21
  112. package/src/api/control.js +76 -76
  113. package/src/api/fault.js +66 -66
  114. package/src/api/index.js +24 -24
  115. package/src/api/login.js +46 -46
  116. package/src/api/optimize.js +72 -72
  117. package/src/api/param.js +154 -154
  118. package/src/api/passwdAssest.js +101 -101
  119. package/src/api/template.js +27 -27
  120. package/src/i18n/index.js +26 -26
  121. package/src/i18n/language/en.js +1111 -1111
  122. package/src/i18n/language/index.js +25 -25
  123. package/src/i18n/language/zh.js +1110 -1110
  124. package/src/icons/demo.css +539 -539
  125. package/src/icons/iconfont.css +835 -835
  126. package/src/icons/iconfont.json +1444 -1444
  127. package/src/icons/index.js +20 -20
  128. package/src/icons/svg/bendi.svg +110 -110
  129. package/src/icons/svg/bujin.svg +36 -36
  130. package/src/icons/svg/connectBlue.svg +7 -7
  131. package/src/icons/svg/currentvolume.svg +0 -0
  132. package/src/icons/svg/cutRed.svg +7 -7
  133. package/src/icons/svg/cycle.svg +0 -0
  134. package/src/icons/svg/dingzhouqi.svg +34 -34
  135. package/src/icons/svg/ganyingkongzhi.svg +30 -30
  136. package/src/icons/svg/guandeng.svg +81 -81
  137. package/src/icons/svg/huangshan.svg +71 -71
  138. package/src/icons/svg/maincontrol.svg +0 -0
  139. package/src/icons/svg/manualcontrolbackground.svg +51 -51
  140. package/src/icons/svg/manualcontrolbackground1.svg +62 -62
  141. package/src/icons/svg/manualcontrolbackgrounden.svg +62 -62
  142. package/src/icons/svg/model.svg +0 -0
  143. package/src/icons/svg/phasediff.svg +0 -0
  144. package/src/icons/svg/quanhong.svg +86 -86
  145. package/src/icons/svg/shanghe.svg +11 -11
  146. package/src/icons/svg/shoudong.svg +103 -103
  147. package/src/icons/svg/time.svg +0 -0
  148. package/src/icons/svg/wuxianlan.svg +46 -46
  149. package/src/icons/svg/xiala.svg +11 -11
  150. package/src/icons/svg/xingrenguojie.svg +33 -33
  151. package/src/icons/svg/xitong.svg +89 -89
  152. package/src/icons/svg/youxian.svg +41 -41
  153. package/src/icons/svg/zizhukongzhi.svg +43 -43
  154. package/src/kisscomps/components/BoardCard/BoardCard.vue +89 -89
  155. package/src/kisscomps/components/BoardCard/index.js +2 -2
  156. package/src/kisscomps/components/CommonKanban/CommonKanban.vue +118 -118
  157. package/src/kisscomps/components/CommonKanban/index.js +2 -2
  158. package/src/kisscomps/components/ExpendConfig/ExpendConfig.vue +114 -114
  159. package/src/kisscomps/components/ExpendConfig/index.js +2 -2
  160. package/src/kisscomps/components/FaultDetailModal/FaultDetailModal.vue +170 -170
  161. package/src/kisscomps/components/FaultDetailModal/index.js +2 -2
  162. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/CrossRoadsSvg.vue +497 -497
  163. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/CustomRoadsSvg.vue +46 -46
  164. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/PedSectionEWSvg.vue +300 -300
  165. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/PedSectionSNSvg.vue +288 -288
  166. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampEastSvg.vue +391 -391
  167. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampNorthSvg.vue +336 -336
  168. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampSouthSvg.vue +345 -345
  169. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/RampWestSvg.vue +389 -389
  170. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/SidewalkSvg.vue +1179 -1179
  171. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeEastRoadsSvg.vue +402 -402
  172. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeNorthRoadsSvg.vue +361 -361
  173. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeSouthRoadsSvg.vue +368 -368
  174. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/TShapeWestRoadsSvg.vue +475 -475
  175. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LCrossRoadsSvg.vue +494 -494
  176. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeEastRoadsSvg.vue +401 -401
  177. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeNorthRoadsSvg.vue +360 -360
  178. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeSouthRoadsSvg.vue +367 -367
  179. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/leftroad/LTShapeWestRoadsSvg.vue +476 -476
  180. package/src/kisscomps/components/IntersectionMap/crossDirection/baseImg/refreshSvg.vue +63 -63
  181. package/src/kisscomps/components/IntersectionMap/crossDirection/busIcon/busMapSvg.vue +50 -50
  182. package/src/kisscomps/components/IntersectionMap/crossDirection/busIcon/eastBusSvg.vue +167 -167
  183. package/src/kisscomps/components/IntersectionMap/crossDirection/busIcon/northBusSvg.vue +168 -168
  184. package/src/kisscomps/components/IntersectionMap/crossDirection/busIcon/southBusSvg.vue +168 -168
  185. package/src/kisscomps/components/IntersectionMap/crossDirection/busIcon/westBusSvg.vue +169 -169
  186. package/src/kisscomps/components/IntersectionMap/crossDirection/crossDiagram.vue +912 -912
  187. package/src/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/LphaseIconSvg.vue +112 -112
  188. package/src/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/phaseIconSvg.vue +112 -112
  189. package/src/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/rampPhaseIconSvg.vue +111 -111
  190. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/busPos.json +196 -196
  191. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/busPos.left.json +196 -196
  192. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/phasePos.json +99 -99
  193. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/phasePos.left.json +99 -99
  194. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/rampPos.json +52 -52
  195. package/src/kisscomps/components/IntersectionMap/crossDirection/posJson/sidePos.json +99 -99
  196. package/src/kisscomps/components/IntersectionMap/crossDirection/utils.js +78 -78
  197. package/src/kisscomps/components/IntersectionMap/index.js +2 -2
  198. package/src/kisscomps/components/IntersectionMap/intersectionmap.vue +153 -153
  199. package/src/kisscomps/components/IntersectionWithInterface/IntersectionWithInterface.vue +518 -518
  200. package/src/kisscomps/components/IntersectionWithInterface/index.js +2 -2
  201. package/src/kisscomps/components/KanBan/index.js +2 -2
  202. package/src/kisscomps/components/KanBan/kanban.vue +219 -219
  203. package/src/kisscomps/components/OverLap/OverLap.vue +207 -207
  204. package/src/kisscomps/components/OverLap/index.js +2 -2
  205. package/src/kisscomps/components/PatternStatus/PatternStatus.vue +888 -888
  206. package/src/kisscomps/components/PatternStatus/index.js +2 -2
  207. package/src/kisscomps/components/PatternWalkSvg/PatternWalkSvg.vue +423 -424
  208. package/src/kisscomps/components/PatternWalkSvg/index.js +2 -2
  209. package/src/kisscomps/components/PhaseMarker/index.js +6 -6
  210. package/src/kisscomps/components/PhaseMarker/phasemarker.vue +215 -215
  211. package/src/kisscomps/components/PhaseMarker/svg/patternSvg.vue +121 -121
  212. package/src/kisscomps/components/PhaseMarker/svg/phase.vue +60 -60
  213. package/src/kisscomps/components/PhaseMarker/svg/phaseCount.vue +62 -62
  214. package/src/kisscomps/components/PhaseMarker/svg/phaseCountCycle.vue +62 -62
  215. package/src/kisscomps/components/PhaseMarker/svg/phaseSvg.vue +117 -117
  216. package/src/kisscomps/components/SchemeConfig/SchemeConfig.vue +744 -739
  217. package/src/kisscomps/components/SchemeConfig/closePhaselControlModal/index.vue +195 -195
  218. package/src/kisscomps/components/SchemeConfig/index.js +2 -2
  219. package/src/kisscomps/components/SchemeConfig/lockingPhaselControlModal/index.vue +198 -198
  220. package/src/kisscomps/components/SchemeConfig/manualControlModal/index.vue +219 -219
  221. package/src/kisscomps/components/SchemeConfig/realtimeStatusModal/index.vue +263 -263
  222. package/src/kisscomps/components/SchemeConfig/tentativeplancontrolmodal/index.vue +1384 -1384
  223. package/src/kisscomps/components/StageBord/StageBord.vue +242 -242
  224. package/src/kisscomps/components/StageBord/index.js +2 -2
  225. package/src/kisscomps/components/StageStatus/StageStatus.vue +306 -306
  226. package/src/kisscomps/components/StageStatus/index.js +2 -2
  227. package/src/kisscomps/components/Stages/index.vue +139 -139
  228. package/src/kisscomps/components/SvgIcon/SvgIcon.vue +53 -53
  229. package/src/kisscomps/components/SvgIcon/index.js +2 -2
  230. package/src/kisscomps/components/XRDDirSelector/XRDDirSelector.vue +522 -522
  231. package/src/kisscomps/components/XRDDirSelector/index.js +2 -2
  232. package/src/kisscomps/components/overView/index.vue +676 -676
  233. package/src/kisscomps/components/patternList/index.js +2 -2
  234. package/src/kisscomps/components/patternList/patternList.vue +562 -562
  235. package/src/kisscomps/index.js +92 -92
  236. package/src/lib/publicjs/ArryListUtil.js +38 -38
  237. package/src/lib/publicjs/HttpurlMgr.js +45 -45
  238. package/src/lib/publicjs/KissApi.js +158 -158
  239. package/src/lib/publicjs/KissWSSub/Heartcheck.js +128 -128
  240. package/src/lib/publicjs/KissWSSub/KissWsSub.js +91 -91
  241. package/src/lib/publicjs/KissWSSub/KissWsSubByType.js +152 -152
  242. package/src/lib/publicjs/KissWSSub/SimuWsSubByType.js +44 -44
  243. package/src/lib/publicjs/KissWSSub/Sub.js +51 -51
  244. package/src/lib/publicjs/KissWSSub/SubChannel.js +119 -119
  245. package/src/lib/publicjs/basecomponents.js +65 -65
  246. package/src/lib/publicjs/localStorage.js +112 -112
  247. package/src/lib/publicjs/objdeepcopy.js +32 -32
  248. package/src/lib/publicjs/pageScroll.js +30 -30
  249. package/src/lib/publicjs/passwdAssest.js +101 -101
  250. package/src/lib/publicjs/styleclassfactory.js +32 -32
  251. package/src/main.js +47 -47
  252. package/src/router/index.js +36 -36
  253. package/src/store/getters.js +16 -16
  254. package/src/store/index.js +26 -26
  255. package/src/store/modules/globalParam.js +27 -27
  256. package/src/utils/ControlFormat.js +68 -68
  257. package/src/utils/RingDataModel.js +191 -180
  258. package/src/utils/auth.js +111 -111
  259. package/src/utils/dateFormat.js +41 -41
  260. package/src/utils/errorcode.js +224 -224
  261. package/src/utils/fault.js +195 -195
  262. package/src/utils/faultcode.js +209 -209
  263. package/src/utils/index.js +69 -69
  264. package/src/utils/pedphasedesc.js +119 -119
  265. package/src/utils/phasedesc.js +124 -124
  266. package/src/utils/responseMessage.js +21 -21
  267. package/src/utils/validate.js +43 -43
  268. package/src/views/home.1.vue +479 -479
  269. package/src/views/home.vue +78 -78
  270. package/src/views/intersection.vue +276 -276
  271. package/src/views/overView.vue +41 -41
  272. package/src/views/schemeconfig.vue +154 -154
  273. package/static/apiconfig.json +336 -336
  274. package/static/styles/common.scss +19 -19
  275. package/static/styles/commonkanban.scss +87 -87
  276. package/static/styles/dark/index.scss +2 -2
  277. package/static/styles/dark/theme/element-dark.scss +42 -42
  278. package/static/styles/index.scss +84 -84
  279. package/static/styles/intersection.scss +170 -170
  280. package/static/styles/light/index.scss +2 -2
  281. package/static/styles/light/theme/element-light.scss +42 -42
  282. package/static/styles/overview.scss +371 -371
  283. package/static/styles/schemeconfig.scss +405 -405
  284. package/static/styles/stages.scss +64 -64
  285. package/static/token.json +2 -2
  286. package/test/e2e/custom-assertions/elementCount.js +27 -27
  287. package/test/e2e/nightwatch.conf.js +46 -46
  288. package/test/e2e/runner.js +48 -48
  289. package/test/e2e/specs/test.js +19 -19
  290. package/test/unit/.eslintrc +7 -7
  291. package/test/unit/jest.conf.js +30 -30
  292. package/test/unit/setup.js +3 -3
  293. package/test/unit/specs/HelloWorld.spec.js +11 -11
@@ -1,888 +1,888 @@
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="main-patternstatus">
14
- <!-- 环模式true -->
15
- <div v-if="this.contrloType === 'ring' || !this.contrloType">
16
- <div class="ring-first" v-for="(list, index1) in patternInfo" :key="index1">
17
- <div v-for="(item,index2) in list" :key="index2" :class="item.controltype===99?'direction': ''">
18
- <div class="first-1" :style="{'width':item.greenWidth,'height':'34px','background':'#7ccc66'}">
19
- <el-tooltip placement="top-start" effect="light">
20
- <div slot="content">P{{item.id}}:{{item.split}}</div>
21
- <div style="cursor:pointer;">
22
- <div class="ring-phase">
23
- <patternwalksvg :showWalk="item.peddirection" :Width="'32'" :Height="'34'"></patternwalksvg>
24
- <xdrdirselector Width="36px" Height="34px" :showlist="item.direction"></xdrdirselector>
25
- </div>
26
- <div class="box">
27
- <div class="ring-nums">P{{item.id}}</div>
28
- <div class="ring-nums">{{item.split}}</div>
29
- </div>
30
- </div>
31
- </el-tooltip>
32
- <div style="position:relative; width:50px;" v-for="(bus,index3) in busPhaseData" :key="index3">
33
- <i class="iconfont icon-lukouzhilu" style="position: absolute;top: 8px;font-size:12px;color:#454545;" v-if="bus.controltype === 1 && bus.phaseid===item.id"></i>
34
- <i class="iconfont icon-BRT" style="position: absolute;top: 8px;font-size:12px;color:#454545;" v-if="bus.controltype === 4 && bus.phaseid===item.id"></i>
35
- <i class="iconfont icon-xuxiangwei" style="position: absolute;top: 8px;font-size:12px;color:#454545;" v-if="bus.controltype === 99 && bus.phaseid===item.id"></i>
36
- <i class="iconfont icon-feijidongche" style="position: absolute;top: 8px;font-size:12px;color:#454545;" v-if="bus.controltype === 6 && bus.phaseid===item.id"></i>
37
- <i class="iconfont icon-gongjiaoche" style="position: absolute;top: 8px;font-size:12px;color:#454545;" v-if="bus.controltype === 3 && bus.phaseid===item.id"></i>
38
- <i class="iconfont icon-youguidianche" style="position: absolute;top: 8px;font-size:12px;color:#454545;" v-if="bus.controltype === 5 && bus.phaseid===item.id"></i>
39
- </div>
40
- </div>
41
- <div class="first-1" :style="{'width':item.flashgreen,'height':'34px','float':'left','background': 'linear-gradient(to right, #ffffff 50%, #7ccc66 0)','background-size': '4px 100%'}"></div>
42
- <div class="first-1" :style="{'width':item.yellowWidth,'height':'34px','background':'#f9dc6a'}"></div>
43
- <div class="first-1" :style="{'width':item.redWidth,'height':'34px','background':'#f27979'}"></div>
44
- </div>
45
- </div>
46
- <div v-for="(item, index) in barrierList" :key="index + '1'">
47
- <div class="divider" :style="{'left':item, 'height':barrierHeight}"></div>
48
- </div>
49
- <div v-show="(syncTime && cycle && cycle>0) || (syncTime && newCycle && newCycle>0)">
50
- <div class="curTimeDiv" :style="{'left':paddingLeft, 'background-color': '#409EFF'}">{{ timeNumDevide }}</div>
51
- <div class="curTimeLine" :style="{'left':paddingLeft, 'height':barrierHeight}"></div>
52
- </div>
53
- </div>
54
- <div v-if="this.contrloType === 'stage'">
55
- <div v-for="(list, index1) in stageLists" :key="index1">
56
- <!-- <div> -->
57
- <div class="first-1" :style="{'width':list.greenWidth,'height':'34px','background':'#7ccc66'}">
58
- <el-tooltip placement="top-start" effect="light">
59
- <div slot="content">
60
- <span class="ring-nums" v-for="(pha,index) in list.phases" :key="index">
61
- P:{{pha}}
62
- </span>
63
- </div>
64
- <div style="cursor:pointer;">
65
- <div class="ring-phase">
66
- <patternwalksvg :showWalk="list.peddirection" :Width="'32'" :Height="'34'"></patternwalksvg>
67
- <xdrdirselector Width="36px" Height="34px" :showlist="list.direction"></xdrdirselector>
68
- </div>
69
- <div class="box" style="line-height:28px">
70
- <span class="ring-nums" v-for="(pha,index) in list.phases" :key="index">
71
- P:{{pha}}
72
- </span>
73
- </div>
74
- </div>
75
- </el-tooltip>
76
- </div>
77
- <!-- <div class="first-1" :style="{'width':item.flashgreen,'height':'34px','float':'left','background': 'linear-gradient(to right, #ffffff 50%, #7ccc66 0)','background-size': '4px 100%'}"></div> -->
78
- <div class="first-1" :style="{'width':list.yellowWidth,'height':'34px','background':'#f9dc6a'}"></div>
79
- <div class="first-1" :style="{'width':list.redWidth,'height':'34px','background':'#f27979'}"></div>
80
- </div>
81
- </div>
82
- <!-- </div> -->
83
- </div>
84
- </template>
85
- <script>
86
- import patternwalksvg from '../PatternWalkSvg/PatternWalkSvg'
87
- import xdrdirselector from '../XRDDirSelector/XRDDirSelector'
88
- // import PatternWalkSvg from '../IntersectionMap/crossDirection/baseImg/PatternWalkSvg'
89
- import PhaseDataModel from '../IntersectionMap/crossDirection/utils.js'
90
- import CrossDiagramMgr from '../../../EdgeMgr/controller/crossDiagramMgr.js'
91
- export default {
92
- name: 'pattern-list',
93
- components: {
94
- patternwalksvg,
95
- xdrdirselector
96
- },
97
- data () {
98
- return {
99
- barrierHeight: '',
100
- barrierList: [],
101
- newCycle: this.cycles,
102
- patternIds: this.patternId,
103
- newPatterns: [],
104
- newList: [],
105
- sidewalkPhaseData: [],
106
- // controlDatas: this.controlData,
107
- max: '',
108
- stageLists: [],
109
- busPhaseData: [], // 公交相位数据
110
- patternInfo: []
111
- }
112
- },
113
- props: {
114
- stagesChange: {
115
- type: Array
116
- },
117
- contrloType: {
118
- type: String
119
- },
120
- phaseList: {
121
- type: Array
122
- },
123
- patternList: {
124
- type: Array
125
- },
126
- localPatternList: {
127
- type: Array
128
- },
129
- controlData: {
130
- type: Object
131
- },
132
- cycle: {
133
- type: Number
134
- },
135
- agentId: {
136
- type: String
137
- },
138
- cycles: {
139
- type: Number
140
- },
141
- patternId: {
142
- type: Number
143
- },
144
- patternStatusList: {
145
- type: Array
146
- },
147
- syncTime: {
148
- type: Number
149
- }
150
- },
151
- computed: {
152
- paddingLeft () {
153
- let res = '0%'
154
- if (this.newCycle && this.newCycle > 0) {
155
- let curPercent = (this.newCycle - this.syncTime) / this.newCycle
156
- res = curPercent * 100 + '%'
157
- }
158
- if (this.cycle && this.cycle > 0) {
159
- let curPercent = (this.cycle - this.syncTime) / this.cycle
160
- res = curPercent * 100 + '%'
161
- }
162
- return res
163
- },
164
- timeNumDevide () {
165
- if (this.newCycle && this.newCycle > 0) {
166
- let res = (this.newCycle - this.syncTime) + '/' + this.newCycle
167
- return res
168
- }
169
- if (this.cycle && this.cycle > 0) {
170
- let res = (this.cycle - this.syncTime) + '/' + this.cycle
171
- return res
172
- }
173
- }
174
- },
175
- watch: {
176
- controlData: {
177
- handler: function (val, oldVal) {
178
- if (this.contrloType === 'stage') {
179
- this.getIndexStage()
180
- }
181
- // this.controlDatas = this.controlData
182
- this.getPedPhasePos()
183
- this.handlePatternData()
184
- this.handleBarrierHeight()
185
- },
186
- // 深度观察监听
187
- deep: true
188
- },
189
- phaseList: {
190
- handler: function (val, oldVal) {
191
- this.getPedPhasePos()
192
- this.getBusPos()
193
- this.getStage()
194
- this.handlePatternData()
195
- },
196
- // 深度观察监听
197
- deep: true
198
- },
199
- agentId: {
200
- handler: function (val, oldVal) {
201
- this.getBusPos()
202
- },
203
- // 深度观察监听
204
- deep: true
205
- },
206
- patternId: {
207
- handler: function (val, oldVal) {
208
- this.patternIds = this.patternId
209
- },
210
- // 深度观察监听
211
- deep: true
212
- },
213
- cycles: {
214
- handler: function (val, oldVal) {
215
- this.newCycle = this.cycles
216
- },
217
- // 深度观察监听
218
- deep: true
219
- },
220
- contrloType: {
221
- handler: function (val, oldVal) {
222
- if (this.contrloType === 'stage') {
223
- this.getStage()
224
- }
225
- },
226
- // 深度观察监听
227
- deep: true
228
- },
229
- stagesChange: {
230
- handler: function (val, oldVal) {
231
- if (this.contrloType === 'stage') {
232
- this.getStage()
233
- }
234
- },
235
- // 深度观察监听
236
- deep: true
237
- },
238
- patternStatusList: {
239
- handler: function (val, oldVal) {
240
- this.handleBarrierHeight() // 计算屏障高度
241
- if (this.patternStatusList && this.newCycle) {
242
- setTimeout(() => {
243
- this.handleCurrentChange(this.patternStatusList)
244
- }, 10)
245
- this.handleBarrierHeight()
246
- }
247
- },
248
- // 深度观察监听
249
- deep: true
250
- }
251
- },
252
- created () {
253
- this.globalParamModel = this.$store.getters.globalParamModel
254
- if (this.patternStatusList && this.newCycle && !this.controlData) {
255
- setTimeout(() => {
256
- this.handleCurrentChange(this.patternStatusList)
257
- this.handleBarrierHeight()
258
- }, 400)
259
- } else {
260
- this.handlePatternData()
261
- }
262
- this.PhaseDataModel = new PhaseDataModel()
263
- this.CrossDiagramMgr = new CrossDiagramMgr()
264
- this.getPedPhasePos()
265
- this.getBusPos()
266
- if (this.contrloType === 'stage') {
267
- this.getStage()
268
- }
269
- },
270
- methods: {
271
- getPed (data) {
272
- let ped = []
273
- for (let stg of data) {
274
- let peddirections = []
275
- let currPhase = this.phaseList.filter((item) => {
276
- return item.id === stg
277
- })[0]
278
- for (let walk of this.sidewalkPhaseData) {
279
- for (let ped of currPhase.peddirection) {
280
- if (stg === walk.phaseid) {
281
- let obj = {}
282
- obj.name = walk.name
283
- obj.id = walk.id
284
- if (ped === walk.id) {
285
- peddirections.push(obj)
286
- peddirections = Array.from(new Set(peddirections))
287
- }
288
- }
289
- }
290
- }
291
- ped.push(...peddirections)
292
- }
293
- return ped
294
- },
295
- handleStageData (data) {
296
- if (!data) return
297
- let stagesTemp = []
298
- let tempList = []
299
- for (let stg of data) {
300
- let directionList = []
301
- let currPhase = this.phaseList.filter((item) => {
302
- return item.id === stg
303
- })[0]
304
- if (currPhase !== undefined) {
305
- directionList.push(...currPhase.direction)
306
- directionList = Array.from(new Set(directionList))
307
- }
308
- // if (directionList.length === 0) return
309
- tempList = directionList.map(dir => ({
310
- id: dir,
311
- color: '#606266'
312
- }))
313
- stagesTemp.push(...tempList)
314
- }
315
- return stagesTemp
316
- },
317
- getIndexStage () {
318
- if (this.localPatternList.length === 0) return
319
- for (let i = 0; i < this.localPatternList.length; i++) {
320
- if (this.controlData.patternid === this.localPatternList[i].id) {
321
- if (!this.localPatternList[i].stagesList) return
322
- let stageCycleList = this.localPatternList[i].stagesList.map(item => {
323
- return item.stageSplit ? item.stageSplit : 0
324
- })
325
- let stageMaxCyle = stageCycleList.reduce((a, b) => {
326
- return a + b
327
- }, 0)
328
- this.stageLists = this.localPatternList[i].stagesList.map(item => {
329
- return {
330
- ...item,
331
- peddirection: this.getPed(item.phases ? item.phases : item.stages),
332
- direction: this.handleStageData(item.phases ? item.phases : item.stages),
333
- greenWidth: (item.green / stageMaxCyle * 100).toFixed(3) + '%',
334
- yellowWidth: (item.yellow / stageMaxCyle * 100).toFixed(3) + '%',
335
- redWidth: (item.red / stageMaxCyle * 100).toFixed(3) + '%'
336
- }
337
- })
338
- }
339
- }
340
- },
341
- getStage () {
342
- if (!this.stagesChange) return
343
- let stageCycleList = this.stagesChange.map(item => {
344
- return item.stageSplit ? item.stageSplit : 0
345
- })
346
- let stageMaxCyle = stageCycleList.reduce((a, b) => {
347
- return a + b
348
- }, 0)
349
- this.stageLists = this.stagesChange.map(item => {
350
- return {
351
- ...item,
352
- peddirection: this.getPed(item.phases ? item.phases : item.stages),
353
- direction: this.handleStageData(item.phases ? item.phases : item.stages),
354
- greenWidth: (item.green / stageMaxCyle * 100).toFixed(3) + '%',
355
- yellowWidth: (item.yellow / stageMaxCyle * 100).toFixed(3) + '%',
356
- redWidth: (item.red / stageMaxCyle * 100).toFixed(3) + '%'
357
- }
358
- })
359
- },
360
- getBusPos () {
361
- // 公交相位信息
362
- this.busPhaseData = []
363
- this.phaseList.forEach((ele, i) => {
364
- // if (ele.controltype >= 3 && ele.controltype <= 5) {
365
- ele.direction.forEach((dir, index) => {
366
- // 车道相位
367
- this.busPhaseData.push({
368
- phaseid: ele.id, // 相位id,用于对应相位状态
369
- id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
370
- name: this.PhaseDataModel.getBusPhasePos(dir).name,
371
- controltype: ele.controltype
372
- })
373
- })
374
- // }
375
- })
376
- let result = []
377
- let obj = {}
378
- for (var i = 0; i < this.busPhaseData.length; i++) {
379
- if (!obj[this.busPhaseData[i].phaseid]) {
380
- result.push(this.busPhaseData[i])
381
- obj[this.busPhaseData[i].phaseid] = true
382
- }
383
- }
384
- this.busPhaseData = result
385
- },
386
- getPedPhasePos () {
387
- // 行人相位信息
388
- this.sidewalkPhaseData = []
389
- this.phaseList.forEach((ele, i) => {
390
- if (ele.peddirection) {
391
- ele.peddirection.forEach((dir, index) => {
392
- // 行人相位
393
- if (this.PhaseDataModel.getSidePos(dir)) {
394
- this.sidewalkPhaseData.push({
395
- key: this.CrossDiagramMgr.getUniqueKey('pedphase'),
396
- phaseid: ele.id, // 相位id,用于对应相位状态
397
- id: dir,
398
- name: this.PhaseDataModel.getSidePos(dir).name
399
- })
400
- }
401
- })
402
- }
403
- })
404
- },
405
- handlePatternData () {
406
- if (!this.controlData) return
407
- this.newList = []
408
- if (Object.keys(this.controlData).length === 0 || this.phaseList.length === 0) return
409
- if (!this.controlData.phase) return
410
- let cycle = this.controlData.cycle
411
- if (!this.controlData.rings) return
412
- for (let rings of this.controlData.rings) {
413
- let phase = this.controlData.phase
414
- let list = []
415
- for (let sequ of rings.sequence) {
416
- let obj = {}
417
- obj.id = sequ
418
- let split = phase.filter((item) => {
419
- return item.id === sequ
420
- })[0].split
421
- let currPhase = this.phaseList.filter((item) => {
422
- if (item.id === sequ && item.controltype === 99) {
423
- obj.controltype = item.controltype
424
- }
425
- return item.id === sequ
426
- })[0]
427
- if (currPhase) {
428
- obj.redWidth = (currPhase.redclear / cycle * 100).toFixed(3) + '%'
429
- obj.yellowWidth = (currPhase.yellow / cycle * 100).toFixed(3) + '%'
430
- obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / cycle * 100).toFixed(3) + '%'
431
- obj.flashgreen = (currPhase.flashgreen / cycle * 100).toFixed(3) + '%'
432
- // obj.peddirection = currPhase.peddirection
433
- let peddirections = []
434
- for (let walk of this.sidewalkPhaseData) {
435
- for (let ped of currPhase.peddirection) {
436
- // if (stg === walk.phaseid) {
437
- let objs = {}
438
- objs.name = walk.name
439
- objs.id = walk.id
440
- if (ped === walk.id) {
441
- peddirections.push(objs)
442
- peddirections = Array.from(new Set(peddirections))
443
- }
444
- // }
445
- }
446
- }
447
- obj.peddirection = peddirections
448
- obj.split = split
449
- obj.direction = currPhase.direction.map(item => {
450
- return {
451
- id: item,
452
- color: '#454545'
453
- }
454
- })
455
- list.push(obj)
456
- }
457
- }
458
- this.newList.push(list)
459
- this.patternInfo = [...this.newList]
460
- }
461
- },
462
- handleBarrierHeight () { // 屏障高度
463
- if (!this.patternInfo) return
464
- let patternLength = this.patternInfo.length
465
- this.barrierHeight = (patternLength * 35 + 21) + 'px'
466
- },
467
- handleCurrentChange (val) { // 两个ring的数据
468
- if (val === null || val.length === 0) return
469
- this.patternInfo = []
470
- this.barrierList = []
471
- let currentArr = []
472
- let newPattern = []
473
- val.map(i => {
474
- newPattern.push(...i)
475
- })
476
- if (this.phaseList.length === 0) return
477
- for (let patternStatus of val[0]) {
478
- if (patternStatus.mode !== 7) {
479
- let concurrent = this.phaseList.filter((item) => {
480
- return item.id === patternStatus.id // patternStatus.id当前相位id concurrent当前相位的并发相位
481
- })[0].concurrent// 当前相位的并发相位
482
- if (concurrent) {
483
- let obj = {
484
- id: patternStatus.id,
485
- current: concurrent.sort()
486
- }
487
- currentArr.push(obj)
488
- }
489
- }
490
- }
491
- if (currentArr.length !== 0) {
492
- let newCurrent = this.tranform(currentArr)
493
- let ringTeam = this.step1(this.phaseList, newCurrent)
494
- if (this.patternList) {
495
- this.setBarrier(ringTeam, val)
496
- }
497
- this.fillGap(ringTeam, val)
498
- let barrier = this.step2(ringTeam, newPattern)
499
- this.barrierList = barrier.map(j => {
500
- return (j / (this.max ? this.max : this.newCycle) * 100) + '%'
501
- })
502
- // this.barrierList.unshift(0)
503
- }
504
- for (let rings of val) {
505
- if (rings.length === 0) continue
506
- let list = []
507
- for (let ring of rings) {
508
- if (ring.value === 0) continue
509
- let obj = {}
510
- let split = ring.value
511
- obj.id = ring.id
512
- // obj.split = split
513
- let currPhase = this.phaseList.filter((item) => {
514
- if (item.id === ring.id && item.controltype === 99) {
515
- obj.controltype = item.controltype
516
- }
517
- return item.id === ring.id
518
- })[0]
519
- if (ring.desc) {
520
- obj.direction = ring.desc.map(item => { // 虚相位desc为空
521
- return {
522
- id: item.id,
523
- color: '#454545'
524
- }
525
- })
526
- } else {
527
- obj.direction = currPhase.direction.map(item => {
528
- return {
529
- id: item,
530
- color: '#454545'
531
- }
532
- })
533
- }
534
- if (ring.sum) {
535
- obj.split = split + ring.sum
536
- obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen + ring.sum) / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
537
- } else {
538
- obj.split = split
539
- obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
540
- }
541
- obj.flashgreen = (currPhase.flashgreen / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
542
- obj.redWidth = (currPhase.redclear / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
543
- obj.yellowWidth = (currPhase.yellow / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
544
- // obj.peddirection = currPhase.peddirection
545
- let peddirections = []
546
- for (let walk of this.sidewalkPhaseData) {
547
- for (let ped of currPhase.peddirection) {
548
- // if (stg === walk.phaseid) {
549
- let objs = {}
550
- objs.name = walk.name
551
- objs.id = walk.id
552
- if (ped === walk.id) {
553
- peddirections.push(objs)
554
- peddirections = Array.from(new Set(peddirections))
555
- }
556
- // }
557
- }
558
- }
559
- obj.peddirection = peddirections
560
- // 忽略相位不显示
561
- let mode = ring.mode
562
- if (mode !== 7) { // 忽略相位不显示
563
- list.push(obj)
564
- }
565
- }
566
- this.patternInfo.push(list)
567
- }
568
- },
569
- setBarrier (ringTeam, val) { // 添加特征参数barrier
570
- this.patternList.map(item => {
571
- if (item.id === this.patternIds) {
572
- const patternObjs = {}
573
- val.forEach(l => {
574
- l.map(k => {
575
- patternObjs[k.id] = k.value
576
- })
577
- })
578
- let ret = ringTeam.map((y, index) => {
579
- y.map(n => {
580
- n.length = n.data.length > 1 ? n.data.reduce((pre, cur) => pre + patternObjs[cur], 0) : patternObjs[n.data[0]]
581
- })
582
- return {
583
- barrier: index + 1,
584
- length: y[0].length,
585
- items: y.map(j => {
586
- return {
587
- ring: j.ring,
588
- data: j.data
589
- }
590
- })
591
- }
592
- })
593
- item.barriers = ret
594
- }
595
- })
596
- },
597
- tranform (arr) { // 分barrier
598
- let newMap = new Map()
599
- arr.forEach(({id, current}) => {
600
- const find = newMap.get(current.join())
601
- if (find) newMap.get(current.join()).push(id)
602
- else newMap.set(current.join(), [id])
603
- })
604
- let ret = []
605
- newMap.forEach((value, key) => {
606
- ret.push(Array.from(new Set(key.split(',').map(Number).concat(value))))
607
- })
608
- const result = []
609
- for (const a of ret) {
610
- let merged = false
611
- for (const r of result) {
612
- if (this.check([...r], a)) {
613
- a.forEach(item => r.add(item))
614
- merged = true
615
- }
616
- }
617
- if (!merged) {
618
- result.push(new Set(a))
619
- }
620
- merged = false
621
- }
622
- return result.map(s => [...s])
623
- },
624
- check (arr1, arr2) {
625
- return arr1.some(a1 => arr2.some(a2 => a1 === a2))
626
- },
627
- step1 (list, arr) { // 各个环包含的相位
628
- const ret = []
629
- const listObj = {}
630
- list.forEach(l => {
631
- listObj[l.id] = l.ring
632
- })
633
- arr.forEach(a => {
634
- const retItem = []
635
- a.forEach(b => {
636
- if (listObj[b]) {
637
- const find = retItem.find(r => r.ring === listObj[b])
638
- if (find) find.data.push(b)
639
- else retItem.push({ring: listObj[b], data: [b]})
640
- }
641
- })
642
- ret.push(retItem)
643
- })
644
- return ret
645
- },
646
- step2 (newArr, pattern) { // 不同环并发相位做比较
647
- let ret = []
648
- const patternObj = {}
649
- pattern.forEach(l => {
650
- if (l.mode !== 7) {
651
- patternObj[l.id] = l.value
652
- }
653
- })
654
- newArr.forEach((na, index) => {
655
- let max = 0
656
- na.forEach(n => {
657
- const total = n.data.reduce((pre, cur) => pre + patternObj[cur], 0)
658
- if (total > max) {
659
- max = total
660
- }
661
- })
662
- while (index > 0 && max < this.newCycle) { // && max < _this.newCycle
663
- index--
664
- max += ret[index]
665
- }
666
- ret.push(max)
667
- })
668
- return ret
669
- },
670
- fillGap (newArr, pattern) {
671
- this.newPatterns = []
672
- const patternObj = {}
673
- pattern.forEach(l => {
674
- l.map(k => {
675
- if (k.mode !== 7) {
676
- patternObj[k.id] = k.value
677
- }
678
- })
679
- })
680
- let newMax = []
681
- let newMin = []
682
- newArr.forEach((na, index) => {
683
- na.map(n => {
684
- n.length = n.data.length > 1 ? n.data.reduce((pre, cur) => pre + patternObj[cur], 0) : patternObj[n.data[0]]
685
- })
686
- let maxNum = Math.max.apply(Math, na.map(item => { return item.length }))
687
- let minNum = Math.min.apply(Math, na.map(item => { return item.length }))
688
- newMax.push(maxNum)
689
- newMin.push(minNum)
690
- let newmaxNum = Math.max.apply(Math, newMax)// 每组最大值
691
- let newminNum = Math.min.apply(Math, newMin)
692
- if (newmaxNum === newminNum) {
693
- this.newCycle = newmaxNum + newminNum
694
- this.max = newmaxNum + newminNum
695
- pattern.map(d => {
696
- d.map(r => {
697
- if (r.sum && r.mode !== 7) {
698
- delete r.sum
699
- }
700
- })
701
- })
702
- }
703
- if (maxNum === minNum) {
704
- na.map(n => {
705
- pattern.map(h => {
706
- h.map(d => {
707
- if (d.id === n.data[1] && d.sum && d.mode !== 7) {
708
- delete d.sum
709
- }
710
- })
711
- })
712
- })
713
- } else {
714
- na.map(n => {
715
- if (n.length === maxNum) {
716
- pattern.map(h => {
717
- h.map(d => {
718
- if (n.data.length > 1) {
719
- if (d.id === n.data[1] && d.mode !== 7) {
720
- delete d.sum
721
- }
722
- } else {
723
- if (d.id === n.data[0] && d.mode !== 7) {
724
- delete d.sum
725
- }
726
- }
727
- })
728
- })
729
- }
730
- })
731
- }
732
- na.forEach((value, index, array) => {
733
- if (value.length !== maxNum) {
734
- let newNa = []
735
- newNa.push(value)
736
- newNa.forEach(m => {
737
- let sum = Number(maxNum - m.length)
738
- pattern.filter((i) => {
739
- i.map(j => {
740
- if (m.data.length > 1) {
741
- if (j.id === m.data[1] && j.mode !== 7) {
742
- j.sum = sum
743
- }
744
- } else {
745
- if (j.id === m.data[0] && j.mode !== 7) {
746
- j.sum = sum
747
- }
748
- }
749
- })
750
- })
751
- })
752
- }
753
- let mapAdd = pattern.map(item => {
754
- return item.map(val => {
755
- return val.mode === 7 ? 0 : val.value + (val.sum ? val.sum : 0)
756
- })
757
- })
758
- let maxCycle = mapAdd.length > 0 ? mapAdd.map(item => {
759
- return item.length > 0 ? item.reduce((a, b) => {
760
- return a + b
761
- }) : 0
762
- }) : 0
763
- this.max = Math.max(...maxCycle)// 每个环的周期最大值
764
- })
765
- })
766
- }
767
- }
768
- }
769
- </script>
770
- <style lang="scss">
771
- // el-tooltip样式
772
- .el-tooltip__popper.is-light {
773
- background: #409EFF !important;
774
- border: 1px solid #409EFF !important;
775
- color: #FFFFFF !important;
776
- }
777
- .el-tooltip__popper.is-light[x-placement^="top"] .popper__arrow {
778
- border-top-color: #409EFF !important;
779
- }
780
- .el-tooltip__popper.is-light[x-placement^="top"] .popper__arrow::after {
781
- border-top-color: #409EFF !important;
782
- }
783
- </style>
784
- <style lang="scss" scoped>
785
- .main-patternstatus {
786
- position: relative;
787
- margin-bottom: 20px;
788
- }
789
- .main-patternstatus {
790
- position: relative;
791
- .ring-first {
792
- margin-top: 1px;
793
- width: 100%;
794
- height: 34px;
795
- }
796
- .first-1 {
797
- float: left;
798
- // text-align: center;
799
- }
800
- // .ring-num {
801
- // float: left;
802
- // margin-top:7px;
803
- // margin-left: 5px;
804
- // font-size: 14px;
805
- // font-weight: normal;
806
- // font-stretch: normal;
807
- // line-height: 22px;
808
- // letter-spacing: 0px;
809
- // color: #ffffff;
810
- // }
811
- .box {
812
- float: left;
813
- margin-left: 6px;
814
- margin-right: 10px;
815
- }
816
- .ring-nums {
817
- // float: left;
818
- // margin-top:7px;
819
- // margin-left: 5px;
820
- font-size: 12px;
821
- height: 14px;
822
- font-weight: normal;
823
- font-stretch: normal;
824
- // line-height: 22px;
825
- letter-spacing: 0px;
826
- color: #333333;
827
- }
828
- .ring-phase {
829
- position: relative;
830
- float: left;
831
- // margin-left: 5px;
832
- height: 34px;
833
- z-index: 999;
834
- background: rgba(30, 96, 12, 0.2);
835
- // margin-top:1px;
836
- }
837
- .ring-phase::after {
838
- position: absolute;
839
- display: block;
840
- content: '';
841
- height: 0;
842
- width: 0;
843
- top: 11px;
844
- left: 36px;
845
- border: 5px solid transparent;
846
- border-left-color: rgba(30, 96, 12, 0.2);
847
- }
848
- .divider {
849
- position: absolute;
850
- top: -10px;
851
- // left: 370px;
852
- width: 3px;
853
- // height: 99px;
854
- z-index: 999;
855
- background-color:#B9BABF;
856
- }
857
- .curTimeLine {
858
- position: absolute;
859
- top: -10px;
860
- width: 2px;
861
- background-color: #409EFF;
862
- }
863
- .curTimeDiv {
864
- position: absolute;
865
- z-index:50;
866
- top: -21px;
867
- margin-left: -30px;
868
- text-align:center;
869
- vertical-align: middle;
870
- width: 60px;
871
- height: 19px;
872
- color:#FFFFFF;
873
- background-color: #409EFF;
874
- }
875
- }
876
- .ring-first {
877
- margin-top: 1px;
878
- width: 100%;
879
- height: 34px;
880
- }
881
- .direction {
882
- opacity: 0.6;
883
- }
884
- .first-1 {
885
- float: left;
886
- // text-align: center;
887
- }
888
- </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="main-patternstatus">
14
+ <!-- 环模式true -->
15
+ <div v-if="this.contrloType === 'ring' || !this.contrloType">
16
+ <div class="ring-first" v-for="(list, index1) in patternInfo" :key="index1">
17
+ <div v-for="(item,index2) in list" :key="index2" :class="item.controltype===99?'direction': ''">
18
+ <div class="first-1" :style="{'width':item.greenWidth,'height':'34px','background':'#7ccc66'}">
19
+ <el-tooltip placement="top-start" effect="light">
20
+ <div slot="content">P{{item.id}}:{{item.split}}</div>
21
+ <div style="cursor:pointer;">
22
+ <div class="ring-phase">
23
+ <patternwalksvg :showWalk="item.peddirection" :Width="'32'" :Height="'34'"></patternwalksvg>
24
+ <xdrdirselector Width="36px" Height="34px" :showlist="item.direction"></xdrdirselector>
25
+ </div>
26
+ <div class="box">
27
+ <div class="ring-nums">P{{item.id}}</div>
28
+ <div class="ring-nums">{{item.split}}</div>
29
+ </div>
30
+ </div>
31
+ </el-tooltip>
32
+ <div style="position:relative; width:50px;" v-for="(bus,index3) in busPhaseData" :key="index3">
33
+ <i class="iconfont icon-lukouzhilu" style="position: absolute;top: 8px;font-size:12px;color:#454545;" v-if="bus.controltype === 1 && bus.phaseid===item.id"></i>
34
+ <i class="iconfont icon-BRT" style="position: absolute;top: 8px;font-size:12px;color:#454545;" v-if="bus.controltype === 4 && bus.phaseid===item.id"></i>
35
+ <i class="iconfont icon-xuxiangwei" style="position: absolute;top: 8px;font-size:12px;color:#454545;" v-if="bus.controltype === 99 && bus.phaseid===item.id"></i>
36
+ <i class="iconfont icon-feijidongche" style="position: absolute;top: 8px;font-size:12px;color:#454545;" v-if="bus.controltype === 6 && bus.phaseid===item.id"></i>
37
+ <i class="iconfont icon-gongjiaoche" style="position: absolute;top: 8px;font-size:12px;color:#454545;" v-if="bus.controltype === 3 && bus.phaseid===item.id"></i>
38
+ <i class="iconfont icon-youguidianche" style="position: absolute;top: 8px;font-size:12px;color:#454545;" v-if="bus.controltype === 5 && bus.phaseid===item.id"></i>
39
+ </div>
40
+ </div>
41
+ <div class="first-1" :style="{'width':item.flashgreen,'height':'34px','float':'left','background': 'linear-gradient(to right, #ffffff 50%, #7ccc66 0)','background-size': '4px 100%'}"></div>
42
+ <div class="first-1" :style="{'width':item.yellowWidth,'height':'34px','background':'#f9dc6a'}"></div>
43
+ <div class="first-1" :style="{'width':item.redWidth,'height':'34px','background':'#f27979'}"></div>
44
+ </div>
45
+ </div>
46
+ <div v-for="(item, index) in barrierList" :key="index + '1'">
47
+ <div class="divider" :style="{'left':item, 'height':barrierHeight}"></div>
48
+ </div>
49
+ <div v-show="(syncTime && cycle && cycle>0) || (syncTime && newCycle && newCycle>0)">
50
+ <div class="curTimeDiv" :style="{'left':paddingLeft, 'background-color': '#409EFF'}">{{ timeNumDevide }}</div>
51
+ <div class="curTimeLine" :style="{'left':paddingLeft, 'height':barrierHeight}"></div>
52
+ </div>
53
+ </div>
54
+ <div v-if="this.contrloType === 'stage'">
55
+ <div v-for="(list, index1) in stageLists" :key="index1">
56
+ <!-- <div> -->
57
+ <div class="first-1" :style="{'width':list.greenWidth,'height':'34px','background':'#7ccc66'}">
58
+ <el-tooltip placement="top-start" effect="light">
59
+ <div slot="content">
60
+ <span class="ring-nums" v-for="(pha,index) in list.phases" :key="index">
61
+ P:{{pha}}
62
+ </span>
63
+ </div>
64
+ <div style="cursor:pointer;">
65
+ <div class="ring-phase">
66
+ <patternwalksvg :showWalk="list.peddirection" :Width="'32'" :Height="'34'"></patternwalksvg>
67
+ <xdrdirselector Width="36px" Height="34px" :showlist="list.direction"></xdrdirselector>
68
+ </div>
69
+ <div class="box" style="line-height:28px">
70
+ <span class="ring-nums" v-for="(pha,index) in list.phases" :key="index">
71
+ P:{{pha}}
72
+ </span>
73
+ </div>
74
+ </div>
75
+ </el-tooltip>
76
+ </div>
77
+ <!-- <div class="first-1" :style="{'width':item.flashgreen,'height':'34px','float':'left','background': 'linear-gradient(to right, #ffffff 50%, #7ccc66 0)','background-size': '4px 100%'}"></div> -->
78
+ <div class="first-1" :style="{'width':list.yellowWidth,'height':'34px','background':'#f9dc6a'}"></div>
79
+ <div class="first-1" :style="{'width':list.redWidth,'height':'34px','background':'#f27979'}"></div>
80
+ </div>
81
+ </div>
82
+ <!-- </div> -->
83
+ </div>
84
+ </template>
85
+ <script>
86
+ import patternwalksvg from '../PatternWalkSvg/PatternWalkSvg'
87
+ import xdrdirselector from '../XRDDirSelector/XRDDirSelector'
88
+ // import PatternWalkSvg from '../IntersectionMap/crossDirection/baseImg/PatternWalkSvg'
89
+ import PhaseDataModel from '../IntersectionMap/crossDirection/utils.js'
90
+ import CrossDiagramMgr from '../../../EdgeMgr/controller/crossDiagramMgr.js'
91
+ export default {
92
+ name: 'pattern-list',
93
+ components: {
94
+ patternwalksvg,
95
+ xdrdirselector
96
+ },
97
+ data () {
98
+ return {
99
+ barrierHeight: '',
100
+ barrierList: [],
101
+ newCycle: this.cycles,
102
+ patternIds: this.patternId,
103
+ newPatterns: [],
104
+ newList: [],
105
+ sidewalkPhaseData: [],
106
+ // controlDatas: this.controlData,
107
+ max: '',
108
+ stageLists: [],
109
+ busPhaseData: [], // 公交相位数据
110
+ patternInfo: []
111
+ }
112
+ },
113
+ props: {
114
+ stagesChange: {
115
+ type: Array
116
+ },
117
+ contrloType: {
118
+ type: String
119
+ },
120
+ phaseList: {
121
+ type: Array
122
+ },
123
+ patternList: {
124
+ type: Array
125
+ },
126
+ localPatternList: {
127
+ type: Array
128
+ },
129
+ controlData: {
130
+ type: Object
131
+ },
132
+ cycle: {
133
+ type: Number
134
+ },
135
+ agentId: {
136
+ type: String
137
+ },
138
+ cycles: {
139
+ type: Number
140
+ },
141
+ patternId: {
142
+ type: Number
143
+ },
144
+ patternStatusList: {
145
+ type: Array
146
+ },
147
+ syncTime: {
148
+ type: Number
149
+ }
150
+ },
151
+ computed: {
152
+ paddingLeft () {
153
+ let res = '0%'
154
+ if (this.newCycle && this.newCycle > 0) {
155
+ let curPercent = (this.newCycle - this.syncTime) / this.newCycle
156
+ res = curPercent * 100 + '%'
157
+ }
158
+ if (this.cycle && this.cycle > 0) {
159
+ let curPercent = (this.cycle - this.syncTime) / this.cycle
160
+ res = curPercent * 100 + '%'
161
+ }
162
+ return res
163
+ },
164
+ timeNumDevide () {
165
+ if (this.newCycle && this.newCycle > 0) {
166
+ let res = (this.newCycle - this.syncTime) + '/' + this.newCycle
167
+ return res
168
+ }
169
+ if (this.cycle && this.cycle > 0) {
170
+ let res = (this.cycle - this.syncTime) + '/' + this.cycle
171
+ return res
172
+ }
173
+ }
174
+ },
175
+ watch: {
176
+ controlData: {
177
+ handler: function (val, oldVal) {
178
+ if (this.contrloType === 'stage') {
179
+ this.getIndexStage()
180
+ }
181
+ // this.controlDatas = this.controlData
182
+ this.getPedPhasePos()
183
+ this.handlePatternData()
184
+ this.handleBarrierHeight()
185
+ },
186
+ // 深度观察监听
187
+ deep: true
188
+ },
189
+ phaseList: {
190
+ handler: function (val, oldVal) {
191
+ this.getPedPhasePos()
192
+ this.getBusPos()
193
+ this.getStage()
194
+ this.handlePatternData()
195
+ },
196
+ // 深度观察监听
197
+ deep: true
198
+ },
199
+ agentId: {
200
+ handler: function (val, oldVal) {
201
+ this.getBusPos()
202
+ },
203
+ // 深度观察监听
204
+ deep: true
205
+ },
206
+ patternId: {
207
+ handler: function (val, oldVal) {
208
+ this.patternIds = this.patternId
209
+ },
210
+ // 深度观察监听
211
+ deep: true
212
+ },
213
+ cycles: {
214
+ handler: function (val, oldVal) {
215
+ this.newCycle = this.cycles
216
+ },
217
+ // 深度观察监听
218
+ deep: true
219
+ },
220
+ contrloType: {
221
+ handler: function (val, oldVal) {
222
+ if (this.contrloType === 'stage') {
223
+ this.getStage()
224
+ }
225
+ },
226
+ // 深度观察监听
227
+ deep: true
228
+ },
229
+ stagesChange: {
230
+ handler: function (val, oldVal) {
231
+ if (this.contrloType === 'stage') {
232
+ this.getStage()
233
+ }
234
+ },
235
+ // 深度观察监听
236
+ deep: true
237
+ },
238
+ patternStatusList: {
239
+ handler: function (val, oldVal) {
240
+ this.handleBarrierHeight() // 计算屏障高度
241
+ if (this.patternStatusList && this.newCycle) {
242
+ setTimeout(() => {
243
+ this.handleCurrentChange(this.patternStatusList)
244
+ }, 10)
245
+ this.handleBarrierHeight()
246
+ }
247
+ },
248
+ // 深度观察监听
249
+ deep: true
250
+ }
251
+ },
252
+ created () {
253
+ this.globalParamModel = this.$store.getters.globalParamModel
254
+ if (this.patternStatusList && this.newCycle && !this.controlData) {
255
+ setTimeout(() => {
256
+ this.handleCurrentChange(this.patternStatusList)
257
+ this.handleBarrierHeight()
258
+ }, 400)
259
+ } else {
260
+ this.handlePatternData()
261
+ }
262
+ this.PhaseDataModel = new PhaseDataModel()
263
+ this.CrossDiagramMgr = new CrossDiagramMgr()
264
+ this.getPedPhasePos()
265
+ this.getBusPos()
266
+ if (this.contrloType === 'stage') {
267
+ this.getStage()
268
+ }
269
+ },
270
+ methods: {
271
+ getPed (data) {
272
+ let ped = []
273
+ for (let stg of data) {
274
+ let peddirections = []
275
+ let currPhase = this.phaseList.filter((item) => {
276
+ return item.id === stg
277
+ })[0]
278
+ for (let walk of this.sidewalkPhaseData) {
279
+ for (let ped of currPhase.peddirection) {
280
+ if (stg === walk.phaseid) {
281
+ let obj = {}
282
+ obj.name = walk.name
283
+ obj.id = walk.id
284
+ if (ped === walk.id) {
285
+ peddirections.push(obj)
286
+ peddirections = Array.from(new Set(peddirections))
287
+ }
288
+ }
289
+ }
290
+ }
291
+ ped.push(...peddirections)
292
+ }
293
+ return ped
294
+ },
295
+ handleStageData (data) {
296
+ if (!data) return
297
+ let stagesTemp = []
298
+ let tempList = []
299
+ for (let stg of data) {
300
+ let directionList = []
301
+ let currPhase = this.phaseList.filter((item) => {
302
+ return item.id === stg
303
+ })[0]
304
+ if (currPhase !== undefined) {
305
+ directionList.push(...currPhase.direction)
306
+ directionList = Array.from(new Set(directionList))
307
+ }
308
+ // if (directionList.length === 0) return
309
+ tempList = directionList.map(dir => ({
310
+ id: dir,
311
+ color: '#606266'
312
+ }))
313
+ stagesTemp.push(...tempList)
314
+ }
315
+ return stagesTemp
316
+ },
317
+ getIndexStage () {
318
+ if (this.localPatternList.length === 0) return
319
+ for (let i = 0; i < this.localPatternList.length; i++) {
320
+ if (this.controlData.patternid === this.localPatternList[i].id) {
321
+ if (!this.localPatternList[i].stagesList) return
322
+ let stageCycleList = this.localPatternList[i].stagesList.map(item => {
323
+ return item.stageSplit ? item.stageSplit : 0
324
+ })
325
+ let stageMaxCyle = stageCycleList.reduce((a, b) => {
326
+ return a + b
327
+ }, 0)
328
+ this.stageLists = this.localPatternList[i].stagesList.map(item => {
329
+ return {
330
+ ...item,
331
+ peddirection: this.getPed(item.phases ? item.phases : item.stages),
332
+ direction: this.handleStageData(item.phases ? item.phases : item.stages),
333
+ greenWidth: (item.green / stageMaxCyle * 100).toFixed(3) + '%',
334
+ yellowWidth: (item.yellow / stageMaxCyle * 100).toFixed(3) + '%',
335
+ redWidth: (item.red / stageMaxCyle * 100).toFixed(3) + '%'
336
+ }
337
+ })
338
+ }
339
+ }
340
+ },
341
+ getStage () {
342
+ if (!this.stagesChange) return
343
+ let stageCycleList = this.stagesChange.map(item => {
344
+ return item.stageSplit ? item.stageSplit : 0
345
+ })
346
+ let stageMaxCyle = stageCycleList.reduce((a, b) => {
347
+ return a + b
348
+ }, 0)
349
+ this.stageLists = this.stagesChange.map(item => {
350
+ return {
351
+ ...item,
352
+ peddirection: this.getPed(item.phases ? item.phases : item.stages),
353
+ direction: this.handleStageData(item.phases ? item.phases : item.stages),
354
+ greenWidth: (item.green / stageMaxCyle * 100).toFixed(3) + '%',
355
+ yellowWidth: (item.yellow / stageMaxCyle * 100).toFixed(3) + '%',
356
+ redWidth: (item.red / stageMaxCyle * 100).toFixed(3) + '%'
357
+ }
358
+ })
359
+ },
360
+ getBusPos () {
361
+ // 公交相位信息
362
+ this.busPhaseData = []
363
+ this.phaseList.forEach((ele, i) => {
364
+ // if (ele.controltype >= 3 && ele.controltype <= 5) {
365
+ ele.direction.forEach((dir, index) => {
366
+ // 车道相位
367
+ this.busPhaseData.push({
368
+ phaseid: ele.id, // 相位id,用于对应相位状态
369
+ id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
370
+ name: this.PhaseDataModel.getBusPhasePos(dir).name,
371
+ controltype: ele.controltype
372
+ })
373
+ })
374
+ // }
375
+ })
376
+ let result = []
377
+ let obj = {}
378
+ for (var i = 0; i < this.busPhaseData.length; i++) {
379
+ if (!obj[this.busPhaseData[i].phaseid]) {
380
+ result.push(this.busPhaseData[i])
381
+ obj[this.busPhaseData[i].phaseid] = true
382
+ }
383
+ }
384
+ this.busPhaseData = result
385
+ },
386
+ getPedPhasePos () {
387
+ // 行人相位信息
388
+ this.sidewalkPhaseData = []
389
+ this.phaseList.forEach((ele, i) => {
390
+ if (ele.peddirection) {
391
+ ele.peddirection.forEach((dir, index) => {
392
+ // 行人相位
393
+ if (this.PhaseDataModel.getSidePos(dir)) {
394
+ this.sidewalkPhaseData.push({
395
+ key: this.CrossDiagramMgr.getUniqueKey('pedphase'),
396
+ phaseid: ele.id, // 相位id,用于对应相位状态
397
+ id: dir,
398
+ name: this.PhaseDataModel.getSidePos(dir).name
399
+ })
400
+ }
401
+ })
402
+ }
403
+ })
404
+ },
405
+ handlePatternData () {
406
+ if (!this.controlData) return
407
+ this.newList = []
408
+ if (Object.keys(this.controlData).length === 0 || this.phaseList.length === 0) return
409
+ if (!this.controlData.phase) return
410
+ let cycle = this.controlData.cycle
411
+ if (!this.controlData.rings) return
412
+ for (let rings of this.controlData.rings) {
413
+ let phase = this.controlData.phase
414
+ let list = []
415
+ for (let sequ of rings.sequence) {
416
+ let obj = {}
417
+ obj.id = sequ
418
+ let split = phase.filter((item) => {
419
+ return item.id === sequ
420
+ })[0].split
421
+ let currPhase = this.phaseList.filter((item) => {
422
+ if (item.id === sequ && item.controltype === 99) {
423
+ obj.controltype = item.controltype
424
+ }
425
+ return item.id === sequ
426
+ })[0]
427
+ if (currPhase) {
428
+ obj.redWidth = (currPhase.redclear / cycle * 100).toFixed(3) + '%'
429
+ obj.yellowWidth = (currPhase.yellow / cycle * 100).toFixed(3) + '%'
430
+ obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / cycle * 100).toFixed(3) + '%'
431
+ obj.flashgreen = (currPhase.flashgreen / cycle * 100).toFixed(3) + '%'
432
+ // obj.peddirection = currPhase.peddirection
433
+ let peddirections = []
434
+ for (let walk of this.sidewalkPhaseData) {
435
+ for (let ped of currPhase.peddirection) {
436
+ // if (stg === walk.phaseid) {
437
+ let objs = {}
438
+ objs.name = walk.name
439
+ objs.id = walk.id
440
+ if (ped === walk.id) {
441
+ peddirections.push(objs)
442
+ peddirections = Array.from(new Set(peddirections))
443
+ }
444
+ // }
445
+ }
446
+ }
447
+ obj.peddirection = peddirections
448
+ obj.split = split
449
+ obj.direction = currPhase.direction.map(item => {
450
+ return {
451
+ id: item,
452
+ color: '#454545'
453
+ }
454
+ })
455
+ list.push(obj)
456
+ }
457
+ }
458
+ this.newList.push(list)
459
+ this.patternInfo = [...this.newList]
460
+ }
461
+ },
462
+ handleBarrierHeight () { // 屏障高度
463
+ if (!this.patternInfo) return
464
+ let patternLength = this.patternInfo.length
465
+ this.barrierHeight = (patternLength * 35 + 21) + 'px'
466
+ },
467
+ handleCurrentChange (val) { // 两个ring的数据
468
+ if (val === null || val.length === 0) return
469
+ this.patternInfo = []
470
+ this.barrierList = []
471
+ let currentArr = []
472
+ let newPattern = []
473
+ val.map(i => {
474
+ newPattern.push(...i)
475
+ })
476
+ if (this.phaseList.length === 0) return
477
+ for (let patternStatus of val[0]) {
478
+ if (patternStatus.mode !== 7) {
479
+ let concurrent = this.phaseList.filter((item) => {
480
+ return item.id === patternStatus.id // patternStatus.id当前相位id concurrent当前相位的并发相位
481
+ })[0].concurrent// 当前相位的并发相位
482
+ if (concurrent) {
483
+ let obj = {
484
+ id: patternStatus.id,
485
+ current: concurrent.sort()
486
+ }
487
+ currentArr.push(obj)
488
+ }
489
+ }
490
+ }
491
+ if (currentArr.length !== 0) {
492
+ let newCurrent = this.tranform(currentArr)
493
+ let ringTeam = this.step1(this.phaseList, newCurrent)
494
+ if (this.patternList) {
495
+ this.setBarrier(ringTeam, val)
496
+ }
497
+ this.fillGap(ringTeam, val)
498
+ let barrier = this.step2(ringTeam, newPattern)
499
+ this.barrierList = barrier.map(j => {
500
+ return (j / (this.max ? this.max : this.newCycle) * 100) + '%'
501
+ })
502
+ // this.barrierList.unshift(0)
503
+ }
504
+ for (let rings of val) {
505
+ if (rings.length === 0) continue
506
+ let list = []
507
+ for (let ring of rings) {
508
+ if (ring.value === 0) continue
509
+ let obj = {}
510
+ let split = ring.value
511
+ obj.id = ring.id
512
+ // obj.split = split
513
+ let currPhase = this.phaseList.filter((item) => {
514
+ if (item.id === ring.id && item.controltype === 99) {
515
+ obj.controltype = item.controltype
516
+ }
517
+ return item.id === ring.id
518
+ })[0]
519
+ if (ring.desc) {
520
+ obj.direction = ring.desc.map(item => { // 虚相位desc为空
521
+ return {
522
+ id: item.id,
523
+ color: '#454545'
524
+ }
525
+ })
526
+ } else {
527
+ obj.direction = currPhase.direction.map(item => {
528
+ return {
529
+ id: item,
530
+ color: '#454545'
531
+ }
532
+ })
533
+ }
534
+ if (ring.sum) {
535
+ obj.split = split + ring.sum
536
+ obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen + ring.sum) / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
537
+ } else {
538
+ obj.split = split
539
+ obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
540
+ }
541
+ obj.flashgreen = (currPhase.flashgreen / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
542
+ obj.redWidth = (currPhase.redclear / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
543
+ obj.yellowWidth = (currPhase.yellow / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
544
+ // obj.peddirection = currPhase.peddirection
545
+ let peddirections = []
546
+ for (let walk of this.sidewalkPhaseData) {
547
+ for (let ped of currPhase.peddirection) {
548
+ // if (stg === walk.phaseid) {
549
+ let objs = {}
550
+ objs.name = walk.name
551
+ objs.id = walk.id
552
+ if (ped === walk.id) {
553
+ peddirections.push(objs)
554
+ peddirections = Array.from(new Set(peddirections))
555
+ }
556
+ // }
557
+ }
558
+ }
559
+ obj.peddirection = peddirections
560
+ // 忽略相位不显示
561
+ let mode = ring.mode
562
+ if (mode !== 7) { // 忽略相位不显示
563
+ list.push(obj)
564
+ }
565
+ }
566
+ this.patternInfo.push(list)
567
+ }
568
+ },
569
+ setBarrier (ringTeam, val) { // 添加特征参数barrier
570
+ this.patternList.map(item => {
571
+ if (item.id === this.patternIds) {
572
+ const patternObjs = {}
573
+ val.forEach(l => {
574
+ l.map(k => {
575
+ patternObjs[k.id] = k.value
576
+ })
577
+ })
578
+ let ret = ringTeam.map((y, index) => {
579
+ y.map(n => {
580
+ n.length = n.data.length > 1 ? n.data.reduce((pre, cur) => pre + patternObjs[cur], 0) : patternObjs[n.data[0]]
581
+ })
582
+ return {
583
+ barrier: index + 1,
584
+ length: y[0].length,
585
+ items: y.map(j => {
586
+ return {
587
+ ring: j.ring,
588
+ data: j.data
589
+ }
590
+ })
591
+ }
592
+ })
593
+ item.barriers = ret
594
+ }
595
+ })
596
+ },
597
+ tranform (arr) { // 分barrier
598
+ let newMap = new Map()
599
+ arr.forEach(({id, current}) => {
600
+ const find = newMap.get(current.join())
601
+ if (find) newMap.get(current.join()).push(id)
602
+ else newMap.set(current.join(), [id])
603
+ })
604
+ let ret = []
605
+ newMap.forEach((value, key) => {
606
+ ret.push(Array.from(new Set(key.split(',').map(Number).concat(value))))
607
+ })
608
+ const result = []
609
+ for (const a of ret) {
610
+ let merged = false
611
+ for (const r of result) {
612
+ if (this.check([...r], a)) {
613
+ a.forEach(item => r.add(item))
614
+ merged = true
615
+ }
616
+ }
617
+ if (!merged) {
618
+ result.push(new Set(a))
619
+ }
620
+ merged = false
621
+ }
622
+ return result.map(s => [...s])
623
+ },
624
+ check (arr1, arr2) {
625
+ return arr1.some(a1 => arr2.some(a2 => a1 === a2))
626
+ },
627
+ step1 (list, arr) { // 各个环包含的相位
628
+ const ret = []
629
+ const listObj = {}
630
+ list.forEach(l => {
631
+ listObj[l.id] = l.ring
632
+ })
633
+ arr.forEach(a => {
634
+ const retItem = []
635
+ a.forEach(b => {
636
+ if (listObj[b]) {
637
+ const find = retItem.find(r => r.ring === listObj[b])
638
+ if (find) find.data.push(b)
639
+ else retItem.push({ring: listObj[b], data: [b]})
640
+ }
641
+ })
642
+ ret.push(retItem)
643
+ })
644
+ return ret
645
+ },
646
+ step2 (newArr, pattern) { // 不同环并发相位做比较
647
+ let ret = []
648
+ const patternObj = {}
649
+ pattern.forEach(l => {
650
+ if (l.mode !== 7) {
651
+ patternObj[l.id] = l.value
652
+ }
653
+ })
654
+ newArr.forEach((na, index) => {
655
+ let max = 0
656
+ na.forEach(n => {
657
+ const total = n.data.reduce((pre, cur) => pre + patternObj[cur], 0)
658
+ if (total > max) {
659
+ max = total
660
+ }
661
+ })
662
+ while (index > 0 && max < this.newCycle) { // && max < _this.newCycle
663
+ index--
664
+ max += ret[index]
665
+ }
666
+ ret.push(max)
667
+ })
668
+ return ret
669
+ },
670
+ fillGap (newArr, pattern) {
671
+ this.newPatterns = []
672
+ const patternObj = {}
673
+ pattern.forEach(l => {
674
+ l.map(k => {
675
+ if (k.mode !== 7) {
676
+ patternObj[k.id] = k.value
677
+ }
678
+ })
679
+ })
680
+ let newMax = []
681
+ let newMin = []
682
+ newArr.forEach((na, index) => {
683
+ na.map(n => {
684
+ n.length = n.data.length > 1 ? n.data.reduce((pre, cur) => pre + patternObj[cur], 0) : patternObj[n.data[0]]
685
+ })
686
+ let maxNum = Math.max.apply(Math, na.map(item => { return item.length }))
687
+ let minNum = Math.min.apply(Math, na.map(item => { return item.length }))
688
+ newMax.push(maxNum)
689
+ newMin.push(minNum)
690
+ let newmaxNum = Math.max.apply(Math, newMax)// 每组最大值
691
+ let newminNum = Math.min.apply(Math, newMin)
692
+ if (newmaxNum === newminNum) {
693
+ this.newCycle = newmaxNum + newminNum
694
+ this.max = newmaxNum + newminNum
695
+ pattern.map(d => {
696
+ d.map(r => {
697
+ if (r.sum && r.mode !== 7) {
698
+ delete r.sum
699
+ }
700
+ })
701
+ })
702
+ }
703
+ if (maxNum === minNum) {
704
+ na.map(n => {
705
+ pattern.map(h => {
706
+ h.map(d => {
707
+ if (d.id === n.data[1] && d.sum && d.mode !== 7) {
708
+ delete d.sum
709
+ }
710
+ })
711
+ })
712
+ })
713
+ } else {
714
+ na.map(n => {
715
+ if (n.length === maxNum) {
716
+ pattern.map(h => {
717
+ h.map(d => {
718
+ if (n.data.length > 1) {
719
+ if (d.id === n.data[1] && d.mode !== 7) {
720
+ delete d.sum
721
+ }
722
+ } else {
723
+ if (d.id === n.data[0] && d.mode !== 7) {
724
+ delete d.sum
725
+ }
726
+ }
727
+ })
728
+ })
729
+ }
730
+ })
731
+ }
732
+ na.forEach((value, index, array) => {
733
+ if (value.length !== maxNum) {
734
+ let newNa = []
735
+ newNa.push(value)
736
+ newNa.forEach(m => {
737
+ let sum = Number(maxNum - m.length)
738
+ pattern.filter((i) => {
739
+ i.map(j => {
740
+ if (m.data.length > 1) {
741
+ if (j.id === m.data[1] && j.mode !== 7) {
742
+ j.sum = sum
743
+ }
744
+ } else {
745
+ if (j.id === m.data[0] && j.mode !== 7) {
746
+ j.sum = sum
747
+ }
748
+ }
749
+ })
750
+ })
751
+ })
752
+ }
753
+ let mapAdd = pattern.map(item => {
754
+ return item.map(val => {
755
+ return val.mode === 7 ? 0 : val.value + (val.sum ? val.sum : 0)
756
+ })
757
+ })
758
+ let maxCycle = mapAdd.length > 0 ? mapAdd.map(item => {
759
+ return item.length > 0 ? item.reduce((a, b) => {
760
+ return a + b
761
+ }) : 0
762
+ }) : 0
763
+ this.max = Math.max(...maxCycle)// 每个环的周期最大值
764
+ })
765
+ })
766
+ }
767
+ }
768
+ }
769
+ </script>
770
+ <style lang="scss">
771
+ // el-tooltip样式
772
+ .el-tooltip__popper.is-light {
773
+ background: #409EFF !important;
774
+ border: 1px solid #409EFF !important;
775
+ color: #FFFFFF !important;
776
+ }
777
+ .el-tooltip__popper.is-light[x-placement^="top"] .popper__arrow {
778
+ border-top-color: #409EFF !important;
779
+ }
780
+ .el-tooltip__popper.is-light[x-placement^="top"] .popper__arrow::after {
781
+ border-top-color: #409EFF !important;
782
+ }
783
+ </style>
784
+ <style lang="scss" scoped>
785
+ .main-patternstatus {
786
+ position: relative;
787
+ margin-bottom: 20px;
788
+ }
789
+ .main-patternstatus {
790
+ position: relative;
791
+ .ring-first {
792
+ margin-top: 1px;
793
+ width: 100%;
794
+ height: 34px;
795
+ }
796
+ .first-1 {
797
+ float: left;
798
+ // text-align: center;
799
+ }
800
+ // .ring-num {
801
+ // float: left;
802
+ // margin-top:7px;
803
+ // margin-left: 5px;
804
+ // font-size: 14px;
805
+ // font-weight: normal;
806
+ // font-stretch: normal;
807
+ // line-height: 22px;
808
+ // letter-spacing: 0px;
809
+ // color: #ffffff;
810
+ // }
811
+ .box {
812
+ float: left;
813
+ margin-left: 6px;
814
+ margin-right: 10px;
815
+ }
816
+ .ring-nums {
817
+ // float: left;
818
+ // margin-top:7px;
819
+ // margin-left: 5px;
820
+ font-size: 12px;
821
+ height: 14px;
822
+ font-weight: normal;
823
+ font-stretch: normal;
824
+ // line-height: 22px;
825
+ letter-spacing: 0px;
826
+ color: #333333;
827
+ }
828
+ .ring-phase {
829
+ position: relative;
830
+ float: left;
831
+ // margin-left: 5px;
832
+ height: 34px;
833
+ z-index: 999;
834
+ background: rgba(30, 96, 12, 0.2);
835
+ // margin-top:1px;
836
+ }
837
+ .ring-phase::after {
838
+ position: absolute;
839
+ display: block;
840
+ content: '';
841
+ height: 0;
842
+ width: 0;
843
+ top: 11px;
844
+ left: 36px;
845
+ border: 5px solid transparent;
846
+ border-left-color: rgba(30, 96, 12, 0.2);
847
+ }
848
+ .divider {
849
+ position: absolute;
850
+ top: -10px;
851
+ // left: 370px;
852
+ width: 3px;
853
+ // height: 99px;
854
+ z-index: 999;
855
+ background-color:#B9BABF;
856
+ }
857
+ .curTimeLine {
858
+ position: absolute;
859
+ top: -10px;
860
+ width: 2px;
861
+ background-color: #409EFF;
862
+ }
863
+ .curTimeDiv {
864
+ position: absolute;
865
+ z-index:50;
866
+ top: -21px;
867
+ margin-left: -30px;
868
+ text-align:center;
869
+ vertical-align: middle;
870
+ width: 60px;
871
+ height: 19px;
872
+ color:#FFFFFF;
873
+ background-color: #409EFF;
874
+ }
875
+ }
876
+ .ring-first {
877
+ margin-top: 1px;
878
+ width: 100%;
879
+ height: 34px;
880
+ }
881
+ .direction {
882
+ opacity: 0.6;
883
+ }
884
+ .first-1 {
885
+ float: left;
886
+ // text-align: center;
887
+ }
888
+ </style>