openatc-components 0.1.38 → 0.1.40

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.
@@ -71,6 +71,8 @@ export default {
71
71
  value: 6
72
72
  }, {
73
73
  value: 7
74
+ }, {
75
+ value: 8
74
76
  }],
75
77
  coordphaseOption: [{
76
78
  value: 1
@@ -15,7 +15,7 @@
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
17
  <div v-for="(item,index2) in list" :key="index2" :class="item.mode===7?'direction': ''">
18
- <div class="first-1" :style="{'width':item.greenWidth,'height':'34px','background':'#7ccc66'}">
18
+ <div class="first-1" :class="item.mode===8?'mask': ''" :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>
21
21
  <div style="cursor:pointer;">
@@ -32,15 +32,15 @@
32
32
  <div style="position:relative; width:50px;" v-for="(bus,index3) in busPhaseData" :key="index3">
33
33
  <i class="iconfont icon-lukouzhilu" style="position: absolute;top: 8px;font-size:12px;color:#454545;" v-if="bus.controltype === 1 && bus.phaseid===item.id"></i>
34
34
  <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>
35
- <i class="iconfont icon-xuxiangwei" style="position: absolute;top: 8px;font-size:12px;color:#454545;" v-if="bus.controltype === 99 && bus.phaseid===item.id"></i>
35
+ <i class="iconfont icon-xuxiangwei-xin" style="position: absolute;top: 8px;font-size:12px;color:#454545;" v-if="bus.controltype === 99 && bus.phaseid===item.id"></i>
36
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
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
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
39
  </div>
40
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>
41
+ <div class="first-1" :class="item.mode===8?'mask': ''" :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" :class="item.mode===8?'mask': ''" :style="{'width':item.yellowWidth,'height':'34px','background':'#f9dc6a'}"></div>
43
+ <div class="first-1" :class="item.mode===8?'mask': ''" :style="{'width':item.redWidth,'height':'34px','background':'#f27979'}"></div>
44
44
  </div>
45
45
  </div>
46
46
  <div v-if="showBarrier">
@@ -190,9 +190,9 @@ export default {
190
190
  }
191
191
  // this.controlDatas = this.controlData
192
192
  this.getPedPhasePos()
193
- if ((this.controlData && this.controlData.patternid === 109) || (this.controlData && this.showCondition) || this.controlData) {
193
+ if ((this.controlData && this.controlData.patternid === 109) || (this.controlData && this.showCondition)) {
194
194
  this.handleTentivePatternData()
195
- } else {
195
+ } else if (this.controlData) {
196
196
  this.handlePatternData()
197
197
  }
198
198
  this.handleBarrierHeight()
@@ -385,15 +385,15 @@ export default {
385
385
  this.busPhaseData = []
386
386
  this.phaseList.forEach((ele, i) => {
387
387
  // if (ele.controltype >= 3 && ele.controltype <= 5) {
388
- ele.direction.forEach((dir, index) => {
389
- // 车道相位
390
- this.busPhaseData.push({
391
- phaseid: ele.id, // 相位id,用于对应相位状态
392
- id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
393
- name: this.PhaseDataModel.getBusPhasePos(dir).name,
394
- controltype: ele.controltype
395
- })
388
+ // ele.direction.forEach((dir, index) => {
389
+ // 车道相位
390
+ this.busPhaseData.push({
391
+ phaseid: ele.id, // 相位id,用于对应相位状态
392
+ // id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
393
+ // name: this.PhaseDataModel.getBusPhasePos(dir).name,
394
+ controltype: ele.controltype
396
395
  })
396
+ // })
397
397
  // }
398
398
  })
399
399
  let result = []
@@ -581,6 +581,30 @@ export default {
581
581
  },
582
582
  handleOverViewChange (val) {
583
583
  if (val === null || val.length === 0) return
584
+ // 按环序分组
585
+ let ringlength = []
586
+ let ringsequence = val.map(item => {
587
+ if (item.length === 0) return
588
+ ringlength.push(item.length)
589
+ return item.map(k => {
590
+ return k.id
591
+ })
592
+ })
593
+ let newRings = ringsequence.filter(item => item)
594
+ let minLength = Math.min(...ringlength)
595
+ let resultArrs = [] // 环1分组
596
+ let resultArr = [] // 环2分组
597
+ for (let j = 0; j < ringsequence[0].length; j += minLength) {
598
+ resultArrs.push(ringsequence[0].slice(j, j + minLength))
599
+ if (ringsequence[0].length === minLength) {
600
+ resultArrs.push([])
601
+ }
602
+ }
603
+ if (newRings.length > 1) {
604
+ for (let i = 0; i < ringsequence[1].length; i += minLength) {
605
+ resultArr.push(ringsequence[1].slice(i, i + minLength))
606
+ }
607
+ }
584
608
  this.patternInfo = []
585
609
  let currentArr = []
586
610
  let newPattern = []
@@ -604,8 +628,62 @@ export default {
604
628
  }
605
629
  if (currentArr.length !== 0) {
606
630
  let newCurrent = this.tranform(currentArr)
607
- let ringTeam = this.step1(this.phaseList, newCurrent)
608
- this.fillGap(ringTeam, val)
631
+ // 取没个环与环关系的并集
632
+ let barrierRing1 = []
633
+ let barrierRing2 = []
634
+ let ring1 = [] // 环1与关系1的并集
635
+ for (let h = 0; h < newCurrent.length; h++) {
636
+ let adds = [...new Set(resultArrs[0])].filter(item => newCurrent[h].includes(item))
637
+ ring1.push(adds)
638
+ }
639
+ let ring1s = [] // 环1与关系2的并集
640
+ for (let h = 0; h < newCurrent.length; h++) {
641
+ let addRing1 = [...new Set(resultArrs[1])].filter(item => newCurrent[h].includes(item))
642
+ ring1s.push(addRing1)
643
+ }
644
+ barrierRing1.push(...ring1, ...ring1s)
645
+ let resultList = []
646
+ if (newRings.length > 1) {
647
+ let ring2s = [] // 环2与关系1的并集
648
+ for (let h = 0; h < newCurrent.length; h++) {
649
+ let addRing2 = [...new Set(resultArr[1])].filter(item => newCurrent[h].includes(item))
650
+ ring2s.push(addRing2)
651
+ }
652
+ let ring2 = [] // 环2与关系1的并集
653
+ for (let h = 0; h < newCurrent.length; h++) {
654
+ let add = [...new Set(resultArr[0])].filter(item => newCurrent[h].includes(item))
655
+ ring2.push(add)
656
+ }
657
+ barrierRing2.push(...ring2, ...ring2s)
658
+ for (let k = 0; k < barrierRing1.length; k++) {
659
+ resultList.push(barrierRing1[k].concat(barrierRing2[k]))
660
+ }
661
+ }
662
+ let resultLists = resultList.filter(item => item.length !== 0)
663
+ let ringArr = []
664
+ for (let l = 0; l < resultLists.length; l++) {
665
+ for (let d = 0; d < newCurrent.length; d++) {
666
+ if (newCurrent[d].filter(item => resultLists[l].includes(item)).length > 0) {
667
+ ringArr.push({
668
+ data: resultLists[l],
669
+ id: d + 1,
670
+ index: l
671
+ })
672
+ }
673
+ }
674
+ }
675
+ for (var i = 0; i < ringArr.length; i++) {
676
+ for (var j = i + 1; j < ringArr.length; j++) {
677
+ if (ringArr[i].id === ringArr[j].id && ringArr[i].index + 1 === ringArr[j].index) {
678
+ ringArr[i].data = ringArr[i].data.concat(ringArr[j].data)
679
+ ringArr.splice(ringArr.indexOf(ringArr[j].id), 1)
680
+ }
681
+ }
682
+ }
683
+ let resArr = ringArr.map(item => item.data)
684
+ let ringTeam = this.step1(this.phaseList, resArr)
685
+ let ringTeams = ringTeam.filter(item => item.length !== 0)
686
+ this.fillGap(ringTeams, val)
609
687
  }
610
688
  let cycle = this.controlData.cycle
611
689
  for (let rings of val) {
@@ -684,6 +762,30 @@ export default {
684
762
  },
685
763
  handleCurrentChange (val) { // 两个ring的数据
686
764
  if (val === null || val.length === 0) return
765
+ // 按环序分组
766
+ let ringlength = []
767
+ let ringsequence = val.map(item => {
768
+ if (item.length === 0) return
769
+ ringlength.push(item.length)
770
+ return item.map(k => {
771
+ return k.id
772
+ })
773
+ })
774
+ let newRings = ringsequence.filter(item => item)
775
+ let minLength = Math.min(...ringlength)
776
+ let resultArrs = [] // 环1分组
777
+ let resultArr = [] // 环2分组
778
+ for (let j = 0; j < ringsequence[0].length; j += minLength) {
779
+ resultArrs.push(ringsequence[0].slice(j, j + minLength))
780
+ if (ringsequence[0].length === minLength) {
781
+ resultArrs.push([])
782
+ }
783
+ }
784
+ if (newRings.length > 1) {
785
+ for (let i = 0; i < ringsequence[1].length; i += minLength) {
786
+ resultArr.push(ringsequence[1].slice(i, i + minLength))
787
+ }
788
+ }
687
789
  this.patternInfo = []
688
790
  this.barrierList = []
689
791
  let currentArr = []
@@ -708,12 +810,66 @@ export default {
708
810
  }
709
811
  if (currentArr.length !== 0) {
710
812
  let newCurrent = this.tranform(currentArr)
711
- let ringTeam = this.step1(this.phaseList, newCurrent)
813
+ // 取没个环与环关系的并集
814
+ let barrierRing1 = []
815
+ let barrierRing2 = []
816
+ let ring1 = [] // 环1与关系1的并集
817
+ for (let h = 0; h < newCurrent.length; h++) {
818
+ let adds = [...new Set(resultArrs[0])].filter(item => newCurrent[h].includes(item))
819
+ ring1.push(adds)
820
+ }
821
+ let ring1s = [] // 环1与关系2的并集
822
+ for (let h = 0; h < newCurrent.length; h++) {
823
+ let addRing1 = [...new Set(resultArrs[1])].filter(item => newCurrent[h].includes(item))
824
+ ring1s.push(addRing1)
825
+ }
826
+ barrierRing1.push(...ring1, ...ring1s)
827
+ let resultList = []
828
+ if (newRings.length > 1) {
829
+ let ring2s = [] // 环2与关系1的并集
830
+ for (let h = 0; h < newCurrent.length; h++) {
831
+ let addRing2 = [...new Set(resultArr[1])].filter(item => newCurrent[h].includes(item))
832
+ ring2s.push(addRing2)
833
+ }
834
+ let ring2 = [] // 环2与关系1的并集
835
+ for (let h = 0; h < newCurrent.length; h++) {
836
+ let add = [...new Set(resultArr[0])].filter(item => newCurrent[h].includes(item))
837
+ ring2.push(add)
838
+ }
839
+ barrierRing2.push(...ring2, ...ring2s)
840
+ for (let k = 0; k < barrierRing1.length; k++) {
841
+ resultList.push(barrierRing1[k].concat(barrierRing2[k]))
842
+ }
843
+ }
844
+ let resultLists = resultList.filter(item => item.length !== 0)
845
+ let ringArr = []
846
+ for (let l = 0; l < resultLists.length; l++) {
847
+ for (let d = 0; d < newCurrent.length; d++) {
848
+ if (newCurrent[d].filter(item => resultLists[l].includes(item)).length > 0) {
849
+ ringArr.push({
850
+ data: resultLists[l],
851
+ id: d + 1,
852
+ index: l
853
+ })
854
+ }
855
+ }
856
+ }
857
+ for (var i = 0; i < ringArr.length; i++) {
858
+ for (var j = i + 1; j < ringArr.length; j++) {
859
+ if (ringArr[i].id === ringArr[j].id && ringArr[i].index + 1 === ringArr[j].index) {
860
+ ringArr[i].data = ringArr[i].data.concat(ringArr[j].data)
861
+ ringArr.splice(ringArr.indexOf(ringArr[j].id), 1)
862
+ }
863
+ }
864
+ }
865
+ let resArr = ringArr.map(item => item.data)
866
+ let ringTeam = this.step1(this.phaseList, resArr)
867
+ let ringTeams = ringTeam.filter(item => item.length !== 0)
712
868
  if (this.patternList) {
713
- this.setBarrier(ringTeam, val)
869
+ this.setBarrier(ringTeams, val)
714
870
  }
715
- this.fillGap(ringTeam, val)
716
- let barrier = this.step2(ringTeam, newPattern)
871
+ this.fillGap(ringTeams, val)
872
+ let barrier = this.step2(ringTeams, newPattern)
717
873
  this.barrierList = barrier.map(j => {
718
874
  return (j / (this.max ? this.max : this.newCycle) * 100) + '%'
719
875
  })
@@ -775,33 +931,16 @@ export default {
775
931
  ]
776
932
  }
777
933
  }
934
+ obj.split = split
778
935
  if (ring.sum) {
779
- obj.split = split + ring.sum
780
- obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen + ring.sum) / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
936
+ obj.redWidth = ((currPhase.redclear + ring.sum) / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
781
937
  } else {
782
- obj.split = split
783
- obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
938
+ obj.redWidth = (currPhase.redclear / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
784
939
  }
785
940
  obj.mode = ring.mode
941
+ obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
786
942
  obj.flashgreen = (currPhase.flashgreen / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
787
- obj.redWidth = (currPhase.redclear / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
788
943
  obj.yellowWidth = (currPhase.yellow / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
789
- // // obj.peddirection = currPhase.peddirection
790
- // let peddirections = []
791
- // for (let walk of this.sidewalkPhaseData) {
792
- // for (let ped of currPhase.peddirection) {
793
- // // if (stg === walk.phaseid) {
794
- // let objs = {}
795
- // objs.name = walk.name
796
- // objs.id = walk.id
797
- // if (ped === walk.id) {
798
- // peddirections.push(objs)
799
- // peddirections = Array.from(new Set(peddirections))
800
- // }
801
- // // }
802
- // }
803
- // }
804
- // obj.peddirection = peddirections
805
944
  // 忽略相位不显示
806
945
  // let mode = ring.mode
807
946
  // if (mode !== 7) { // 忽略相位不显示
@@ -821,6 +960,7 @@ export default {
821
960
  })
822
961
  })
823
962
  let ret = ringTeam.map((y, index) => {
963
+ if (!y || y.length === 0) return
824
964
  y.map(n => {
825
965
  n.length = n.data.length > 1 ? n.data.reduce((pre, cur) => pre + patternObjs[cur], 0) : patternObjs[n.data[0]]
826
966
  })
@@ -897,6 +1037,7 @@ export default {
897
1037
  // }
898
1038
  })
899
1039
  newArr.forEach((na, index) => {
1040
+ if (!na || na.length === 0) return
900
1041
  let max = 0
901
1042
  na.forEach(n => {
902
1043
  const total = n.data.reduce((pre, cur) => pre + patternObj[cur], 0)
@@ -904,7 +1045,7 @@ export default {
904
1045
  max = total
905
1046
  }
906
1047
  })
907
- while (index > 0) { // && max < _this.newCycle
1048
+ while (index > 0 && max < this.max) { // && max < _this.newCycle
908
1049
  index--
909
1050
  max += ret[index]
910
1051
  }
@@ -925,6 +1066,7 @@ export default {
925
1066
  let newMax = []
926
1067
  let newMin = []
927
1068
  newArr.forEach((na, index) => {
1069
+ if (!na || na.length === 0) return
928
1070
  na.map(n => {
929
1071
  n.length = n.data.length > 1 ? n.data.reduce((pre, cur) => pre + patternObj[cur], 0) : patternObj[n.data[0]]
930
1072
  })
@@ -1127,6 +1269,9 @@ export default {
1127
1269
  .direction {
1128
1270
  opacity: 0.6;
1129
1271
  }
1272
+ .mask {
1273
+ background: rgb(242, 121, 121) !important;
1274
+ }
1130
1275
  .first-1 {
1131
1276
  float: left;
1132
1277
  // text-align: center;
@@ -36,7 +36,7 @@
36
36
  <i class="iconfont icon-lukouzhilu" style="font-size:16PX;color:#454545;" v-if="item[item.length-1].controltype === 1"></i>
37
37
  <i class="iconfont icon-BRT" style="font-size:11PX;color:#454545;" v-if="item[item.length-1].controltype === 4"></i>
38
38
  <div style="transform:scale(0.65);margin-left:-6px;">
39
- <i class="iconfont icon-xuxiangwei" style="font-size:5PX;color:#454545;" v-if="item[item.length-1].controltype === 99"></i>
39
+ <i class="iconfont icon-xuxiangwei-xin" style="font-size:5PX;color:#454545;" v-if="item[item.length-1].controltype === 99"></i>
40
40
  </div>
41
41
  <i class="iconfont icon-gongjiaoche" style="font-size:11PX;color:#606266;" v-if="item[item.length-1].controltype === 3"></i>
42
42
  <i class="iconfont icon-youguidianche" style="font-size:11PX;color:#606266;" v-if="item[item.length-1].controltype === 5"></i>