openatc-components 0.3.83 → 0.3.85

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.
Files changed (47) hide show
  1. package/config/index.js +2 -1
  2. package/package/kisscomps/components/BoardCard/BoardCard.vue +0 -11
  3. package/package/kisscomps/components/ChannelizationWithInterface/ChannelizationWithInterface.vue +1 -1
  4. package/package/kisscomps/components/DrawChannelization/drawsvg/iconSvg/motorwayIconSvg.vue +145 -46
  5. package/package/kisscomps/components/DrawChannelization/drawsvg/index.draw.vue +4 -4
  6. package/package/kisscomps/components/IntersectionMap/crossDirection/crossDiagram.vue +10 -11
  7. package/package/kisscomps/components/IntersectionMap/intersectionmap.vue +7 -11
  8. package/package/kisscomps/components/IntersectionWithInterface/IntersectionWithInterface.vue +6 -5
  9. package/package/kisscomps/components/PatternOptimize/PatternOptimize.vue +2 -11
  10. package/package/kisscomps/components/PatternStatus/PatternStatus.vue +8 -83
  11. package/package/kisscomps/components/SchemeConfig/SchemeConfig.vue +4 -28
  12. package/package/kisscomps/components/SchemeConfig/lockingPhaselControlModal/index.vue +11 -9
  13. package/package/kisscomps/components/SchemeConfig/realtimeStatusModal/index.vue +1 -21
  14. package/package/kisscomps/components/patternConfig/planContent.vue +3 -3
  15. package/package/kisscomps/components/patternList/patternList.vue +0 -11
  16. package/package/kisscomps/index.js +1 -3
  17. package/package/kissui.min.js +1 -1
  18. package/package.json +1 -1
  19. package/src/i18n/language/en.js +2 -11
  20. package/src/i18n/language/zh.js +2 -11
  21. package/src/kisscomps/components/BoardCard/BoardCard.vue +0 -11
  22. package/src/kisscomps/components/ChannelizationWithInterface/ChannelizationWithInterface.vue +1 -1
  23. package/src/kisscomps/components/DrawChannelization/drawsvg/iconSvg/motorwayIconSvg.vue +145 -46
  24. package/src/kisscomps/components/DrawChannelization/drawsvg/index.draw.vue +4 -4
  25. package/src/kisscomps/components/IntersectionMap/crossDirection/crossDiagram.vue +10 -11
  26. package/src/kisscomps/components/IntersectionMap/intersectionmap.vue +7 -11
  27. package/src/kisscomps/components/IntersectionWithInterface/IntersectionWithInterface.vue +6 -5
  28. package/src/kisscomps/components/PatternOptimize/PatternOptimize.vue +2 -11
  29. package/src/kisscomps/components/PatternStatus/PatternStatus.vue +8 -83
  30. package/src/kisscomps/components/SchemeConfig/SchemeConfig.vue +4 -28
  31. package/src/kisscomps/components/SchemeConfig/lockingPhaselControlModal/index.vue +11 -9
  32. package/src/kisscomps/components/SchemeConfig/realtimeStatusModal/index.vue +1 -21
  33. package/src/kisscomps/components/patternConfig/planContent.vue +3 -3
  34. package/src/kisscomps/components/patternList/patternList.vue +0 -11
  35. package/src/kisscomps/index.js +1 -3
  36. package/src/views/intersection.vue +6 -7
  37. package/src/views/intersection2.vue +2 -2
  38. package/src/views/overView.vue +4 -17
  39. package/src/views/patternConfig.vue +35 -5
  40. package/static/styles/common.scss +3 -3
  41. package/static/styles/dark/theme/element-dark.scss +1 -1
  42. package/static/styles/intersection.scss +15 -5
  43. package/static/styles/light/theme/element-light.scss +1 -1
  44. package/static/styles/schemeconfig.scss +3 -6
  45. package/src/kisscomps/components/OverviewComponent/index.js +0 -2
  46. package/src/kisscomps/components/OverviewComponent/index.vue +0 -793
  47. package/static/styles/theme/element-dark.scss +0 -0
