openatc-components 0.0.61 → 0.0.64

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