openatc-components 0.3.79 → 0.3.80

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/DirectionListConfiguration/DirectionListConfiguration.vue +7 -5
  2. package/package/kisscomps/components/DrawChannelization/drawsvg/iconSvg/motorwayIconSvg.vue +145 -46
  3. package/package/kisscomps/components/DrawChannelization/drawsvg/index.draw.vue +4 -4
  4. package/package/kisscomps/components/IntersectionMap/crossDirection/crossDiagram.vue +5 -6
  5. package/package/kisscomps/components/IntersectionMap/intersectionmap.vue +5 -9
  6. package/package/kisscomps/components/IntersectionWithInterface/IntersectionWithInterface.vue +3 -3
  7. package/package/kisscomps/components/OptimizeKanban/index.js +2 -0
  8. package/package/kisscomps/components/OptimizeKanban/index.vue +369 -0
  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/index.js +1 -3
  13. package/package/kissui.min.js +1 -1
  14. package/package.json +1 -1
  15. package/src/i18n/language/en.js +0 -7
  16. package/src/i18n/language/zh.js +0 -7
  17. package/src/kisscomps/components/DirectionListConfiguration/DirectionListConfiguration.vue +7 -5
  18. package/src/kisscomps/components/DrawChannelization/drawsvg/iconSvg/motorwayIconSvg.vue +145 -46
  19. package/src/kisscomps/components/DrawChannelization/drawsvg/index.draw.vue +4 -4
  20. package/src/kisscomps/components/IntersectionMap/crossDirection/crossDiagram.vue +5 -6
  21. package/src/kisscomps/components/IntersectionMap/intersectionmap.vue +5 -9
  22. package/src/kisscomps/components/IntersectionWithInterface/IntersectionWithInterface.vue +3 -3
  23. package/src/kisscomps/components/SchemeConfig/SchemeConfig.vue +4 -28
  24. package/src/kisscomps/components/SchemeConfig/lockingPhaselControlModal/index.vue +11 -9
  25. package/src/kisscomps/components/SchemeConfig/realtimeStatusModal/index.vue +1 -21
  26. package/src/kisscomps/index.js +1 -3
  27. package/src/node_modules/.package_versions.json +1 -0
  28. package/src/utils/conflct.js +33 -24
  29. package/src/views/intersection.vue +5 -6
  30. package/src/views/intersection2.vue +2 -2
  31. package/src/views/overView.vue +4 -17
  32. package/static/styles/common.scss +3 -3
  33. package/static/styles/dark/theme/element-dark.scss +1 -1
  34. package/static/styles/intersection.scss +15 -5
  35. package/static/styles/light/theme/element-light.scss +1 -1
  36. package/static/styles/schemeconfig.scss +3 -6
  37. package/package/kisscomps/components/OverviewComponent/index.js +0 -2
  38. package/package/kisscomps/components/OverviewComponent/index.vue +0 -794
  39. package/src/kisscomps/components/OverviewComponent/index.js +0 -2
  40. package/src/kisscomps/components/OverviewComponent/index.vue +0 -794
