openatc-components 0.0.77 → 0.0.78

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.
@@ -150,7 +150,6 @@ export default {
150
150
  })
151
151
  }
152
152
  })
153
- console.log(overlapData, 'overlapData')
154
153
  this.overlapDatas = overlapData
155
154
  }
156
155
  }
@@ -65,7 +65,6 @@
65
65
  :phaseList="phaseList"
66
66
  :overlap="overlap"
67
67
  :patternSelect="patternSelect"
68
- :planPattern="planPattern"
69
68
  :allPatternList="allPatternList"
70
69
  @closePhaseBack="closePhaseBack"
71
70
  @closePhaseControl="closePhaseControl"
@@ -156,9 +155,6 @@ export default {
156
155
  ip: {
157
156
  type: String
158
157
  },
159
- planPattern: {
160
- type: Object
161
- },
162
158
  allPatternList: {
163
159
  type: Array
164
160
  },
@@ -171,9 +171,6 @@ export default {
171
171
  allPatternList: {
172
172
  type: Array
173
173
  },
174
- planPattern: {
175
- type: Object
176
- },
177
174
  patternSelect: {
178
175
  type: Array
179
176
  }
@@ -302,149 +299,7 @@ export default {
302
299
  ringCounts: 1,
303
300
  coordphaseOption: [],
304
301
  patternOne: [],
305
- // planPattern: {
306
- // cycle: 120,
307
- // offset: 0,
308
- // rings: [
309
- // [
310
- // {
311
- // 'name': 'Phase 1',
312
- // 'desc': [
313
- // {
314
- // 'id': 13,
315
- // 'color': '#454545'
316
- // }
317
- // ],
318
- // 'id': 1,
319
- // 'value': 30,
320
- // 'mode': 2,
321
- // 'options': [],
322
- // 'delaystart': 0,
323
- // 'advanceend': 0
324
- // },
325
- // {
326
- // 'name': 'Phase 2',
327
- // 'desc': [
328
- // {
329
- // 'id': 3,
330
- // 'color': '#454545'
331
- // },
332
- // {
333
- // 'id': 12,
334
- // 'color': '#454545'
335
- // }
336
- // ],
337
- // 'id': 2,
338
- // 'value': 30,
339
- // 'mode': 2,
340
- // 'options': [],
341
- // 'delaystart': 0,
342
- // 'advanceend': 0
343
- // },
344
- // {
345
- // 'name': 'Phase 3',
346
- // 'desc': [
347
- // {
348
- // 'id': 1,
349
- // 'color': '#454545'
350
- // }
351
- // ],
352
- // 'id': 3,
353
- // 'value': 30,
354
- // 'mode': 2,
355
- // 'options': [],
356
- // 'delaystart': 0,
357
- // 'advanceend': 0
358
- // },
359
- // {
360
- // 'name': 'Phase 4',
361
- // 'desc': [
362
- // {
363
- // 'id': 6,
364
- // 'color': '#454545'
365
- // },
366
- // {
367
- // 'id': 8,
368
- // 'color': '#454545'
369
- // }
370
- // ],
371
- // 'id': 4,
372
- // 'value': 30,
373
- // 'mode': 2,
374
- // 'options': [],
375
- // 'delaystart': 0,
376
- // 'advanceend': 0
377
- // }
378
- // ],
379
- // [
380
- // {
381
- // 'name': 'Phase 5',
382
- // 'desc': [
383
- // {
384
- // 'id': 9,
385
- // 'color': '#454545'
386
- // }
387
- // ],
388
- // 'id': 5,
389
- // 'value': 30,
390
- // 'mode': 2,
391
- // 'options': [],
392
- // 'delaystart': 0,
393
- // 'advanceend': 0
394
- // },
395
- // {
396
- // 'name': 'Phase 6',
397
- // 'desc': [
398
- // {
399
- // 'id': 14,
400
- // 'color': '#454545'
401
- // },
402
- // {
403
- // 'id': 16,
404
- // 'color': '#454545'
405
- // }
406
- // ],
407
- // 'id': 6,
408
- // 'value': 30,
409
- // 'mode': 2,
410
- // 'options': [],
411
- // 'delaystart': 0,
412
- // 'advanceend': 0
413
- // },
414
- // {
415
- // 'name': 'Phase 7',
416
- // 'desc': [],
417
- // 'id': 7,
418
- // 'value': 30,
419
- // 'mode': 2,
420
- // 'options': [],
421
- // 'delaystart': 0,
422
- // 'advanceend': 0
423
- // },
424
- // {
425
- // 'name': 'Phase 8',
426
- // 'desc': [
427
- // {
428
- // 'id': 2,
429
- // 'color': '#454545'
430
- // },
431
- // {
432
- // 'id': 4,
433
- // 'color': '#454545'
434
- // }
435
- // ],
436
- // 'id': 8,
437
- // 'value': 30,
438
- // 'mode': 2,
439
- // 'options': [],
440
- // 'delaystart': 0,
441
- // 'advanceend': 0
442
- // }
443
- // ],
444
- // [],
445
- // []
446
- // ]
447
- // },
302
+ planPattern: {},
448
303
  // allPatternList: [
449
304
  // {
450
305
  // 'id': 1,
@@ -1176,12 +1031,71 @@ export default {
1176
1031
  }
1177
1032
  },
1178
1033
  created () {
1034
+ this.patternPlan()
1035
+ this.getCycle()
1179
1036
  if (this.patternOne.length === 0) {
1180
1037
  this.handleStageData(this.planPattern.rings)
1181
1038
  }
1182
1039
  this.initData()
1183
1040
  },
1184
1041
  methods: {
1042
+ patternPlan () {
1043
+ let Pattern = {
1044
+ offset: 0,
1045
+ cycle: 0,
1046
+ rings: [[], [], [], []]
1047
+ }
1048
+ var newPattern = JSON.parse(JSON.stringify(Pattern))
1049
+ for (let phase of this.phaseList) {
1050
+ let ring = {}
1051
+ ring.name = 'Phase ' + phase.id
1052
+ ring.desc = this.getPhaseDescription(phase.direction)
1053
+ ring.id = phase.id
1054
+ ring.value = 30
1055
+ ring.mode = 2
1056
+ ring.options = []
1057
+ ring.delaystart = 0
1058
+ ring.advanceend = 0
1059
+ if (phase.ring === 1) {
1060
+ newPattern.rings[0].push(ring)
1061
+ } else if (phase.ring === 2) {
1062
+ newPattern.rings[1].push(ring)
1063
+ } else if (phase.ring === 3) {
1064
+ newPattern.rings[2].push(ring)
1065
+ } else if (phase.ring === 4) {
1066
+ newPattern.rings[3].push(ring)
1067
+ }
1068
+ }
1069
+ this.planPattern = newPattern
1070
+ },
1071
+ getCycle () {
1072
+ for (let rings of this.planPattern.rings) {
1073
+ let num = 0
1074
+ for (let i = 0; i < rings.length; i++) {
1075
+ if (rings[i].length !== 0) {
1076
+ if (rings[i].mode === 7) { // 忽略相位不计周期
1077
+ continue
1078
+ }
1079
+ num = num + Number(rings[i].value)
1080
+ }
1081
+ }
1082
+ if (num !== 0) {
1083
+ this.planPattern.cycle = num
1084
+ break
1085
+ }
1086
+ }
1087
+ },
1088
+ getPhaseDescription (phaseList) {
1089
+ if (!phaseList) return
1090
+ let list = []
1091
+ for (let id of phaseList) {
1092
+ let obj = {}
1093
+ obj.id = id
1094
+ obj.color = '#454545'
1095
+ list.push(obj)
1096
+ }
1097
+ return list
1098
+ },
1185
1099
  handleClose () {
1186
1100
  this.$emit('closePhaseBack')
1187
1101
  },
@@ -70,7 +70,6 @@
70
70
  ref="rightpanel"
71
71
  :statusData="crossStatusData"
72
72
  :agentName="agentName"
73
- :planPattern="planPattern"
74
73
  :responseTime="responseTime"
75
74
  :devStatus="devStatus"
76
75
  :agentId="agentId"
@@ -145,7 +144,6 @@ export default {
145
144
  controlData: {},
146
145
  checked: false,
147
146
  overlap: [],
148
- planPattern: {},
149
147
  contrloType: '',
150
148
  narr: [],
151
149
  patternList: [],
@@ -279,84 +277,6 @@ export default {
279
277
  setHost(host)
280
278
  }
281
279
  },
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
- },
360
280
  getIntersectionInfo (agentid, id) {
361
281
  // 获取路口信息
362
282
  getIntersectionInfo(agentid).then(res => {
@@ -365,8 +285,6 @@ export default {
365
285
  this.overlap = res.data.data.param.overlaplList
366
286
  this.contrloType = this.allPatternList[0].contrloType
367
287
  this.phaseList = res.data.data.param.phaseList
368
- this.patternPlan()
369
- this.getCycle()
370
288
  // this.patternList = res.data.data.param.patternList.filter(item => {
371
289
  // return item.id === id
372
290
  // })[0].rings