openatc-components 0.0.102 → 0.0.103
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/BoardCard/BoardCard.vue +6 -1
- package/package/kisscomps/components/Channelization/Channelization.vue +13 -10
- package/package/kisscomps/components/DrawChannelization/drawsvg/channelizationElements.vue +18 -12
- package/package/kisscomps/components/DrawChannelization/drawsvg/drawElement/crossMap.vue +54 -69
- package/package/kisscomps/components/DrawChannelization/drawsvg/firstImportCrossmap.vue +1 -4
- package/package/kisscomps/components/DrawChannelization/drawsvg/iconSvg/countdownSvg.vue +11 -34
- package/package/kisscomps/components/DrawChannelization/drawsvg/iconSvg/detectorChart.vue +1 -26
- package/package/kisscomps/components/DrawChannelization/drawsvg/iconSvg/detectorIconSvg.vue +18 -37
- package/package/kisscomps/components/DrawChannelization/drawsvg/iconSvg/laneIcon.vue +6 -0
- package/package/kisscomps/components/DrawChannelization/drawsvg/iconSvg/motorwayIconSvg.vue +28 -50
- package/package/kisscomps/components/DrawChannelization/drawsvg/iconSvg/pedroadIconSvg.vue +29 -53
- package/package/kisscomps/components/DrawChannelization/drawsvg/importDialog.vue +1 -4
- package/package/kisscomps/components/DrawChannelization/drawsvg/index.draw.vue +147 -130
- package/package/kisscomps/components/DrawChannelization/drawsvg/index.vue +5 -6
- package/package/kisscomps/components/DrawChannelization/drawsvg/laneEditPanel.vue +43 -144
- package/package/kisscomps/components/DrawChannelization/drawsvg/utils/loadutils.js +8 -52
- package/package/kisscomps/components/KanBan/kanban.vue +7 -7
- package/package/kisscomps/components/PatternStatus/PatternStatus.vue +153 -38
- package/package/kisscomps/components/SchemeConfig/SchemeConfig.vue +16 -0
- package/package/kisscomps/components/SchemeConfig/priorityControl/index.vue +190 -0
- package/package/kisscomps/components/SchemeConfig/priorityControl/utils.js +163 -0
- package/package/kisscomps/components/StageStatus/StageStatus.vue +6 -2
- package/package/kisscomps/components/patternList/patternList.vue +5 -0
- package/package/kisscomps/index.js +2 -0
- package/package/kissui.min.js +1 -1
- package/package.json +13 -12
- package/src/i18n/language/en.js +32 -7
- package/src/i18n/language/zh.js +31 -6
- package/src/kisscomps/components/BoardCard/BoardCard.vue +6 -1
- package/src/kisscomps/components/Channelization/Channelization.vue +13 -10
- package/src/kisscomps/components/DrawChannelization/drawsvg/channelizationElements.vue +18 -12
- package/src/kisscomps/components/DrawChannelization/drawsvg/drawElement/crossMap.vue +54 -69
- package/src/kisscomps/components/DrawChannelization/drawsvg/firstImportCrossmap.vue +1 -4
- package/src/kisscomps/components/DrawChannelization/drawsvg/iconSvg/countdownSvg.vue +11 -34
- package/src/kisscomps/components/DrawChannelization/drawsvg/iconSvg/detectorChart.vue +1 -26
- package/src/kisscomps/components/DrawChannelization/drawsvg/iconSvg/detectorIconSvg.vue +18 -37
- package/src/kisscomps/components/DrawChannelization/drawsvg/iconSvg/laneIcon.vue +6 -0
- package/src/kisscomps/components/DrawChannelization/drawsvg/iconSvg/motorwayIconSvg.vue +28 -50
- package/src/kisscomps/components/DrawChannelization/drawsvg/iconSvg/pedroadIconSvg.vue +29 -53
- package/src/kisscomps/components/DrawChannelization/drawsvg/importDialog.vue +1 -4
- package/src/kisscomps/components/DrawChannelization/drawsvg/index.draw.vue +147 -130
- package/src/kisscomps/components/DrawChannelization/drawsvg/index.vue +5 -6
- package/src/kisscomps/components/DrawChannelization/drawsvg/laneEditPanel.vue +43 -144
- package/src/kisscomps/components/DrawChannelization/drawsvg/phaseAssociatedComponent.check.vue +191 -0
- package/src/kisscomps/components/DrawChannelization/drawsvg/phaseAssociatedComponent.syncOper.vue +331 -0
- package/src/kisscomps/components/DrawChannelization/drawsvg/utils/loadutils.js +8 -52
- package/src/kisscomps/components/KanBan/kanban.vue +7 -7
- package/src/kisscomps/components/PatternStatus/PatternStatus.vue +153 -38
- package/src/kisscomps/components/SchemeConfig/SchemeConfig.vue +16 -0
- package/src/kisscomps/components/SchemeConfig/priorityControl/index.vue +190 -0
- package/src/kisscomps/components/SchemeConfig/priorityControl/utils.js +163 -0
- package/src/kisscomps/components/StageStatus/StageStatus.vue +6 -2
- package/src/kisscomps/components/patternList/patternList.vue +5 -0
- package/src/kisscomps/index.js +2 -0
- package/src/router/index.js +2 -2
- package/src/views/intersection.vue +5 -3
- package/static/styles/channelizatioon.scss +2 -40
- package/static/styles/schemeconfig.scss +52 -0
- package/package/kisscomps/components/DrawChannelization/drawsvg/basicCoordInfo.vue +0 -113
- package/src/kisscomps/components/DrawChannelization/drawsvg/basicCoordInfo.vue +0 -113
package/src/kisscomps/components/DrawChannelization/drawsvg/phaseAssociatedComponent.syncOper.vue
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
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="phase-associated-component">
|
|
14
|
+
<div class="phase-box" v-for="(item, index) in phaseList" :key="index">
|
|
15
|
+
<div class="single-phase" @click="selectPhase(index, item)" :class="preselectPhase == item.id ? 'single-phase-select' : ''">
|
|
16
|
+
<!-- <div class="ped-icon">
|
|
17
|
+
<div v-for="(side, index) in item.peddirection" :key="'peddir-' + index">
|
|
18
|
+
<PatternWalkSvg :Data="getshowped(side)" Width="42" Height="44" />
|
|
19
|
+
</div>
|
|
20
|
+
</div> -->
|
|
21
|
+
|
|
22
|
+
<div class="phase-icon" v-if="item.direction">
|
|
23
|
+
<xdr-dir-selector Width="44px" Height="44px" :showlist="getShowlist(item.direction)" :roadDirection="roadDirection"></xdr-dir-selector>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="delete-phase-icon" @click="handleDeletePhase(index, item)">
|
|
26
|
+
<i class="el-icon-close"></i>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="single-phase-name">{{$t('openatccomponents.channelizationmap.phase') + item.id}}</div>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="phase-box">
|
|
32
|
+
<div class="single-phase add-phase" @click="handleAddPhase()">
|
|
33
|
+
<i class="iconfont icon-fangda" :class="{'add-disabled': !isCanAdd}"></i>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
<script>
|
|
39
|
+
import { mapState } from 'vuex'
|
|
40
|
+
import PhaseDataModel from '../../IntersectionMap/crossDirection/utils.js'
|
|
41
|
+
// import PatternWalkSvg from 'openatc-components/package/kisscomps/components/PatternWalkSvg'
|
|
42
|
+
export default {
|
|
43
|
+
name: 'phase-associated-component',
|
|
44
|
+
data () {
|
|
45
|
+
return {
|
|
46
|
+
preselectPhase: -1,
|
|
47
|
+
id: 1,
|
|
48
|
+
isCanAdd: true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
components: {
|
|
52
|
+
// PatternWalkSvg
|
|
53
|
+
},
|
|
54
|
+
props: {
|
|
55
|
+
editData: {
|
|
56
|
+
type: Object
|
|
57
|
+
},
|
|
58
|
+
phaseAssociatedMap: {
|
|
59
|
+
type: Map
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
computed: {
|
|
63
|
+
...mapState({
|
|
64
|
+
phaseList: state => state.globalParam.tscParam.phaseList,
|
|
65
|
+
roadDirection: state => state.globalParam.roadDirection
|
|
66
|
+
})
|
|
67
|
+
},
|
|
68
|
+
watch: {
|
|
69
|
+
phaseList: {
|
|
70
|
+
handler: function (list) {
|
|
71
|
+
if (list.length >= 40) {
|
|
72
|
+
this.isCanAdd = false
|
|
73
|
+
} else {
|
|
74
|
+
this.isCanAdd = true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
deep: true
|
|
78
|
+
},
|
|
79
|
+
editData: {
|
|
80
|
+
handler: function (editobj) {
|
|
81
|
+
// console.log('editobj', editobj)
|
|
82
|
+
if (editobj.phaseid !== undefined) {
|
|
83
|
+
this.preselectPhase = editobj.phaseid
|
|
84
|
+
} else {
|
|
85
|
+
this.preselectPhase = -1
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
deep: true
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
methods: {
|
|
92
|
+
selectPhase (index, item) {
|
|
93
|
+
let direction = this.editDirPosToPhaseDireaciton(this.editData.icondireid, this.editData.lanePosition)
|
|
94
|
+
// 校验同方位车道不能关联不同相位
|
|
95
|
+
if (this.checkSameDirectionPhase(item.id, direction) === false) return
|
|
96
|
+
// 关联相位
|
|
97
|
+
this.preselectPhase = item.id
|
|
98
|
+
// 组合现有和之前的相位 direction,并去重
|
|
99
|
+
item.direction = Array.from(new Set([...item.direction, ...direction]))
|
|
100
|
+
this.$emit('selectPhase', this.preselectPhase, direction)
|
|
101
|
+
},
|
|
102
|
+
changeDirection (choosedicon) {
|
|
103
|
+
for (let i = 0; i < this.phaseList.length; i++) {
|
|
104
|
+
if (this.phaseList[i].id === choosedicon.phaseid) {
|
|
105
|
+
let direction = this.editDirPosToPhaseDireaciton(choosedicon.icondireid, choosedicon.lanePosition)
|
|
106
|
+
// 校验同方位车道不能关联不同相位
|
|
107
|
+
if (this.checkSameDirectionPhase(choosedicon.phaseid, direction) === false) return
|
|
108
|
+
// 组合现有和之前的相位 direction,并去重
|
|
109
|
+
this.phaseList[i].direction = Array.from(new Set([...this.phaseList[i].direction, ...direction]))
|
|
110
|
+
this.$emit('selectPhase', this.preselectPhase, direction)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
editDirPosToPhaseDireaciton (laneDirArr, lanePos) {
|
|
115
|
+
// 编辑的车道转向和方位,转化成相位的direction
|
|
116
|
+
let phaseDireacitonArr = laneDirArr.map(lanedir => {
|
|
117
|
+
if (lanePos === 1) {
|
|
118
|
+
// 东
|
|
119
|
+
return lanedir
|
|
120
|
+
}
|
|
121
|
+
if (lanePos === 2) {
|
|
122
|
+
// 西
|
|
123
|
+
return 4 * 1 + lanedir
|
|
124
|
+
}
|
|
125
|
+
if (lanePos === 3) {
|
|
126
|
+
// 南
|
|
127
|
+
return 4 * 3 + lanedir
|
|
128
|
+
}
|
|
129
|
+
if (lanePos === 4) {
|
|
130
|
+
// 北
|
|
131
|
+
return 4 * 2 + lanedir
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
return phaseDireacitonArr
|
|
135
|
+
},
|
|
136
|
+
getShowlist (direction) {
|
|
137
|
+
return direction.map(dir => {
|
|
138
|
+
return {
|
|
139
|
+
id: dir,
|
|
140
|
+
color: '#606266'
|
|
141
|
+
}
|
|
142
|
+
})
|
|
143
|
+
},
|
|
144
|
+
getshowped (peddirection) {
|
|
145
|
+
return {
|
|
146
|
+
id: peddirection,
|
|
147
|
+
name: this.PhaseDataModel.getSidePos(peddirection).name
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
handleDeletePhase (index, row) {
|
|
151
|
+
this.$confirm(this.$t('openatccomponents.phase.deletetip'),
|
|
152
|
+
this.$t('openatccomponents.common.alarm'), {
|
|
153
|
+
confirmButtonText: this.$t('openatccomponents.common.confirm'),
|
|
154
|
+
cancelButtonText: this.$t('openatccomponents.common.cancel'),
|
|
155
|
+
type: 'warning'
|
|
156
|
+
}).then(() => {
|
|
157
|
+
this.globalParamModel.deleteParamsByType('phaseList', index, 1)
|
|
158
|
+
this.deleteRing(row)
|
|
159
|
+
this.$message({
|
|
160
|
+
type: 'success',
|
|
161
|
+
message: this.$t('openatccomponents.common.deletesucess')
|
|
162
|
+
})
|
|
163
|
+
// 删除关联此行的并发相位
|
|
164
|
+
this.handleDeleteConcurrent(row.id, [], row.concurrent)
|
|
165
|
+
// 删除关联此相位的所有车道相位id
|
|
166
|
+
this.handleDisassociatePhase(row.id)
|
|
167
|
+
}).catch(() => {
|
|
168
|
+
this.$message({
|
|
169
|
+
type: 'info',
|
|
170
|
+
message: this.$t('openatccomponents.common.deletecancel')
|
|
171
|
+
})
|
|
172
|
+
})
|
|
173
|
+
},
|
|
174
|
+
handleDisassociatePhase (deletePhaseid) {
|
|
175
|
+
// 删除相位后,解除相位关联
|
|
176
|
+
this.$emit('handleDisassociatePhase', deletePhaseid)
|
|
177
|
+
},
|
|
178
|
+
handleAddPhase () {
|
|
179
|
+
this.increaseId()
|
|
180
|
+
if (this.globalParamModel.getParamLength('phaseList') >= 40) {
|
|
181
|
+
this.$message.error(
|
|
182
|
+
this.$t('openatccomponents.phase.mostdata')
|
|
183
|
+
)
|
|
184
|
+
return
|
|
185
|
+
}
|
|
186
|
+
var phaseInitData = {
|
|
187
|
+
id: this.id,
|
|
188
|
+
direction: [],
|
|
189
|
+
peddirection: [], // 行人方向
|
|
190
|
+
mingreen: 0,
|
|
191
|
+
max1: 120,
|
|
192
|
+
max2: 180,
|
|
193
|
+
passage: 3,
|
|
194
|
+
phasewalk: 0,
|
|
195
|
+
pedclear: 0,
|
|
196
|
+
yellow: 3,
|
|
197
|
+
redclear: 2,
|
|
198
|
+
flashgreen: 0,
|
|
199
|
+
redyellow: 0,
|
|
200
|
+
ring: 1,
|
|
201
|
+
greenpulse: 5,
|
|
202
|
+
redpulse: 10,
|
|
203
|
+
vehiclethresh: 30,
|
|
204
|
+
pedestrianthresh: 30,
|
|
205
|
+
controltype: 0, // 控制类型
|
|
206
|
+
concurrent: []
|
|
207
|
+
}
|
|
208
|
+
this.globalParamModel.addParamsByType('phaseList', phaseInitData)
|
|
209
|
+
// this.id++
|
|
210
|
+
this.editRing(phaseInitData)
|
|
211
|
+
// 重新排序相位数组
|
|
212
|
+
let phaseList = this.globalParamModel.getParamsByType('phaseList')
|
|
213
|
+
phaseList.sort(this.compareProperty('id'))
|
|
214
|
+
},
|
|
215
|
+
compareProperty (property) {
|
|
216
|
+
return function (a, b) {
|
|
217
|
+
var value1 = a[property]
|
|
218
|
+
var value2 = b[property]
|
|
219
|
+
return value1 - value2
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
increaseId () { // 实现id在之前的基础上寻找最小的
|
|
223
|
+
let phaseList = this.globalParamModel.getParamsByType('phaseList')
|
|
224
|
+
let phaseIdList = phaseList.map(ele => ele.id)
|
|
225
|
+
let i = phaseList.length - 1
|
|
226
|
+
if (i >= 0) {
|
|
227
|
+
for (let j = 1; j <= 40; j++) {
|
|
228
|
+
if (!phaseIdList.includes(j)) {
|
|
229
|
+
this.id = j
|
|
230
|
+
return
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
deleteRing (row) {
|
|
236
|
+
let patternList = this.globalParamModel.getParamsByType('patternList')
|
|
237
|
+
let id = row.id
|
|
238
|
+
let ring = row.ring - 1
|
|
239
|
+
for (let pattern of patternList) {
|
|
240
|
+
for (let i = 0; i < pattern.rings[ring].length; i++) {
|
|
241
|
+
if (pattern.rings[ring][i].id === id) {
|
|
242
|
+
pattern.rings[ring].splice(i, 1)
|
|
243
|
+
pattern.cycle = pattern.cycle - 30
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
editRing (value) {
|
|
249
|
+
let patternList = this.globalParamModel.getParamsByType('patternList')
|
|
250
|
+
let id = value.id
|
|
251
|
+
for (let pattern of patternList) {
|
|
252
|
+
let ring = {}
|
|
253
|
+
ring.name = 'Phase ' + id
|
|
254
|
+
ring.id = id
|
|
255
|
+
ring.value = 30
|
|
256
|
+
pattern.rings[0].push(ring)
|
|
257
|
+
pattern.cycle = pattern.cycle + 30
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
handleDeleteConcurrent (curid, curVal, oldVal) {
|
|
261
|
+
// 删除关联的并发相位
|
|
262
|
+
let phaseList = this.globalParamModel.getParamsByType('phaseList')
|
|
263
|
+
for (let i = 0; i < oldVal.length; i++) {
|
|
264
|
+
if (curVal.indexOf(oldVal[i]) === -1) {
|
|
265
|
+
// 此项已被删除
|
|
266
|
+
for (let j = 0; j < phaseList.length; j++) {
|
|
267
|
+
if (phaseList[j].id === oldVal[i]) {
|
|
268
|
+
let index = phaseList[j].concurrent.indexOf(curid)
|
|
269
|
+
if (index !== -1) {
|
|
270
|
+
phaseList[j].concurrent.splice(index, 1)
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
checkSameDirectionPhase (curphaseid, curdirection) {
|
|
278
|
+
// 校验同方向车道关联相位
|
|
279
|
+
// console.log('phaseAssociatedMap', this.phaseAssociatedMap)
|
|
280
|
+
let checkSame = true
|
|
281
|
+
for (let [key, value] of this.phaseAssociatedMap) {
|
|
282
|
+
if (curphaseid !== key) {
|
|
283
|
+
for (let i = 0; i < value.length; i++) {
|
|
284
|
+
if (value[i].index === this.editData.index) continue
|
|
285
|
+
if (!value[i].direction || !value[i].direction.length) continue
|
|
286
|
+
for (let j = 0; j < curdirection.length; j++) {
|
|
287
|
+
if (value[i].direction.indexOf(curdirection[j]) !== -1) {
|
|
288
|
+
checkSame = false
|
|
289
|
+
this.$message.error(this.$t('openatccomponents.channelizationmap.associatedphaseerror'))
|
|
290
|
+
break
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return checkSame
|
|
297
|
+
},
|
|
298
|
+
getPedPhasePos () {
|
|
299
|
+
// 行人相位信息
|
|
300
|
+
this.sidewalkPhaseData = []
|
|
301
|
+
this.phaseList.forEach((ele, i) => {
|
|
302
|
+
if (ele.peddirection) {
|
|
303
|
+
ele.peddirection.forEach((dir, index) => {
|
|
304
|
+
// 行人相位
|
|
305
|
+
if (this.PhaseDataModel.getSidePos(dir)) {
|
|
306
|
+
this.sidewalkPhaseData.push({
|
|
307
|
+
key: this.CrossDiagramMgr.getUniqueKey('pedphase'),
|
|
308
|
+
phaseid: ele.id, // 相位id,用于对应相位状态
|
|
309
|
+
id: dir,
|
|
310
|
+
name: this.PhaseDataModel.getSidePos(dir).name
|
|
311
|
+
})
|
|
312
|
+
}
|
|
313
|
+
})
|
|
314
|
+
}
|
|
315
|
+
})
|
|
316
|
+
return this.sidewalkPhaseData
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
created () {
|
|
320
|
+
this.globalParamModel = this.$store.getters.globalParamModel
|
|
321
|
+
this.PhaseDataModel = new PhaseDataModel()
|
|
322
|
+
this.increaseId()
|
|
323
|
+
},
|
|
324
|
+
mounted () {
|
|
325
|
+
},
|
|
326
|
+
destroyed () {
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
</script>
|
|
330
|
+
<style lang="scss">
|
|
331
|
+
</style>
|
|
@@ -10,11 +10,10 @@
|
|
|
10
10
|
* See the Mulan PSL v2 for more details.
|
|
11
11
|
**/
|
|
12
12
|
export default class Svgmethods {
|
|
13
|
-
clickOpen (call
|
|
13
|
+
clickOpen (call) {
|
|
14
14
|
const file = document.getElementById('importimg').files[0]
|
|
15
15
|
const filetype = file.type
|
|
16
16
|
const reader = new FileReader()
|
|
17
|
-
const reader2 = new FileReader()
|
|
18
17
|
const filesize = file.size
|
|
19
18
|
if (filetype !== 'image/svg+xml' && filetype !== 'image/png' && filetype !== 'image/jpeg') {
|
|
20
19
|
call('error', 'type')
|
|
@@ -25,63 +24,20 @@ export default class Svgmethods {
|
|
|
25
24
|
return
|
|
26
25
|
}
|
|
27
26
|
if (filetype === 'image/svg+xml') {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
calculateImageSize(imageSrc).then(function ({width, height}) {
|
|
33
|
-
// 通过ES6的结构赋值来得到图片的宽和高
|
|
34
|
-
let svgsize = {
|
|
35
|
-
width,
|
|
36
|
-
height
|
|
37
|
-
}
|
|
38
|
-
call2('vectorgraph', svgsize)
|
|
39
|
-
reader.readAsText(file, 'UTF-8')
|
|
40
|
-
reader.addEventListener('load', async (readerEvent) => {
|
|
41
|
-
const content = readerEvent.target.result
|
|
42
|
-
call('vectorgraph', content)
|
|
43
|
-
})
|
|
44
|
-
})
|
|
27
|
+
reader.readAsText(file, 'UTF-8')
|
|
28
|
+
reader.addEventListener('load', async (readerEvent) => {
|
|
29
|
+
const content = readerEvent.target.result
|
|
30
|
+
call('vectorgraph', content)
|
|
45
31
|
})
|
|
46
32
|
}
|
|
47
33
|
if (filetype === 'image/png' || filetype === 'image/jpeg') {
|
|
48
34
|
reader.readAsDataURL(file)
|
|
49
35
|
reader.addEventListener('load', async (readerEvent) => {
|
|
50
36
|
// 图片的 base64 格式, 可以直接当成 img 的 src 属性值
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// 通过ES6的结构赋值来得到图片的宽和高
|
|
55
|
-
let pngsize = {
|
|
56
|
-
width,
|
|
57
|
-
height
|
|
58
|
-
}
|
|
59
|
-
call2('picture', pngsize)
|
|
60
|
-
const _base64 = reader.result
|
|
61
|
-
const content = _base64
|
|
62
|
-
call('picture', content)
|
|
63
|
-
})
|
|
37
|
+
const _base64 = reader.result
|
|
38
|
+
const content = _base64
|
|
39
|
+
call('picture', content)
|
|
64
40
|
})
|
|
65
41
|
}
|
|
66
42
|
}
|
|
67
43
|
}
|
|
68
|
-
|
|
69
|
-
// 根据图片地址获取图片的宽和高
|
|
70
|
-
const calculateImageSize = function (url) {
|
|
71
|
-
return new Promise(function (resolve, reject) {
|
|
72
|
-
const image = document.createElement('img')
|
|
73
|
-
image.addEventListener('load', function (e) {
|
|
74
|
-
resolve({
|
|
75
|
-
width: e.target.width,
|
|
76
|
-
height: e.target.height
|
|
77
|
-
})
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
image.addEventListener('error', function () {
|
|
81
|
-
console.log('error')
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
// 将图片的url地址添加到图片地址中
|
|
85
|
-
image.src = url
|
|
86
|
-
})
|
|
87
|
-
}
|
|
@@ -180,7 +180,7 @@ export default {
|
|
|
180
180
|
ls.minSplit = temp1 > temp2 ? temp1 : temp2
|
|
181
181
|
if (ls.mode !== 7 && ls.value < ls.minSplit) {
|
|
182
182
|
ls.value = ls.minSplit
|
|
183
|
-
this.$message.error(this.$t('openatccomponents.pattern.splitCheckMsg'))
|
|
183
|
+
// this.$message.error(this.$t('openatccomponents.pattern.splitCheckMsg'))
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
},
|
|
@@ -202,12 +202,12 @@ export default {
|
|
|
202
202
|
}
|
|
203
203
|
return maxCycle
|
|
204
204
|
},
|
|
205
|
-
doChange (
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
205
|
+
doChange (e) {
|
|
206
|
+
if (e) {
|
|
207
|
+
let n = this.index
|
|
208
|
+
this.$emit('handleMode', n)
|
|
209
|
+
this.$forceUpdate()
|
|
210
|
+
}
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
}
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<div class="first-1" :style="{'width':item.redWidth,'height':'34px','background':'#f27979'}"></div>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
|
-
<div v-for="(item, index) in barrierList" :key="index + '1'">
|
|
46
|
+
<div v-if="showBarrier" v-for="(item, index) in barrierList" :key="index + '1'">
|
|
47
47
|
<div class="divider" :style="{'left':item, 'height':barrierHeight}"></div>
|
|
48
48
|
</div>
|
|
49
49
|
<div v-show="(syncTime && cycle && cycle>0) || (syncTime && newCycle && newCycle>0)">
|
|
@@ -123,6 +123,10 @@ export default {
|
|
|
123
123
|
patternList: {
|
|
124
124
|
type: Array
|
|
125
125
|
},
|
|
126
|
+
showBarrier: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
default: false
|
|
129
|
+
},
|
|
126
130
|
localPatternList: {
|
|
127
131
|
type: Array
|
|
128
132
|
},
|
|
@@ -162,10 +166,10 @@ export default {
|
|
|
162
166
|
return res
|
|
163
167
|
},
|
|
164
168
|
timeNumDevide () {
|
|
165
|
-
if (this.newCycle && this.newCycle > 0) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
+
// if (this.newCycle && this.newCycle > 0) {
|
|
170
|
+
// let res = (this.newCycle - this.syncTime) + '/' + this.newCycle
|
|
171
|
+
// return res
|
|
172
|
+
// }
|
|
169
173
|
if (this.cycle && this.cycle > 0) {
|
|
170
174
|
let res = (this.cycle - this.syncTime) + '/' + this.cycle
|
|
171
175
|
return res
|
|
@@ -191,7 +195,7 @@ export default {
|
|
|
191
195
|
this.getPedPhasePos()
|
|
192
196
|
this.getBusPos()
|
|
193
197
|
this.getStage()
|
|
194
|
-
this.handlePatternData()
|
|
198
|
+
// this.handlePatternData()
|
|
195
199
|
},
|
|
196
200
|
// 深度观察监听
|
|
197
201
|
deep: true
|
|
@@ -407,63 +411,174 @@ export default {
|
|
|
407
411
|
this.newList = []
|
|
408
412
|
if (Object.keys(this.controlData).length === 0 || this.phaseList.length === 0) return
|
|
409
413
|
if (!this.controlData.phase) return
|
|
410
|
-
let cycle = this.controlData.cycle
|
|
414
|
+
// let cycle = this.controlData.cycle
|
|
411
415
|
if (!this.controlData.rings) return
|
|
416
|
+
let newValue = []
|
|
412
417
|
for (let rings of this.controlData.rings) {
|
|
413
418
|
let phase = this.controlData.phase
|
|
414
|
-
let list = []
|
|
419
|
+
// let list = []
|
|
420
|
+
let obj = {}
|
|
421
|
+
for (let key in rings.sequence) {
|
|
422
|
+
obj[key] = rings.sequence[key]
|
|
423
|
+
}
|
|
424
|
+
let newObj = Object.keys(obj).map(val => ({
|
|
425
|
+
id: obj[val]
|
|
426
|
+
}))
|
|
427
|
+
newValue.push(newObj)
|
|
415
428
|
for (let sequ of rings.sequence) {
|
|
416
429
|
let obj = {}
|
|
417
430
|
obj.id = sequ
|
|
418
431
|
let split = phase.filter((item) => {
|
|
419
432
|
return item.id === sequ
|
|
420
433
|
})[0].split
|
|
434
|
+
newValue.map(d => {
|
|
435
|
+
d.map(r => {
|
|
436
|
+
if (r.id === sequ) {
|
|
437
|
+
r.value = split
|
|
438
|
+
}
|
|
439
|
+
})
|
|
440
|
+
})
|
|
441
|
+
// let currPhase = this.phaseList.filter((item) => {
|
|
442
|
+
// if (item.id === sequ && item.controltype === 99) {
|
|
443
|
+
// obj.controltype = item.controltype
|
|
444
|
+
// }
|
|
445
|
+
// return item.id === sequ
|
|
446
|
+
// })[0]
|
|
447
|
+
// if (currPhase) {
|
|
448
|
+
// obj.redWidth = (currPhase.redclear / cycle * 100).toFixed(3) + '%'
|
|
449
|
+
// obj.yellowWidth = (currPhase.yellow / cycle * 100).toFixed(3) + '%'
|
|
450
|
+
// obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / cycle * 100).toFixed(3) + '%'
|
|
451
|
+
// obj.flashgreen = (currPhase.flashgreen / cycle * 100).toFixed(3) + '%'
|
|
452
|
+
// // obj.peddirection = currPhase.peddirection
|
|
453
|
+
// let peddirections = []
|
|
454
|
+
// for (let walk of this.sidewalkPhaseData) {
|
|
455
|
+
// for (let ped of currPhase.peddirection) {
|
|
456
|
+
// // if (stg === walk.phaseid) {
|
|
457
|
+
// let objs = {}
|
|
458
|
+
// objs.name = walk.name
|
|
459
|
+
// objs.id = walk.id
|
|
460
|
+
// if (ped === walk.id) {
|
|
461
|
+
// peddirections.push(objs)
|
|
462
|
+
// peddirections = Array.from(new Set(peddirections))
|
|
463
|
+
// }
|
|
464
|
+
// // }
|
|
465
|
+
// }
|
|
466
|
+
// }
|
|
467
|
+
// obj.peddirection = peddirections
|
|
468
|
+
// obj.split = split
|
|
469
|
+
// obj.direction = currPhase.direction.map(item => {
|
|
470
|
+
// return {
|
|
471
|
+
// id: item,
|
|
472
|
+
// color: '#454545'
|
|
473
|
+
// }
|
|
474
|
+
// })
|
|
475
|
+
// list.push(obj)
|
|
476
|
+
// }
|
|
477
|
+
}
|
|
478
|
+
// this.newList.push(list)
|
|
479
|
+
// this.patternInfo = [...this.newList]
|
|
480
|
+
}
|
|
481
|
+
this.handleOverViewChange(newValue)
|
|
482
|
+
},
|
|
483
|
+
handleBarrierHeight () { // 屏障高度
|
|
484
|
+
if (!this.patternInfo) return
|
|
485
|
+
let patternLength = this.patternInfo.length
|
|
486
|
+
this.barrierHeight = (patternLength * 35 + 21) + 'px'
|
|
487
|
+
},
|
|
488
|
+
handleOverViewChange (val) {
|
|
489
|
+
if (val === null || val.length === 0) return
|
|
490
|
+
this.patternInfo = []
|
|
491
|
+
let currentArr = []
|
|
492
|
+
let newPattern = []
|
|
493
|
+
val.map(i => {
|
|
494
|
+
newPattern.push(...i)
|
|
495
|
+
})
|
|
496
|
+
if (this.phaseList.length === 0) return
|
|
497
|
+
for (let patternStatus of val[0]) {
|
|
498
|
+
if (patternStatus.mode !== 7) {
|
|
499
|
+
let concurrent = this.phaseList.filter((item) => {
|
|
500
|
+
return item.id === patternStatus.id // patternStatus.id当前相位id concurrent当前相位的并发相位
|
|
501
|
+
})[0].concurrent// 当前相位的并发相位
|
|
502
|
+
if (concurrent) {
|
|
503
|
+
let obj = {
|
|
504
|
+
id: patternStatus.id,
|
|
505
|
+
current: concurrent.sort()
|
|
506
|
+
}
|
|
507
|
+
currentArr.push(obj)
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
if (currentArr.length !== 0) {
|
|
512
|
+
let newCurrent = this.tranform(currentArr)
|
|
513
|
+
let ringTeam = this.step1(this.phaseList, newCurrent)
|
|
514
|
+
this.fillGap(ringTeam, val)
|
|
515
|
+
}
|
|
516
|
+
let cycle = this.controlData.cycle
|
|
517
|
+
for (let rings of val) {
|
|
518
|
+
if (rings.length === 0) continue
|
|
519
|
+
let list = []
|
|
520
|
+
for (let ring of rings) {
|
|
521
|
+
if (ring.value === 0) continue
|
|
522
|
+
let obj = {}
|
|
523
|
+
let split = ring.value
|
|
524
|
+
obj.id = ring.id
|
|
525
|
+
// obj.split = split
|
|
421
526
|
let currPhase = this.phaseList.filter((item) => {
|
|
422
|
-
if (item.id ===
|
|
527
|
+
if (item.id === ring.id && item.controltype === 99) {
|
|
423
528
|
obj.controltype = item.controltype
|
|
424
529
|
}
|
|
425
|
-
return item.id ===
|
|
530
|
+
return item.id === ring.id
|
|
426
531
|
})[0]
|
|
427
|
-
if (
|
|
428
|
-
obj.
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
// obj.peddirection = currPhase.peddirection
|
|
433
|
-
let peddirections = []
|
|
434
|
-
for (let walk of this.sidewalkPhaseData) {
|
|
435
|
-
for (let ped of currPhase.peddirection) {
|
|
436
|
-
// if (stg === walk.phaseid) {
|
|
437
|
-
let objs = {}
|
|
438
|
-
objs.name = walk.name
|
|
439
|
-
objs.id = walk.id
|
|
440
|
-
if (ped === walk.id) {
|
|
441
|
-
peddirections.push(objs)
|
|
442
|
-
peddirections = Array.from(new Set(peddirections))
|
|
443
|
-
}
|
|
444
|
-
// }
|
|
532
|
+
if (ring.desc) {
|
|
533
|
+
obj.direction = ring.desc.map(item => { // 虚相位desc为空
|
|
534
|
+
return {
|
|
535
|
+
id: item.id,
|
|
536
|
+
color: '#454545'
|
|
445
537
|
}
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
obj.split = split
|
|
538
|
+
})
|
|
539
|
+
} else {
|
|
449
540
|
obj.direction = currPhase.direction.map(item => {
|
|
450
541
|
return {
|
|
451
542
|
id: item,
|
|
452
543
|
color: '#454545'
|
|
453
544
|
}
|
|
454
545
|
})
|
|
546
|
+
}
|
|
547
|
+
if (ring.sum) {
|
|
548
|
+
obj.split = split
|
|
549
|
+
obj.redWidth = (currPhase.redclear + ring.sum / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
|
|
550
|
+
} else {
|
|
551
|
+
obj.split = split
|
|
552
|
+
obj.redWidth = (currPhase.redclear / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
|
|
553
|
+
}
|
|
554
|
+
obj.flashgreen = (currPhase.flashgreen / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
|
|
555
|
+
obj.yellowWidth = (currPhase.yellow / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
|
|
556
|
+
obj.greenWidth = ((split - currPhase.redclear - currPhase.yellow - currPhase.flashgreen) / (this.max ? this.max : cycle) * 100).toFixed(3) + '%'
|
|
557
|
+
// obj.peddirection = currPhase.peddirection
|
|
558
|
+
let peddirections = []
|
|
559
|
+
for (let walk of this.sidewalkPhaseData) {
|
|
560
|
+
for (let ped of currPhase.peddirection) {
|
|
561
|
+
// if (stg === walk.phaseid) {
|
|
562
|
+
let objs = {}
|
|
563
|
+
objs.name = walk.name
|
|
564
|
+
objs.id = walk.id
|
|
565
|
+
if (ped === walk.id) {
|
|
566
|
+
peddirections.push(objs)
|
|
567
|
+
peddirections = Array.from(new Set(peddirections))
|
|
568
|
+
}
|
|
569
|
+
// }
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
obj.peddirection = peddirections
|
|
573
|
+
// 忽略相位不显示
|
|
574
|
+
let mode = ring.mode
|
|
575
|
+
if (mode !== 7) { // 忽略相位不显示
|
|
455
576
|
list.push(obj)
|
|
456
577
|
}
|
|
457
578
|
}
|
|
458
|
-
this.
|
|
459
|
-
this.patternInfo = [...this.newList]
|
|
579
|
+
this.patternInfo.push(list)
|
|
460
580
|
}
|
|
461
581
|
},
|
|
462
|
-
handleBarrierHeight () { // 屏障高度
|
|
463
|
-
if (!this.patternInfo) return
|
|
464
|
-
let patternLength = this.patternInfo.length
|
|
465
|
-
this.barrierHeight = (patternLength * 35 + 21) + 'px'
|
|
466
|
-
},
|
|
467
582
|
handleCurrentChange (val) { // 两个ring的数据
|
|
468
583
|
if (val === null || val.length === 0) return
|
|
469
584
|
this.patternInfo = []
|