@@ -1,794 +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
- // if (this.$route.query !== undefined && Object.keys(this.$route.query).length) {
231
- this.agentId = this.AgentId
232
- setIframdevid(this.agentId)
233
- this.registerMessage() // 注册消息
234
- this.getIntersectionInfo(this.agentId)
235
- },
236
- mounted () {
237
- this.getPlatform()
238
- if (this.$route.query.shrink) {
239
- this.shrink = Number(this.$route.query.shrink)
240
- }
241
- this.getChannelizatonChart()
242
- if (this.curHomePage === 'Graphical') {
243
- this.$nextTick(() => {
244
- this.$refs.intersectionMap.resetCrossDiagram()
245
- })
246
- }
247
- },
248
- updated () {
249
- if (this.$refs.tuxingLeft.offsetHeight !== this.commonHeight) {
250
- // 根据左侧面板动态变化的高度,同步更新右侧面板高度
251
- this.commonHeight = this.$refs.tuxingLeft.offsetHeight
252
- this.$refs.tuxingRight.style.height = this.commonHeight + 'PX'
253
- }
254
- },
255
- methods: {
256
- getIntersectionInfo (agentid) {
257
- // 获取路口信息
258
- return new Promise((resolve, reject) => {
259
- getIntersectionInfo(agentid).then(res => {
260
- if (sessionStorage.getItem('firstGet') !== 'false') {
261
- if (res.data.data.param.manualpanel === undefined) {
262
- res.data.data.param.manualpanel = {}
263
- }
264
- if (res.data.data.param.channellock === undefined) {
265
- res.data.data.param.channellock = []
266
- }
267
- if (res.data.data.param.channelList === undefined) {
268
- res.data.data.param.channelList = []
269
- }
270
- if (res.data.data.param.overlaplList === undefined) {
271
- res.data.data.param.overlaplList = []
272
- }
273
- if (res.data.data.param.detectorList === undefined) {
274
- res.data.data.param.detectorList = []
275
- }
276
- if (res.data.data.param.pedestrainDetectorList === undefined) {
277
- res.data.data.param.pedestrainDetectorList = []
278
- }
279
- if (res.data.data.param.preemptList === undefined) {
280
- res.data.data.param.preemptList = []
281
- }
282
- if (res.data.data.param.channelGreenConflictInfo === undefined) {
283
- res.data.data.param.channelGreenConflictInfo = []
284
- }
285
- if (res.data.data.param.singleoptim === undefined) {
286
- res.data.data.param.singleoptim = []
287
- }
288
- }
289
- this.allPatternList = res.data.data.param.patternList
290
- console.log(this.allPatternList)
291
- if (!this.allPatternList[0].contrloType && this.allPatternList[0].rings.length > 0) {
292
- this.contrloType = 'ring'
293
- } else if (!this.allPatternList[0].contrloType && this.allPatternList[0].rings.length === 0) {
294
- this.contrloType = 'stage'
295
- } else {
296
- this.contrloType = this.allPatternList[0].contrloType
297
- }
298
- this.overlap = res.data.data.param.overlaplList
299
- resolve(res.data.data)
300
- // this.phaseList = res.data.data.param.phaseList
301
- // this.patternPlan()
302
- // this.getCycle()
303
- // if (id) {
304
- // this.patternList = res.data.data.param.patternList.filter(item => {
305
- // return item.id === id
306
- // })[0].rings
307
- // }
308
- })
309
- })
310
- },
311
- getChannelizatonChart () {
312
- let _this = this
313
- getChannelizatonChart(this.AgentId).then(data => {
314
- if (!data.data.success) {
315
- // let parrenterror = getMessageByCode(data.data.code, _this.$i18n.locale)
316
- // if (data.data.data) {
317
- // // 子类型错误
318
- // let childErrorCode = data.data.data.errorCode
319
- // if (childErrorCode) {
320
- // let childerror = getMessageByCode(data.data.data.errorCode, _this.$i18n.locale)
321
- // _this.$message.error(parrenterror + ',' + childerror)
322
- // }
323
- // } else {
324
- // _this.$message.error(parrenterror)
325
- // }
326
- _this.curHomePage = 'Graphical'
327
- return
328
- }
329
- // 路口已设置渠化,则总览默认显示渠化路口,未设置显示模版路口
330
- if (_this.isfromatc === true && data.data.success === true && JSON.stringify(data.data.data) !== '{}') {
331
- _this.curHomePage = 'Channelization'
332
- } else {
333
- _this.curHomePage = 'Graphical'
334
- }
335
- })
336
- },
337
- getPedPhasePos () {
338
- // 行人相位信息
339
- this.sidewalkPhaseData = []
340
- this.phaseList.forEach((ele, i) => {
341
- if (ele.peddirection) {
342
- ele.peddirection.forEach((dir, index) => {
343
- // 行人相位
344
- if (this.PhaseDataModel.getSidePos(dir)) {
345
- this.sidewalkPhaseData.push({
346
- key: this.CrossDiagramMgr.getUniqueKey('pedphase'),
347
- phaseid: ele.id, // 相位id,用于对应相位状态
348
- id: dir,
349
- name: this.PhaseDataModel.getSidePos(dir).name
350
- })
351
- }
352
- })
353
- }
354
- })
355
- },
356
- registerMessage () {
357
- registerMessage(this.agentId).then(data => {
358
- if (!data.data.success) {
359
- // this.devStatus = 2
360
- if (data.data.code === '4002' && data.data.data.errorCode === '4209') {
361
- let success = data.data.data.content.success
362
- if (success !== 0) {
363
- let errormsg = 'openatccomponents.overview.putTscControlError' + success
364
- this.$message.error(this.$t(errormsg))
365
- return
366
- }
367
- }
368
- let parrenterror = getMessageByCode(data.data.code, this.$i18n.locale)
369
- if (data.data.data) {
370
- // 子类型错误
371
- let childErrorCode = data.data.data.errorCode
372
- if (childErrorCode) {
373
- let childerror = getMessageByCode(data.data.data.errorCode, this.$i18n.locale)
374
- this.$message.error(parrenterror + ',' + childerror)
375
- }
376
- } else {
377
- this.$message.error(parrenterror)
378
- }
379
- if (this.isResend) {
380
- this.reSend()
381
- }
382
- return
383
- }
384
- // this.devStatus = 3
385
- this.clearPatternInterval() // 清除其他定时器
386
- this.clearVolumeInterval()
387
- this.phaseControlTimer = setInterval(() => {
388
- if (this.intervalFlag) {
389
- this.initData()
390
- }
391
- }, 1000)
392
- this.getPhase()
393
- })
394
- },
395
- reSend () { // 设备掉线重连机制
396
- // this.devStatus = 1
397
- this.clearRegisterMessageTimer()
398
- this.registerMessageTimer = setTimeout(() => {
399
- this.reconnectionDev()
400
- }, 5000)
401
- },
402
- clearPatternInterval () {
403
- if (this.phaseControlTimer !== null) {
404
- clearInterval(this.phaseControlTimer) // 清除定时器
405
- this.phaseControlTimer = null
406
- }
407
- },
408
- clearVolumeInterval () {
409
- if (this.volumeControlTimer !== null) {
410
- clearInterval(this.volumeControlTimer) // 清除流量定时器
411
- this.volumeControlTimer = null
412
- }
413
- },
414
- clearRegisterMessageTimer () {
415
- if (this.registerMessageTimer !== null) {
416
- clearTimeout(this.registerMessageTimer) // 清除延时器
417
- this.registerMessageTimer = null
418
- }
419
- },
420
- clearDetectorStatusTimer () {
421
- if (this.detectorStatusTimer !== null) {
422
- clearInterval(this.detectorStatusTimer) // 清除定时器
423
- this.detectorStatusTimer = null
424
- }
425
- },
426
- initData () {
427
- this.intervalFlag = false
428
- let startTime = new Date().getTime()
429
- getTscControl(this.agentId).then((data) => {
430
- let endTime = new Date().getTime()
431
- let diffTime = endTime - startTime
432
- this.responseTime = diffTime
433
- this.intervalFlag = true
434
- if (!data.data.success) {
435
- if (data.data.code === '4002' && data.data.data.errorCode === '4209') {
436
- let success = data.data.data.content.success
437
- if (success !== 0) {
438
- let errormsg = 'openatccomponents.overview.putTscControlError' + success
439
- this.$message.error(this.$t(errormsg))
440
- return
441
- }
442
- }
443
- if (data.data.code === '4003') {
444
- // this.devStatus = 2
445
- this.clearPatternInterval() // 清除其他定时器
446
- this.clearVolumeInterval()
447
- this.$message.error(getMessageByCode(data.data.code, this.$i18n.locale))
448
- if (this.isResend) {
449
- this.reSend()
450
- }
451
- return
452
- }
453
- let parrenterror = getMessageByCode(data.data.code, this.$i18n.locale)
454
- if (data.data.data) {
455
- // 子类型错误
456
- let childErrorCode = data.data.data.errorCode
457
- if (childErrorCode) {
458
- let childerror = getMessageByCode(data.data.data.errorCode, this.$i18n.locale)
459
- this.$message.error(parrenterror + ',' + childerror)
460
- }
461
- } else {
462
- this.$message.error(parrenterror)
463
- }
464
- this.clearPatternInterval() // 清除其他定时器
465
- this.clearVolumeInterval()
466
- if (this.isResend) {
467
- this.reSend()
468
- }
469
- return
470
- }
471
- if (data.data.data.data) {
472
- this.crossStatusData = JSON.parse(JSON.stringify(data.data.data.data))
473
- } else {
474
- this.crossStatusData = {}
475
- }
476
- let TscData = JSON.parse(JSON.stringify(data.data.data.data))
477
- // this.handleStageData(TscData) // 处理阶段(驻留)stage数据
478
- this.controlData = this.handleGetData(TscData)
479
- console.log('this.controlData', this.controlData)
480
- this.checkStage(this.controlData)
481
- }).catch(error => {
482
- // this.$message.error(error)
483
- console.log(error)
484
- })
485
- },
486
- getControl (newList) { // 总揽实时数据
487
- let currentIds = ''
488
- let lastCurrentIds = ''
489
- this.stateList = [0]
490
- this.narr = []
491
- let overstagesList = []
492
- let phaseList = []
493
- for (let j = 0; j <= this.max; j++) { // 指针长度
494
- for (let i = 0; i < newList.length; i++) { // 环列表
495
- let ring = newList[i]// 每个环对象
496
- let sum = 0
497
- for (let n = 0; n < ring.length; n++) { // 相位累计长度
498
- // if (ring[n].mode !== 7) {
499
- sum = sum + ring[n].value + (ring[n].sum ? ring[n].sum : 0)
500
- if (j < sum) {
501
- let phaseId = ring[n].id
502
- currentIds = currentIds + '-' + phaseId
503
- break
504
- }
505
- // }
506
- }
507
- // for (let n = 0; n < ring.length; n++) { // 相位累计长度
508
- // if (ring[n].mode !== 7) {
509
- // sum = sum + ring[n].split
510
- // if (j < sum) {
511
- // let phaseId = ring[n].id
512
- // currentIds = currentIds + '-' + phaseId
513
- // break
514
- // }
515
- // }
516
- // }
517
- }
518
- if (lastCurrentIds !== currentIds && lastCurrentIds !== '') { // 当前相位id和上一个相比不同说明相位变化了
519
- phaseList.push(lastCurrentIds)
520
- this.stateList.push(j)// 阶段累计长度的集合
521
- }
522
- lastCurrentIds = currentIds
523
- currentIds = ''
524
- }
525
- let newPhaselist = []
526
- phaseList.forEach(i => {
527
- let rangeArr = i.split('-').map(Number)
528
- if (rangeArr.length > 2) {
529
- newPhaselist.push([
530
- JSON.parse(JSON.stringify(rangeArr[1])),
531
- JSON.parse(JSON.stringify(rangeArr[2]))
532
- ])
533
- } else {
534
- newPhaselist.push([
535
- JSON.parse(JSON.stringify(rangeArr[1]))
536
- ])
537
- }
538
- })
539
- for (let i = this.stateList.length - 1; i >= 1; i--) {
540
- this.narr.push(this.stateList[i] - this.stateList[i - 1])
541
- }
542
- this.narr.reverse()// 阶段差
543
- for (let i = 0; i < newPhaselist.length; i++) {
544
- let stage = JSON.parse(JSON.stringify(newPhaselist[i]))
545
- let newStage = []
546
- stage.map(item => {
547
- for (let ring of newList) {
548
- for (let ringItem of ring) {
549
- if (item === ringItem.id && (ringItem.mode !== 7 && ringItem.mode !== 8 && ringItem.mode !== 9)) {
550
- newStage.push(item)
551
- }
552
- }
553
- }
554
- })
555
- let stageItem = this.getStageItem(newStage, newList, i)
556
- overstagesList.push(JSON.parse(JSON.stringify(stageItem)))
557
- }
558
- this.overlapCycle = overstagesList.reduce((prev, curr) => prev + parseInt(curr.split), 0)
559
- this.stagesListOver = JSON.parse(JSON.stringify(overstagesList))
560
- console.log(this.stagesListOver)
561
- },
562
- getStageItem (stageArr, ringsList, i) {
563
- let res = {
564
- key: i,
565
- split: this.narr[i], // 阶段绿性比
566
- phases: stageArr,
567
- delaystart: 0,
568
- advanceend: 0
569
- }
570
- // let splitArr = []
571
- let delaystartArr = []
572
- let advanceendArr = []
573
- for (let rings of ringsList) {
574
- for (let ring of rings) {
575
- if (stageArr.includes(ring.id)) {
576
- // let split = ring.value
577
- let delaystart = ring.delaystart
578
- let advanceend = ring.advanceend
579
- // splitArr.push(split)
580
- delaystartArr.push(delaystart)
581
- advanceendArr.push(advanceend)
582
- }
583
- }
584
- }
585
- // splitArr.sort(function (a, b) { return a - b })
586
- delaystartArr.sort(function (a, b) { return b - a })
587
- advanceendArr.sort(function (a, b) { return a - b })
588
- // res.split = splitArr.length > 0 ? splitArr[0] : 0
589
- res.delaystart = delaystartArr.length > 0 ? delaystartArr[0] : 0
590
- res.advanceend = advanceendArr.length > 0 ? advanceendArr[0] : 0
591
- return res
592
- },
593
- checkStage (rings) {
594
- if (!rings.phase || !rings.rings) return
595
- let idPattern = this.allPatternList.filter(item => item.id === rings.patternid)
596
- if (idPattern.length === 0) return
597
- let ringList = this.allPatternList.filter(item => {
598
- return item.id === rings.patternid
599
- })[0].rings
600
- let filterPattern = []
601
- for (let i of ringList) {
602
- for (let j of this.controlData.rings) {
603
- let filterSequence = i.filter(item => j.sequence.includes(item.id))
604
- if (filterSequence.length > 0) {
605
- filterPattern.push(filterSequence)
606
- }
607
- }
608
- }
609
- // let mapAdd = rings.phase.map(item => {
610
- // return {
611
- // id: item.id,
612
- // split: item.split
613
- // }
614
- // })
615
- // let newRings = rings.rings.map(j => {
616
- // return j.sequence
617
- // })
618
- // let newList = newRings.map(item => {
619
- // let ret = []
620
- // item.map(i => {
621
- // const find = mapAdd.find(j => j.id === i)
622
- // if (find) {
623
- // ret.push(find)
624
- // }
625
- // })
626
- // return ret
627
- // })
628
- // let mapAdds = newList.map(item => {
629
- // return item.map(val => {
630
- // return val.split
631
- // })
632
- // })
633
- // let maxCycle = mapAdds.length > 0 ? mapAdds.map(item => {
634
- // return item.length > 0 ? item.reduce((a, b) => {
635
- // return a + b
636
- // }) : 0
637
- // }) : 0
638
- let mapAdd = filterPattern.map(item => {
639
- return item.map(val => {
640
- return val.value + (val.sum ? val.sum : 0)
641
- })
642
- })
643
- let maxCycle = mapAdd.length > 0 ? mapAdd.map(item => {
644
- return item.length > 0 ? item.reduce((a, b) => {
645
- return a + b
646
- }) : 0
647
- }) : 0
648
- this.max = Math.max(...maxCycle)// 每个环的周期最大值
649
- this.getControl(filterPattern)
650
- },
651
- handleGetData (data) {
652
- let that = this
653
- if (data.name === '') {
654
- if (that.$i18n.locale === 'en') {
655
- data.name = 'Pattern' + data.patternid
656
- } else if (that.$i18n.locale === 'zh') {
657
- data.name = '方案' + data.patternid
658
- }
659
- }
660
- Object.keys(data).forEach(function (key) {
661
- if (that.$i18n.locale === 'en') {
662
- if (key === 'mode') {
663
- if (data[key] > 0 && data[key] < 6) {
664
- data[key] = that.ParamsModeEn.get(data[key])
665
- } else {
666
- data[key] = that.ParamsModeEn.get(0)
667
- }
668
- }
669
- // if (key === 'control') {
670
- // data[key] = that.ParamsControlEn.get(data[key])
671
- // }
672
- if (key === 'phase' || key === 'overlap') {
673
- for (let val of data[key]) {
674
- val.typestr = that.phaseTypeEn.get(val.type)
675
- val.pedtypestr = that.phaseTypeEn.get(val.pedtype)
676
- }
677
- }
678
- } else if (that.$i18n.locale === 'zh') {
679
- if (key === 'mode') {
680
- if (data[key] > 0 && data[key] < 6) {
681
- data[key] = that.ParamsMode.get(data[key])
682
- } else {
683
- data[key] = that.ParamsMode.get(0)
684
- }
685
- }
686
- // if (key === 'control') {
687
- // data[key] = that.ParamsControl.get(data[key])
688
- // }
689
- if (key === 'phase' || key === 'overlap') {
690
- for (let val of data[key]) {
691
- val.typestr = that.phaseType.get(val.type)
692
- val.pedtypestr = that.phaseType.get(val.pedtype)
693
- }
694
- }
695
- }
696
- })
697
- return data
698
- },
699
- reconnectionDev () {
700
- this.registerMessage()
701
- },
702
- queryDevParams () {
703
- queryDevice(this.AgentId).then(res => {
704
- if (!res.data.success) {
705
- this.$message.error(getMessageByCode(res.data.code, this.$i18n.locale))
706
- return
707
- }
708
- let devParams = res.data.data.jsonparam
709
- this.ip = devParams.ip
710
- this.port = String(devParams.port)
711
- this.protocol = res.data.data.protocol
712
- this.agentId = res.data.data.agentid
713
- if (res.data.data.name) {
714
- this.agentName = res.data.data.name
715
- }
716
- this.platform = res.data.data.platform
717
- let state = res.data.data.state
718
- if (state === 'UP') {
719
- this.stateName = this.$t('openatccomponents.overview.online')
720
- } else {
721
- this.stateName = this.$t('openatccomponents.overview.offline')
722
- }
723
- this.registerMessage() // 注册消息
724
- this.initData()
725
- // 配置工具没参数的时候
726
- this.getIntersectionInfo(this.agentId)
727
- })
728
- },
729
- getPhase () {
730
- uploadSingleTscParam('phase', this.agentId).then(data => {
731
- let res = data.data
732
- if (!res.success) {
733
- if (data.data.code === '4002' && data.data.data.errorCode === '4209') {
734
- let success = data.data.data.content.success
735
- if (success !== 0) {
736
- let errormsg = 'openatccomponents.overview.putTscControlError' + success
737
- this.$message.error(this.$t(errormsg))
738
- return
739
- }
740
- }
741
- let parrenterror = getMessageByCode(data.data.code, this.$i18n.locale)
742
- if (data.data.data) {
743
- // 子类型错误
744
- let childErrorCode = data.data.data.errorCode
745
- if (childErrorCode) {
746
- let childerror = getMessageByCode(data.data.data.errorCode, this.$i18n.locale)
747
- this.$message.error(parrenterror + ',' + childerror)
748
- }
749
- } else {
750
- this.$message.error(parrenterror)
751
- }
752
- return
753
- }
754
- if (res.data.data && res.data.data.phaseList) {
755
- this.phaseList = res.data.data.phaseList
756
- }
757
- })
758
- },
759
- getPlatform () {
760
- queryDevice(this.AgentId).then(res => {
761
- if (!res.data.success) {
762
- this.$message.error(getMessageByCode(res.data.code, this.$i18n.locale))
763
- return
764
- }
765
- let devParams = res.data.data.jsonparam
766
- this.ip = devParams.ip
767
- this.port = String(devParams.port)
768
- this.protocol = res.data.data.protocol
769
- this.agentId = res.data.data.agentid
770
- if (res.data.data.name) {
771
- this.agentName = res.data.data.name
772
- }
773
- this.platform = res.data.data.platform
774
- let func = 'allFunc'
775
- if (this.platform === 'OpenATC') {
776
- func = 'allFunc'
777
- }
778
- if (this.platform === 'SCATS' || this.platform === 'HUATONG') {
779
- func = 'basicFunc'
780
- }
781
- this.FuncSort = func
782
- })
783
- }
784
- },
785
- destroyed () {
786
- this.isResend = false
787
- this.clearPatternInterval() // 清除定时器
788
- this.clearVolumeInterval()
789
- this.clearDetectorStatusTimer()
790
- this.clearRegisterMessageTimer() // 清除定时器
791
- this.getPlatform()
792
- }
793
- }
794
- </script>