openatc-components 0.1.42 → 0.1.44

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
@@ -133,7 +133,7 @@
133
133
  :overlap="overlap"
134
134
  :checked="true"
135
135
  :tentative="true"
136
- :cycle="patternOne.length===0?planPattern.cycle:patternOne[0].cycle"
136
+ :cycle="overLapCycle"
137
137
  >
138
138
  </over-lap>
139
139
  </el-col>
@@ -200,6 +200,7 @@ export default {
200
200
  return {
201
201
  stagesList: [],
202
202
  phaseRings: [],
203
+ overLapCycle: 0,
203
204
  options: {
204
205
  group: 'pattern'
205
206
  },
@@ -470,6 +471,7 @@ export default {
470
471
  let stageItem = this.getStageItem(stage, rings, i)
471
472
  stagesList.push(JSON.parse(JSON.stringify(stageItem)))
472
473
  }
474
+ this.overLapCycle = stagesList.reduce((prev, curr) => prev + parseInt(curr.split), 0)
473
475
  this.stagesList = JSON.parse(JSON.stringify(stagesList))
474
476
  }
475
477
  }
@@ -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 => {