openatc-components 0.0.37 → 0.0.38-hotfix

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