openatc-components 0.1.41 → 0.1.43

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.
@@ -166,7 +166,7 @@ export default {
166
166
  res = curPercent * 100 + '%'
167
167
  }
168
168
  if (this.cycle && this.cycle > 0) {
169
- let curPercent = (this.cycle - this.syncTime) / this.cycle
169
+ let curPercent = (this.cycle - this.syncTime) / (this.max ? this.max : this.cycle)
170
170
  res = curPercent * 100 + '%'
171
171
  }
172
172
  return res
@@ -471,18 +471,18 @@ export default {
471
471
  })
472
472
  if (this.phaseList.length === 0) return
473
473
  for (let patternStatus of val[0]) {
474
- if (patternStatus.mode !== 7) {
475
- let concurrent = this.phaseList.filter((item) => {
476
- return item.id === patternStatus.id // patternStatus.id当前相位id concurrent当前相位的并发相位
477
- })[0].concurrent// 当前相位的并发相位
478
- if (concurrent) {
479
- let obj = {
480
- id: patternStatus.id,
481
- current: concurrent.sort()
482
- }
483
- currentArr.push(obj)
474
+ // if (patternStatus.mode !== 7) {
475
+ let concurrent = this.phaseList.filter((item) => {
476
+ return item.id === patternStatus.id // patternStatus.id当前相位id concurrent当前相位的并发相位
477
+ })[0].concurrent// 当前相位的并发相位
478
+ if (concurrent) {
479
+ let obj = {
480
+ id: patternStatus.id,
481
+ current: concurrent.sort()
484
482
  }
483
+ currentArr.push(obj)
485
484
  }
485
+ // }
486
486
  }
487
487
  if (currentArr.length !== 0) {
488
488
  let newCurrent = this.tranform(currentArr)
@@ -555,10 +555,10 @@ export default {
555
555
  obj.yellowWidth = (currPhase.yellow / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
556
556
  obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
557
557
  // 忽略相位不显示
558
- let mode = ring.mode
559
- if (mode !== 7) { // 忽略相位不显示
560
- list.push(obj)
561
- }
558
+ // let mode = ring.mode
559
+ // if (mode !== 7) { // 忽略相位不显示
560
+ list.push(obj)
561
+ // }
562
562
  }
563
563
  this.patternInfo.push(list)
564
564
  }
@@ -275,6 +275,26 @@ export default {
275
275
  }
276
276
  }
277
277
  },
278
+ getCycles () {
279
+ if (!this.patternOne[0].stages) return
280
+ let stages = this.patternOne[0].stages
281
+ let modeId = stages.filter(item => item.length === 1)[0]
282
+ for (let rings of this.patternOne[0].rings) {
283
+ let num = 0
284
+ for (let i = 0; i < rings.length; i++) {
285
+ if (rings[i].length !== 0) {
286
+ if (rings[i].mode === 7 && (modeId && modeId[0] === rings[i].id)) { // 忽略相位不计周期
287
+ continue
288
+ }
289
+ num = num + Number(rings[i].value)
290
+ }
291
+ }
292
+ if (num !== 0) {
293
+ this.patternOne[0].cycle = num
294
+ break
295
+ }
296
+ }
297
+ },
278
298
  getPhaseDescription (phaseList) {
279
299
  if (!phaseList) return
280
300
  let list = []
@@ -343,11 +363,15 @@ export default {
343
363
  let currPattern = this.patternOne[0].rings
344
364
  setTimeout(() => {
345
365
  this.handleStageData(currPattern)
366
+ this.getCycles()
367
+ this.patternOne[0].stagesList = this.stagesList
346
368
  }, 50)
347
369
  } else {
348
370
  let currPattern = this.planPattern.rings
349
371
  setTimeout(() => {
350
372
  this.handleStageData(currPattern)
373
+ this.getCycle()
374
+ this.allPatternList[0].stagesList = this.stagesList
351
375
  }, 50)
352
376
  }
353
377
  },
@@ -383,11 +407,11 @@ export default {
383
407
  // rings = JSON.parse(JSON.stringify(rings))
384
408
  let mapAdd = rings.map(item => {
385
409
  return item.map(val => {
386
- if (val.mode !== 7) {
387
- return val.value + (val.sum ? val.sum : 0)
388
- } else {
389
- return 0
390
- }
410
+ // if (val.mode !== 7) {
411
+ return val.value + (val.sum ? val.sum : 0)
412
+ // } else {
413
+ // return 0
414
+ // }
391
415
  })
392
416
  })
393
417
  let maxCycle = mapAdd.length > 0 ? mapAdd.map(item => {
@@ -405,14 +429,14 @@ export default {
405
429
  let ring = rings[i]// 每个环对象
406
430
  let sum = 0
407
431
  for (let n = 0; n < ring.length; n++) { // 相位累计长度
408
- if (ring[n].mode !== 7) {
409
- sum = sum + ring[n].value + (ring[n].sum ? ring[n].sum : 0)
410
- if (j < sum) {
411
- let phaseId = ring[n].id
412
- currentIds = currentIds + '-' + phaseId
413
- break
414
- }
432
+ // if (ring[n].mode !== 7) {
433
+ sum = sum + ring[n].value + (ring[n].sum ? ring[n].sum : 0)
434
+ if (j < sum) {
435
+ let phaseId = ring[n].id
436
+ currentIds = currentIds + '-' + phaseId
437
+ break
415
438
  }
439
+ // }
416
440
  }
417
441
  }
418
442
  if (lastCurrentIds !== currentIds && lastCurrentIds !== '') { // 当前相位id和上一个相比不同说明相位变化了
@@ -157,18 +157,20 @@ export default {
157
157
  let ring = newList[i]// 每个环对象
158
158
  let sum = 0
159
159
  for (let n = 0; n < ring.length; n++) { // 相位累计长度
160
- if (ring[n].mode !== 7) {
161
- if (this.controlData) {
162
- sum = sum + ring[n].split
163
- } else {
164
- sum = sum + ring[n].value
165
- }
166
- if (j < sum) {
167
- let phaseId = ring[n].id
168
- currentIds = currentIds + '-' + phaseId
169
- break
170
- }
160
+ // if (ring[n].mode !== 7) {
161
+ // if (this.controlData) {
162
+ // sum = sum + ring[n].split
163
+ sum = sum + ring[n].value + (ring[n].sum ? ring[n].sum : 0)
164
+ // } else {
165
+ // sum = sum + ring[n].value
166
+ // sum = sum + ring[n].value + (ring[n].sum ? ring[n].sum : 0)
167
+ // }
168
+ if (j < sum) {
169
+ let phaseId = ring[n].id
170
+ currentIds = currentIds + '-' + phaseId
171
+ break
171
172
  }
173
+ // }
172
174
  }
173
175
  }
174
176
  if (lastCurrentIds !== currentIds && lastCurrentIds !== '') { // 当前相位id和上一个相比不同说明相位变化了
@@ -189,38 +191,52 @@ export default {
189
191
  }
190
192
  // this.stageLineStatus = true
191
193
  if (this.controlData) {
194
+ if (this.localPatternList.length === 0) return
195
+ let ringList = this.localPatternList.filter(item => {
196
+ return item.id === this.controlData.patternid
197
+ })[0].rings
192
198
  if (!rings.rings) return
193
- let mapAdd = rings.phase.map(item => {
194
- return {
195
- id: item.id,
196
- split: item.split
197
- }
198
- })
199
- let newRings = rings.rings.map(j => {
200
- return j.sequence
201
- })
202
- let newList = newRings.map(item => {
203
- let ret = []
204
- item.map(i => {
205
- const find = mapAdd.find(j => j.id === i)
206
- if (find) {
207
- ret.push(find)
208
- }
209
- })
210
- return ret
211
- })
212
- let mapAdds = newList.map(item => {
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 => {
213
229
  return item.map(val => {
214
- return val.split
230
+ return val.value + (val.sum ? val.sum : 0)
215
231
  })
216
232
  })
217
- let maxCycle = mapAdds.length > 0 ? mapAdds.map(item => {
233
+ let maxCycle = mapAdd.length > 0 ? mapAdd.map(item => {
218
234
  return item.length > 0 ? item.reduce((a, b) => {
219
235
  return a + b
220
236
  }) : 0
221
237
  }) : 0
222
238
  this.max = Math.max(...maxCycle)// 每个环的周期最大值
223
- this.getControl(newList)
239
+ this.getControl(ringList)
224
240
  } else {
225
241
  let mapAdd = rings.map(item => {
226
242
  return item.map(val => {