openatc-components 0.3.71 → 0.3.73

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