openatc-components 0.5.45 → 0.5.46

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.
@@ -433,6 +433,9 @@ export default {
433
433
  },
434
434
  methods: {
435
435
  compareIsChangedPhase (newCrossStatus, oldCrossStatus) {
436
+ if (!oldCrossStatus || !newCrossStatus) return
437
+ if (!newCrossStatus.phase) return
438
+ if (!oldCrossStatus.phase) return
436
439
  if (newCrossStatus.control === 1 || newCrossStatus.control === 2 || newCrossStatus.control === 3) return
437
440
  // 返回的相位状态改变后,按照返回的相位状态更新路口相位显示(下个周期生效)
438
441
  let newPhaseIds = newCrossStatus.phase.map(item => item.id)
@@ -492,7 +495,9 @@ export default {
492
495
  this.getOverlapPhaseStatus()
493
496
  this.getRoadwayLightStatus()
494
497
  this.getCurPhaseCountdown()
495
- this.getCurStageCountdown()
498
+ if (this.isHasStageCountdown) {
499
+ this.getCurStageCountdown()
500
+ }
496
501
  this.getBusPhaseStatus()
497
502
  if (this.mainType === '100' || this.mainType === '101' || this.mainType === '104') {
498
503
  // 城市道路和路段行人过街才显示人行道状态
@@ -852,7 +857,7 @@ export default {
852
857
  stagesList () {
853
858
  let list = []
854
859
  this.isHasStageCountdown = false
855
- if (this.crossStatusData && this.crossStatusData.stages && this.crossInfo.phaseList && this.crossInfo.phaseList.length > 0) {
860
+ if (this.crossStatusData && this.crossStatusData.stages && this.crossInfo && this.crossInfo.phaseList && this.crossInfo.phaseList.length > 0) {
856
861
  this.isHasStageCountdown = true
857
862
  let ringDataModel = new RingDataModel(this.crossStatusData, this.crossInfo.phaseList)
858
863
  list = ringDataModel.getStageData()
@@ -890,11 +895,14 @@ export default {
890
895
  // console.log(this.stageCountdownList)
891
896
  },
892
897
  getshowped (peddirection) {
893
- let peddirarr = peddirection.map(peddir => ({
894
- id: peddir,
895
- name: this.PhaseDataModel.getSidePos(peddir).name,
896
- color: 'rgba(255, 255, 255, 0.4)'
897
- }))
898
+ let peddirarr = []
899
+ if (peddirection) {
900
+ peddirection.map(peddir => ({
901
+ id: peddir,
902
+ name: this.PhaseDataModel.getSidePos(peddir).name,
903
+ color: 'rgba(255, 255, 255, 0.4)'
904
+ }))
905
+ }
898
906
  return peddirarr
899
907
  },
900
908
  getIntersectionInfo () {
@@ -1025,20 +1033,22 @@ export default {
1025
1033
  this.busPhaseData = []
1026
1034
  this.crossInfo.phaseList.forEach((ele, i) => {
1027
1035
  if (ele.controltype >= 3 && ele.controltype <= 6) {
1028
- ele.direction.forEach((dir, index) => {
1029
- // 车道相位
1030
- this.busPhaseData.push({
1031
- key: this.CrossDiagramMgr.getUniqueKey('busphase'),
1032
- phaseid: ele.id, // 相位id,用于对应相位状态
1033
- id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
1034
- name: this.PhaseDataModel.getBusPhasePos(dir).name,
1035
- left: this.PhaseDataModel.getBusPhasePos(dir).x,
1036
- top: this.PhaseDataModel.getBusPhasePos(dir).y,
1037
- busleft: this.PhaseDataModel.getBusMapPos(dir).x,
1038
- bustop: this.PhaseDataModel.getBusMapPos(dir).y,
1039
- controltype: ele.controltype
1036
+ if (ele.direction) {
1037
+ ele.direction.forEach((dir, index) => {
1038
+ // 车道相位
1039
+ this.busPhaseData.push({
1040
+ key: this.CrossDiagramMgr.getUniqueKey('busphase'),
1041
+ phaseid: ele.id, // 相位id,用于对应相位状态
1042
+ id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
1043
+ name: this.PhaseDataModel.getBusPhasePos(dir).name,
1044
+ left: this.PhaseDataModel.getBusPhasePos(dir).x,
1045
+ top: this.PhaseDataModel.getBusPhasePos(dir).y,
1046
+ busleft: this.PhaseDataModel.getBusMapPos(dir).x,
1047
+ bustop: this.PhaseDataModel.getBusMapPos(dir).y,
1048
+ controltype: ele.controltype
1049
+ })
1040
1050
  })
1041
- })
1051
+ }
1042
1052
  }
1043
1053
  })
1044
1054
  // 去掉重复方向的数据
@@ -1055,17 +1065,19 @@ export default {
1055
1065
  this.LanePhaseData = []
1056
1066
  this.crossInfo.phaseList.forEach((ele, i) => {
1057
1067
  if (ele.controltype === undefined || ele.controltype <= 2) {
1058
- ele.direction.forEach((dir, index) => {
1059
- // 车道相位
1060
- this.LanePhaseData.push({
1061
- key: this.CrossDiagramMgr.getUniqueKey('phase'),
1062
- phaseid: ele.id, // 相位id,用于对应相位状态
1063
- id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
1064
- name: this.PhaseDataModel.getPhase(dir).name,
1065
- left: this.PhaseDataModel.getPhase(dir).x,
1066
- top: this.PhaseDataModel.getPhase(dir).y
1068
+ if (ele.direction) {
1069
+ ele.direction.forEach((dir, index) => {
1070
+ // 车道相位
1071
+ this.LanePhaseData.push({
1072
+ key: this.CrossDiagramMgr.getUniqueKey('phase'),
1073
+ phaseid: ele.id, // 相位id,用于对应相位状态
1074
+ id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
1075
+ name: this.PhaseDataModel.getPhase(dir).name,
1076
+ left: this.PhaseDataModel.getPhase(dir).x,
1077
+ top: this.PhaseDataModel.getPhase(dir).y
1078
+ })
1067
1079
  })
1068
- })
1080
+ }
1069
1081
  }
1070
1082
  })
1071
1083
  // 去掉重复方向的数据
@@ -1098,14 +1110,16 @@ export default {
1098
1110
  // 匝道车道相位信息
1099
1111
  this.LanePhaseData = []
1100
1112
  this.crossInfo.phaseList.forEach((ele, i) => {
1101
- ele.direction.forEach((dir, index) => {
1102
- if (ele.controltype === 0) {
1103
- this.handleRampPhasePosData(`${i}-${index}`, ele, dir, this.PhaseDataModel.getMainPhasePos)
1104
- }
1105
- if (ele.controltype === 1) {
1106
- this.handleRampPhasePosData(`${i}-${index}`, ele, dir, this.PhaseDataModel.getSidePhasePos)
1107
- }
1108
- })
1113
+ if (ele.direction) {
1114
+ ele.direction.forEach((dir, index) => {
1115
+ if (ele.controltype === 0) {
1116
+ this.handleRampPhasePosData(`${i}-${index}`, ele, dir, this.PhaseDataModel.getMainPhasePos)
1117
+ }
1118
+ if (ele.controltype === 1) {
1119
+ this.handleRampPhasePosData(`${i}-${index}`, ele, dir, this.PhaseDataModel.getSidePhasePos)
1120
+ }
1121
+ })
1122
+ }
1109
1123
  })
1110
1124
  // 去掉重复方向的数据
1111
1125
  this.LanePhaseData = Array.from(new Set(this.LanePhaseData.map(item => item.id)))
@@ -623,22 +623,18 @@ export default {
623
623
  return item.id === stg
624
624
  })[0]
625
625
  if (!currPhase) return
626
- // if (!currPhase.peddirection) return
626
+ if (!currPhase.peddirection) return
627
627
  for (let walk of this.sidewalkPhaseData) {
628
- if (currPhase.peddirection) {
629
- for (let ped of currPhase.peddirection) {
630
- if (stg === walk.phaseid) {
631
- let obj = {}
632
- obj.name = walk.name
633
- obj.id = walk.id
634
- if (ped === walk.id) {
635
- peddirections.push(obj)
636
- peddirections = Array.from(new Set(peddirections))
637
- }
628
+ for (let ped of currPhase.peddirection) {
629
+ if (stg === walk.phaseid) {
630
+ let obj = {}
631
+ obj.name = walk.name
632
+ obj.id = walk.id
633
+ if (ped === walk.id) {
634
+ peddirections.push(obj)
635
+ peddirections = Array.from(new Set(peddirections))
638
636
  }
639
637
  }
640
- } else {
641
- peddirections = []
642
638
  }
643
639
  }
644
640
  ped.push(...peddirections)
@@ -702,7 +698,7 @@ export default {
702
698
  let currPhase = this.phaseList.filter((item) => {
703
699
  return item.id === stg
704
700
  })[0]
705
- if (currPhase !== undefined && currPhase.direction) {
701
+ if (currPhase !== undefined) {
706
702
  directionList.push(...currPhase.direction)
707
703
  directionList = Array.from(new Set(directionList))
708
704
  }
@@ -179,7 +179,7 @@ export default {
179
179
  let phasedesc = this.phaseOption.filter((item) => {
180
180
  return item.id === id
181
181
  })[0].direction
182
- if (!phasedesc || phasedesc.length === 0) return id
182
+ if (phasedesc.length === 0) return id
183
183
  let description = getPhaseDesc(phasedesc, this.$i18n)
184
184
  return id + '-' + description
185
185
  },
@@ -188,31 +188,22 @@ export default {
188
188
  this.dirArr = []
189
189
  this.phaseOption.filter((item) => {
190
190
  if (item.id === data) {
191
- if (item.direction) {
192
- if (item.direction.length === 0) {
193
- let recd = {
194
- id: 0,
195
- peddirection: this.getPed(item.peddirection),
196
- color: color
197
- }
198
- this.dirArr.push(recd)
199
- } else {
200
- for (let rec of item.direction) {
201
- let recd = {
202
- id: rec,
203
- peddirection: this.getPed(item.peddirection),
204
- color: color
205
- }
206
- this.dirArr.push(recd)
207
- }
208
- }
209
- } else {
191
+ if (item.direction.length === 0) {
210
192
  let recd = {
211
193
  id: 0,
212
194
  peddirection: this.getPed(item.peddirection),
213
195
  color: color
214
196
  }
215
197
  this.dirArr.push(recd)
198
+ } else {
199
+ for (let rec of item.direction) {
200
+ let recd = {
201
+ id: rec,
202
+ peddirection: this.getPed(item.peddirection),
203
+ color: color
204
+ }
205
+ this.dirArr.push(recd)
206
+ }
216
207
  }
217
208
  }
218
209
  })
@@ -248,31 +239,22 @@ export default {
248
239
  let color = getTheme() === 'light' ? '#1E1E1E' : '#F1F3F4'
249
240
  this.Options = list.map((item, index) => {
250
241
  let dirArr = []
251
- if (item.direction) {
252
- if (item.direction.length === 0) {
253
- let recd = {
254
- id: 0,
255
- peddirection: this.getPed(item.peddirection),
256
- color: color
257
- }
258
- dirArr.push(recd)
259
- } else {
260
- for (let rec of item.direction) {
261
- let recd = {
262
- id: rec,
263
- peddirection: this.getPed(item.peddirection),
264
- color: color
265
- }
266
- dirArr.push(recd)
267
- }
268
- }
269
- } else {
242
+ if (item.direction.length === 0) {
270
243
  let recd = {
271
244
  id: 0,
272
245
  peddirection: this.getPed(item.peddirection),
273
246
  color: color
274
247
  }
275
248
  dirArr.push(recd)
249
+ } else {
250
+ for (let rec of item.direction) {
251
+ let recd = {
252
+ id: rec,
253
+ peddirection: this.getPed(item.peddirection),
254
+ color: color
255
+ }
256
+ dirArr.push(recd)
257
+ }
276
258
  }
277
259
  let name = ''
278
260
  name = this.$t('openatccomponents.pattern.phase') + item.id
@@ -331,7 +313,6 @@ export default {
331
313
  })
332
314
  },
333
315
  getPed (data) {
334
- if (!data) return
335
316
  let ped = []
336
317
  let peddirections = []
337
318
  let color = getTheme() === 'light' ? '#1E1E1E' : '#F1F3F4'