openatc-components 0.0.74 → 0.0.77

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.
@@ -2,6 +2,7 @@
2
2
  <div class="overLap" v-if="checked" :style="{'margin':this.controlData ? '20px 0 0 0' :tentative ? '0' : '0 40px 0 417px'}">
3
3
  <div class="ring-first" v-for="(list, index1) in this.overlapDatas" :key="index1">
4
4
  <div v-for="(item,index2) in list.stageLists" :key="index2" >
5
+ <!-- {{list.peddirection}} -->
5
6
  <div class="first-2">
6
7
  <el-tooltip v-if="item.greenWidth" placement="top-start" effect="light">
7
8
  <div slot="content">
@@ -12,7 +13,7 @@
12
13
  </div>
13
14
  <div style="cursor:pointer;">
14
15
  <div class="ring-phase">
15
- <patternwalksvg :sidewalkPhaseData="list.sidewalkPhaseData" :showWalk="list.peddirection" :Width="'32'" :Height="'34'"></patternwalksvg>
16
+ <patternwalksvg :showWalk="list.peddirection" :Width="'32'" :Height="'34'"></patternwalksvg>
16
17
  <xdrdirselector Width="36px" Height="34px" :showlist="item.direction"></xdrdirselector>
17
18
  </div>
18
19
  <div class="box">
@@ -135,6 +136,7 @@ export default {
135
136
  findIndexs = Array.from(new Set(findIndexs))
136
137
  return {
137
138
  ...item,
139
+ peddirection: this.getPedPhasePos(item.peddirection),
138
140
  sidewalkPhaseData: this.getPedPhasePos(item.peddirection),
139
141
  stageLists: stageList.map(sta => {
140
142
  const find = findIndexs.includes(sta.key)
@@ -148,6 +150,7 @@ export default {
148
150
  })
149
151
  }
150
152
  })
153
+ console.log(overlapData, 'overlapData')
151
154
  this.overlapDatas = overlapData
152
155
  }
153
156
  }
@@ -20,7 +20,7 @@
20
20
  <div slot="content">P{{item.id}}:{{item.split}}</div>
21
21
  <div style="cursor:pointer;">
22
22
  <div class="ring-phase">
23
- <patternwalksvg :sidewalkPhaseData="sidewalkPhaseData" :showWalk="item.peddirection" :Width="'32'" :Height="'34'"></patternwalksvg>
23
+ <patternwalksvg :showWalk="item.peddirection" :Width="'32'" :Height="'34'"></patternwalksvg>
24
24
  <xdrdirselector Width="36px" Height="34px" :showlist="item.direction"></xdrdirselector>
25
25
  </div>
26
26
  <div class="box">
@@ -63,7 +63,7 @@
63
63
  </div>
64
64
  <div style="cursor:pointer;">
65
65
  <div class="ring-phase">
66
- <patternwalksvg :sidewalkPhaseData="sidewalkPhaseData" :showWalk="list.peddirection" :Width="'32'" :Height="'34'"></patternwalksvg>
66
+ <patternwalksvg :showWalk="list.peddirection" :Width="'32'" :Height="'34'"></patternwalksvg>
67
67
  <xdrdirselector Width="36px" Height="34px" :showlist="list.direction"></xdrdirselector>
68
68
  </div>
69
69
  <div class="box" style="line-height:28px">
@@ -274,9 +274,16 @@ export default {
274
274
  return item.id === stg
275
275
  })[0]
