openatc-components 0.0.14 → 0.0.17

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 (38) hide show
  1. package/package/kisscomps/components/BoardCard/BoardCard.vue +85 -0
  2. package/package/kisscomps/components/BoardCard/index.js +2 -0
  3. package/package/kisscomps/components/IntersectionMap/crossDirection/crossDiagram.vue +4 -2
  4. package/package/kisscomps/components/IntersectionWithInterface/IntersectionWithInterface.vue +1 -1
  5. package/package/kisscomps/components/OverLap/OverLap.vue +193 -0
  6. package/package/kisscomps/components/OverLap/index.js +2 -0
  7. package/package/kisscomps/components/PatternStatus/PatternStatus.vue +832 -0
  8. package/package/kisscomps/components/PatternStatus/index.js +2 -0
  9. package/package/kisscomps/components/SchemeConfig/SchemeConfig.vue +94 -78
  10. package/package/kisscomps/components/SchemeConfig/lockingPhaselControlModal/index.vue +22 -42
  11. package/package/kisscomps/components/StageStatus/StageStatus.vue +303 -0
  12. package/package/kisscomps/components/StageStatus/index.js +2 -0
  13. package/package/kisscomps/components/patternList/index.js +2 -0
  14. package/package/kisscomps/components/patternList/patternList.vue +558 -0
  15. package/package/kisscomps/index.js +12 -0
  16. package/package/kissui.js +73981 -0
  17. package/package/kissui.min.js +1 -1
  18. package/package.json +1 -1
  19. package/src/api/control.js +2 -2
  20. package/src/api/param.js +2 -2
  21. package/src/kisscomps/components/BoardCard/BoardCard.vue +85 -0
  22. package/src/kisscomps/components/BoardCard/index.js +2 -0
  23. package/src/kisscomps/components/IntersectionMap/crossDirection/crossDiagram.vue +4 -2
  24. package/src/kisscomps/components/IntersectionWithInterface/IntersectionWithInterface.vue +1 -1
  25. package/src/kisscomps/components/OverLap/OverLap.vue +193 -0
  26. package/src/kisscomps/components/OverLap/index.js +2 -0
  27. package/src/kisscomps/components/PatternStatus/PatternStatus.vue +832 -0
  28. package/src/kisscomps/components/PatternStatus/index.js +2 -0
  29. package/src/kisscomps/components/SchemeConfig/SchemeConfig.vue +94 -78
  30. package/src/kisscomps/components/SchemeConfig/lockingPhaselControlModal/index.vue +22 -42
  31. package/src/kisscomps/components/StageStatus/StageStatus.vue +303 -0
  32. package/src/kisscomps/components/StageStatus/index.js +2 -0
  33. package/src/kisscomps/components/patternList/index.js +2 -0
  34. package/src/kisscomps/components/patternList/patternList.vue +558 -0
  35. package/src/kisscomps/index.js +12 -0
  36. package/src/utils/RingDataModel.js +98 -0
  37. package/src/views/intersection.vue +3 -2
  38. package/src/views/schemeconfig.vue +17 -2
@@ -0,0 +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>