openatc-components 0.1.38 → 0.1.39

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,27 @@ 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 minLength = Math.min(...ringlength)
594
+ let resultArrs = [] // 环1分组
595
+ let resultArr = [] // 环2分组
596
+ for (let j = 0; j < ringsequence[0].length; j += minLength) {
597
+ resultArrs.push(ringsequence[0].slice(j, j + minLength))
598
+ if (ringsequence[0].length === minLength) {
599
+ resultArrs.push([])
600
+ }
601
+ }
602
+ for (let i = 0; i < ringsequence[1].length; i += minLength) {
603
+ resultArr.push(ringsequence[1].slice(i, i + minLength))
604
+ }
584
605
  this.patternInfo = []
585
606
  let currentArr = []
586
607
  let newPattern = []
@@ -604,8 +625,60 @@ export default {
604
625
  }
605
626
  if (currentArr.length !== 0) {
606
627
  let newCurrent = this.tranform(currentArr)
607
- let ringTeam = this.step1(this.phaseList, newCurrent)
608
- this.fillGap(ringTeam, val)
628
+ // 取没个环与环关系的并集
629
+ let barrierRing1 = []
630
+ let barrierRing2 = []
631
+ let ring1 = [] // 环1与关系1的并集
632
+ for (let h = 0; h < newCurrent.length; h++) {
633
+ let adds = [...new Set(resultArrs[0])].filter(item => newCurrent[h].includes(item))
634
+ ring1.push(adds)
635
+ }
636
+ let ring1s = [] // 环1与关系2的并集
637
+ for (let h = 0; h < newCurrent.length; h++) {
638
+ let addRing1 = [...new Set(resultArrs[1])].filter(item => newCurrent[h].includes(item))
639
+ ring1s.push(addRing1)
640
+ }
641
+ barrierRing1.push(...ring1, ...ring1s)
642
+ let ring2s = [] // 环2与关系1的并集
643
+ for (let h = 0; h < newCurrent.length; h++) {
644
+ let addRing2 = [...new Set(resultArr[1])].filter(item => newCurrent[h].includes(item))
645
+ ring2s.push(addRing2)
646
+ }
647
+ let ring2 = [] // 环2与关系1的并集
648
+ for (let h = 0; h < newCurrent.length; h++) {
649
+ let add = [...new Set(resultArr[0])].filter(item => newCurrent[h].includes(item))
650
+ ring2.push(add)
651
+ }
652
+ barrierRing2.push(...ring2, ...ring2s)
653
+ let resultList = []
654
+ for (let k = 0; k < barrierRing1.length; k++) {
655
+ resultList.push(barrierRing1[k].concat(barrierRing2[k]))
656
+ }
657
+ let resultLists = resultList.filter(item => item.length !== 0)
658
+ let ringArr = []
659
+ for (let l = 0; l < resultLists.length; l++) {
660
+ for (let d = 0; d < newCurrent.length; d++) {
661
+ if (newCurrent[d].filter(item => resultLists[l].includes(item)).length > 0) {
662
+ ringArr.push({
663
+ data: resultLists[l],
664
+ id: d + 1,
665
+ index: l
666
+ })
667
+ }
668
+ }
669
+ }
670
+ for (var i = 0; i < ringArr.length; i++) {
671
+ for (var j = i + 1; j < ringArr.length; j++) {
672
+ if (ringArr[i].id === ringArr[j].id && ringArr[i].index + 1 === ringArr[j].index) {
673
+ ringArr[i].data = ringArr[i].data.concat(ringArr[j].data)
674
+ ringArr.splice(ringArr.indexOf(ringArr[j].id), 1)
675
+ }
676
+ }
677
+ }
678
+ let resArr = ringArr.map(item => item.data)
679
+ let ringTeam = this.step1(this.phaseList, resArr)
680
+ let ringTeams = ringTeam.filter(item => item.length !== 0)
681
+ this.fillGap(ringTeams, val)
609
682
  }
610
683
  let cycle = this.controlData.cycle
