openatc-components 0.3.93 → 0.3.94

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