openatc-components 0.4.61 → 0.4.63
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.
- package/package/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/phaseIconSvg.vue +6 -2
- package/package/kisscomps/components/IntersectionMapDirSelect/customCrossDiagram.vue +711 -0
- package/package/kisscomps/components/IntersectionMapDirSelect/customintersectionmap.vue +188 -0
- package/package/kisscomps/components/IntersectionMapDirSelect/index.js +2 -0
- package/package/kisscomps/index.js +3 -1
- package/package/kissui.min.js +1 -1
- package/package.json +1 -1
- package/src/i18n/language/en.js +19 -0
- package/src/i18n/language/zh.js +19 -0
- package/src/kisscomps/components/IntersectionMap/crossDirection/phaseIcon/phaseIconSvg.vue +6 -2
- package/src/kisscomps/components/IntersectionMapDirSelect/customCrossDiagram.vue +711 -0
- package/src/kisscomps/components/IntersectionMapDirSelect/customintersectionmap.vue +188 -0
- package/src/kisscomps/components/IntersectionMapDirSelect/index.js +2 -0
- package/src/kisscomps/index.js +3 -1
- package/src/views/intersection.vue +15 -5
- package/src/utils/errorcode.js +0 -231
|
@@ -0,0 +1,711 @@
|
|
|
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
|
+
<!-- 仅支持基础道路相位方向选择(不包含匝道、公交相位) -->
|
|
13
|
+
<template>
|
|
14
|
+
<div class="crossImg">
|
|
15
|
+
<!-- 右行道路 B-->
|
|
16
|
+
<div class="right-dir-road">
|
|
17
|
+
<div class="centerText" v-if="crossType !== 'Customroads'">
|
|
18
|
+
<!-- 手动刷新 -->
|
|
19
|
+
<div v-if="!isLoaded">
|
|
20
|
+
<RefreshSvg @click.native="refresh"/>
|
|
21
|
+
<span class="text">{{$t('openatccomponents.overview.getintersectionmapagain')}}</span>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<!-- 路口底图 -->
|
|
25
|
+
<div class="baseImg">
|
|
26
|
+
<!-- 城市道路 -->
|
|
27
|
+
<CrossRoadsSvg v-if="crossType === 'Crossroads'"/>
|
|
28
|
+
<TShapeEastRoadsSvg v-if="crossType === 'TypeT-east'"/>
|
|
29
|
+
<TShapeWestRoadsSvg v-if="crossType === 'TypeT-west'"/>
|
|
30
|
+
<TShapeNorthRoadsSvg v-if="crossType === 'TypeT-north'"/>
|
|
31
|
+
<TShapeSouthRoadsSvg v-if="crossType === 'TypeT-south'"/>
|
|
32
|
+
<!-- 其他路口 -->
|
|
33
|
+
<CustomRoadsSvg v-if="crossType === 'Customroads'"/>
|
|
34
|
+
<!-- 匝道 -->
|
|
35
|
+
<!-- <RampEastRoadsSvg v-if="crossType === 'ramp-east'" />
|
|
36
|
+
<RampWestRoadsSvg v-if="crossType === 'ramp-west'" />
|
|
37
|
+
<RampNorthRoadsSvg v-if="crossType === 'ramp-north'" />
|
|
38
|
+
<RampSouthRoadsSvg v-if="crossType === 'ramp-south'" /> -->
|
|
39
|
+
<!-- 路段行人过街 -->
|
|
40
|
+
<PedSectionSNSvg v-if="crossType === 'ped-section-south-north'" />
|
|
41
|
+
<PedSectionEWSvg v-if="crossType === 'ped-section-east-west'" />
|
|
42
|
+
</div>
|
|
43
|
+
<!-- 城市道路状态-->
|
|
44
|
+
<div v-if="mainType === '100' || mainType === '101' || mainType === '104'">
|
|
45
|
+
<!-- 人行道 -->
|
|
46
|
+
<div class="sidewalk" id="sidewalk" v-if="resetflag && isLoaded">
|
|
47
|
+
<SidewalkClickSvg v-if="compSidewalkPhaseData.length" :Data="compSidewalkPhaseData" :clickMode="clickMode" @handleClickSidewalkIcon="handleClickSidewalkIcon" />
|
|
48
|
+
<SidewalkSvg v-else v-for="(side, index) in compSidewalkPhaseData" :key="side.key + '-' + index" :Data="side" :crossType="crossType" />
|
|
49
|
+
</div>
|
|
50
|
+
<!-- 车道相位 -->
|
|
51
|
+
<div v-if="resetflag" class="phaseIcon">
|
|
52
|
+
<PhaseIconSvg v-for="(item, index) in compLanePhaseData" :key="item.key + '-' + index" :Data="item" :customClick="clickMode" :clickMode="clickMode" @handleClickPhaseIcon="handleClickPhaseIcon" />
|
|
53
|
+
</div>
|
|
54
|
+
<!-- 公交相位 -->
|
|
55
|
+
<!-- <div v-if="resetflag" class="busIcon">
|
|
56
|
+
<BusMapSvg v-for="(item, index) in comdireBusPhaseData" :key="'Busmap-' + item.key + '-' + index" :Data="item" />
|
|
57
|
+
<PhaseIconSvg v-for="(item, index) in comdireBusPhaseData" :key="item.key + '-' + index" :Data="item"/>
|
|
58
|
+
</div> -->
|
|
59
|
+
</div>
|
|
60
|
+
<!-- 匝道状态 -->
|
|
61
|
+
<!-- 车道相位 -->
|
|
62
|
+
<!-- <div v-if="resetflag && mainType === '103'">
|
|
63
|
+
<RampPhaseIconSvg v-for="(item, index) in LanePhaseData" :key="item.key + '-' + index" :Data="item" />
|
|
64
|
+
</div> -->
|
|
65
|
+
</div>
|
|
66
|
+
<!-- 右行道路 E-->
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
<script>
|
|
70
|
+
import PhaseIconSvg from '../IntersectionMap/crossDirection/phaseIcon/phaseIconSvg'
|
|
71
|
+
import PhaseDataModel from '../IntersectionMap/crossDirection/utils'
|
|
72
|
+
import { getIntersectionInfo } from '../../../api/template.js'
|
|
73
|
+
import { uploadSingleTscParam } from '../../../api/param.js'
|
|
74
|
+
import CrossRoadsSvg from '../IntersectionMap/crossDirection/baseImg/CrossRoadsSvg'
|
|
75
|
+
import TShapeEastRoadsSvg from '../IntersectionMap/crossDirection/baseImg/TShapeEastRoadsSvg'
|
|
76
|
+
import TShapeWestRoadsSvg from '../IntersectionMap/crossDirection/baseImg/TShapeWestRoadsSvg.vue'
|
|
77
|
+
import TShapeNorthRoadsSvg from '../IntersectionMap/crossDirection/baseImg/TShapeNorthRoadsSvg.vue'
|
|
78
|
+
import TShapeSouthRoadsSvg from '../IntersectionMap/crossDirection/baseImg/TShapeSouthRoadsSvg.vue'
|
|
79
|
+
import CustomRoadsSvg from '../IntersectionMap/crossDirection/baseImg/CustomRoadsSvg.vue'
|
|
80
|
+
import RefreshSvg from '../IntersectionMap/crossDirection/baseImg/refreshSvg'
|
|
81
|
+
import SidewalkSvg from '../IntersectionMap/crossDirection/baseImg/SidewalkSvg'
|
|
82
|
+
import SidewalkClickSvg from '../IntersectionMap/crossDirection/baseImg/SidewalkClickSvg'
|
|
83
|
+
import RampEastRoadsSvg from '../IntersectionMap/crossDirection/baseImg/RampEastSvg'
|
|
84
|
+
import RampWestRoadsSvg from '../IntersectionMap/crossDirection/baseImg/RampWestSvg'
|
|
85
|
+
import RampNorthRoadsSvg from '../IntersectionMap/crossDirection/baseImg/RampNorthSvg'
|
|
86
|
+
import RampSouthRoadsSvg from '../IntersectionMap/crossDirection/baseImg/RampSouthSvg'
|
|
87
|
+
import RampPhaseIconSvg from '../IntersectionMap/crossDirection/phaseIcon/rampPhaseIconSvg'
|
|
88
|
+
import PedSectionEWSvg from '../IntersectionMap/crossDirection/baseImg/PedSectionEWSvg'
|
|
89
|
+
import PedSectionSNSvg from '../IntersectionMap/crossDirection/baseImg/PedSectionSNSvg'
|
|
90
|
+
// import { mapState } from 'vuex'
|
|
91
|
+
import LCrossRoadsSvg from '../IntersectionMap/crossDirection/baseImg/leftroad/LCrossRoadsSvg'
|
|
92
|
+
import LTShapeEastRoadsSvg from '../IntersectionMap/crossDirection/baseImg/leftroad/LTShapeEastRoadsSvg'
|
|
93
|
+
import LTShapeWestRoadsSvg from '../IntersectionMap/crossDirection/baseImg/leftroad/LTShapeWestRoadsSvg.vue'
|
|
94
|
+
import LTShapeNorthRoadsSvg from '../IntersectionMap/crossDirection/baseImg/leftroad/LTShapeNorthRoadsSvg.vue'
|
|
95
|
+
import LTShapeSouthRoadsSvg from '../IntersectionMap/crossDirection/baseImg/leftroad/LTShapeSouthRoadsSvg.vue'
|
|
96
|
+
import LPhaseIconSvg from '../IntersectionMap/crossDirection/phaseIcon/LphaseIconSvg'
|
|
97
|
+
import CrossDiagramMgr from '../../../EdgeMgr/controller/crossDiagramMgr.js'
|
|
98
|
+
import BusMapSvg from '../IntersectionMap/crossDirection/busIcon/busMapSvg'
|
|
99
|
+
import { getMessageByCode } from '../../../utils/responseMessage.js'
|
|
100
|
+
|
|
101
|
+
export default {
|
|
102
|
+
name: 'crossDiagram',
|
|
103
|
+
components: {
|
|
104
|
+
PhaseIconSvg,
|
|
105
|
+
CrossRoadsSvg,
|
|
106
|
+
TShapeEastRoadsSvg,
|
|
107
|
+
TShapeWestRoadsSvg,
|
|
108
|
+
TShapeNorthRoadsSvg,
|
|
109
|
+
TShapeSouthRoadsSvg,
|
|
110
|
+
CustomRoadsSvg,
|
|
111
|
+
RefreshSvg,
|
|
112
|
+
SidewalkSvg,
|
|
113
|
+
RampEastRoadsSvg,
|
|
114
|
+
RampWestRoadsSvg,
|
|
115
|
+
RampNorthRoadsSvg,
|
|
116
|
+
RampSouthRoadsSvg,
|
|
117
|
+
RampPhaseIconSvg,
|
|
118
|
+
PedSectionEWSvg,
|
|
119
|
+
PedSectionSNSvg,
|
|
120
|
+
LCrossRoadsSvg,
|
|
121
|
+
LTShapeEastRoadsSvg,
|
|
122
|
+
LTShapeWestRoadsSvg,
|
|
123
|
+
LTShapeNorthRoadsSvg,
|
|
124
|
+
LTShapeSouthRoadsSvg,
|
|
125
|
+
LPhaseIconSvg,
|
|
126
|
+
BusMapSvg,
|
|
127
|
+
SidewalkClickSvg
|
|
128
|
+
},
|
|
129
|
+
props: {
|
|
130
|
+
agentId: {
|
|
131
|
+
type: String
|
|
132
|
+
},
|
|
133
|
+
isShowMessage: {
|
|
134
|
+
type: Boolean,
|
|
135
|
+
default: true
|
|
136
|
+
},
|
|
137
|
+
choosedDirection: {
|
|
138
|
+
type: Array,
|
|
139
|
+
default: () => []
|
|
140
|
+
},
|
|
141
|
+
choosedPedDirection: {
|
|
142
|
+
type: Array,
|
|
143
|
+
default: () => []
|
|
144
|
+
},
|
|
145
|
+
clickMode: {
|
|
146
|
+
type: Boolean,
|
|
147
|
+
default: false
|
|
148
|
+
},
|
|
149
|
+
channelType: {
|
|
150
|
+
type: Boolean,
|
|
151
|
+
default: false
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
watch: {
|
|
155
|
+
tempType: {
|
|
156
|
+
handler: function (val) {
|
|
157
|
+
this.getCrossType()
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
agentId: {
|
|
161
|
+
handler: function (val1, val2) {
|
|
162
|
+
if (val1 !== val2) {
|
|
163
|
+
this.init()
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
immediate: true
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
data () {
|
|
170
|
+
return {
|
|
171
|
+
LanePhaseData: [], // 车道相位数据
|
|
172
|
+
overlapLanePhaseData: [], // 车道跟随相位数据
|
|
173
|
+
ColorMap: new Map([[0, '#828282'], [1, '#ff2828'], [2, '#f7b500'], [3, '#77fb65'], [4, '#77fb65'], [5, '#f7b500']]), // 当前相位状态 --- 0:关灯, 1:红, 2:黄, 3:绿, 4:绿闪, 5:黄闪
|
|
174
|
+
SidewalkColorMap: new Map([[0, '#828282'], [1, '#e24b4b'], [3, '#7bd66b']]),
|
|
175
|
+
tempType: '', // 模版类型
|
|
176
|
+
mainType: '101', // 路口形状
|
|
177
|
+
mainDirection: '000', // 路口方向
|
|
178
|
+
crossType: '', // 路口底图类型
|
|
179
|
+
isLoaded: false, // 是否成功加载底图
|
|
180
|
+
sidewalkPhaseData: [], // 行人相位
|
|
181
|
+
overlapsidewalkPhaseData: [], // 行人跟随相位
|
|
182
|
+
resetflag: true, // 离线后,控制行人相位、车道相位reset标识
|
|
183
|
+
compLanePhaseData: [], // 对比车道相位和车道跟随相位后,显示的数据
|
|
184
|
+
compSidewalkPhaseData: [], // // 对比行人相位和车道跟随相位后,显示的数据
|
|
185
|
+
comdirePhaseData: [], // 对比相同方向车道相位数据后,被删减的唯一direction的数组
|
|
186
|
+
comdireOverlapPhaseData: [], // 对比相同方向车道跟随相位数据后,被删减的唯一direction的数组
|
|
187
|
+
busPhaseData: [], // 公交相位数据
|
|
188
|
+
comdireBusPhaseData: [], // 对比相同方向公交车道数据后,被删减的唯一direction的数组
|
|
189
|
+
channelStatusMap: new Map(), // 通道实时状态映射
|
|
190
|
+
channelStatusList: [], // 通道实时状态列表
|
|
191
|
+
phaseDirMap: new Map(),
|
|
192
|
+
contrloType: 'ring'
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
methods: {
|
|
196
|
+
init () {
|
|
197
|
+
this.CrossDiagramMgr = new CrossDiagramMgr()
|
|
198
|
+
this.PhaseDataModel = new PhaseDataModel()
|
|
199
|
+
this.getIntersectionInfo() // 获取路口信息
|
|
200
|
+
},
|
|
201
|
+
drawDefaultPhaseIcon () {
|
|
202
|
+
this.compLanePhaseData = JSON.parse(JSON.stringify(this.CrossDiagramMgr.compare(this.LanePhaseData, this.overlapLanePhaseData, 'type', 'nostatus')))
|
|
203
|
+
this.compSidewalkPhaseData = JSON.parse(JSON.stringify(this.CrossDiagramMgr.compare(this.sidewalkPhaseData, this.overlapsidewalkPhaseData, 'pedtype', 'nostatus')))
|
|
204
|
+
this.comdireBusPhaseData = JSON.parse(JSON.stringify(this.busPhaseData))
|
|
205
|
+
console.log(this.LanePhaseData)
|
|
206
|
+
console.log(this.overlapLanePhaseData)
|
|
207
|
+
console.log('###################', this.compLanePhaseData)
|
|
208
|
+
},
|
|
209
|
+
getIntersectionInfo () {
|
|
210
|
+
// 获取路口信息
|
|
211
|
+
this.contrloType = 'ring'
|
|
212
|
+
const agentid = this.agentId
|
|
213
|
+
getIntersectionInfo(agentid).then(res => {
|
|
214
|
+
if (!res.data.success) {
|
|
215
|
+
this.isLoaded = false
|
|
216
|
+
let commomMsg = this.$t('openatccomponents.overview.signalID') + ' : ' + agentid
|
|
217
|
+
let msg = getMessageByCode(res.data.code, this.$i18n.locale)
|
|
218
|
+
if (res.data.data) {
|
|
219
|
+
// 子类型错误
|
|
220
|
+
let childErrorCode = res.data.data.errorCode
|
|
221
|
+
if (childErrorCode) {
|
|
222
|
+
let childerror = getMessageByCode(res.data.data.errorCode, this.$i18n.locale)
|
|
223
|
+
msg = msg + ' - ' + childerror
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
msg = msg + ' - ' + commomMsg
|
|
227
|
+
// this.isShowMessage && this.$message.error(msg)
|
|
228
|
+
if (this.isShowMessage) {
|
|
229
|
+
console.log(msg)
|
|
230
|
+
}
|
|
231
|
+
return
|
|
232
|
+
}
|
|
233
|
+
this.isLoaded = true
|
|
234
|
+
this.tempType = res.data.data.type
|
|
235
|
+
// 获取车道相位、行人相位信息(坐标、名称)
|
|
236
|
+
this.mainType = this.tempType.split('-')[0]
|
|
237
|
+
this.mainDirection = this.tempType.split('-')[1]
|
|
238
|
+
if (this.channelType) {
|
|
239
|
+
this.getChannelInfo()
|
|
240
|
+
return
|
|
241
|
+
}
|
|
242
|
+
this.getTempCrossInfo(res)
|
|
243
|
+
// 显示阶段的判断条件
|
|
244
|
+
this.allPatternList = res.data.data.param.patternList
|
|
245
|
+
if (this.allPatternList[0].rings === undefined || this.allPatternList[0].rings.length === 0) {
|
|
246
|
+
this.contrloType = 'stage'
|
|
247
|
+
} else if (this.allPatternList[0].contrloType === 'stage') {
|
|
248
|
+
this.contrloType = 'stage'
|
|
249
|
+
} else {
|
|
250
|
+
this.contrloType = 'ring'
|
|
251
|
+
}
|
|
252
|
+
})
|
|
253
|
+
},
|
|
254
|
+
getTempCrossInfo (res) {
|
|
255
|
+
this.crossInfo = res.data.data.param
|
|
256
|
+
this.crossInfo.phaseList.forEach(cross => this.phaseDirMap.set(cross.id, {direction: cross.direction, peddirection: cross.peddirection}))
|
|
257
|
+
if (this.mainType === '100' || this.mainType === '101' || this.mainType === '104') {
|
|
258
|
+
// 城市道路加载车道相位坐标和人行道坐标
|
|
259
|
+
this.getPhasePos()
|
|
260
|
+
this.getOverlapPhasePos()
|
|
261
|
+
this.getPedPhasePos()
|
|
262
|
+
this.getOverlapPedPhasePos()
|
|
263
|
+
}
|
|
264
|
+
this.inneChoosedDirection = [...this.choosedDirection]
|
|
265
|
+
this.inneChoosedPedDirection = [...this.choosedPedDirection]
|
|
266
|
+
this.drawDefaultPhaseIcon()
|
|
267
|
+
},
|
|
268
|
+
getBusPos () {
|
|
269
|
+
// 公交相位信息
|
|
270
|
+
this.busPhaseData = []
|
|
271
|
+
this.crossInfo.phaseList.forEach((ele, i) => {
|
|
272
|
+
if (ele.controltype >= 3 && ele.controltype <= 6) {
|
|
273
|
+
ele.direction.forEach((dir, index) => {
|
|
274
|
+
// 车道相位
|
|
275
|
+
this.busPhaseData.push({
|
|
276
|
+
key: this.CrossDiagramMgr.getUniqueKey('busphase'),
|
|
277
|
+
phaseid: ele.id, // 相位id,用于对应相位状态
|
|
278
|
+
id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
|
|
279
|
+
name: this.PhaseDataModel.getBusPhasePos(dir).name,
|
|
280
|
+
left: this.PhaseDataModel.getBusPhasePos(dir).x,
|
|
281
|
+
top: this.PhaseDataModel.getBusPhasePos(dir).y,
|
|
282
|
+
busleft: this.PhaseDataModel.getBusMapPos(dir).x,
|
|
283
|
+
bustop: this.PhaseDataModel.getBusMapPos(dir).y,
|
|
284
|
+
controltype: ele.controltype
|
|
285
|
+
})
|
|
286
|
+
})
|
|
287
|
+
}
|
|
288
|
+
})
|
|
289
|
+
// 去掉重复方向的数据
|
|
290
|
+
this.busPhaseData = Array.from(new Set(this.busPhaseData.map(item => item.id)))
|
|
291
|
+
.map(id => this.busPhaseData.find(item => item.id === id))
|
|
292
|
+
},
|
|
293
|
+
getPhasePos () {
|
|
294
|
+
// 车道相位信息
|
|
295
|
+
this.LanePhaseData = []
|
|
296
|
+
this.crossInfo.phaseList.forEach((ele, i) => {
|
|
297
|
+
if (ele.controltype === undefined || ele.controltype <= 2) {
|
|
298
|
+
ele.direction.forEach((dir, index) => {
|
|
299
|
+
// 车道相位
|
|
300
|
+
this.LanePhaseData.push({
|
|
301
|
+
key: this.CrossDiagramMgr.getUniqueKey('phase'),
|
|
302
|
+
phaseid: ele.id, // 相位id,用于对应相位状态
|
|
303
|
+
id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
|
|
304
|
+
name: this.PhaseDataModel.getPhase(dir).name,
|
|
305
|
+
left: this.PhaseDataModel.getPhase(dir).x,
|
|
306
|
+
top: this.PhaseDataModel.getPhase(dir).y
|
|
307
|
+
})
|
|
308
|
+
})
|
|
309
|
+
}
|
|
310
|
+
})
|
|
311
|
+
// 去掉重复方向的数据
|
|
312
|
+
this.LanePhaseData = Array.from(new Set(this.LanePhaseData.map(item => item.id)))
|
|
313
|
+
.map(id => this.LanePhaseData.find(item => item.id === id))
|
|
314
|
+
},
|
|
315
|
+
getOverlapPhasePos () {
|
|
316
|
+
// 车道跟随相位信息
|
|
317
|
+
if (!this.crossInfo.overlaplList) return
|
|
318
|
+
this.overlapLanePhaseData = []
|
|
319
|
+
this.crossInfo.overlaplList.forEach((ele, i) => {
|
|
320
|
+
if (ele.direction) {
|
|
321
|
+
ele.direction.forEach((dir, index) => {
|
|
322
|
+
this.overlapLanePhaseData.push({
|
|
323
|
+
key: this.CrossDiagramMgr.getUniqueKey('overlapphase'),
|
|
324
|
+
phaseid: ele.id, // 相位id,用于对应相位状态
|
|
325
|
+
id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
|
|
326
|
+
name: this.PhaseDataModel.getPhase(dir).name,
|
|
327
|
+
left: this.PhaseDataModel.getPhase(dir).x,
|
|
328
|
+
top: this.PhaseDataModel.getPhase(dir).y
|
|
329
|
+
})
|
|
330
|
+
})
|
|
331
|
+
}
|
|
332
|
+
})
|
|
333
|
+
// 去掉重复方向的数据
|
|
334
|
+
this.overlapLanePhaseData = Array.from(new Set(this.overlapLanePhaseData.map(item => item.id)))
|
|
335
|
+
.map(id => this.overlapLanePhaseData.find(item => item.id === id))
|
|
336
|
+
},
|
|
337
|
+
getRampPhasePos () {
|
|
338
|
+
// 匝道车道相位信息
|
|
339
|
+
this.LanePhaseData = []
|
|
340
|
+
this.crossInfo.phaseList.forEach((ele, i) => {
|
|
341
|
+
ele.direction.forEach((dir, index) => {
|
|
342
|
+
if (ele.controltype === 0) {
|
|
343
|
+
this.handleRampPhasePosData(`${i}-${index}`, ele, dir, this.PhaseDataModel.getMainPhasePos)
|
|
344
|
+
}
|
|
345
|
+
if (ele.controltype === 1) {
|
|
346
|
+
this.handleRampPhasePosData(`${i}-${index}`, ele, dir, this.PhaseDataModel.getSidePhasePos)
|
|
347
|
+
}
|
|
348
|
+
})
|
|
349
|
+
})
|
|
350
|
+
// 去掉重复方向的数据
|
|
351
|
+
this.LanePhaseData = Array.from(new Set(this.LanePhaseData.map(item => item.id)))
|
|
352
|
+
.map(id => this.LanePhaseData.find(item => item.id === id))
|
|
353
|
+
},
|
|
354
|
+
handleRampPhasePosData (key, phase, dir) {
|
|
355
|
+
let posInfo = phase.controltype === 0 ? this.PhaseDataModel.getMainPhasePos(dir) : this.PhaseDataModel.getSidePhasePos(dir)
|
|
356
|
+
this.LanePhaseData.push({
|
|
357
|
+
key,
|
|
358
|
+
controlType: phase.controltype,
|
|
359
|
+
phaseid: phase.id, // 相位id,用于对应相位状态
|
|
360
|
+
id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
|
|
361
|
+
name: posInfo.name,
|
|
362
|
+
left: posInfo.x,
|
|
363
|
+
top: posInfo.y
|
|
364
|
+
})
|
|
365
|
+
},
|
|
366
|
+
getPedPhasePos () {
|
|
367
|
+
// 行人相位信息
|
|
368
|
+
this.sidewalkPhaseData = []
|
|
369
|
+
this.crossInfo.phaseList.forEach((ele, i) => {
|
|
370
|
+
if (ele.peddirection) {
|
|
371
|
+
ele.peddirection.forEach((dir, index) => {
|
|
372
|
+
// 行人相位
|
|
373
|
+
if (this.PhaseDataModel.getSidePos(dir)) {
|
|
374
|
+
let key = this.CrossDiagramMgr.getUniqueKey('pedphase')
|
|
375
|
+
this.sidewalkPhaseData.push({
|
|
376
|
+
key,
|
|
377
|
+
phaseid: ele.id, // 相位id,用于对应相位状态
|
|
378
|
+
id: dir,
|
|
379
|
+
name: this.PhaseDataModel.getSidePos(dir).name,
|
|
380
|
+
left: this.PhaseDataModel.getSidePos(dir).x,
|
|
381
|
+
top: this.PhaseDataModel.getSidePos(dir).y
|
|
382
|
+
})
|
|
383
|
+
}
|
|
384
|
+
})
|
|
385
|
+
}
|
|
386
|
+
})
|
|
387
|
+
// 去掉重复方向的数据
|
|
388
|
+
this.sidewalkPhaseData = Array.from(new Set(this.sidewalkPhaseData.map(item => item.id)))
|
|
389
|
+
.map(id => this.sidewalkPhaseData.find(item => item.id === id))
|
|
390
|
+
},
|
|
391
|
+
getOverlapPedPhasePos () {
|
|
392
|
+
// 行人跟随相位信息
|
|
393
|
+
if (!this.crossInfo.overlaplList) return
|
|
394
|
+
this.overlapsidewalkPhaseData = []
|
|
395
|
+
this.crossInfo.overlaplList.forEach((ele, i) => {
|
|
396
|
+
if (ele.peddirection) {
|
|
397
|
+
ele.peddirection.forEach((dir, index) => {
|
|
398
|
+
if (this.PhaseDataModel.getSidePos(dir)) {
|
|
399
|
+
this.overlapsidewalkPhaseData.push({
|
|
400
|
+
key: this.CrossDiagramMgr.getUniqueKey('overlappedphase'),
|
|
401
|
+
phaseid: ele.id, // 相位id,用于对应相位状态
|
|
402
|
+
id: dir,
|
|
403
|
+
name: this.PhaseDataModel.getSidePos(dir).name,
|
|
404
|
+
left: this.PhaseDataModel.getSidePos(dir).x,
|
|
405
|
+
top: this.PhaseDataModel.getSidePos(dir).y
|
|
406
|
+
})
|
|
407
|
+
}
|
|
408
|
+
})
|
|
409
|
+
}
|
|
410
|
+
})
|
|
411
|
+
// 去掉重复方向的数据
|
|
412
|
+
this.overlapsidewalkPhaseData = Array.from(new Set(this.overlapsidewalkPhaseData.map(item => item.id)))
|
|
413
|
+
.map(id => this.overlapsidewalkPhaseData.find(item => item.id === id))
|
|
414
|
+
},
|
|
415
|
+
getCrossType () {
|
|
416
|
+
// 路口类型对应底图决策
|
|
417
|
+
if (this.mainType === '101') {
|
|
418
|
+
// 十字路口
|
|
419
|
+
this.crossType = 'Crossroads'
|
|
420
|
+
}
|
|
421
|
+
if (this.mainType === '100') {
|
|
422
|
+
// T型路口
|
|
423
|
+
switch (this.mainDirection) {
|
|
424
|
+
case '001': this.crossType = 'TypeT-east'
|
|
425
|
+
break
|
|
426
|
+
case '002': this.crossType = 'TypeT-south'
|
|
427
|
+
break
|
|
428
|
+
case '003': this.crossType = 'TypeT-west'
|
|
429
|
+
break
|
|
430
|
+
case '004': this.crossType = 'TypeT-north'
|
|
431
|
+
break
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
if (this.mainType === '103') {
|
|
435
|
+
// 匝道
|
|
436
|
+
switch (this.mainDirection) {
|
|
437
|
+
case '001': this.crossType = 'ramp-east'
|
|
438
|
+
break
|
|
439
|
+
case '002': this.crossType = 'ramp-south'
|
|
440
|
+
break
|
|
441
|
+
case '003': this.crossType = 'ramp-west'
|
|
442
|
+
break
|
|
443
|
+
case '004': this.crossType = 'ramp-north'
|
|
444
|
+
break
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
if (this.mainType === '104') {
|
|
448
|
+
// 路段行人过街
|
|
449
|
+
switch (this.mainDirection) {
|
|
450
|
+
case '005': this.crossType = 'ped-section-east-west'
|
|
451
|
+
break
|
|
452
|
+
case '006': this.crossType = 'ped-section-south-north'
|
|
453
|
+
break
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (this.mainType === '999') {
|
|
457
|
+
// 其他路口
|
|
458
|
+
this.crossType = 'Customroads'
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
refresh () {
|
|
462
|
+
this.getIntersectionInfo()
|
|
463
|
+
},
|
|
464
|
+
getChannelInfo () {
|
|
465
|
+
uploadSingleTscParam('channel', this.agentId).then(data => {
|
|
466
|
+
let res = data.data
|
|
467
|
+
if (!res.success) {
|
|
468
|
+
if (res.code === '4003') {
|
|
469
|
+
// this.isShowMessage && this.$message.error(this.$t('openatccomponents.errorTip.devicenotonline'))
|
|
470
|
+
if (this.isShowMessage) {
|
|
471
|
+
console.log(this.$t('openatccomponents.errorTip.devicenotonline'))
|
|
472
|
+
}
|
|
473
|
+
return
|
|
474
|
+
}
|
|
475
|
+
// this.isShowMessage && this.$message.error(getMessageByCode(data.data.code, this.$i18n.locale))
|
|
476
|
+
if (this.isShowMessage) {
|
|
477
|
+
console.log(getMessageByCode(data.data.code, this.$i18n.locale))
|
|
478
|
+
}
|
|
479
|
+
return
|
|
480
|
+
}
|
|
481
|
+
let channelList = res.data.data.channelList.filter(ele => ele.type !== undefined)
|
|
482
|
+
this.channelList = this.handleRepeatRealdir(channelList)
|
|
483
|
+
console.log('this.channelList', this.channelList)
|
|
484
|
+
this.handleChannelDirection()
|
|
485
|
+
})
|
|
486
|
+
},
|
|
487
|
+
handleRepeatRealdir (channelList) {
|
|
488
|
+
// 按realdir去掉重复方向的数据
|
|
489
|
+
let dirChannelList = channelList.filter(ele => ele.realdir !== undefined && (ele.type === 0 || ele.type === 1 || ele.type === 3))
|
|
490
|
+
let pedDirChannelList = channelList.filter(ele => ele.realdir !== undefined && ele.type === 2)
|
|
491
|
+
let map = new Map()
|
|
492
|
+
let map2 = new Map()
|
|
493
|
+
dirChannelList.forEach(ele => {
|
|
494
|
+
ele.realdir.forEach(dir => {
|
|
495
|
+
if (map.get(dir) === undefined) {
|
|
496
|
+
map.set(dir, ele)
|
|
497
|
+
}
|
|
498
|
+
})
|
|
499
|
+
})
|
|
500
|
+
pedDirChannelList.forEach(ele => {
|
|
501
|
+
ele.realdir.forEach(dir => {
|
|
502
|
+
if (map2.get(dir) === undefined) {
|
|
503
|
+
map2.set(dir, ele)
|
|
504
|
+
}
|
|
505
|
+
})
|
|
506
|
+
})
|
|
507
|
+
let arr = Array.from(map)
|
|
508
|
+
let pedarr = Array.from(map2)
|
|
509
|
+
let newarr = []
|
|
510
|
+
arr.forEach(ele => {
|
|
511
|
+
ele[1].realdir = [ele[0]]
|
|
512
|
+
let obj = {
|
|
513
|
+
...ele[1],
|
|
514
|
+
realdir: [ele[0]]
|
|
515
|
+
}
|
|
516
|
+
newarr.push(obj)
|
|
517
|
+
})
|
|
518
|
+
pedarr.forEach(ele => {
|
|
519
|
+
ele[1].realdir = [ele[0]]
|
|
520
|
+
let obj = {
|
|
521
|
+
...ele[1],
|
|
522
|
+
realdir: [ele[0]]
|
|
523
|
+
}
|
|
524
|
+
newarr.push(obj)
|
|
525
|
+
})
|
|
526
|
+
// console.log(newarr)
|
|
527
|
+
return newarr
|
|
528
|
+
},
|
|
529
|
+
handleChannelDirection () {
|
|
530
|
+
this.LanePhaseData = []
|
|
531
|
+
this.sidewalkPhaseData = []
|
|
532
|
+
this.sidewalkDir = []
|
|
533
|
+
let realphasedirarr = []
|
|
534
|
+
let realpeddirarr = []
|
|
535
|
+
this.channelList.forEach((ele, i) => {
|
|
536
|
+
if (ele.type === 0 || ele.type === 1 || ele.type === 3) {
|
|
537
|
+
if (ele.realdir) {
|
|
538
|
+
ele.realdir.forEach((dir, index) => {
|
|
539
|
+
// 车道相位(通道类型是机动车,非机动车,公交时,对应相位机动车)
|
|
540
|
+
this.LanePhaseData.push({
|
|
541
|
+
key: this.CrossDiagramMgr.getUniqueKey('phase'),
|
|
542
|
+
channelid: ele.id, // 通道id
|
|
543
|
+
id: dir, // 接口返回的dir字段,对应前端定义的相位方向id,唯一标识
|
|
544
|
+
name: this.PhaseDataModel.getPhase(dir).name,
|
|
545
|
+
left: this.PhaseDataModel.getPhase(dir).x,
|
|
546
|
+
top: this.PhaseDataModel.getPhase(dir).y
|
|
547
|
+
})
|
|
548
|
+
})
|
|
549
|
+
realphasedirarr = Array.from(new Set(realphasedirarr.concat(ele.realdir)))
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
if (ele.type === 2) {
|
|
553
|
+
if (ele.realdir) {
|
|
554
|
+
ele.realdir.forEach((dir, index) => {
|
|
555
|
+
// 行人相位
|
|
556
|
+
if (this.sidewalkDir.indexOf(dir) === -1 && this.PhaseDataModel.getSidePos(dir)) {
|
|
557
|
+
let obj = {
|
|
558
|
+
key: this.CrossDiagramMgr.getUniqueKey('pedphase') + `-${this.agentId}`,
|
|
559
|
+
channelid: ele.id, // 通道id
|
|
560
|
+
id: dir,
|
|
561
|
+
name: this.PhaseDataModel.getSidePos(dir).name
|
|
562
|
+
}
|
|
563
|
+
if (this.channelType) {
|
|
564
|
+
obj.left = this.PhaseDataModel.getSidePos(dir).x
|
|
565
|
+
obj.top = this.PhaseDataModel.getSidePos(dir).y
|
|
566
|
+
}
|
|
567
|
+
this.sidewalkPhaseData.push(obj)
|
|
568
|
+
}
|
|
569
|
+
})
|
|
570
|
+
realpeddirarr = Array.from(new Set(realpeddirarr.concat(ele.realdir)))
|
|
571
|
+
this.sidewalkDir = Array.from(new Set([...this.sidewalkDir.concat(ele.realdir)]))
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
})
|
|
575
|
+
this.inneChoosedDirection = this.choosedDirection.filter(dir => realphasedirarr.indexOf(dir) !== -1)
|
|
576
|
+
this.inneChoosedPedDirection = this.choosedPedDirection.filter(dir => realpeddirarr.indexOf(dir) !== -1)
|
|
577
|
+
this.drawPhaseIcon()
|
|
578
|
+
},
|
|
579
|
+
async drawPhaseIcon () {
|
|
580
|
+
const targetIds = [4, 8, 12, 16] // 掉头相位后画
|
|
581
|
+
this.LanePhaseData = this.LanePhaseData.filter(item => !targetIds.includes(item.id)).concat(this.LanePhaseData.filter(item => targetIds.includes(item.id)))
|
|
582
|
+
this.handleClickedPhase()
|
|
583
|
+
this.compLanePhaseData = JSON.parse(JSON.stringify(this.LanePhaseData))
|
|
584
|
+
this.handleClickedPedPhase()
|
|
585
|
+
this.compSidewalkPhaseData = JSON.parse(JSON.stringify(this.sidewalkPhaseData))
|
|
586
|
+
},
|
|
587
|
+
handleClickedPhase () {
|
|
588
|
+
for (let index = 0; index < this.LanePhaseData.length; index++) {
|
|
589
|
+
const element = this.LanePhaseData[index]
|
|
590
|
+
if (!this.inneChoosedDirection) return
|
|
591
|
+
if (this.inneChoosedDirection.indexOf(element.id) !== -1) {
|
|
592
|
+
element.clicked = true
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
},
|
|
596
|
+
|
|
597
|
+
handleClickPhaseIcon (key, action) {
|
|
598
|
+
let curClickedPhase = {}
|
|
599
|
+
if (action === 'clicked') {
|
|
600
|
+
for (let index = 0; index < this.LanePhaseData.length; index++) {
|
|
601
|
+
const element = this.LanePhaseData[index]
|
|
602
|
+
if (element.key === key) {
|
|
603
|
+
element.clicked = true
|
|
604
|
+
curClickedPhase = JSON.parse(JSON.stringify(element))
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
if (action === 'cancle') {
|
|
609
|
+
for (let index = 0; index < this.LanePhaseData.length; index++) {
|
|
610
|
+
const element = this.LanePhaseData[index]
|
|
611
|
+
if (element.key === key) {
|
|
612
|
+
delete element.clicked
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
this.compLanePhaseData = JSON.parse(JSON.stringify(this.LanePhaseData))
|
|
617
|
+
let clickedDirection = this.compLanePhaseData.filter(ele => ele.clicked && !ele.disabled)
|
|
618
|
+
this.inneChoosedDirection = clickedDirection.map(ele => ele.id)
|
|
619
|
+
this.EmitAllChoosedDirection(curClickedPhase)
|
|
620
|
+
},
|
|
621
|
+
handleClickedPedPhase () {
|
|
622
|
+
// 排他
|
|
623
|
+
for (let index = 0; index < this.sidewalkPhaseData.length; index++) {
|
|
624
|
+
const element = this.sidewalkPhaseData[index]
|
|
625
|
+
delete element.clicked
|
|
626
|
+
}
|
|
627
|
+
for (let index = 0; index < this.sidewalkPhaseData.length; index++) {
|
|
628
|
+
const element = this.sidewalkPhaseData[index]
|
|
629
|
+
if (!this.inneChoosedPedDirection) return
|
|
630
|
+
if (this.inneChoosedPedDirection.indexOf(element.id) !== -1) {
|
|
631
|
+
element.clicked = true
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
},
|
|
635
|
+
handleClickSidewalkIcon (data, curChoosePed) {
|
|
636
|
+
this.clickedPedDirection = data.filter(ele => ele.clicked && !ele.disabled)
|
|
637
|
+
this.inneChoosedPedDirection = this.clickedPedDirection.map(ele => ele.id)
|
|
638
|
+
this.EmitAllChoosedDirection(curChoosePed)
|
|
639
|
+
},
|
|
640
|
+
EmitAllChoosedDirection (curClickedPhase) {
|
|
641
|
+
let allChoosedDir = {
|
|
642
|
+
direction: this.inneChoosedDirection,
|
|
643
|
+
peddirection: this.inneChoosedPedDirection
|
|
644
|
+
}
|
|
645
|
+
this.$emit('handleClickCrossIcon', allChoosedDir, curClickedPhase)
|
|
646
|
+
this.drawPhaseIcon()
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
mounted () {
|
|
650
|
+
// this.init()
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
</script>
|
|
654
|
+
<style scoped>
|
|
655
|
+
.invisible {
|
|
656
|
+
visibility: hidden;
|
|
657
|
+
}
|
|
658
|
+
.crossImg{
|
|
659
|
+
position: relative;
|
|
660
|
+
width: 870px;
|
|
661
|
+
height: 650px;
|
|
662
|
+
left: 50%;
|
|
663
|
+
transform: translateX(-50%);
|
|
664
|
+
}
|
|
665
|
+
.centerText {
|
|
666
|
+
position: absolute;
|
|
667
|
+
width: 140px;
|
|
668
|
+
height: 140px;
|
|
669
|
+
left: 50%;
|
|
670
|
+
top: 50%;
|
|
671
|
+
transform: translateX(-50%) translateY(-50%);
|
|
672
|
+
/* text-align: center; */
|
|
673
|
+
z-index: 9;
|
|
674
|
+
display: flex;
|
|
675
|
+
align-items: center;
|
|
676
|
+
/* padding-left: 16px; */
|
|
677
|
+
}
|
|
678
|
+
.phaseCountdown {
|
|
679
|
+
line-height: 42PX;
|
|
680
|
+
font-size: 18px;
|
|
681
|
+
font-weight: normal;
|
|
682
|
+
font-stretch: normal;
|
|
683
|
+
letter-spacing: 0px;
|
|
684
|
+
color: #fff;
|
|
685
|
+
width: 150px;
|
|
686
|
+
margin: 0 auto;
|
|
687
|
+
}
|
|
688
|
+
.countdownBg {
|
|
689
|
+
border-radius: 10PX;
|
|
690
|
+
background-color: rgba(94, 90, 90, 0.8);
|
|
691
|
+
padding-left: 14PX;
|
|
692
|
+
padding-top: 10PX;
|
|
693
|
+
padding-bottom: 10PX;
|
|
694
|
+
}
|
|
695
|
+
.centerText .text {
|
|
696
|
+
display: inline-block;
|
|
697
|
+
color: #299BCC;
|
|
698
|
+
margin-top: 20PX;
|
|
699
|
+
}
|
|
700
|
+
.merge-direction-icon {
|
|
701
|
+
width: 80PX;
|
|
702
|
+
height: 80PX;
|
|
703
|
+
margin: 0 auto;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
.baseImg {
|
|
707
|
+
width: 100%;
|
|
708
|
+
height: 650px;
|
|
709
|
+
position: relative;
|
|
710
|
+
}
|
|
711
|
+
</style>
|