openatc-components 0.1.63 → 0.1.65

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.
@@ -161,10 +161,10 @@ export default {
161
161
  computed: {
162
162
  paddingLeft () {
163
163
  let res = '0%'
164
- if (this.newCycle && this.newCycle > 0) {
165
- let curPercent = (this.newCycle - this.syncTime) / this.newCycle
166
- res = curPercent * 100 + '%'
167
- }
164
+ // if (this.newCycle && this.newCycle > 0) {
165
+ // let curPercent = (this.newCycle - this.syncTime) / this.newCycle
166
+ // res = curPercent * 100 + '%'
167
+ // }
168
168
  if (this.cycle && this.cycle > 0) {
169
169
  let curPercent = (this.cycle - this.syncTime) / (this.max ? this.max : this.cycle)
170
170
  res = curPercent * 100 + '%'
@@ -191,6 +191,7 @@ export default {
191
191
  // this.controlDatas = this.controlData
192
192
  this.getPedPhasePos()
193
193
  if (this.localPatternList) {
194
+ this.max = ''
194
195
  let idPattern = this.localPatternList.filter(item => item.id === this.controlData.patternid)
195
196
  if (idPattern.length === 0 || (this.controlData && this.showCondition)) {
196
197
  this.handleTentivePatternData()
@@ -558,13 +559,13 @@ export default {
558
559
  }
559
560
  obj.split = split
560
561
  if (ring.sum) {
561
- obj.redWidth = ((currPhase.redclear + ring.sum) / cycle * 100).toFixed(3) + '%'
562
+ obj.redWidth = ((currPhase.redclear + ring.sum) / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
562
563
  } else {
563
- obj.redWidth = (currPhase.redclear / cycle * 100).toFixed(3) + '%'
564
+ obj.redWidth = (currPhase.redclear / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
564
565
  }
565
- obj.flashgreen = (currPhase.flashgreen / cycle * 100).toFixed(3) + '%'
566
- obj.yellowWidth = (currPhase.yellow / cycle * 100).toFixed(3) + '%'
567
- obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / cycle * 100).toFixed(3) + '%'
566
+ obj.flashgreen = (currPhase.flashgreen / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
567
+ obj.yellowWidth = (currPhase.yellow / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
568
+ obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
568
569
  // 忽略相位不显示
569
570
  // let mode = ring.mode
570
571
  // if (mode !== 7) { // 忽略相位不显示
@@ -774,13 +775,13 @@ export default {
774
775
  }
775
776
  obj.split = split
776
777
  if (ring.sum) {
777
- obj.redWidth = ((currPhase.redclear + ring.sum) / cycle * 100).toFixed(3) + '%'
778
+ obj.redWidth = ((currPhase.redclear + ring.sum) / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
778
779
  } else {
779
- obj.redWidth = (currPhase.redclear / cycle * 100).toFixed(3) + '%'
780
+ obj.redWidth = (currPhase.redclear / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
780
781
  }
781
- obj.flashgreen = (currPhase.flashgreen / cycle * 100).toFixed(3) + '%'
782
- obj.yellowWidth = (currPhase.yellow / cycle * 100).toFixed(3) + '%'
783
- obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / cycle * 100).toFixed(3) + '%'
782
+ obj.flashgreen = (currPhase.flashgreen / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
783
+ obj.yellowWidth = (currPhase.yellow / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
784
+ obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
784
785
  // 忽略相位不显示
785
786
  // let mode = ring.mode
786
787
  // if (mode !== 7) { // 忽略相位不显示
@@ -1065,26 +1066,27 @@ export default {
1065
1066
  },
1066
1067
  step2 (newArr, pattern) { // 不同环并发相位做比较
1067
1068
  let ret = []
1069
+ let max = 0
1068
1070
  const patternObj = {}
1069
1071
  pattern.forEach(l => {
1070
1072
  // if (l.mode !== 7) {
1071
1073
  patternObj[l.id] = l.value
1072
1074
  // }
1073
1075
  })
1074
- newArr.forEach((na, index) => {
1075
- if (!na || na.length === 0) return
1076
- let max = 0
1077
- na.forEach(n => {
1078
- const total = n.data.reduce((pre, cur) => pre + patternObj[cur], 0)
1079
- if (total > max) {
1080
- max = total
1076
+ let barrierCycle = newArr.map(item => {
1077
+ return Math.max.apply(Math, item.map(k => { return k.length }))
1078
+ })
1079
+ barrierCycle.forEach((b, index) => {
1080
+ if (index === 0) {
1081
+ ret.push(barrierCycle[index])
1082
+ } else {
1083
+ if (max) {
1084
+ max = barrierCycle[index] + max
1085
+ } else {
1086
+ max = barrierCycle[index] + barrierCycle[index - 1]
1081
1087
  }
1082
- })
1083
- while (index > 0 && max < this.newCycle) { // && max < _this.newCycle
1084
- index--
1085
- max += ret[index]
1088
+ ret.push(max)
1086
1089
  }
1087
- ret.push(max)
1088
1090
  })
1089
1091
  return ret
1090
1092
  },