openatc-components 0.0.74 → 0.0.75

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.0.74",
3
+ "version": "0.0.75",
4
4
  "description": "A Vue.js project",
5
5
  "author": "openatc developer",
6
6
  "private": false,
@@ -65,12 +65,12 @@
65
65
  </over-lap>
66
66
  </div>
67
67
  </div>
68
-
69
68
  <div ref="tuxingRight" class="tuxing-right" >
70
69
  <scheme-config
71
70
  ref="rightpanel"
72
71
  :statusData="crossStatusData"
73
72
  :agentName="agentName"
73
+ :planPattern="planPattern"
74
74
  :responseTime="responseTime"
75
75
  :devStatus="devStatus"
76
76
  :agentId="agentId"
@@ -145,6 +145,7 @@ export default {
145
145
  controlData: {},
146
146
  checked: false,
147
147
  overlap: [],
148
+ planPattern: {},
148
149
  contrloType: '',
149
150
  narr: [],
150
151
  patternList: [],
@@ -278,6 +279,84 @@ export default {
278
279
  setHost(host)
279
280
  }
280
281
  },
282
+ patternPlan () {
283
+ // this.increaseId()
284
+ let Pattern = {
285
+ // id: this.id,
286
+ // desc: `${this.$t('edge.pattern.pattern')}${this.id}`,
287
+ offset: 0,
288
+ cycle: 0,
289
+ // stagesList: [],
290
+ rings: [[], [], [], []]
291
+ }
292
+ var newPattern = JSON.parse(JSON.stringify(Pattern))
293
+ // debugger
294
+ // const phaseList = JSON.parse(JSON.stringify(this.globalParamModel.getParamsByType('phaseList')))
295
+ for (let phase of this.phaseList) {
296
+ let ring = {}
297
+ ring.name = 'Phase ' + phase.id
298
+ ring.desc = this.getPhaseDescription(phase.direction)
299
+ ring.id = phase.id
300
+ ring.value = 30
301
+ ring.mode = 2
302
+ ring.options = []
303
+ ring.delaystart = 0
304
+ ring.advanceend = 0
305
+ if (phase.ring === 1) {
306
+ newPattern.rings[0].push(ring)
307
+ } else if (phase.ring === 2) {
308
+ newPattern.rings[1].push(ring)
309
+ } else if (phase.ring === 3) {
310
+ newPattern.rings[2].push(ring)
311
+ } else if (phase.ring === 4) {
312
+ newPattern.rings[3].push(ring)
313
+ }
314
+ // pahseIndex++
315
+ }
316
+ this.planPattern = newPattern
317
+ return newPattern
318
+ },
319
+ getPhaseDescription (phaseList) {
320
+ if (!phaseList) return
321
+ let list = []
322
+ for (let id of phaseList) {
323
+ let obj = {}
324
+ obj.id = id
325
+ obj.color = '#454545'
326
+ list.push(obj)
327
+ }
328
+ return list
329
+ },
330
+ getCycle () {
331
+ for (let rings of this.planPattern.rings) {
332
+ let num = 0
333
+ for (let i = 0; i < rings.length; i++) {
334
+ if (rings[i].length !== 0) {
335
+ if (rings[i].mode === 7) { // 忽略相位不计周期
336
+ continue
337
+ }
338
+ num = num + Number(rings[i].value)
339
+ let id = rings[i].id
340
+ rings[i].name = this.getDescription(id)
341
+ }
342
+ }
343
+ if (num !== 0) {
344
+ this.planPattern.cycle = num
345
+ break
346
+ }
347
+ }
348
+ },
349
+ getDescription (id) {
350
+ for (let phase of this.phaseList) {
351
+ if (phase.id === id) {
352
+ if (phase.desc !== '' && phase.desc !== undefined) {
353
+ return phase.desc
354
+ } else {
355
+ return 'phase' + id
356
+ }
357
+ }
358
+ }
359
+ },
281
360
  getIntersectionInfo (agentid, id) {
282
361
  // 获取路口信息
283
362
  getIntersectionInfo(agentid).then(res => {
@@ -286,9 +365,11 @@ export default {
286
365
  this.overlap = res.data.data.param.overlaplList
287
366
  this.contrloType = this.allPatternList[0].contrloType
288
367
  this.phaseList = res.data.data.param.phaseList
289
- this.patternList = res.data.data.param.patternList.filter(item => {
290
- return item.id === id
291
- })[0].rings
368
+ this.patternPlan()
369
+ this.getCycle()
370
+ // this.patternList = res.data.data.param.patternList.filter(item => {
371
+ // return item.id === id
372
+ // })[0].rings
292
373
  })
293
374
  },
294
375
  getPedPhasePos () {