openatc-components 0.1.56 → 0.1.58

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.56",
3
+ "version": "0.1.58",
4
4
  "description": "A Vue.js project",
5
5
  "author": "openatc developer",
6
6
  "private": false,
@@ -192,51 +192,58 @@ export default {
192
192
  // this.stageLineStatus = true
193
193
  if (this.controlData) {
194
194
  if (this.localPatternList.length === 0) return
195
- let ringList = this.localPatternList.filter(item => {
196
- return item.id === this.controlData.patternid
197
- })[0].rings
198
- if (!rings.rings) return
199
- // let mapAdd = rings.phase.map(item => {
200
- // return {
201
- // id: item.id,
202
- // split: item.split
203
- // }
204
- // })
205
- // let newRings = rings.rings.map(j => {
206
- // return j.sequence
207
- // })
208
- // let newList = newRings.map(item => {
209
- // let ret = []
210
- // item.map(i => {
211
- // const find = mapAdd.find(j => j.id === i)
212
- // if (find) {
213
- // ret.push(find)
214
- // }
215
- // })
216
- // return ret
217
- // })
218
- // let mapAdds = newList.map(item => {
219
- // return item.map(val => {
220
- // return val.split
221
- // })
222
- // })
223
- // let maxCycle = mapAdds.length > 0 ? mapAdds.map(item => {
224
- // return item.length > 0 ? item.reduce((a, b) => {
225
- // return a + b
226
- // }) : 0
227
- // }) : 0
228
- let mapAdd = ringList.map(item => {
229
- return item.map(val => {
230
- return val.value + (val.sum ? val.sum : 0)
195
+ let idPattern = this.localPatternList.filter(item => item.id === this.controlData.patternid)
196
+ if (idPattern.length === 0) {
197
+ let mapAdd = rings.phase.map(item => {
198
+ return {
199
+ id: item.id,
200
+ value: item.split
201
+ }
231
202
  })
232
- })
233
- let maxCycle = mapAdd.length > 0 ? mapAdd.map(item => {
234
- return item.length > 0 ? item.reduce((a, b) => {
235
- return a + b
203
+ let newRings = rings.rings.map(j => {
204
+ return j.sequence
205
+ })
206
+ let newList = newRings.map(item => {
207
+ let ret = []
208
+ item.map(i => {
209
+ const find = mapAdd.find(j => j.id === i)
210
+ if (find) {
211
+ ret.push(find)
212
+ }
213
+ })
214
+ return ret
215
+ })
216
+ let mapAdds = newList.map(item => {
217
+ return item.map(val => {
218
+ return val.value
219
+ })
220
+ })
221
+ let maxCycle = mapAdds.length > 0 ? mapAdds.map(item => {
222
+ return item.length > 0 ? item.reduce((a, b) => {
223
+ return a + b
224
+ }) : 0
236
225
  }) : 0
237
- }) : 0
238
- this.max = Math.max(...maxCycle)// 每个环的周期最大值
239
- this.getControl(ringList)
226
+ this.max = Math.max(...maxCycle)// 每个环的周期最大值
227
+ this.getControl(newList)
228
+ } else {
229
+ let ringList = this.localPatternList.filter(item => {
230
+ return item.id === this.controlData.patternid
231
+ })[0].rings
232
+ if (!rings.rings) return
233
+
234
+ let mapAdd = ringList.map(item => {
235
+ return item.map(val => {
236
+ return val.value + (val.sum ? val.sum : 0)
237
+ })
238
+ })
239
+ let maxCycle = mapAdd.length > 0 ? mapAdd.map(item => {
240
+ return item.length > 0 ? item.reduce((a, b) => {
241
+ return a + b
242
+ }) : 0
243
+ }) : 0
244
+ this.max = Math.max(...maxCycle)// 每个环的周期最大值
245
+ this.getControl(ringList)
246
+ }
240
247
  } else {
241
248
  let mapAdd = rings.map(item => {
242
249
  return item.map(val => {
@@ -70,17 +70,20 @@ export default class RingDataModel {
70
70
  let peddirections = []
71
71
  let sidewalkPhaseData = this.getPedPhasePos()
72
72
  for (let walk of sidewalkPhaseData) {
73
- if (!phaseList.peddirection) return
74
- for (let ped of phaseList.peddirection) {
73
+ if (phaseList.peddirection) {
74
+ for (let ped of phaseList.peddirection) {
75
75
  // if (stg === walk.phaseid) {
76
- let obj = {}
77
- obj.name = walk.name
78
- obj.id = walk.id
79
- if (ped === walk.id) {
80
- peddirections.push(obj)
81
- peddirections = Array.from(new Set(peddirections))
82
- }
76
+ let obj = {}
77
+ obj.name = walk.name
78
+ obj.id = walk.id
79
+ if (ped === walk.id) {
80
+ peddirections.push(obj)
81
+ peddirections = Array.from(new Set(peddirections))
82
+ }
83
83
  // }
84
+ }
85
+ } else {
86
+ peddirections = []
84
87
  }
85
88
  }
86
89
  for (let id of phaseList.direction) {