openatc-components 0.0.23 → 0.0.26

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 (78) hide show
  1. package/config/index.js +1 -1
  2. package/package/kisscomps/components/BoardCard/BoardCard.vue +4 -0
  3. package/package/kisscomps/components/ExpendConfig/ExpendConfig.vue +93 -0
  4. package/package/kisscomps/components/ExpendConfig/index.js +2 -0
  5. package/package/kisscomps/components/IntersectionMap/crossDirection/crossDiagram.vue +22 -0
  6. package/package/kisscomps/components/IntersectionMap/intersectionmap.vue +16 -12
  7. package/package/kisscomps/components/IntersectionWithInterface/IntersectionWithInterface.vue +244 -4
  8. package/package/kisscomps/components/KanBan/index.js +2 -0
  9. package/package/kisscomps/components/KanBan/kanban.vue +219 -0
  10. package/package/kisscomps/components/OverLap/OverLap.vue +11 -1
  11. package/package/kisscomps/components/PatternStatus/PatternStatus.vue +14 -3
  12. package/package/kisscomps/components/PhaseMarker/index.js +6 -0
  13. package/package/kisscomps/components/PhaseMarker/phasemarker.vue +215 -0
  14. package/package/kisscomps/components/PhaseMarker/svg/patternSvg.vue +121 -0
  15. package/package/kisscomps/components/PhaseMarker/svg/phase.vue +60 -0
  16. package/package/kisscomps/components/PhaseMarker/svg/phaseCount.vue +62 -0
  17. package/package/kisscomps/components/PhaseMarker/svg/phaseCountCycle.vue +62 -0
  18. package/package/kisscomps/components/PhaseMarker/svg/phaseSvg.vue +117 -0
  19. package/package/kisscomps/components/SchemeConfig/SchemeConfig.vue +30 -3
  20. package/package/kisscomps/components/SchemeConfig/manualControlModal/index.vue +21 -2
  21. package/package/kisscomps/components/SchemeConfig/realtimeStatusModal/index.vue +5 -47
  22. package/package/kisscomps/components/SchemeConfig/tentativeplancontrolmodal/index.vue +1304 -0
  23. package/package/kisscomps/components/StageBord/StageBord.vue +242 -0
  24. package/package/kisscomps/components/StageBord/index.js +2 -0
  25. package/package/kisscomps/components/StageStatus/StageStatus.vue +4 -2
  26. package/package/kisscomps/components/Stages/index.vue +86 -0
  27. package/package/kisscomps/components/overView/index.vue +656 -0
  28. package/package/kisscomps/components/patternList/patternList.vue +4 -0
  29. package/package/kisscomps/index.js +15 -1
  30. package/package/kissui.min.js +1 -1
  31. package/package.json +2 -2
  32. package/src/api/authapi.js +1 -1
  33. package/src/i18n/language/en.js +4 -1
  34. package/src/i18n/language/zh.js +4 -1
  35. package/src/icons/svg/tentativeplan.svg +33 -0
  36. package/src/kisscomps/components/BoardCard/BoardCard.vue +4 -0
  37. package/src/kisscomps/components/ExpendConfig/ExpendConfig.vue +93 -0
  38. package/src/kisscomps/components/ExpendConfig/index.js +2 -0
  39. package/src/kisscomps/components/IntersectionMap/crossDirection/crossDiagram.vue +22 -0
  40. package/src/kisscomps/components/IntersectionMap/intersectionmap.vue +16 -12
  41. package/src/kisscomps/components/IntersectionWithInterface/IntersectionWithInterface.vue +244 -4
  42. package/src/kisscomps/components/KanBan/index.js +2 -0
  43. package/src/kisscomps/components/KanBan/kanban.vue +219 -0
  44. package/src/kisscomps/components/OverLap/OverLap.vue +11 -1
  45. package/src/kisscomps/components/PatternStatus/PatternStatus.vue +14 -3
  46. package/src/kisscomps/components/PhaseMarker/index.js +6 -0
  47. package/src/kisscomps/components/PhaseMarker/phasemarker.vue +215 -0
  48. package/src/kisscomps/components/PhaseMarker/svg/patternSvg.vue +121 -0
  49. package/src/kisscomps/components/PhaseMarker/svg/phase.vue +60 -0
  50. package/src/kisscomps/components/PhaseMarker/svg/phaseCount.vue +62 -0
  51. package/src/kisscomps/components/PhaseMarker/svg/phaseCountCycle.vue +62 -0
  52. package/src/kisscomps/components/PhaseMarker/svg/phaseSvg.vue +117 -0
  53. package/src/kisscomps/components/SchemeConfig/SchemeConfig.vue +30 -3
  54. package/src/kisscomps/components/SchemeConfig/manualControlModal/index.vue +21 -2
  55. package/src/kisscomps/components/SchemeConfig/realtimeStatusModal/index.vue +5 -47
  56. package/src/kisscomps/components/SchemeConfig/tentativeplancontrolmodal/index.vue +1304 -0
  57. package/src/kisscomps/components/StageBord/StageBord.vue +242 -0
  58. package/src/kisscomps/components/StageBord/index.js +2 -0
  59. package/src/kisscomps/components/StageStatus/StageStatus.vue +4 -2
  60. package/src/kisscomps/components/Stages/index.vue +86 -0
  61. package/src/kisscomps/components/overView/index.vue +656 -0
  62. package/src/kisscomps/components/patternList/patternList.vue +4 -0
  63. package/src/kisscomps/index.js +15 -1
  64. package/src/lib/publicjs/KissApi.js +2 -0
  65. package/src/main.js +2 -0
  66. package/src/router/index.js +15 -8
  67. package/src/utils/ControlFormat.js +68 -0
  68. package/src/utils/RingDataModel.js +1 -1
  69. package/src/utils/auth.js +8 -0
  70. package/src/views/home.vue +16 -1
  71. package/src/views/intersection.vue +188 -6
  72. package/src/views/overView.vue +33 -0
  73. package/src/views/schemeconfig.vue +6 -5
  74. package/static/styles/common.scss +2 -0
  75. package/static/styles/intersection.scss +18 -0
  76. package/static/styles/overview.scss +372 -0
  77. package/static/styles/schemeconfig.scss +99 -1
  78. package/static/styles/stages.scss +65 -0
