openatc-components 0.1.41 → 0.1.42

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.
@@ -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和上一个相比不同说明相位变化了