611
684
  for (let rings of val) {
@@ -684,6 +757,27 @@ export default {
684
757
  },
685
758
  handleCurrentChange (val) { // 两个ring的数据
686
759
  if (val === null || val.length === 0) return
760
+ // 按环序分组
761
+ let ringlength = []
762
+ let ringsequence = val.map(item => {
763
+ if (item.length === 0) return
764
+ ringlength.push(item.length)
765
+ return item.map(k => {
766
+ return k.id
767
+ })
768
+ })
769
+ let minLength = Math.min(...ringlength)
770
+ let resultArrs = [] // 环1分组
771
+ let resultArr = [] // 环2分组
772
+ for (let j = 0; j < ringsequence[0].length; j += minLength) {
773
+ resultArrs.push(ringsequence[0].slice(j, j + minLength))
774
+ if (ringsequence[0].length === minLength) {
775
+ resultArrs.push([])
776
+ }
777
+ }
778
+ for (let i = 0; i < ringsequence[1].length; i += minLength) {
779
+ resultArr.push(ringsequence[1].slice(i, i + minLength))
780
+ }
687
781
  this.patternInfo = []
688
782
  this.barrierList = []
689
783
  let currentArr = []
@@ -708,12 +802,64 @@ export default {
708
802
  }
709
803
  if (currentArr.length !== 0) {
710
804
  let newCurrent = this.tranform(currentArr)
711
- let ringTeam = this.step1(this.phaseList, newCurrent)
805
+ // 取没个环与环关系的并集
806
+ let barrierRing1 = []
807
+ let barrierRing2 = []
808
+ let ring1 = [] // 环1与关系1的并集
809
+ for (let h = 0; h < newCurrent.length; h++) {
810
+ let adds = [...new Set(resultArrs[0])].filter(item => newCurrent[h].includes(item))
811
+ ring1.push(adds)
812
+ }
813
+ let ring1s = [] // 环1与关系2的并集
814
+ for (let h = 0; h < newCurrent.length; h++) {
815
+ let addRing1 = [...new Set(resultArrs[1])].filter(item => newCurrent[h].includes(item))
816
+ ring1s.push(addRing1)
817
+ }
818
+ barrierRing1.push(...ring1, ...ring1s)
819
+ let ring2s = [] // 环2与关系1的并集
820
+ for (let h = 0; h < newCurrent.length; h++) {
821
+ let addRing2 = [...new Set(resultArr[1])].filter(item => newCurrent[h].includes(item))
822
+ ring2s.push(addRing2)
823
+ }
824
+ let ring2 = [] // 环2与关系1的并集
825
+ for (let h = 0; h < newCurrent.length; h++) {
826
+ let add = [...new Set(resultArr[0])].filter(item => newCurrent[h].includes(item))
827
+ ring2.push(add)
828
+ }
829
+ barrierRing2.push(...ring2, ...ring2s)
830
+ let resultList = []
831
+ for (let k = 0; k < barrierRing1.length; k++) {
832
+ resultList.push(barrierRing1[k].concat(barrierRing2[k]))
833
+ }
834
+ let resultLists = resultList.filter(item => item.length !== 0)
835
+ let ringArr = []
836
+ for (let l = 0; l < resultLists.length; l++) {
837
+ for (let d = 0; d < newCurrent.length; d++) {
838
+ if (newCurrent[d].filter(item => resultLists[l].includes(item)).length > 0) {
839
+ ringArr.push({
840
+ data: resultLists[l],
841
+ id: d + 1,
842
+ index: l
843
+ })
844
+ }
845
+ }
846
+ }
847
+ for (var i = 0; i < ringArr.length; i++) {
848
+ for (var j = i + 1; j < ringArr.length; j++) {
849
+ if (ringArr[i].id === ringArr[j].id && ringArr[i].index + 1 === ringArr[j].index) {
850
+ ringArr[i].data = ringArr[i].data.concat(ringArr[j].data)
851
+ ringArr.splice(ringArr.indexOf(ringArr[j].id), 1)
852
+ }
853
+ }
854
+ }
855
+ let resArr = ringArr.map(item => item.data)
856
+ let ringTeam = this.step1(this.phaseList, resArr)
857
+ let ringTeams = ringTeam.filter(item => item.length !== 0)
712
858
  if (this.patternList) {
713
- this.setBarrier(ringTeam, val)
859
+ this.setBarrier(ringTeams, val)
714
860
  }
715
- this.fillGap(ringTeam, val)
716
- let barrier = this.step2(ringTeam, newPattern)
861
+ this.fillGap(ringTeams, val)
862
+ let barrier = this.step2(ringTeams, newPattern)
717
863
  this.barrierList = barrier.map(j => {
718
864
  return (j / (this.max ? this.max : this.newCycle) * 100) + '%'
719
865
  })
@@ -775,33 +921,16 @@ export default {
775
921
  ]
776
922
  }
777
923
  }
924
+ obj.split = split
778
925
  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) + '%'
926
+ obj.redWidth = ((currPhase.redclear + ring.sum) / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
781
927
  } else {
782
- obj.split = split
783
- obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
928
+ obj.redWidth = (currPhase.redclear / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
784
929
  }
785
930
  obj.mode = ring.mode
931
+ obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / (this.max ? this.max : this.newCycle) * 100).toFixed(3) + '%'
786
932
  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
933
  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
934
  // 忽略相位不显示
806
935
  // let mode = ring.mode
807
936
  // if (mode !== 7) { // 忽略相位不显示
@@ -821,6 +950,7 @@ export default {
821
950
  })
822
951
  })
823
952
  let ret = ringTeam.map((y, index) => {
953
+ if (!y || y.length === 0) return
824
954
  y.map(n => {
825
955
  n.length = n.data.length > 1 ? n.data.reduce((pre, cur) => pre + patternObjs[cur], 0) : patternObjs[n.data[0]]
826
956
  })
@@ -897,6 +1027,7 @@ export default {
897
1027
  // }
898
1028
  })
899
1029
  newArr.forEach((na, index) => {
1030
+ if (!na || na.length === 0) return
900
1031
  let max = 0
901
1032
  na.forEach(n => {
902
1033
  const total = n.data.reduce((pre, cur) => pre + patternObj[cur], 0)
@@ -904,7 +1035,7 @@ export default {
904
1035
  max = total
905
1036
  }
906
1037
  })
907
- while (index > 0) { // && max < _this.newCycle
1038
+ while (index > 0 && max < this.max) { // && max < _this.newCycle
908
1039
  index--
909
1040
  max += ret[index]
910
1041
  }
@@ -925,6 +1056,7 @@ export default {
925
1056
  let newMax = []
926
1057
  let newMin = []
927
1058
  newArr.forEach((na, index) => {
1059
+ if (!na || na.length === 0) return
928
1060
  na.map(n => {
929
1061
  n.length = n.data.length > 1 ? n.data.reduce((pre, cur) => pre + patternObj[cur], 0) : patternObj[n.data[0]]
930
1062
  })
@@ -1127,6 +1259,9 @@ export default {
1127
1259
  .direction {
1128
1260
  opacity: 0.6;
1129
1261
  }
1262
+ .mask {
1263
+ background: rgb(242, 121, 121) !important;
1264
+ }
1130
1265
  .first-1 {
1131
1266
  float: left;
1132
1267
  // 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>