openatc-components 0.3.19 → 0.3.21

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.3.19",
3
+ "version": "0.3.21",
4
4
  "description": "A Vue.js project",
5
5
  "author": "openatc developer",
6
6
  "private": false,
@@ -93,7 +93,6 @@ export default {
93
93
  return
94
94
  }
95
95
  this.platform = res.data.data.platform
96
- console.log(this.platform)
97
96
  if (this.platform !== '' && this.platform !== 'OpenATC') {
98
97
  this.isThirdSignal = true
99
98
  } else {
@@ -108,6 +107,10 @@ export default {
108
107
  created () {
109
108
  },
110
109
  mounted () {
110
+ // setTimeout(() => {
111
+ // 模拟
112
+ // this.crossStatusData = JSON.parse(JSON.stringify(this.channelRealtimeStatusData))
113
+ // }, 3000)
111
114
  this.getPlatform()
112
115
  this.crossStatusData = JSON.parse(JSON.stringify(this.channelRealtimeStatusData))
113
116
  },
@@ -1075,10 +1075,20 @@ export default {
1075
1075
  let pedarr = Array.from(map2)
1076
1076
  let newarr = []
1077
1077
  arr.forEach(ele => {
1078
- newarr.push(ele[1])
1078
+ ele[1].realdir = [ele[0]]
1079
+ let obj = {
1080
+ ...ele[1],
1081
+ realdir: [ele[0]]
1082
+ }
1083
+ newarr.push(obj)
1079
1084
  })
1080
1085
  pedarr.forEach(ele => {
1081
- newarr.push(ele[1])
1086
+ ele[1].realdir = [ele[0]]
1087
+ let obj = {
1088
+ ...ele[1],
1089
+ realdir: [ele[0]]
1090
+ }
1091
+ newarr.push(obj)
1082
1092
  })
1083
1093
  // console.log(newarr)
1084
1094
  return newarr
@@ -148,11 +148,7 @@ export default {
148
148
  let list = []
149
149
  if (this.crossStatusData && this.crossStatusData.stages && this.phaseList && this.phaseList.length > 0) {
150
150
  let ringDataModel = new RingDataModel(this.crossStatusData, this.phaseList)
151
- if (this.showDataType === 'phase') {
152
- list = ringDataModel.getStageData('phase')
153
- } else {
154
- list = ringDataModel.getStageData()
155
- }
151
+ list = ringDataModel.getPhaseLegendData()
156
152
  if (this.isShowCurrentStage) {
157
153
  this.currentStage = this.crossStatusData.current_stage
158
154
  }
@@ -187,13 +187,8 @@ export default class RingDataModel {
187
187
  let busPhaseData = this.getBusPos()
188
188
  let sidewalkPhaseData = this.getPedPhasePos()
189
189
  let stages
190
- if (datatype === 'phase') {
191
- // 如果需要按相位展示,datatype传'phase'
192
- stages = data.phase.map(ele => [ele.id])
193
- } else {
194
- // 默认按阶段数据处理
195
- stages = data.stages
196
- }
190
+ // 按阶段数据处理
191
+ stages = data.stages
197
192
  for (let stage of stages) {
198
193
  let tempList = []
199
194
  let directionList = []
@@ -208,9 +203,6 @@ export default class RingDataModel {
208
203
  if (!currPhase) return
209
204
  if (currPhase !== undefined && phaseMode[0].mode !== 1) {
210
205
  directionList = [...currPhase.direction, ...directionList]
211
- if (datatype === 'phase') {
212
- currPhaseid = stg
213
- }
214
206
  }
215
207
  if (currPhase.peddirection) {
216
208
  for (let walk of sidewalkPhaseData) {
@@ -245,9 +237,6 @@ export default class RingDataModel {
245
237
  peddirection: peddirections,
246
238
  sidewalkPhaseData: sidewalkPhaseData
247
239
  }
248
- if (datatype === 'phase') {
249
- temp.phaseid = currPhaseid
250
- }
251
240
  return temp
252
241
  })
253
242
  if (directionList.length === 0) {
@@ -266,4 +255,77 @@ export default class RingDataModel {
266
255
  this.stagesList = JSON.parse(JSON.stringify(stagesTemp))
267
256
  return this.stagesList
268
257
  }
258
+ getPhaseLegendData () {
259
+ let data = this.crossStatusData
260
+ let stagesTemp = []
261
+ let busPhaseData = this.getBusPos()
262
+ let sidewalkPhaseData = this.getPedPhasePos()
263
+ let phaseIdList
264
+ phaseIdList = data.phase.map(ele => [ele.id])
265
+ for (let phase of phaseIdList) {
266
+ let tempList = []
267
+ let directionList = []
268
+ let currPhaseid = ''
269
+ let stageControType = 0
270
+ let peddirections = []
271
+ for (let id of phase) {
272
+ let phaseMode = data.phase.filter(item => item.id === id)
273
+ let currPhase = this.phaseList.filter((item) => {
274
+ return item.id === id
275
+ })[0]
276
+ if (!currPhase) return
277
+ if (currPhase !== undefined && phaseMode[0].mode !== 1) {
278
+ directionList = [...currPhase.direction, ...directionList]
279
+ currPhaseid = id
280
+ }
281
+ if (currPhase.peddirection) {
282
+ for (let walk of sidewalkPhaseData) {
283
+ for (let ped of currPhase.peddirection) {
284
+ let obj = {}
285
+ obj.name = walk.name
286
+ obj.id = walk.id
287
+ if (ped === walk.id) {
288
+ peddirections.push(obj)
289
+ peddirections = Array.from(new Set(peddirections))
290
+ }
291
+ }
292
+ }
293
+ } else {
294
+ peddirections = []
295
+ }
296
+ for (let busPhase of busPhaseData) {
297
+ if (id === busPhase.phaseid) {
298
+ stageControType = busPhase.controltype
299
+ }
300
+ }
301
+ }
302
+ directionList = [...new Set(directionList)]
303
+ tempList = directionList.map(dir => {
304
+ let temp = {
305
+ id: dir,
306
+ phaseid: currPhaseid,
307
+ color: '#606266',
308
+ controltype: stageControType,
309
+ peddirection: peddirections,
310
+ sidewalkPhaseData: sidewalkPhaseData
311
+ }
312
+ return temp
313
+ })
314
+ if (directionList.length === 0) {
315
+ tempList = [
316
+ {
317
+ id: -1,
318
+ phaseid: currPhaseid,
319
+ color: '#606266',
320
+ controltype: stageControType,
321
+ peddirection: peddirections,
322
+ sidewalkPhaseData: sidewalkPhaseData
323
+ }
324
+ ]
325
+ }
326
+ stagesTemp.push(tempList)
327
+ }
328
+ this.List = JSON.parse(JSON.stringify(stagesTemp))
329
+ return this.List
330
+ }
269
331
  }
@@ -61,15 +61,24 @@ export async function computedRelation (id) {
61
61
  })
62
62
  delete item.conflictchannel
63
63
  })
64
- const uniqueDirections = new Set()
65
- const doChange = results.filter(obj => {
66
- if (uniqueDirections.has(obj.direction)) {
64
+ // const uniqueDirections = new Set()
65
+ // const doChange = results.filter(obj => {
66
+ // if (uniqueDirections.has(obj.direction)) {
67
+ // return false
68
+ // }
69
+ // uniqueDirections.add(obj.direction)
70
+ // return true
71
+ // })
72
+ const uniqueDirectionsAndTypes = new Set()
73
+ const filteredResults = results.filter(obj => {
74
+ const key = `${obj.direction}_${obj.type}`
75
+ if (uniqueDirectionsAndTypes.has(key)) {
67
76
  return false
68
77
  }
69
- uniqueDirections.add(obj.direction)
78
+ uniqueDirectionsAndTypes.add(key)
70
79
  return true
71
80
  })
72
- let result = doChange.map(item => {
81
+ let result = filteredResults.map(item => {
73
82
  let uniqueLaneConflictList = [...new Set(item.laneConflictList)]
74
83
  let uniquePedConflictList = [...new Set(item.pedConflictList)]
75
84
  return {
@@ -161,12 +161,12 @@ export default {
161
161
  return {
162
162
  roadDirection: 'right',
163
163
  // reqUrl: 'http://192.168.13.103:10003/openatc',
164
- agentId: '12008_ticp',
164
+ agentId: 'tjblfql',
165
165
  // agentId: '13013',
166
166
  // agentId: '12007_390',
167
167
  // agentId: '12014',
168
168
  reqUrl: 'http://192.168.13.103:10003/openatc',
169
- Token: 'eyJraWQiOiIxNzIxOTcwMTEzMTMwIiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTcyMTk3MzcxMywiaWF0IjoxNzIxOTY2NTEzfQ.aT14xZel09fHji-SrPMDTPAxISEUS8Y6KF30BWjCGKY',
169
+ Token: 'eyJraWQiOiIxNzIxOTc3OTkzMTY4IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTcyMTk4MTU5MywiaWF0IjoxNzIxOTc0MzkzfQ.vjgAFMJlM4FEHxT9K9lJQ_VsUx1fDubr4tYgMaVffS0',
170
170
  // agentId: '30003-352',
171
171
  // reqUrl: 'https://kints-dev.devdolphin.com/openatc',
172
172
  // Token: 'eyJraWQiOiIxNjUwNTA5MDI2ODk2IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJ4aWFvbWluZyIsImV4cCI6MTczNjkwOTAyNiwiaWF0IjoxNjUwNTA5MDI2fQ.-s4T-uMRmB2zf9yer87USKQXLY1a12Zq5lCOnqjNmfA',