276
276
  for (let walk of this.sidewalkPhaseData) {
277
- if (stg === walk.phaseid) {
278
- peddirections.push(...currPhase.peddirection)
279
- peddirections = Array.from(new Set(peddirections))
277
+ for (let ped of currPhase.peddirection) {
278
+ if (stg === walk.phaseid) {
279
+ let obj = {}
280
+ obj.name = walk.name
281
+ obj.id = walk.id
282
+ if (ped === walk.id) {
283
+ peddirections.push(obj)
284
+ peddirections = Array.from(new Set(peddirections))
285
+ }
286
+ }
280
287
  }
281
288
  }
282
289
  ped.push(...peddirections)
@@ -420,7 +427,22 @@ export default {
420
427
  obj.yellowWidth = (currPhase.yellow / cycle * 100).toFixed(3) + '%'
421
428
  obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / cycle * 100).toFixed(3) + '%'
422
429
  obj.flashgreen = (currPhase.flashgreen / cycle * 100).toFixed(3) + '%'
423
- obj.peddirection = currPhase.peddirection
430
+ // obj.peddirection = currPhase.peddirection
431
+ let peddirections = []
432
+ for (let walk of this.sidewalkPhaseData) {
433
+ for (let ped of currPhase.peddirection) {
434
+ // if (stg === walk.phaseid) {
435
+ let objs = {}
436
+ objs.name = walk.name
437
+ objs.id = walk.id
438
+ if (ped === walk.id) {
439
+ peddirections.push(objs)
440
+ peddirections = Array.from(new Set(peddirections))
441
+ }
442
+ // }
443
+ }
444
+ }
445
+ obj.peddirection = peddirections
424
446
  obj.split = split
425
447
  obj.direction = currPhase.direction.map(item => {
426
448
  return {
@@ -517,7 +539,22 @@ export default {
517
539
  obj.flashgreen = (currPhase.flashgreen / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
518
540
  obj.redWidth = (currPhase.redclear / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
519
541
  obj.yellowWidth = (currPhase.yellow / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
520
- obj.peddirection = currPhase.peddirection
542
+ // obj.peddirection = currPhase.peddirection
543
+ let peddirections = []
544
+ for (let walk of this.sidewalkPhaseData) {
545
+ for (let ped of currPhase.peddirection) {
546
+ // if (stg === walk.phaseid) {
547
+ let objs = {}
548
+ objs.name = walk.name
549
+ objs.id = walk.id
550
+ if (ped === walk.id) {
551
+ peddirections.push(objs)
552
+ peddirections = Array.from(new Set(peddirections))
553
+ }
554
+ // }
555
+ }
556
+ }
557
+ obj.peddirection = peddirections
521
558
  // 忽略相位不显示
522
559
  let mode = ring.mode
523
560
  if (mode !== 7) { // 忽略相位不显示
@@ -370,9 +370,6 @@ export default {
370
370
  }
371
371
  },
372
372
  props: {
373
- sidewalkPhaseData: {
374
- type: Array
375
- },
376
373
  showWalk: {
377
374
  type: Array
378
375
  },
@@ -389,28 +386,21 @@ export default {
389
386
  }
390
387
  },
391
388
  watch: {
392
- sidewalkPhaseData: {
393
- handler: function () {
394
- this.getShow()
395
- },
396
- deep: true // 深度监听
397
- },
398
389
  showWalk: {
399
- handler: function () {
400
- this.getShow()
390
+ handler: function (newList) {
391
+ this.refreshShow(newList)
401
392
  },
402
393
  deep: true // 深度监听
403
394
  }
404
395
  },
405
396
  created () {
406
- this.getShow()
397
+ this.refreshShow(this.showWalk)
407
398
  },
408
399
  methods: {
409
- getShow () {
410
- if (!this.sidewalkPhaseData) return
411
- for (let i = 0; i < this.sidewalkPhaseData.length; i++) {
400
+ refreshShow (showWalk) {
401
+ for (let i = 0; i < this.showWalk.length; i++) {
412
402
  for (let j = 0; j < this.status.length; j++) {
413
- if (this.sidewalkPhaseData[i].name === this.status[j].name && this.showWalk.includes(this.sidewalkPhaseData[i].id)) {
403
+ if (this.showWalk[i].name === this.status[j].name) {
414
404
  this.status[j].isshow = true
415
405
  }
416
406
  }
@@ -499,7 +499,7 @@ export default {
499
499
  }
500
500
  })
501
501
  control.control = that.preselectModel === -1 ? that.currModel : that.preselectModel
502
- control.terminal = Number(manualInfo.tempPatternid)
502
+ control.terminal = isNaN(parseInt(manualInfo.tempPatternid)) ? Number(manualInfo.tempPatternid.replace(/[^0-9]/ig, '')) : manualInfo.tempPatternid
503
503
  control.delay = Number(manualInfo.tempDelay)
504
504
  control.duration = Number(manualInfo.tempDuration)
505
505
  control.value = that.preselectStages === -1 ? 0 : that.preselectStages
@@ -26,7 +26,6 @@
26
26
  </template> -->
27
27
  <patternwalksvg class="patternWalk"
28
28
  :showWalk="item[0].peddirection"
29
- :sidewalkPhaseData="item[0].sidewalkPhaseData"
30
29
  :Width="'40'"
31
30
  :Height="'40'" />
32
31
  <xdr-dir-selector Width="40PX" Height="40PX" :showlist="item"></xdr-dir-selector>
@@ -65,12 +65,12 @@
65
65
  </over-lap>
66
66
  </div>
67
67
  </div>
68
-
69
68
  <div ref="tuxingRight" class="tuxing-right" >
70
69
  <scheme-config
71
70
  ref="rightpanel"
72
71
  :statusData="crossStatusData"
73
72
  :agentName="agentName"
73
+ :planPattern="planPattern"
74
74
  :responseTime="responseTime"
75
75
  :devStatus="devStatus"
76
76
  :agentId="agentId"
@@ -145,6 +145,7 @@ export default {
145
145
  controlData: {},
146
146
  checked: false,
147
147
  overlap: [],
148
+ planPattern: {},
148
149
  contrloType: '',
149
150
  narr: [],
150
151
  patternList: [],
@@ -278,6 +279,84 @@ export default {
278
279
  setHost(host)
279
280
  }
280
281
  },
282
+ patternPlan () {
283
+ // this.increaseId()
284
+ let Pattern = {
285
+ // id: this.id,
286
+ // desc: `${this.$t('edge.pattern.pattern')}${this.id}`,
287
+ offset: 0,
288
+ cycle: 0,
289
+ // stagesList: [],
290
+ rings: [[], [], [], []]
291
+ }
292
+ var newPattern = JSON.parse(JSON.stringify(Pattern))
293
+ // debugger
294
+ // const phaseList = JSON.parse(JSON.stringify(this.globalParamModel.getParamsByType('phaseList')))
295
+ for (let phase of this.phaseList) {
296
+ let ring = {}
297
+ ring.name = 'Phase ' + phase.id
298
+ ring.desc = this.getPhaseDescription(phase.direction)
299
+ ring.id = phase.id
300
+ ring.value = 30
301
+ ring.mode = 2
302
+ ring.options = []
303
+ ring.delaystart = 0
304
+ ring.advanceend = 0
305
+ if (phase.ring === 1) {
306
+ newPattern.rings[0].push(ring)
307
+ } else if (phase.ring === 2) {
308
+ newPattern.rings[1].push(ring)
309
+ } else if (phase.ring === 3) {
310
+ newPattern.rings[2].push(ring)
311
+ } else if (phase.ring === 4) {
312
+ newPattern.rings[3].push(ring)
313
+ }
314
+ // pahseIndex++
315
+ }
316
+ this.planPattern = newPattern
317
+ return newPattern
318
+ },
319
+ getPhaseDescription (phaseList) {
320
+ if (!phaseList) return
321
+ let list = []
322
+ for (let id of phaseList) {
323
+ let obj = {}
324
+ obj.id = id
325
+ obj.color = '#454545'
326
+ list.push(obj)
327
+ }
328
+ return list
329
+ },
330
+ getCycle () {
331
+ for (let rings of this.planPattern.rings) {
332
+ let num = 0
333
+ for (let i = 0; i < rings.length; i++) {
334
+ if (rings[i].length !== 0) {
335
+ if (rings[i].mode === 7) { // 忽略相位不计周期
336
+ continue
337
+ }
338
+ num = num + Number(rings[i].value)
339
+ let id = rings[i].id
340
+ rings[i].name = this.getDescription(id)
341
+ }
342
+ }
343
+ if (num !== 0) {
344
+ this.planPattern.cycle = num
345
+ break
346
+ }
347
+ }
348
+ },
349
+ getDescription (id) {
350
+ for (let phase of this.phaseList) {
351
+ if (phase.id === id) {
352
+ if (phase.desc !== '' && phase.desc !== undefined) {
353
+ return phase.desc
354
+ } else {
355
+ return 'phase' + id
356
+ }
357
+ }
358
+ }
359
+ },
281
360
  getIntersectionInfo (agentid, id) {
282
361
  // 获取路口信息
283
362
  getIntersectionInfo(agentid).then(res => {
@@ -286,9 +365,11 @@ export default {
286
365
  this.overlap = res.data.data.param.overlaplList
287
366
  this.contrloType = this.allPatternList[0].contrloType
288
367
  this.phaseList = res.data.data.param.phaseList
289
- this.patternList = res.data.data.param.patternList.filter(item => {
290
- return item.id === id
291
- })[0].rings
368
+ this.patternPlan()
369
+ this.getCycle()
370
+ // this.patternList = res.data.data.param.patternList.filter(item => {
371
+ // return item.id === id
372
+ // })[0].rings
292
373
  })
293
374
  },
294
375
  getPedPhasePos () {