@@ -1,793 +0,0 @@
1
- /**
2
- * Copyright (c) 2020 kedacom
3
- * OpenATC is licensed under Mulan PSL v2.
4
- * You can use this software according to the terms and conditions of the Mulan PSL v2.
5
- * You may obtain a copy of Mulan PSL v2 at:
6
- * http://license.coscl.org.cn/MulanPSL2
7
- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9
- * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10
- * See the Mulan PSL v2 for more details.
11
- **/
12
- <template>
13
- <div class="container-main">
14
- <div :style="{'transform': `scale(${shrink})`, 'transform-origin': 'left top', 'height': '100%'}">
15
- <div class="tuxingjiemian" v-show="curHomePage === 'Graphical' || curHomePage === 'Channelization'" :class="{'minifont': curBodyWidth <= 650}">
16
- <div class="tuxing-left" :class="{'changeWidth': graphicMode}" ref="tuxingLeft">
17
- <intersection-base-map
18
- v-if="curHomePage === 'Graphical'"
19
- ref="intersectionMap"
20
- :stateName="stateName"
21
- :crossStatusData="crossStatusData"
22
- :agentId="agentId"
23
- :roadDirection="roadDirection" />
24
- <channelization
25
- v-if="curHomePage === 'Channelization'"
26
- ref="channelization"
27
- :AgentId="agentId"
28
- :crossStatusData="crossStatusData"
29
- :detectorStatusData="detectorStatusData" />
30
- <div class="pattern-status" v-if="!graphicMode && crossStatusData.control !== 1 && crossStatusData.control !== 2 && crossStatusData.control !== 3">
31
- <div class="pattern-name cross-mess">{{$t('openatccomponents.overviewcomponent.patternstate')}}</div>
32
- <div class="pattern-message">({{$t('openatccomponents.overviewcomponent.cycle')}}: {{controlData.cycle}} {{$t('openatccomponents.overviewcomponent.patternoffset')}}: {{controlData.patternoffset}} {{$t('openatccomponents.overviewcomponent.coordinationtime')}}: {{controlData.offset}})</div>
33
- <span class="pattern-explain"><el-checkbox v-model="checked">{{$t('openatccomponents.overviewcomponent.overLap')}}</el-checkbox></span>
34
- <!-- 没ring数据显示方案图 -->
35
- <pattern-list
36
- v-if="
37
- (controlData &&
38
- !controlData.rings &&
39
- contrloType === 'ring' &&
40
- !controlData.syncTime) ||
41
- (controlData && !controlData.rings && contrloType === 'ring')
42
- "
43
- :showBarrier="true"
44
- :controlPhase ="controlData"
45
- :contrloType="contrloType"
46
- :syncTime="controlData.syncTime"
47
- :patternStatusList="patterData ? patterData.rings : []"
48
- :cycles="patterData ? patterData.cycle : 0"
49
- :isPhase="false"
50
- :phaseList="phaseList"
51
- >
52
- </pattern-list>
53
- <!-- 1049没ring数据显示阶段图 -->
54
- <pattern-list
55
- v-else-if="controlData && !controlData.rings && contrloType === 'stage'"
56
- ref="boardCard"
57
- :stagesChange="patterData ? patterData.stagesList : []"
58
- :contrloType="contrloType"
59
- :controlData="controlData"
60
- :cycles="patterData ? patterData.cycle : 0"
61
- :syncTime="controlData.syncTime"
62
- :localPatternList="allPatternList"
63
- :showBarrier="true"
64
- :isPhase="false"
65
- :phaseList="phaseList"
66
- >
67
- </pattern-list>
68
- <pattern-list
69
- v-else
70
- ref="boardCard"
71
- :cycle="crossStatusData ? crossStatusData.cycle : 0"
72
- :syncTime="crossStatusData ? crossStatusData.syncTime : 0"
73
- :controlData="controlData"
74
- :contrloType="contrloType"
75
- :localPatternList="allPatternList"
76
- :phaseList="phaseList"
77
- :showBarrier="true"
78
- :isPhase="false"
79
- :agentId="agentId"
80
- >
81
- </pattern-list>
82
- <!-- <over-lap
83
- v-if="this.contrloType === 'ring'"
84
- :checked="checked"
85
- :overlap="overlap"
86
- :stageList="stagesListOver"
87
- :cycle="overlapCycle"
88
- :controlData="controlData"
89
- >
90
- </over-lap> -->
91
- </div>
92
- </div>
93
-
94
- <div ref="tuxingRight" class="tuxing-right" >
95
- <scheme-config
96
- ref="rightpanel"
97
- :statusData="crossStatusData"
98
- :phaseList="phaseList"
99
- :agentName="agentName"
100
- :responseTime="responseTime"
101
- :agentId="agentId"
102
- :ip="ip"
103
- :platform="platform"
104
- :funcSort="FuncSort"
105
- :roadDirection="roadDirection"
106
- :isFromAtc="isfromatc" />
107
- </div>
108
- </div>
109
- </div>
110
- </div>
111
- </template>
112
-
113
- <script>
114
- import { getTscControl, queryDevice } from '../../../api/control.js'
115
- import { registerMessage, uploadSingleTscParam } from '../../../api/param'
116
- import { getIntersectionInfo } from '../../../api/template'
117
- import { setIframdevid } from '../../../utils/auth.js'
118
- import { getMessageByCode } from '../../../utils/responseMessage'
119
- import PhaseDataModel from '../IntersectionMap/crossDirection/utils.js'
120
- import CrossDiagramMgr from '../../../EdgeMgr/controller/crossDiagramMgr.js'
121
- import { getChannelizatonChart } from '../../../api/cross'
122
- export default {
123
- name: 'overview-component',
124
- components: {
125
- },
126
- props: {
127
- AgentId: {
128
- type: String,
129
- default: '0'
130
- },
131
- roadDirection: {
132
- type: String,
133
- default: 'right'
134
- },
135
- isfromatc: {
136
- type: Boolean,
137
- default: true
138
- }
139
- },
140
- data () {
141
- return {
142
- stateName: this.$t('openatccomponents.overview.offline'),
143
- controlData: {},
144
- checked: false,
145
- overlap: [],
146
- contrloType: '',
147
- narr: [],
148
- // patternList: [],
149
- // patternSelect: [], // 所有方案id
150
- // planPattern: {}, // 默认显示方案
151
- allPatternList: [], // 所有方案
152
- stagesListOver: [],
153
- sidewalkPhaseData: [],
154
- phaseControlTimer: null, // 定时器
155
- registerMessageTimer: null, // 延时器
156
- volumeControlTimer: null, // 流量定时器
157
- detectorStatusTimer: null, // 检测器定时器
158
- ParamsMode: new Map([[0, '自主控制'], [1, '本地手动'], [2, '平台控制'], [3, '配置软件控制'], [4, '遥控器控制'], [5, '黄闪器控制'], [6, '降级控制'], [7, '脚本控制'], [8, '算法控制']]),
159
- ParamsModeEn: new Map([[0, 'Autonomous Control'], [1, 'Local Manual'], [2, 'Platform Control'], [3, 'Configuration Software Control'], [4, 'Remote Control'], [5, 'Yellow Flasher Control'], [6, 'Degradation Control'], [7, 'Script Control'], [8, 'Algorithm Control']]),
160
- ParamsControl: new Map([[0, '多时段'], [1, '黄闪'], [2, '全红'], [3, '关灯'], [4, '步进'], [5, '定周期控制'], [6, '单点感应控制'], [7, '协调感应控制'], [8, '方案选择控制'], [9, '自适应控制'], [10, '无电缆控制'], [11, '有电缆控制'], [12, '行人过街控制'], [13, '方案恢复过渡'], [14, '相位驻留'], [15, '通道检测'], [16, '方向锁定'], [17, '韦伯斯特单点控制'], [18, '预留18'], [19, '感应式行人过街'], [20, '方案干预'], [100, '方案干预'], [21, '预留21'], [22, '相位锁定'], [23, '相位放行控制'], [24, '紧急控制'], [99, '设备维护']]),
161
- ParamsControlEn: new Map([[0, 'Multi Period'], [1, 'Yellow Flash Control'], [2, 'Red Control'], [3, 'Dark Control'], [4, 'Step'], [5, 'Fixed_Cycle Control'], [6, 'Free Control'], [7, 'Coordinated Induction Control'], [8, 'Pattern Selection Control'], [9, 'Adaptive Control'], [10, 'Wireless Control'], [11, 'Cable Control'], [12, 'Pedestrian Crossing Control'], [13, 'Pattern recovery'], [14, 'Phase dwell'], [15, 'Channel Detection'], [16, 'Direction lock'], [17, 'Webster Single Point Coordination'], [18, 'Reserving18'], [19, 'Inductive Pedestrian Crossing Control'], [20, 'Program Intervention'], [100, 'Program Intervention'], [21, 'Reserving21'], [22, 'Priority Control'], [23, 'Close Phase'], [24, 'Emergency Control'], [99, 'Device Mantenance']]),
162
- phaseType: new Map([[1, '红'], [2, '黄'], [3, '绿'], [4, '绿闪']]), // phaseType表示红,黄,绿
163
- phaseTypeEn: new Map([[1, 'Red'], [2, 'Yellow'], [3, 'Green'], [4, 'Greenclear']]), // phaseType表示红,黄,绿
164
- ip: '--',
165
- port: '--',
166
- protocol: '--',
167
- // devStatus: 1,
168
- mode: '2',
169
- agentId: '0',
170
- agentName: '',
171
- overlapCycle: 0,
172
- platform: undefined,
173
- crossStatusData: {}, // 路口状态数据
174
- detectorStatusData: {}, // 检测器状态数据(包括车辆检测器状态和行人检测器状态)
175
- reset: false,
176
- responseTime: 0,
177
- phaseList: [], // 当前相位集合
178
- intervalFlag: true,
179
- detIntervalFlag: true,
180
- shrink: 1,
181
- isResend: true,
182
- commonHeight: undefined, // 左右侧面板的高度值
183
- graphicMode: false,
184
- resetcomponent: true,
185
- curHomePage: 'Graphical',
186
- FuncSort: 'allFunc'
187
- }
188
- },
189
- computed: {
190
- // patternList () {
191
- // return this.$store.state.globalParam.tscParam.patternList
192
- // },
193
- patterData () {
194
- return this.allPatternList.filter(item => {
195
- return item.id === this.controlData.patternid
196
- })[0]
197
- }
198
- },
199
- watch: {
200
- AgentId: {
201
- handler: async function (val, oldVal) {
202
- this.agentId = val
203
- this.resetcomponent = false
204
- setIframdevid(val)
205
- this.registerMessage() // 注册消息
206
- await this.getIntersectionInfo(val)
207
- this.$nextTick(() => {
208
- this.resetcomponent = true
209
- this.getChannelizatonChart()
210
- this.getPlatform()
211
- this.getPhase()
212
- this.initData()
213
- })
214
- },
215
- // 深度观察监听
216
- deep: true
217
- },
218
- phaseList: {
219
- handler: function (val, oldVal) {
220
- this.getPedPhasePos()
221
- },
222
- // 深度观察监听
223
- deep: true
224
- }
225
- },
226
- created () {
227
- this.globalParamModel = this.$store.getters.globalParamModel
228
- this.PhaseDataModel = new PhaseDataModel()
229
- this.CrossDiagramMgr = new CrossDiagramMgr()
230
- this.agentId = this.AgentId
231
- setIframdevid(this.agentId)
232
- this.registerMessage() // 注册消息
233
- this.getIntersectionInfo(this.agentId)
234
- },
235
- mounted () {
236
- this.getPlatform()
237
- if (this.$route.query.shrink) {
238
- this.shrink = Number(this.$route.query.shrink)
239
- }
240
- this.getChannelizatonChart()
241
- if (this.curHomePage === 'Graphical') {
242
- this.$nextTick(() => {
243
- this.$refs.intersectionMap.resetCrossDiagram()
244
- })
245
- }
246
- },
247
- updated () {
248
- if (this.$refs.tuxingLeft.offsetHeight !== this.commonHeight) {
249
- // 根据左侧面板动态变化的高度,同步更新右侧面板高度
250
- this.commonHeight = this.$refs.tuxingLeft.offsetHeight
251
- this.$refs.tuxingRight.style.height = this.commonHeight + 'PX'
252
- }
253
- },
254
- methods: {
255
- getIntersectionInfo (agentid) {
256
- // 获取路口信息
257
- return new Promise((resolve, reject) => {
258
- getIntersectionInfo(agentid).then(res => {
259
- if (sessionStorage.getItem('firstGet') !== 'false') {
260
- if (res.data.data.param.manualpanel === undefined) {
261
- res.data.data.param.manualpanel = {}
262
- }
263
- if (res.data.data.param.channellock === undefined) {
264
- res.data.data.param.channellock = []
265
- }
266
- if (res.data.data.param.channelList === undefined) {
267
- res.data.data.param.channelList = []
268
- }
269
- if (res.data.data.param.overlaplList === undefined) {
270
- res.data.data.param.overlaplList = []
271
- }
272
- if (res.data.data.param.detectorList === undefined) {
273
- res.data.data.param.detectorList = []
274
- }
275
- if (res.data.data.param.pedestrainDetectorList === undefined) {
276
- res.data.data.param.pedestrainDetectorList = []
277
- }
278
- if (res.data.data.param.preemptList === undefined) {
279
- res.data.data.param.preemptList = []
280
- }
281
- if (res.data.data.param.channelGreenConflictInfo === undefined) {
282
- res.data.data.param.channelGreenConflictInfo = []
283
- }
284
- if (res.data.data.param.singleoptim === undefined) {
285
- res.data.data.param.singleoptim = []
286
- }
287
- }
288
- this.allPatternList = res.data.data.param.patternList
289
- console.log(this.allPatternList)
290
- if (!this.allPatternList[0].contrloType && this.allPatternList[0].rings.length > 0) {
291
- this.contrloType = 'ring'
292
- } else if (!this.allPatternList[0].contrloType && this.allPatternList[0].rings.length === 0) {
293
- this.contrloType = 'stage'
294
- } else {
295
- this.contrloType = this.allPatternList[0].contrloType
296
- }
297
- this.overlap = res.data.data.param.overlaplList
298
- resolve(res.data.data)
299
- // this.phaseList = res.data.data.param.phaseList
300
- // this.patternPlan()
301
- // this.getCycle()
302
- // if (id) {
303
- // this.patternList = res.data.data.param.patternList.filter(item => {
304
- // return item.id === id
305
- // })[0].rings
306
- // }
307
- })
308
- })
309
- },
310
- getChannelizatonChart () {
311
- let _this = this
312
- getChannelizatonChart(this.AgentId).then(data => {
313
- if (!data.data.success) {
314
- // let parrenterror = getMessageByCode(data.data.code, _this.$i18n.locale)
315
- // if (data.data.data) {
316
- // // 子类型错误
317
- // let childErrorCode = data.data.data.errorCode
318
- // if (childErrorCode) {
319
- // let childerror = getMessageByCode(data.data.data.errorCode, _this.$i18n.locale)
320
- // _this.$message.error(parrenterror + ',' + childerror)
321
- // }
322
- // } else {
323
- // _this.$message.error(parrenterror)
324
- // }
325
- _this.curHomePage = 'Graphical'
326
- return
327
- }
328
- // 路口已设置渠化,则总览默认显示渠化路口,未设置显示模版路口
329
- if (_this.isfromatc === true && data.data.success === true && JSON.stringify(data.data.data) !== '{}') {
330
- _this.curHomePage = 'Channelization'
331
- } else {
332
- _this.curHomePage = 'Graphical'
333
- }
334
- })
335
- },
336
- getPedPhasePos () {
337
- // 行人相位信息
338
- this.sidewalkPhaseData = []
339
- this.phaseList.forEach((ele, i) => {
340
- if (ele.peddirection) {
341
- ele.peddirection.forEach((dir, index) => {
342
- // 行人相位
343
- if (this.PhaseDataModel.getSidePos(dir)) {
344
- this.sidewalkPhaseData.push({
345
- key: this.CrossDiagramMgr.getUniqueKey('pedphase'),
346
- phaseid: ele.id, // 相位id,用于对应相位状态
347
- id: dir,
348
- name: this.PhaseDataModel.getSidePos(dir).name
349
- })
350
- }
351
- })
352
- }
353
- })
354
- },
355
- registerMessage () {
356
- registerMessage(this.agentId).then(data => {
357
- if (!data.data.success) {
358
- // this.devStatus = 2
359
- if (data.data.code === '4002' && data.data.data.errorCode === '4209') {
360
- let success = data.data.data.content.success
361
- if (success !== 0) {
362
- let errormsg = 'openatccomponents.overview.putTscControlError' + success
363
- this.$message.error(this.$t(errormsg))
364
- return
365
- }
366
- }
367
- let parrenterror = getMessageByCode(data.data.code, this.$i18n.locale)
368
- if (data.data.data) {
369
- // 子类型错误
370
- let childErrorCode = data.data.data.errorCode
371
- if (childErrorCode) {
372
- let childerror = getMessageByCode(data.data.data.errorCode, this.$i18n.locale)
373
- this.$message.error(parrenterror + ',' + childerror)
374
- }
375
- } else {
376
- this.$message.error(parrenterror)
377
- }
378
- if (this.isResend) {
379
- this.reSend()
380
- }
381
- return
382
- }
383
- // this.devStatus = 3
384
- this.clearPatternInterval() // 清除其他定时器
385
- this.clearVolumeInterval()
386
- this.phaseControlTimer = setInterval(() => {
387
- if (this.intervalFlag) {
388
- this.initData()
389
- }
390
- }, 1000)
391
- this.getPhase()
392
- })
393
- },
394
- reSend () { // 设备掉线重连机制
395
- // this.devStatus = 1
396
- this.clearRegisterMessageTimer()
397
- this.registerMessageTimer = setTimeout(() => {
398
- this.reconnectionDev()
399
- }, 5000)
400
- },
401
- clearPatternInterval () {
402
- if (this.phaseControlTimer !== null) {
403
- clearInterval(this.phaseControlTimer) // 清除定时器
404
- this.phaseControlTimer = null
405
- }
406
- },
407
- clearVolumeInterval () {
408
- if (this.volumeControlTimer !== null) {
409
- clearInterval(this.volumeControlTimer) // 清除流量定时器
410
- this.volumeControlTimer = null
411
- }
412
- },
413
- clearRegisterMessageTimer () {
414
- if (this.registerMessageTimer !== null) {
415
- clearTimeout(this.registerMessageTimer) // 清除延时器
416
- this.registerMessageTimer = null
417
- }
418
- },
419
- clearDetectorStatusTimer () {
420
- if (this.detectorStatusTimer !== null) {
421
- clearInterval(this.detectorStatusTimer) // 清除定时器
422
- this.detectorStatusTimer = null
423
- }
424
- },
425
- initData () {
426
- this.intervalFlag = false
427
- let startTime = new Date().getTime()
428
- getTscControl(this.agentId).then((data) => {
429
- let endTime = new Date().getTime()
430
- let diffTime = endTime - startTime
431
- this.responseTime = diffTime
432
- this.intervalFlag = true
433
- if (!data.data.success) {
434
- if (data.data.code === '4002' && data.data.data.errorCode === '4209') {
435
- let success = data.data.data.content.success
436
- if (success !== 0) {
437
- let errormsg = 'openatccomponents.overview.putTscControlError' + success
438
- this.$message.error(this.$t(errormsg))
439
- return
440
- }
441
- }
442
- if (data.data.code === '4003') {
443
- // this.devStatus = 2
444
- this.clearPatternInterval() // 清除其他定时器
445
- this.clearVolumeInterval()
446
- this.$message.error(getMessageByCode(data.data.code, this.$i18n.locale))
447
- if (this.isResend) {
448
- this.reSend()
449
- }
450
- return
451
- }
452
- let parrenterror = getMessageByCode(data.data.code, this.$i18n.locale)
453
- if (data.data.data) {
454
- // 子类型错误
455
- let childErrorCode = data.data.data.errorCode
456
- if (childErrorCode) {
457
- let childerror = getMessageByCode(data.data.data.errorCode, this.$i18n.locale)
458
- this.$message.error(parrenterror + ',' + childerror)
459
- }
460
- } else {
461
- this.$message.error(parrenterror)
462
- }
463
- this.clearPatternInterval() // 清除其他定时器
464
- this.clearVolumeInterval()
465
- if (this.isResend) {
466
- this.reSend()
467
- }
468
- return
469
- }
470
- if (data.data.data.data) {
471
- this.crossStatusData = JSON.parse(JSON.stringify(data.data.data.data))
472
- } else {
473
- this.crossStatusData = {}
474
- }
475
- let TscData = JSON.parse(JSON.stringify(data.data.data.data))
476
- // this.handleStageData(TscData) // 处理阶段(驻留)stage数据
477
- this.controlData = this.handleGetData(TscData)
478
- console.log('this.controlData', this.controlData)
479
- this.checkStage(this.controlData)
480
- }).catch(error => {
481
- // this.$message.error(error)
482
- console.log(error)
483
- })
484
- },
485
- getControl (newList) { // 总揽实时数据
486
- let currentIds = ''
487
- let lastCurrentIds = ''
488
- this.stateList = [0]
489
- this.narr = []
490
- let overstagesList = []
491
- let phaseList = []
492
- for (let j = 0; j <= this.max; j++) { // 指针长度
493
- for (let i = 0; i < newList.length; i++) { // 环列表
494
- let ring = newList[i]// 每个环对象
495
- let sum = 0
496
- for (let n = 0; n < ring.length; n++) { // 相位累计长度
497
- // if (ring[n].mode !== 7) {
498
- sum = sum + ring[n].value + (ring[n].sum ? ring[n].sum : 0)
499
- if (j < sum) {
500
- let phaseId = ring[n].id
501
- currentIds = currentIds + '-' + phaseId
502
- break
503
- }
504
- // }
505
- }
506
- // for (let n = 0; n < ring.length; n++) { // 相位累计长度
507
- // if (ring[n].mode !== 7) {
508
- // sum = sum + ring[n].split
509
- // if (j < sum) {
510
- // let phaseId = ring[n].id
511
- // currentIds = currentIds + '-' + phaseId
512
- // break
513
- // }
514
- // }
515
- // }
516
- }
517
- if (lastCurrentIds !== currentIds && lastCurrentIds !== '') { // 当前相位id和上一个相比不同说明相位变化了
518
- phaseList.push(lastCurrentIds)
519
- this.stateList.push(j)// 阶段累计长度的集合
520
- }
521
- lastCurrentIds = currentIds
522
- currentIds = ''
523
- }
524
- let newPhaselist = []
525
- phaseList.forEach(i => {
526
- let rangeArr = i.split('-').map(Number)
527
- if (rangeArr.length > 2) {
528
- newPhaselist.push([
529
- JSON.parse(JSON.stringify(rangeArr[1])),
530
- JSON.parse(JSON.stringify(rangeArr[2]))
531
- ])
532
- } else {
533
- newPhaselist.push([
534
- JSON.parse(JSON.stringify(rangeArr[1]))
535
- ])
536
- }
537
- })
538
- for (let i = this.stateList.length - 1; i >= 1; i--) {
539
- this.narr.push(this.stateList[i] - this.stateList[i - 1])
540
- }
541
- this.narr.reverse()// 阶段差
542
- for (let i = 0; i < newPhaselist.length; i++) {
543
- let stage = JSON.parse(JSON.stringify(newPhaselist[i]))
544
- let newStage = []
545
- stage.map(item => {
546
- for (let ring of newList) {
547
- for (let ringItem of ring) {
548
- if (item === ringItem.id && (ringItem.mode !== 7 && ringItem.mode !== 8 && ringItem.mode !== 9)) {
549
- newStage.push(item)
550
- }
551
- }
552
- }
553
- })
554
- let stageItem = this.getStageItem(newStage, newList, i)
555
- overstagesList.push(JSON.parse(JSON.stringify(stageItem)))
556
- }
557
- this.overlapCycle = overstagesList.reduce((prev, curr) => prev + parseInt(curr.split), 0)
558
- this.stagesListOver = JSON.parse(JSON.stringify(overstagesList))
559
- console.log(this.stagesListOver)
560
- },
561
- getStageItem (stageArr, ringsList, i) {
562
- let res = {
563
- key: i,
564
- split: this.narr[i], // 阶段绿性比
565
- phases: stageArr,
566
- delaystart: 0,
567
- advanceend: 0
568
- }
569
- // let splitArr = []
570
- let delaystartArr = []
571
- let advanceendArr = []
572
- for (let rings of ringsList) {
573
- for (let ring of rings) {
574
- if (stageArr.includes(ring.id)) {
575
- // let split = ring.value
576
- let delaystart = ring.delaystart
577
- let advanceend = ring.advanceend
578
- // splitArr.push(split)
579
- delaystartArr.push(delaystart)
580
- advanceendArr.push(advanceend)
581
- }
582
- }
583
- }
584
- // splitArr.sort(function (a, b) { return a - b })
585
- delaystartArr.sort(function (a, b) { return b - a })
586
- advanceendArr.sort(function (a, b) { return a - b })
587
- // res.split = splitArr.length > 0 ? splitArr[0] : 0
588
- res.delaystart = delaystartArr.length > 0 ? delaystartArr[0] : 0
589
- res.advanceend = advanceendArr.length > 0 ? advanceendArr[0] : 0
590
- return res
591
- },
592
- checkStage (rings) {
593
- if (!rings.phase || !rings.rings) return
594
- let idPattern = this.allPatternList.filter(item => item.id === rings.patternid)
595
- if (idPattern.length === 0) return
596
- let ringList = this.allPatternList.filter(item => {
597
- return item.id === rings.patternid
598
- })[0].rings
599
- let filterPattern = []
600
- for (let i of ringList) {
601
- for (let j of this.controlData.rings) {
602
- let filterSequence = i.filter(item => j.sequence.includes(item.id))
603
- if (filterSequence.length > 0) {
604
- filterPattern.push(filterSequence)
605
- }
606
- }
607
- }
608
- // let mapAdd = rings.phase.map(item => {
609
- // return {
610
- // id: item.id,
611
- // split: item.split
612
- // }
613
- // })
614
- // let newRings = rings.rings.map(j => {
615
- // return j.sequence
616
- // })
617
- // let newList = newRings.map(item => {
618
- // let ret = []
619
- // item.map(i => {
620
- // const find = mapAdd.find(j => j.id === i)
621
- // if (find) {
622
- // ret.push(find)
623
- // }
624
- // })
625
- // return ret
626
- // })
627
- // let mapAdds = newList.map(item => {
628
- // return item.map(val => {
629
- // return val.split
630
- // })
631
- // })
632
- // let maxCycle = mapAdds.length > 0 ? mapAdds.map(item => {
633
- // return item.length > 0 ? item.reduce((a, b) => {
634
- // return a + b
635
- // }) : 0
636
- // }) : 0
637
- let mapAdd = filterPattern.map(item => {
638
- return item.map(val => {
639
- return val.value + (val.sum ? val.sum : 0)
640
- })
641
- })
642
- let maxCycle = mapAdd.length > 0 ? mapAdd.map(item => {
643
- return item.length > 0 ? item.reduce((a, b) => {
644
- return a + b
645
- }) : 0
646
- }) : 0
647
- this.max = Math.max(...maxCycle)// 每个环的周期最大值
648
- this.getControl(filterPattern)
649
- },
650
- handleGetData (data) {
651
- let that = this
652
- if (data.name === '') {
653
- if (that.$i18n.locale === 'en') {
654
- data.name = 'Pattern' + data.patternid
655
- } else if (that.$i18n.locale === 'zh') {
656
- data.name = '方案' + data.patternid
657
- }
658
- }
659
- Object.keys(data).forEach(function (key) {
660
- if (that.$i18n.locale === 'en') {
661
- if (key === 'mode') {
662
- if (data[key] > 0 && data[key] < 6) {
663
- data[key] = that.ParamsModeEn.get(data[key])
664
- } else {
665
- data[key] = that.ParamsModeEn.get(0)
666
- }
667
- }
668
- // if (key === 'control') {
669
- // data[key] = that.ParamsControlEn.get(data[key])
670
- // }
671
- if (key === 'phase' || key === 'overlap') {
672
- for (let val of data[key]) {
673
- val.typestr = that.phaseTypeEn.get(val.type)
674
- val.pedtypestr = that.phaseTypeEn.get(val.pedtype)
675
- }
676
- }
677
- } else if (that.$i18n.locale === 'zh') {
678
- if (key === 'mode') {
679
- if (data[key] > 0 && data[key] < 6) {
680
- data[key] = that.ParamsMode.get(data[key])
681
- } else {
682
- data[key] = that.ParamsMode.get(0)
683
- }
684
- }
685
- // if (key === 'control') {
686
- // data[key] = that.ParamsControl.get(data[key])
687
- // }
688
- if (key === 'phase' || key === 'overlap') {
689
- for (let val of data[key]) {
690
- val.typestr = that.phaseType.get(val.type)
691
- val.pedtypestr = that.phaseType.get(val.pedtype)
692
- }
693
- }
694
- }
695
- })
696
- return data
697
- },
698
- reconnectionDev () {
699
- this.registerMessage()
700
- },
701
- queryDevParams () {
702
- queryDevice(this.AgentId).then(res => {
703
- if (!res.data.success) {
704
- this.$message.error(getMessageByCode(res.data.code, this.$i18n.locale))
705
- return
706
- }
707
- let devParams = res.data.data.jsonparam
708
- this.ip = devParams.ip
709
- this.port = String(devParams.port)
710
- this.protocol = res.data.data.protocol
711
- this.agentId = res.data.data.agentid
712
- if (res.data.data.name) {
713
- this.agentName = res.data.data.name
714
- }
715
- this.platform = res.data.data.platform
716
- let state = res.data.data.state
717
- if (state === 'UP') {
718
- this.stateName = this.$t('openatccomponents.overview.online')
719
- } else {
720
- this.stateName = this.$t('openatccomponents.overview.offline')
721
- }
722
- this.registerMessage() // 注册消息
723
- this.initData()
724
- // 配置工具没参数的时候
725
- this.getIntersectionInfo(this.agentId)
726
- })
727
- },
728
- getPhase () {
729
- uploadSingleTscParam('phase', this.agentId).then(data => {
730
- let res = data.data
731
- if (!res.success) {
732
- if (data.data.code === '4002' && data.data.data.errorCode === '4209') {
733
- let success = data.data.data.content.success
734
- if (success !== 0) {
735
- let errormsg = 'openatccomponents.overview.putTscControlError' + success
736
- this.$message.error(this.$t(errormsg))
737
- return
738
- }
739
- }
740
- let parrenterror = getMessageByCode(data.data.code, this.$i18n.locale)
741
- if (data.data.data) {
742
- // 子类型错误
743
- let childErrorCode = data.data.data.errorCode
744
- if (childErrorCode) {
745
- let childerror = getMessageByCode(data.data.data.errorCode, this.$i18n.locale)
746
- this.$message.error(parrenterror + ',' + childerror)
747
- }
748
- } else {
749
- this.$message.error(parrenterror)
750
- }
751
- return
752
- }
753
- if (res.data.data && res.data.data.phaseList) {
754
- this.phaseList = res.data.data.phaseList
755
- }
756
- })
757
- },
758
- getPlatform () {
759
- queryDevice(this.AgentId).then(res => {
760
- if (!res.data.success) {
761
- this.$message.error(getMessageByCode(res.data.code, this.$i18n.locale))
762
- return
763
- }
764
- let devParams = res.data.data.jsonparam
765
- this.ip = devParams.ip
766
- this.port = String(devParams.port)
767
- this.protocol = res.data.data.protocol
768
- this.agentId = res.data.data.agentid
769
- if (res.data.data.name) {
770
- this.agentName = res.data.data.name
771
- }
772
- this.platform = res.data.data.platform
773
- let func = 'allFunc'
774
- if (this.platform === 'OpenATC') {
775
- func = 'allFunc'
776
- }
777
- if (this.platform === 'SCATS' || this.platform === 'HUATONG') {
778
- func = 'basicFunc'
779
- }
780
- this.FuncSort = func
781
- })
782
- }
783
- },
784
- destroyed () {
785
- this.isResend = false
786
- this.clearPatternInterval() // 清除定时器
787
- this.clearVolumeInterval()
788
- this.clearDetectorStatusTimer()
789
- this.clearRegisterMessageTimer() // 清除定时器
790
- this.getPlatform()
791
- }
792
- }
793
- </script>