openatc-components 0.1.32 → 0.1.34

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openatc-components",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "A Vue.js project",
5
5
  "author": "openatc developer",
6
6
  "private": false,
@@ -28,7 +28,7 @@
28
28
  </el-tooltip>
29
29
  </el-col>
30
30
  <el-col :span="9">
31
- <el-input-number :controls="false" class="col-content" size="small" :min="element.minSplit" :max="255" :step="1" v-model.number="element.value" ref="type" :disabled="element.mode === 7"></el-input-number>
31
+ <el-input-number :controls="false" class="col-content" size="small" :min="element.minSplit" :max="255" :step="1" v-model.number="element.value" ref="type"></el-input-number>
32
32
  </el-col>
33
33
  <el-col :span="9">
34
34
  <el-select v-model="element.mode" class="col-content" size="small" @change="doChange(element)" :placeholder="$t('openatccomponents.common.select')">
@@ -14,7 +14,7 @@
14
14
  <!-- 环模式true -->
15
15
  <div v-if="this.contrloType === 'ring' || !this.contrloType">
16
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': ''">
17
+ <div v-for="(item,index2) in list" :key="index2" :class="item.mode===7?'direction': ''">
18
18
  <div class="first-1" :style="{'width':item.greenWidth,'height':'34px','background':'#7ccc66'}">
19
19
  <el-tooltip placement="top-start" effect="light">
20
20
  <div slot="content">P{{item.id}}:{{item.split}}</div>
@@ -186,7 +186,11 @@ export default {
186
186
  }
187
187
  // this.controlDatas = this.controlData
188
188
  this.getPedPhasePos()
189
- this.handlePatternData()
189
+ if (this.controlData.patternid === 109) {
190
+ this.handleTentivePatternData()
191
+ } else {
192
+ this.handlePatternData()
193
+ }
190
194
  this.handleBarrierHeight()
191
195
  },
192
196
  // 深度观察监听
@@ -417,15 +421,17 @@ export default {
417
421
  }
418
422
  })
419
423
  },
420
- handlePatternData () {
424
+ handleTentivePatternData () {
421
425
  if (!this.controlData) return
422
426
  this.newList = []
423
427
  if (Object.keys(this.controlData).length === 0 || this.phaseList.length === 0) return
424
428
  if (!this.controlData.phase) return
429
+ // let cycle = this.controlData.cycle
425
430
  if (!this.controlData.rings) return
426
431
  let newValue = []
427
432
  for (let rings of this.controlData.rings) {
428
433
  let phase = this.controlData.phase
434
+ // let list = []
429
435
  let obj = {}
430
436
  for (let key in rings.sequence) {
431
437
  obj[key] = rings.sequence[key]
@@ -449,14 +455,9 @@ export default {
449
455
  })
450
456
  }
451
457
  }
452
- this.handleOverViewChange(newValue)
458
+ this.handleTentative(newValue)
453
459
  },
