openatc-components 0.0.22 → 0.0.23

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