@@ -0,0 +1,656 @@
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="wenzijiemian" v-show="!isShowGui">
16
+ <TextPage
17
+ ref="textPage"
18
+ :agentId="agentId"
19
+ :ip="ip"
20
+ :port="port"
21
+ :protocol="protocol"
22
+ :devStatus="devStatus"
23
+ :originControlData="controlData" />
24
+ </div> -->
25
+ <div class="tuxingjiemian" :class="{'minifont': curBodyWidth <= 650}">
26
+ <div class="tuxing-left" :class="{'changeWidth': graphicMode}" ref="tuxingLeft">
27
+ <intersection-base-map
28
+ ref="intersectionMap"
29
+ :crossStatusData="crossStatusData"
30
+ :devStatus="devStatus"
31
+ :agentId="agentId"
32
+ :graphicMode="graphicMode"
33
+ :roadDirection="roadDirection" />
34
+ <div class="pattern-status" v-if="!graphicMode">
35
+ <div class="pattern-name cross-mess">{{$t('openatccomponents.overview.patternstate')}}</div>
36
+ <div class="pattern-message">({{$t('openatccomponents.overview.cycle')}}: {{controlData.cycle}} {{$t('openatccomponents.overview.patternoffset')}}: {{controlData.patternoffset}} {{$t('openatccomponents.overview.coordinationtime')}}: {{controlData.offset}})</div>
37
+ <!-- <span class="pattern-explain">:{{$t('openatccomponents.overview.phasesplit')}}</span> -->
38
+ <span class="pattern-explain"><el-checkbox v-model="checked">{{$t('openatccomponents.pattern.overLap')}}</el-checkbox></span>
39
+ <!-- P{{$t('openatccomponents.overview.phase')}} -->
40
+ <pattern-list
41
+ ref="boardCard"
42
+ :cycle="crossStatusData ? crossStatusData.cycle : 0"
43
+ :syncTime="crossStatusData ? crossStatusData.syncTime : 0"
44
+ :controlData="controlData"
45
+ :contrloType="contrloType"
46
+ :patternStatusList="patternList"
47
+ :localPatternList="allPatternList"
48
+ :phaseList="phaseList"
49
+ :isPhase="true"
50
+ :agentId="agentId"
51
+ >
52
+ </pattern-list>
53
+ <over-lap
54
+ v-if="!contrloType"
55
+ :checked="checked"
56
+ :overlap="overlap"
57
+ :stageList="stagesListOver"
58
+ :cycle="controlData.cycle"
59
+ :controlData="controlData"
60
+ >
61
+ </over-lap>
62
+ </div>
63
+ </div>
64
+
65
+ <div ref="tuxingRight" class="tuxing-right" >
66
+ <scheme-config
67
+ ref="rightpanel"
68
+ :statusData="crossStatusData"
69
+ :agentName="agentName"
70
+ :responseTime="responseTime"
71
+ :devStatus="devStatus"
72
+ :agentId="agentId"
73
+ :ip="ip"
74
+ :platform="platform"
75
+ :funcSort="FuncSort"
76
+ :roadDirection="roadDirection" />
77
+ </div>
78
+ </div>
79
+ </div>
80
+ </div>
81
+ </template>
82
+
83
+ <script>
84
+ import { mapState } from 'vuex'
85
+ import { getTscControl, queryDevice } from '../../../api/control'
86
+ import { registerMessage, uploadSingleTscParam } from '../../../api/param'
87
+ import { setIframdevid, getStageTypes, setToken, setHost } from '../../../utils/auth'
88
+ // import BoardCard from '@/components/BoardCard'
89
+ // import OverLap from '@/components/OverLap'
90
+ import { getIntersectionInfo } from '../../../api/template'
91
+ // import { getFaultMesZh, getFaultMesEn } from '../../utils/faultcode.js'
92
+ import { getMessageByCode } from '../../../utils/responseMessage'
93
+ import PhaseDataModel from '../IntersectionMap/crossDirection/utils.js'
94
+ import CrossDiagramMgr from '../../../EdgeMgr/controller/crossDiagramMgr'
95
+ // import TextPage from './textPage/index'
96
+ // import { setToken, setHost } from '../../../utils/auth.js'
97
+ export default {
98
+ name: 'overview',
99
+ components: {
100
+ // TextPage
101
+ },
102
+ props: {
103
+ reqUrl: {
104
+ type: String,
105
+ default: 'http://192.168.13.105:11003/openatc'
106
+ },
107
+ AgentId: {
108
+ type: String,
109
+ default: '0'
110
+ },
111
+ Token: {
112
+ type: String,
113
+ default: ''
114
+ },
115
+ roadDirection: {
116
+ type: String,
117
+ default: 'right'
118
+ }
119
+ },
120
+ data () {
121
+ return {
122
+ curBodyWidth: 1920,
123
+ graphicMode: false,
124
+ FuncSort: 'allFunc',
125
+ controlData: {},
126
+ checked: false,
127
+ overlap: [],
128
+ contrloType: false,
129
+ narr: [],
130
+ patternList: [],
131
+ allPatternList: [],
132
+ stagesListOver: [],
133
+ sidewalkPhaseData: [],
134
+ phaseControlTimer: null, // 定时器
135
+ registerMessageTimer: null, // 延时器
136
+ volumeControlTimer: null, // 流量定时器
137
+ ParamsMode: new Map([[0, '自主控制'], [1, '本地手动'], [2, '平台控制'], [3, '配置软件控制'], [4, '遥控器控制'], [5, '黄闪器控制'], [6, '降级控制'], [7, '脚本控制'], [8, '算法控制']]),
138
+ 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']]),
139
+ 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, '设备维护']]),
140
+ 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']]),
141
+ phaseType: new Map([[1, '红'], [2, '黄'], [3, '绿']]), // phaseType表示红,黄,绿
142
+ phaseTypeEn: new Map([[1, 'Red'], [2, 'Yellow'], [3, 'Green']]), // phaseType表示红,黄,绿
143
+ ip: '--',
144
+ port: '--',
145
+ protocol: '--',
146
+ devStatus: 1,
147
+ mode: '2',
148
+ agentId: '0',
149
+ agentName: '--',
150
+ platform: undefined,
151
+ crossStatusData: {}, // 路口状态数据
152
+ reset: false,
153
+ responseTime: 0,
154
+ phaseList: [], // 当前相位集合
155
+ intervalFlag: true,
156
+ shrink: 1,
157
+ isResend: true,
158
+ commonHeight: undefined // 左右侧面板的高度值
159
+ }
160
+ },
161
+ computed: {
162
+ // patternList () {
163
+ // return this.$store.state.globalParam.tscParam.patternList
164
+ // },
165
+ ...mapState({
166
+ // curBodyWidth: state => state.globalParam.curBodyWidth,
167
+ curBodyHeight: state => state.globalParam.curBodyHeight,
168
+ // FuncSort: state => state.globalParam.FuncSort,
169
+ hideMenu: state => state.globalParam.hideMenu
170
+ // graphicMode: state => state.globalParam.graphicMode
171
+ // isShowGui: state => state.globalParam.isShowGui,
172
+ // roadDirection: state => state.globalParam.roadDirection
173
+ })
174
+ },
175
+ watch: {
176
+ AgentId: {
177
+ handler: function (val, oldVal) {
178
+ this.agentId = val
179
+ },
180
+ // 深度观察监听
181
+ deep: true
182
+ },
183
+ Token: {
184
+ handler: function (val) {
185
+ this.setPropsToken(val)
186
+ }
187
+ },
188
+ $route: {
189
+ handler: function (val, oldVal) {
190
+ if (val.query !== undefined) {
191
+ if (this.$route.query.shrink) {
192
+ this.shrink = Number(this.$route.query.shrink)
193
+ }
194
+ this.agentId = this.$route.query.agentid
195
+ setIframdevid(this.agentId)
196
+ this.getPlatform()
197
+ this.$refs.rightpanel.getFaultById()
198
+ }
199
+ },
200
+ // 深度观察监听
201
+ deep: true
202
+ },
203
+ phaseList: {
204
+ handler: function (val, oldVal) {
205
+ this.getPedPhasePos()
206
+ },
207
+ // 深度观察监听
208
+ deep: true
209
+ }
210
+ },
211
+ created () {
212
+ this.agentId = this.AgentId
213
+ this.setHost(this.reqUrl)
214
+ this.PhaseDataModel = new PhaseDataModel()
215
+ this.CrossDiagramMgr = new CrossDiagramMgr()
216
+ if (getStageTypes('contrloType') === 'true') {
217
+ this.contrloType = true
218
+ } else {
219
+ this.contrloType = false
220
+ }
221
+ this.globalParamModel = this.$store.getters.globalParamModel
222
+ if (this.$route.query !== undefined && Object.keys(this.$route.query).length) {
223
+ this.agentId = this.$route.query.agentid
224
+ setIframdevid(this.agentId)
225
+ this.registerMessage() // 注册消息
226
+ this.getIntersectionInfo(this.agentId, this.crossStatusData.patternid)
227
+ } else {
228
+ this.queryDevParams() // 查询设备信息
229
+ }
230
+ },
231
+ mounted () {
232
+ this.getPlatform()
233
+ if (this.$route.query.shrink) {
234
+ this.shrink = Number(this.$route.query.shrink)
235
+ }
236
+ var _this = this
237
+ _this.$nextTick(function () {
238
+ this.curBodyWidth = this.$el.parentElement.clientWidth
239
+ })
240
+ },
241
+ updated () {
242
+ if (this.$refs.tuxingLeft.offsetHeight !== this.commonHeight) {
243
+ // 根据左侧面板动态变化的高度,同步更新右侧面板高度
244
+ this.commonHeight = this.$refs.tuxingLeft.offsetHeight
245
+ this.$refs.tuxingRight.style.height = this.commonHeight + 'px'
246
+ }
247
+ },
248
+ methods: {
249
+ setPropsToken (token) {
250
+ // 获取组件外传入的token,便于独立组件调用接口
251
+ if (token && token !== '') {
252
+ setToken(token)
253
+ }
254
+ },
255
+ setHost (host) {
256
+ // 获取组件外传入的token,便于独立组件调用接口
257
+ if (host && host !== '') {
258
+ setHost(host)
259
+ }
260
+ },
261
+ getIntersectionInfo (agentid, id) {
262
+ // 获取路口信息
263
+ getIntersectionInfo(agentid).then(res => {
264
+ // this.globalParamModel.setGlobalParams(res.data.data.param)
265
+ this.allPatternList = res.data.data.param.patternList
266
+ this.overlap = res.data.data.param.overlaplList
267
+ this.phaseList = res.data.data.param.phaseList
268
+ this.patternList = res.data.data.param.patternList.filter(item => {
269
+ return item.id === id
270
+ })[0].rings
271
+ })
272
+ },
273
+ getPedPhasePos () {
274
+ // 行人相位信息
275
+ this.sidewalkPhaseData = []
276
+ this.phaseList.forEach((ele, i) => {
277
+ if (ele.peddirection) {
278
+ ele.peddirection.forEach((dir, index) => {
279
+ // 行人相位
280
+ if (this.PhaseDataModel.getSidePos(dir)) {
281
+ this.sidewalkPhaseData.push({
282
+ key: this.CrossDiagramMgr.getUniqueKey('pedphase'),
283
+ phaseid: ele.id, // 相位id,用于对应相位状态
284
+ id: dir,
285
+ name: this.PhaseDataModel.getSidePos(dir).name
286
+ })
287
+ }
288
+ })
289
+ }
290
+ })
291
+ },
292
+ registerMessage () {
293
+ registerMessage(this.AgentId).then(data => {
294
+ if (!data.data.success) {
295
+ this.devStatus = 2
296
+ let parrenterror = getMessageByCode(data.data.code, this.$i18n.locale)
297
+ if (data.data.data) {
298
+ // 子类型错误
299
+ let childErrorCode = data.data.data.errorCode
300
+ if (childErrorCode) {
301
+ let childerror = getMessageByCode(data.data.data.errorCode, this.$i18n.locale)
302
+ this.$message.error(parrenterror + ',' + childerror)
303
+ }
304
+ } else {
305
+ this.$message.error(parrenterror)
306
+ }
307
+ if (this.isResend) {
308
+ this.reSend()
309
+ }
310
+ return
311
+ }
312
+ this.devStatus = 3
313
+ this.clearPatternInterval() // 清除其他定时器
314
+ this.clearVolumeInterval()
315
+ this.phaseControlTimer = setInterval(() => {
316
+ if (this.intervalFlag) {
317
+ this.initData()
318
+ }
319
+ }, 1000)
320
+ // this.$refs.textPage.getVolume()
321
+ // this.volumeControlTimer = setInterval(() => {
322
+ // this.$refs.textPage.getVolume()
323
+ // }, 300000)
324
+ this.getPhase()
325
+ })
326
+ },
327
+ reSend () { // 设备掉线重连机制
328
+ this.devStatus = 1
329
+ this.clearRegisterMessageTimer()
330
+ this.registerMessageTimer = setTimeout(() => {
331
+ this.reconnectionDev()
332
+ }, 5000)
333
+ },
334
+ clearPatternInterval () {
335
+ if (this.phaseControlTimer !== null) {
336
+ clearInterval(this.phaseControlTimer) // 清除定时器
337
+ this.phaseControlTimer = null
338
+ }
339
+ },
340
+ clearVolumeInterval () {
341
+ if (this.volumeControlTimer !== null) {
342
+ clearInterval(this.volumeControlTimer) // 清除流量定时器
343
+ this.volumeControlTimer = null
344
+ }
345
+ },
346
+ clearRegisterMessageTimer () {
347
+ if (this.registerMessageTimer !== null) {
348
+ clearTimeout(this.registerMessageTimer) // 清除延时器
349
+ this.registerMessageTimer = null
350
+ }
351
+ },
352
+ initData () {
353
+ this.intervalFlag = false
354
+ let startTime = new Date().getTime()
355
+ getTscControl(this.AgentId).then((data) => {
356
+ let endTime = new Date().getTime()
357
+ let diffTime = endTime - startTime
358
+ this.responseTime = diffTime
359
+ this.intervalFlag = true
360
+ if (!data.data.success) {
361
+ if (data.data.code === '4003') {
362
+ this.devStatus = 2
363
+ this.clearPatternInterval() // 清除其他定时器
364
+ this.clearVolumeInterval()
365
+ this.$message.error(getMessageByCode(data.data.code, this.$i18n.locale))
366
+ if (this.isResend) {
367
+ this.reSend()
368
+ }
369
+ return
370
+ }
371
+ let parrenterror = getMessageByCode(data.data.code, this.$i18n.locale)
372
+ if (data.data.data) {
373
+ // 子类型错误
374
+ let childErrorCode = data.data.data.errorCode
375
+ if (childErrorCode) {
376
+ let childerror = getMessageByCode(data.data.data.errorCode, this.$i18n.locale)
377
+ this.$message.error(parrenterror + ',' + childerror)
378
+ }
379
+ } else {
380
+ this.$message.error(parrenterror)
381
+ }
382
+ this.clearPatternInterval() // 清除其他定时器
383
+ this.clearVolumeInterval()
384
+ if (this.isResend) {
385
+ this.reSend()
386
+ }
387
+ return
388
+ }
389
+ this.crossStatusData = JSON.parse(JSON.stringify(data.data.data.data))
390
+ let TscData = JSON.parse(JSON.stringify(data.data.data.data))
391
+ // this.handleStageData(TscData) // 处理阶段(驻留)stage数据
392
+ this.controlData = this.handleGetData(TscData)
393
+ this.checkStage(this.controlData)
394
+ }).catch(error => {
395
+ // this.$message.error(error)
396
+ console.log(error)
397
+ })
398
+ },
399
+ getControl (newList) { // 总揽实时数据
400
+ let currentIds = ''
401
+ let lastCurrentIds = ''
402
+ this.stateList = [0]
403
+ this.narr = []
404
+ let overstagesList = []
405
+ let phaseList = []
406
+ for (let j = 0; j <= this.max; j++) { // 指针长度
407
+ for (let i = 0; i < newList.length; i++) { // 环列表
408
+ let ring = newList[i]// 每个环对象
409
+ let sum = 0
410
+ for (let n = 0; n < ring.length; n++) { // 相位累计长度
411
+ if (ring[n].mode !== 7) {
412
+ sum = sum + ring[n].split
413
+ if (j < sum) {
414
+ let phaseId = ring[n].id
415
+ currentIds = currentIds + '-' + phaseId
416
+ break
417
+ }
418
+ }
419
+ }
420
+ }
421
+ if (lastCurrentIds !== currentIds && lastCurrentIds !== '') { // 当前相位id和上一个相比不同说明相位变化了
422
+ phaseList.push(lastCurrentIds)
423
+ this.stateList.push(j)// 阶段累计长度的集合
424
+ }
425
+ lastCurrentIds = currentIds
426
+ currentIds = ''
427
+ }
428
+ let newPhaselist = []
429
+ phaseList.forEach(i => {
430
+ let rangeArr = i.split('-').map(Number)
431
+ if (rangeArr.length > 2) {
432
+ newPhaselist.push([
433
+ JSON.parse(JSON.stringify(rangeArr[1])),
434
+ JSON.parse(JSON.stringify(rangeArr[2]))
435
+ ])
436
+ } else {
437
+ newPhaselist.push([
438
+ JSON.parse(JSON.stringify(rangeArr[1]))
439
+ ])
440
+ }
441
+ })
442
+ for (let i = this.stateList.length - 1; i >= 1; i--) {
443
+ this.narr.push(this.stateList[i] - this.stateList[i - 1])
444
+ }
445
+ this.narr.reverse()// 阶段差
446
+ for (let i = 0; i < newPhaselist.length; i++) {
447
+ let stage = JSON.parse(JSON.stringify(newPhaselist[i]))
448
+ let stageItem = this.getStageItem(stage, newList, i)
449
+ overstagesList.push(JSON.parse(JSON.stringify(stageItem)))
450
+ }
451
+ this.stagesListOver = JSON.parse(JSON.stringify(overstagesList))
452
+ },
453
+ getStageItem (stageArr, ringsList, i) {
454
+ let res = {
455
+ key: i,
456
+ split: this.narr[i], // 阶段绿性比
457
+ stages: stageArr,
458
+ delaystart: 0,
459
+ advanceend: 0
460
+ }
461
+ // let splitArr = []
462
+ let delaystartArr = []
463
+ let advanceendArr = []
464
+ for (let rings of ringsList) {
465
+ for (let ring of rings) {
466
+ if (stageArr.includes(ring.id)) {
467
+ // let split = ring.value
468
+ let delaystart = ring.delaystart
469
+ let advanceend = ring.advanceend
470
+ // splitArr.push(split)
471
+ delaystartArr.push(delaystart)
472
+ advanceendArr.push(advanceend)
473
+ }
474
+ }
475
+ }
476
+ // splitArr.sort(function (a, b) { return a - b })
477
+ delaystartArr.sort(function (a, b) { return b - a })
478
+ advanceendArr.sort(function (a, b) { return a - b })
479
+ // res.split = splitArr.length > 0 ? splitArr[0] : 0
480
+ res.delaystart = delaystartArr.length > 0 ? delaystartArr[0] : 0
481
+ res.advanceend = advanceendArr.length > 0 ? advanceendArr[0] : 0
482
+ return res
483
+ },
484
+ checkStage (rings) {
485
+ if (!rings.phase || !rings.rings) return
486
+ let mapAdd = rings.phase.map(item => {
487
+ return {
488
+ id: item.id,
489
+ split: item.split
490
+ }
491
+ })
492
+ let newRings = rings.rings.map(j => {
493
+ return j.sequence
494
+ })
495
+ let newList = newRings.map(item => {
496
+ let ret = []
497
+ item.map(i => {
498
+ const find = mapAdd.find(j => j.id === i)
499
+ if (find) {
500
+ ret.push(find)
501
+ }
502
+ })
503
+ return ret
504
+ })
505
+ let mapAdds = newList.map(item => {
506
+ return item.map(val => {
507
+ return val.split
508
+ })
509
+ })
510
+ let maxCycle = mapAdds.length > 0 ? mapAdds.map(item => {
511
+ return item.length > 0 ? item.reduce((a, b) => {
512
+ return a + b
513
+ }) : 0
514
+ }) : 0
515
+ this.max = Math.max(...maxCycle)// 每个环的周期最大值
516
+ this.getControl(newList)
517
+ },
518
+ handleGetData (data) {
519
+ let that = this
520
+ if (data.name === '') {
521
+ if (that.$i18n.locale === 'en') {
522
+ data.name = 'Pattern' + data.patternid
523
+ } else if (that.$i18n.locale === 'zh') {
524
+ data.name = '方案' + data.patternid
525
+ }
526
+ }
527
+ Object.keys(data).forEach(function (key) {
528
+ if (that.$i18n.locale === 'en') {
529
+ if (key === 'mode') {
530
+ if (data[key] > 0 && data[key] < 6) {
531
+ data[key] = that.ParamsModeEn.get(data[key])
532
+ } else {
533
+ data[key] = that.ParamsModeEn.get(0)
534
+ }
535
+ }
536
+ if (key === 'control') {
537
+ data[key] = that.ParamsControlEn.get(data[key])
538
+ }
539
+ if (key === 'phase') {
540
+ for (let val of data[key]) {
541
+ val.type = that.phaseTypeEn.get(val.type)
542
+ }
543
+ }
544
+ } else if (that.$i18n.locale === 'zh') {
545
+ if (key === 'mode') {
546
+ if (data[key] > 0 && data[key] < 6) {
547
+ data[key] = that.ParamsMode.get(data[key])
548
+ } else {
549
+ data[key] = that.ParamsMode.get(0)
550
+ }
551
+ }
552
+ if (key === 'control') {
553
+ data[key] = that.ParamsControl.get(data[key])
554
+ }
555
+ if (key === 'phase') {
556
+ for (let val of data[key]) {
557
+ val.type = that.phaseType.get(val.type)
558
+ }
559
+ }
560
+ }
561
+ })
562
+ return data
563
+ },
564
+ reconnectionDev () {
565
+ this.registerMessage()
566
+ },
567
+ queryDevParams () {
568
+ queryDevice(this.AgentId).then(res => {
569
+ if (!res.data.success) {
570
+ this.$message.error(getMessageByCode(res.data.code, this.$i18n.locale))
571
+ return
572
+ }
573
+ let devParams = res.data.data.jsonparam
574
+ this.ip = devParams.ip
575
+ this.port = String(devParams.port)
576
+ this.protocol = res.data.data.protocol
577
+ this.agentId = res.data.data.agentid
578
+ if (res.data.data.name) {
579
+ this.agentName = res.data.data.name
580
+ }
581
+ this.platform = res.data.data.platform
582
+ if (this.platform === 'OpenATC') {
583
+ this.FuncSort = 'allFunc'
584
+ }
585
+ if (this.platform === 'SCATS' || this.platform === 'HUATONG') {
586
+ this.FuncSort = 'basicFunc'
587
+ }
588
+ this.$refs.intersectionMap.resetCrossDiagram()
589
+ this.registerMessage() // 注册消息
590
+ this.initData()
591
+ this.getIntersectionInfo(this.agentId, this.crossStatusData.patternid)
592
+ })
593
+ },
594
+ getPhase () {
595
+ uploadSingleTscParam('phase', this.AgentId).then(data => {
596
+ let res = data.data
597
+ if (!res.success) {
598
+ if (res.code === '4003') {
599
+ this.$message.error(this.$t('openatccomponents.errorTip.devicenotonline'))
600
+ return
601
+ }
602
+ this.$message.error(getMessageByCode(data.data.code, this.$i18n.locale))
603
+ return
604
+ }
605
+ this.phaseList = res.data.data.phaseList
606
+ })
607
+ },
608
+ getPlatform () {
609
+ queryDevice(this.AgentId).then(res => {
610
+ if (!res.data.success) {
611
+ this.$message.error(getMessageByCode(res.data.code, this.$i18n.locale))
612
+ return
613
+ }
614
+ let devParams = res.data.data.jsonparam
615
+ this.ip = devParams.ip
616
+ this.port = String(devParams.port)
617
+ this.protocol = res.data.data.protocol
618
+ this.agentId = res.data.data.agentid
619
+ if (res.data.data.name) {
620
+ this.agentName = res.data.data.name
621
+ }
622
+ this.platform = res.data.data.platform
623
+ // let func = 'allFunc'
624
+ // if (this.platform === 'OpenATC') {
625
+ // func = 'allFunc'
626
+ // }
627
+ // if (this.platform === 'SCATS' || this.platform === 'HUATONG') {
628
+ // func = 'basicFunc'
629
+ // }
630
+ // this.$store.dispatch('SaveFunctionLevel', func)
631
+ if (this.platform === 'OpenATC') {
632
+ this.FuncSort = 'allFunc'
633
+ }
634
+ if (this.platform === 'SCATS' || this.platform === 'HUATONG') {
635
+ this.FuncSort = 'basicFunc'
636
+ }
637
+ })
638
+ },
639
+ isJsonString (str) {
640
+ try {
641
+ JSON.parse(str)
642
+ return true
643
+ } catch (err) {
644
+ return false
645
+ }
646
+ }
647
+ },
648
+ destroyed () {
649
+ this.isResend = false
650
+ this.clearPatternInterval() // 清除定时器
651
+ this.clearVolumeInterval()
652
+ this.clearRegisterMessageTimer() // 清除定时器
653
+ this.getPlatform()
654
+ }
655
+ }
656
+ </script>
@@ -7,6 +7,7 @@
7
7
  :patternStatusList="patternStatusList"
8
8
  :cycles="cycles"
9
9
  :cycle="cycle"
10
+ :patternList="patternList"
10
11
  :localPatternList="localPatternList"
11
12
  :phaseList="phaseList"
12
13
  :agentId="agentId"
@@ -497,6 +498,9 @@ export default {
497
498
  localPatternList: {
498
499
  type: Array
499
500
  },
501
+ patternList: {
502
+ type: Array
503
+ },
500
504
  stagesChange: {
501
505
  type: Array
502
506
  },