454
- handleBarrierHeight () { // 屏障高度
455
- if (!this.patternInfo) return
456
- let patternLength = this.patternInfo.length
457
- this.barrierHeight = (patternLength * 35 + 21) + 'px'
458
- },
459
- handleOverViewChange (val) {
460
+ handleTentative (val) {
460
461
  if (val === null || val.length === 0) return
461
462
  this.patternInfo = []
462
463
  let currentArr = []
@@ -558,6 +559,125 @@ export default {
558
559
  this.patternInfo.push(list)
559
560
  }
560
561
  },
562
+ handlePatternData () {
563
+ if (!this.controlData) return
564
+ // this.newList = []
565
+ if (Object.keys(this.controlData).length === 0 || this.phaseList.length === 0) return
566
+ if (!this.controlData.phase) return
567
+ if (!this.controlData.rings) return
568
+ let nowPattern = this.localPatternList.filter(item => {
569
+ return item.id === this.controlData.patternid
570
+ })[0].rings
571
+ this.handleOverViewChange(nowPattern)
572
+ },
573
+ handleBarrierHeight () { // 屏障高度
574
+ if (!this.patternInfo) return
575
+ let patternLength = this.patternInfo.length
576
+ this.barrierHeight = (patternLength * 35 + 21) + 'px'
577
+ },
578
+ handleOverViewChange (val) {
579
+ if (val === null || val.length === 0) return
580
+ this.patternInfo = []
581
+ let currentArr = []
582
+ let newPattern = []
583
+ val.map(i => {
584
+ newPattern.push(...i)
585
+ })
586
+ if (this.phaseList.length === 0) return
587
+ for (let patternStatus of val[0]) {
588
+ // if (patternStatus.mode !== 7) {
589
+ let concurrent = this.phaseList.filter((item) => {
590
+ return item.id === patternStatus.id // patternStatus.id当前相位id concurrent当前相位的并发相位
591
+ })[0].concurrent// 当前相位的并发相位
592
+ if (concurrent) {
593
+ let obj = {
594
+ id: patternStatus.id,
595
+ current: concurrent.sort()
596
+ }
597
+ currentArr.push(obj)
598
+ }
599
+ // }
600
+ }
601
+ if (currentArr.length !== 0) {
602
+ let newCurrent = this.tranform(currentArr)
603
+ let ringTeam = this.step1(this.phaseList, newCurrent)
604
+ this.fillGap(ringTeam, val)
605
+ }
606
+ let cycle = this.controlData.cycle
607
+ for (let rings of val) {
608
+ if (rings.length === 0) continue
609
+ let list = []
610
+ for (let ring of rings) {
611
+ if (ring.value === 0) continue
612
+ let obj = {}
613
+ let split = ring.value
614
+ obj.id = ring.id
615
+ obj.mode = ring.mode
616
+ // obj.split = split
617
+ let currPhase = this.phaseList.filter((item) => {
618
+ if (item.id === ring.id && item.controltype === 99) {
619
+ obj.controltype = item.controltype
620
+ }
621
+ return item.id === ring.id
622
+ })[0]
623
+ let peddirections = []
624
+ for (let walk of this.sidewalkPhaseData) {
625
+ for (let ped of currPhase.peddirection) {
626
+ // if (stg === walk.phaseid) {
627
+ let objs = {}
628
+ objs.name = walk.name
629
+ objs.id = walk.id
630
+ if (ped === walk.id) {
631
+ peddirections.push(objs)
632
+ peddirections = Array.from(new Set(peddirections))
633
+ }
634
+ // }
635
+ }
636
+ }
637
+ if (ring.desc) {
638
+ obj.direction = ring.desc.map(item => { // 虚相位desc为空
639
+ return {
640
+ id: item.id,
641
+ color: '#454545'
642
+ }
643
+ })
644
+ } else {
645
+ if (currPhase.direction.length > 0) {
646
+ obj.direction = currPhase.direction.map(item => {
647
+ return {
648
+ id: item,
649
+ peddirection: peddirections,
650
+ color: '#454545'
651
+ }
652
+ })
653
+ } else {
654
+ obj.direction = [
655
+ {
656
+ id: '',
657
+ color: '#454545',
658
+ peddirection: peddirections
659
+ }
660
+ ]
661
+ }
662
+ }
663
+ obj.split = split
664
+ if (ring.sum) {
665
+ obj.redWidth = ((currPhase.redclear + ring.sum) / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
666
+ } else {
667
+ obj.redWidth = (currPhase.redclear / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
668
+ }
669
+ obj.flashgreen = (currPhase.flashgreen / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
670
+ obj.yellowWidth = (currPhase.yellow / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
671
+ obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
672
+ // 忽略相位不显示
673
+ // let mode = ring.mode
674
+ // if (mode !== 7) { // 忽略相位不显示
675
+ list.push(obj)
676
+ // }
677
+ }
678
+ this.patternInfo.push(list)
679
+ }
680
+ },
561
681
  handleCurrentChange (val) { // 两个ring的数据
562
682
  if (val === null || val.length === 0) return
563
683
  this.patternInfo = []
@@ -569,18 +689,18 @@ export default {
569
689
  })
570
690
  if (this.phaseList.length === 0) return
571
691
  for (let patternStatus of val[0]) {
572
- if (patternStatus.mode !== 7) {
573
- let concurrent = this.phaseList.filter((item) => {
574
- return item.id === patternStatus.id // patternStatus.id当前相位id concurrent当前相位的并发相位
575
- })[0].concurrent// 当前相位的并发相位
576
- if (concurrent) {
577
- let obj = {
578
- id: patternStatus.id,
579
- current: concurrent.sort()
580
- }
581
- currentArr.push(obj)
692
+ // if (patternStatus.mode !== 7) {
693
+ let concurrent = this.phaseList.filter((item) => {
694
+ return item.id === patternStatus.id // patternStatus.id当前相位id concurrent当前相位的并发相位
695
+ })[0].concurrent// 当前相位的并发相位
696
+ if (concurrent) {
697
+ let obj = {
698
+ id: patternStatus.id,
699
+ current: concurrent.sort()
582
700
  }
701
+ currentArr.push(obj)
583
702
  }
703
+ // }
584
704
  }
585
705
  if (currentArr.length !== 0) {
586
706
  let newCurrent = this.tranform(currentArr)
@@ -658,6 +778,7 @@ export default {
658
778
  obj.split = split
659
779
  obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
660
780
  }
781
+ obj.mode = ring.mode
661
782
  obj.flashgreen = (currPhase.flashgreen / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
662
783
  obj.redWidth = (currPhase.redclear / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
663
784
  obj.yellowWidth = (currPhase.yellow / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
@@ -678,10 +799,10 @@ export default {
678
799
  // }
679
800
  // obj.peddirection = peddirections
680
801
  // 忽略相位不显示
681
- let mode = ring.mode
682
- if (mode !== 7) { // 忽略相位不显示
683
- list.push(obj)
684
- }
802
+ // let mode = ring.mode
803
+ // if (mode !== 7) { // 忽略相位不显示
804
+ list.push(obj)
805
+ // }
685
806
  }
686
807
  this.patternInfo.push(list)
687
808
  }
@@ -767,9 +888,9 @@ export default {
767
888
  let ret = []
768
889
  const patternObj = {}
769
890
  pattern.forEach(l => {
770
- if (l.mode !== 7) {
771
- patternObj[l.id] = l.value
772
- }
891
+ // if (l.mode !== 7) {
892
+ patternObj[l.id] = l.value
893
+ // }
773
894
  })
774
895
  newArr.forEach((na, index) => {
775
896
  let max = 0
@@ -779,7 +900,7 @@ export default {
779
900
  max = total
780
901
  }
781
902
  })
782
- while (index > 0 && max < this.newCycle) { // && max < _this.newCycle
903
+ while (index > 0) { // && max < _this.newCycle
783
904
  index--
784
905
  max += ret[index]
785
906
  }
@@ -792,9 +913,9 @@ export default {
792
913
  const patternObj = {}
793
914
  pattern.forEach(l => {
794
915
  l.map(k => {
795
- if (k.mode !== 7) {
796
- patternObj[k.id] = k.value
797
- }
916
+ // if (k.mode !== 7) {
917
+ patternObj[k.id] = k.value
918
+ // }
798
919
  })
799
920
  })
800
921
  let newMax = []
@@ -814,7 +935,7 @@ export default {
814
935
  this.max = newmaxNum + newminNum
815
936
  pattern.map(d => {
816
937
  d.map(r => {
817
- if (r.sum && r.mode !== 7) {
938
+ if (r.sum) {
818
939
  delete r.sum
819
940
  }
820
941
  })
@@ -824,7 +945,7 @@ export default {
824
945
  na.map(n => {
825
946
  pattern.map(h => {
826
947
  h.map(d => {
827
- if (d.id === n.data[1] && d.sum && d.mode !== 7) {
948
+ if (d.id === n.data[1] && d.sum) {
828
949
  delete d.sum
829
950
  }
830
951
  })
@@ -836,11 +957,11 @@ export default {
836
957
  pattern.map(h => {
837
958
  h.map(d => {
838
959
  if (n.data.length > 1) {
839
- if (d.id === n.data[1] && d.mode !== 7) {
960
+ if (d.id === n.data[1]) {
840
961
  delete d.sum
841
962
  }
842
963
  } else {
843
- if (d.id === n.data[0] && d.mode !== 7) {
964
+ if (d.id === n.data[0]) {
844
965
  delete d.sum
845
966
  }
846
967
  }
@@ -858,11 +979,11 @@ export default {
858
979
  pattern.filter((i) => {
859
980
  i.map(j => {
860
981
  if (m.data.length > 1) {
861
- if (j.id === m.data[1] && j.mode !== 7) {
982
+ if (j.id === m.data[1]) {
862
983
  j.sum = sum
863
984
  }
864
985
  } else {
865
- if (j.id === m.data[0] && j.mode !== 7) {
986
+ if (j.id === m.data[0]) {
866
987
  j.sum = sum
867
988
  }
868
989
  }
@@ -872,7 +993,7 @@ export default {
872
993
  }
873
994
  let mapAdd = pattern.map(item => {
874
995
  return item.map(val => {
875
- return val.mode === 7 ? 0 : val.value + (val.sum ? val.sum : 0)
996
+ return val.value + (val.sum ? val.sum : 0)
876
997
  })
877
998
  })
878
999
  let maxCycle = mapAdd.length > 0 ? mapAdd.map(item => {
@@ -534,6 +534,24 @@ export default {
534
534
  }
535
535
  return isequal
536
536
  },
537
+ getMaxCycle (pattern) {
538
+ let rings = pattern.rings
539
+ let maxCycle = 0
540
+ for (let ring of rings) {
541
+ if (ring.length === 0) continue
542
+ let cycle = 0
543
+ for (let r of ring) {
544
+ if (r.mode === 7) { // 忽略相位不计周期
545
+ continue
546
+ }
547
+ cycle = cycle + r.value
548
+ }
549
+ if (cycle > maxCycle) {
550
+ maxCycle = cycle
551
+ }
552
+ }
553
+ return maxCycle
554
+ },
537
555
  checkPatternRules (rings) {
538
556
  if (!this.isRingCycleEqual(rings)) {
539
557
  this.patternCycleEqual = false
@@ -561,8 +579,12 @@ export default {
561
579
  // duration: this.manualInfo.tempDuration !== undefined ? Number(this.manualInfo.tempDuration) : 0,
562
580
  data: {}
563
581
  }
582
+ if (this.patternOne.length === 0) {
583
+ submitdata.data.cycle = this.getMaxCycle(this.planPattern)
584
+ } else {
585
+ submitdata.data.cycle = this.getMaxCycle(this.patternOne[0])
586
+ }
564
587
  submitdata.data.offset = this.offset
565
- submitdata.data.cycle = this.cycle
566
588
  submitdata.data.rings = this.rings
567
589
  this.checkPatternRules(submitdata.data.rings)
568
590
  if (this.patternCycleEqual) {