openatc-components 0.5.47 → 0.5.48

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.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openatc-components",
3
- "version": "0.5.47",
3
+ "version": "0.5.48",
4
4
  "description": "A Vue.js project",
5
5
  "author": "openatc developer",
6
6
  "private": false,
@@ -100,10 +100,10 @@
100
100
  </div>
101
101
  <!-- 车道灯 -->
102
102
  <div v-if="resetflag" class="roadwayLightIcon">
103
- <div :key="item.id" v-for="item in roadwayLightData" :style="{position: 'absolute', left: item.lightx, top: item.lighty}">
103
+ <div :key="item.id" v-for="item in compRoadwayLightData" :style="{position: 'absolute', left: item.lightx, top: item.lighty}">
104
104
  <svg t="1773302927218" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="22220" width="17.59" height="17.59"><path d="M868.018201 392.930029h-79.379804V252.956975C789.432195 101.34155 665.070503 0 512.13208 0S234.567366 102.664546 234.567366 254.279972v138.650057h-79.379804A68.266631 68.266631 0 0 0 87.450129 460.932062v495.065377a68.266631 68.266631 0 0 0 68.531231 68.002032H868.018201a68.266631 68.266631 0 0 0 68.531231-68.002032V460.932062a68.266631 68.266631 0 0 0-68.531231-68.002033z m-317.519215 328.367789v108.221133a8.996378 8.996378 0 0 1-8.996378 8.996378h-59.005655a8.996378 8.996378 0 0 1-8.996377-8.996378v-108.221133a84.407192 84.407192 0 0 1-46.834085-74.881615 85.465589 85.465589 0 0 1 170.666579 0 83.877993 83.877993 0 0 1-46.834084 74.881615z m132.299673-326.515593H341.200902V243.695998c0-79.379804 76.73381-144.735843 170.931178-144.735842s170.931178 65.091439 170.931178 144.735842z" fill="#fff" p-id="22221"></path></svg>
105
105
  </div>
106
- <PhaseIconSvg v-for="(item, index) in roadwayLightData" :key="item.key + '-' + index" :Data="item" :clickMode="false" />
106
+ <PhaseIconSvg v-for="(item, index) in compRoadwayLightData" :key="item.key + '-' + index" :Data="item" :clickMode="false" />
107
107
  </div>
108
108
  <!-- 公交相位 -->
109
109
  <div v-if="resetflag && !isVipRoute" class="busIcon">
@@ -407,6 +407,7 @@ export default {
407
407
  comdireOverlapPhaseData: [], // 对比相同方向车道跟随相位数据后,被删减的唯一direction的数组
408
408
  busPhaseData: [], // 公交相位数据
409
409
  comdireBusPhaseData: [], // 对比相同方向公交车道数据后,被删减的唯一direction的数组
410
+ compRoadwayLightData: [], // 车道灯状态映射过的车道灯数据
410
411
  channelStatusMap: new Map(), // 通道实时状态映射
411
412
  channelStatusList: [], // 通道实时状态列表
412
413
  phaseDirMap: new Map(),
@@ -464,6 +465,9 @@ export default {
464
465
  this.SpecialControl(val)
465
466
  }
466
467
  this.isHasPhase = false
468
+ // 特殊控制拿不到状态数据,需要重置车道灯map,状态映射车道灯消失
469
+ this.roadwayLightStatusMap = new Map()
470
+ this.getRoadwayLightStatus()
467
471
  return
468
472
  }
469
473
  if (!val.phase && !this.overlapStatusList) {
@@ -789,7 +793,7 @@ export default {
789
793
  }
790
794
  curData.push(data)
791
795
  }
792
- this.roadwayLightData = JSON.parse(JSON.stringify(curData))
796
+ this.compRoadwayLightData = JSON.parse(JSON.stringify(curData))
793
797
  },
794
798
  getBusPhaseStatus () {
795
799
  // 得到公交车道相位状态(颜色)
@@ -1211,7 +1215,7 @@ export default {
1211
1215
  })
1212
1216
  // 去掉重复方向的数据
1213
1217
  const ids = Array.from(new Set(this.roadwayLightData.map(item => item.id)))
1214
- this.roadwayLightData = ids.map(id => this.roadwayLightData.find(item => item.id === id))
1218
+ this.compRoadwayLightData = ids.map(id => this.roadwayLightData.find(item => item.id === id))
1215
1219
  },
1216
1220
  getEffectDirectionPos () {
1217
1221
  this.effectDirData = []
@@ -80,9 +80,14 @@ export default {
80
80
  if (this.isVipRoute) {
81
81
  this.handleStatus()
82
82
  }
83
- if (this.lastType === '') {
84
- if (val.type === 4 || val.type === '黄闪' || val.type === 5 || val.type === 6) {
85
- // 绿闪:绿-》灰-》绿 循环效果
83
+ if (val.type === 4 || val.type === '黄闪' || val.type === 5 || val.type === 6) {
84
+ // type黄闪代表全部相位黄闪状态
85
+ // type 4绿闪、5黄闪、6 红闪
86
+ if (val.type !== this.lastType) {
87
+ // 清除旧的
88
+ if (this.GreenIntervalId) {
89
+ clearInterval(this.GreenIntervalId)
90
+ }
86
91
  let highlightColor = ''
87
92
  if (val.type === 4) {
88
93
  highlightColor = this.GreenColor
@@ -101,7 +106,11 @@ export default {
101
106
  }
102
107
  }
103
108
  if (this.GreenIntervalId && val.type !== 4 && val.type !== '黄闪' && val.type !== 5 && val.type !== 6 && val.type !== this.lastType) {
104
- clearInterval(this.GreenIntervalId)
109
+ // 非闪烁状态 → 清除
110
+ if (this.GreenIntervalId) {
111
+ clearInterval(this.GreenIntervalId)
112
+ this.GreenIntervalId = null
113
+ }
105
114
  this.FlashColor = undefined
106
115
  this.lastType = ''
107
116
  }
@@ -100,11 +100,14 @@ export default {
100
100
  if (this.isVipRoute || this.customClick) {
101
101
  this.handleStatus()
102
102
  }
103
- if (this.lastStatus === '') {
103
+ if (val.type === 4 || val.type === '黄闪' || val.type === 5 || val.type === 6) {
104
104
  // type黄闪代表全部相位黄闪状态
105
105
  // type 4绿闪、5黄闪、6 红闪
106
- if (val.type === 4 || val.type === '黄闪' || val.type === 5 || val.type === 6) {
107
- // 绿闪:绿-》灰-》绿 循环效果
106
+ if (val.type !== this.lastStatus) {
107
+ // 清除旧的
108
+ if (this.GreenIntervalId) {
109
+ clearInterval(this.GreenIntervalId)
110
+ }
108
111
  let highlightColor = ''
109
112
  if (val.type === 4) {
110
113
  highlightColor = this.GreenColor
@@ -123,7 +126,11 @@ export default {
123
126
  }
124
127
  }
125
128
  if (this.GreenIntervalId && val.type !== 4 && val.type !== '黄闪' && val.type !== 5 && val.type !== 6 && val.type !== this.lastStatus) {
126
- clearInterval(this.GreenIntervalId)
129
+ // 非闪烁状态 → 清除
130
+ if (this.GreenIntervalId) {
131
+ clearInterval(this.GreenIntervalId)
132
+ this.GreenIntervalId = null
133
+ }
127
134
  this.FlashColor = undefined
128
135
  this.lastStatus = ''
129
136
  }
@@ -67,7 +67,6 @@
67
67
  class="ring-nums"
68
68
  :ref="'inputNumbers' + item.id"
69
69
  size="small"
70
- controls-position="right"
71
70
  :controls="false"
72
71
  :min="0"
73
72
  :step="1"
@@ -89,10 +88,8 @@
89
88
  size="small"
90
89
  :min="0"
91
90
  :step="1"
92
- controls-position="right"
93
91
  v-model.number="item.split"
94
92
  @change="handleEdit(item)"
95
- style="width: 80px"
96
93
  ></el-input-number>
97
94
  </div>
98
95
  <div style="width:50px;" v-for="(bus,index3) in busPhaseData" :key="index3">
@@ -1,2 +0,0 @@
1
- import OptimizeKanban from './OptimizeKanban.vue'
2
- export default OptimizeKanban
@@ -1,369 +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="kanbanOptimize">
14
- <div v-if="this.nowNumber === 1" class="optimizetype">
15
- <span>{{$t('openatccomponents.pattern.optimizetype')}}</span>
16
- <el-select v-model="value" clearable :placeholder="$t('openatccomponents.common.select')">
17
- <el-option
18
- v-for="item in typeOptions"
19
- :key="item.value"
20
- :label="$t('openatccomponents.overview.type' + item.value)"
21
- :value="item.value"
22
- >
23
- </el-option>
24
- </el-select>
25
- <span class="optimiNum">{{$t('openatccomponents.pattern.optimizecycle')}}</span>
26
- <el-input v-model="optimizecycle" clearable :placeholder="$t('openatccomponents.common.enter')"></el-input>
27
- <!-- <el-button type="primary" @click="onOptimizeClick()">{{$t('openatccomponents.pattern.inoptimize')}}</el-button> -->
28
- </div>
29
- <div class="common-board-column" :style="{marginTop:this.nowNumber === 1 ? 0 : '50px',marginLeft:this.nowNumber === 1 ? 0 : 0}">
30
- <div class="common-board-column-header">
31
- {{headerText}}
32
- </div>
33
- <div class="openatccomponents-board-table-header">
34
- <el-row :gutter="13">
35
- <el-col :span="4">{{this.$t('openatccomponents.overview.phase')}}
36
- </el-col>
37
- <el-col :span="10">{{this.$t('openatccomponents.overview.flow')}}
38
- </el-col>
39
- <el-col :span="10">{{this.$t('openatccomponents.overview.saturationflow')}}
40
- </el-col>
41
- </el-row>
42
- </div>
43
- <draggable
44
- class="common-board-column-content"
45
- :list="list"
46
- :options="options">
47
- <div class="common-board-item" v-for="element in list" :key="element.id">
48
- <el-row :gutter="13">
49
- <el-col :span="4">
50
- <el-tooltip class="item" effect="dark" placement="left">
51
- <div slot="content">{{element.name}}</div>
52
- <div class="common-phase-description">
53
- <xdrdirselector Width="70px" Height="70px" Widths="58px" Heights="58px" :Datas="styles" :Data="showStyle" :showlist="element.desc" :ISActiveMask="ISActiveMask" :MaskColor="MaskColor"></xdrdirselector>
54
- </div>
55
- </el-tooltip>
56
- </el-col>
57
- <el-col :span="10">
58
- <el-input-number :controls="false" class="col-content" size="small" :step="1" v-model.number="element.flowperhour" ref="type" :disabled="element.mode === 7"></el-input-number>
59
- </el-col>
60
- <el-col :span="10">
61
- <el-input-number :controls="false" class="col-content" size="small" :step="1" v-model.number="element.saturation" ref="types" :disabled="element.mode === 7"></el-input-number>
62
- </el-col>
63
- </el-row>
64
- </div>
65
- </draggable>
66
- </div>
67
- </div>
68
- </template>
69
- <script>
70
- import draggable from 'vuedraggable'
71
- import { getDuration } from '@/api/cross'
72
- import xdrdirselector from '@/components/XRDDirSelector'
73
-
74
- export default {
75
- name: 'patternOptimize',
76
- components: {
77
- draggable,
78
- xdrdirselector
79
- },
80
- data () {
81
- return {
82
- showStyle: {
83
- left: '7px',
84
- top: '0px'
85
- },
86
- styles: {
87
- left: '7px',
88
- top: '0px'
89
- },
90
- typeOptions: [{
91
- value: 'flow-split-opt'
92
- }, {
93
- value: 'cycle-opt'
94
- }],
95
- value: 'flow-split-opt',
96
- optimizecycle: 0
97
- }
98
- },
99
- props: {
100
- headerText: {
101
- type: String,
102
- default: 'Header'
103
- },
104
- id: {
105
- type: Number
106
- },
107
- rings: {
108
- type: Array
109
- },
110
- nowNumber: {
111
- type: Number
112
- },
113
- phaseList: {
114
- type: Array
115
- },
116
- options: {
117
- type: Object,
118
- default () {
119
- return {}
120
- }
121
- },
122
- list: {
123
- type: Array,
124
- default () {
125
- return []
126
- }
127
- },
128
- // index: {
129
- // type: Number
130
- // },
131
- ISActiveMask: {
132
- type: Boolean,
133
- default: true
134
- },
135
- // 当phase的描述为空时,显示的图形颜色。
136
- MaskColor: {
137
- type: String,
138
- default: '#000000'
139
- }
140
- },
141
- created () {
142
- // this.addMinSplit()
143
- this.addMin()
144
- },
145
- computed () {
146
-
147
- },
148
- watch: {
149
- list: {
150
- handler: function () {
151
- // let list = this.$refs.type
152
- // let flow = this.$refs.types
153
- // console.log(this.list, 'list')
154
- // let cycle = 0
155
- // let n = this.index
156
- // for (let i = 0; i < list.length; i++) {
157
- // cycle = cycle + Number(list[i].currentValue)
158
- // }
159
- // const globalParamModel = this.$store.getters.globalParamModel
160
- // // let MaxCycle = globalParamModel.getParamsByType('patternList')[n].cycle
161
- // let pattern = globalParamModel.getParamsByType('patternList')[n]
162
- // globalParamModel.getParamsByType('patternList')[n].cycle = this.getMaxCycle(pattern)
163
- // this.addMinSplit()
164
- // this.$emit('handleSplit', n)
165
- },
166
- deep: true
167
- }
168
- },
169
- methods: {
170
- onOptimizeClick () {
171
- let msg = this.$t('openatccomponents.pattern.algorithmEngineOptimization')
172
- const loading = this.$loading({
173
- lock: true,
174
- text: msg,
175
- spinner: 'el-icon-loading',
176
- background: 'rgba(0, 0, 0, 0.7)'
177
- })
178
- setTimeout(() => {
179
- loading.close()
180
- this.handeleOptimizeClick()
181
- }, 1000)
182
- },
183
- handeleOptimizeClick () {
184
- let newPha = []
185
- for (let i = 0; i < this.rings.length; i++) {
186
- newPha.push(...this.rings[i])
187
- }
188
- let phaseData = newPha.map(item => {
189
- return {
190
- id: item.id,
191
- flowperhour: item.flowperhour,
192
- saturation: item.saturation
193
- }
194
- })
195
- let patternList = this.$store.state.globalParam.tscParam.patternList
196
- let pattern = patternList.filter((item) => item.id === this.id)[0]
197
- let reqData = {
198
- 'type': this.value,
199
- 'optcycle': this.optimizecycle ? this.optimizecycle : 0,
200
- 'phaseList': this.phaseList,
201
- 'pattern': pattern,
202
- 'phases': phaseData
203
- }
204
- let isValidata = []
205
- for (let j = 0; j < newPha.length; j++) {
206
- let comNum = (newPha[j].length / 4) * 1700 * 0.8
207
- isValidata.push(newPha[j].flowperhour > comNum)
208
- }
209
- if (isValidata.includes(true)) {
210
- this.$confirm(this.$t('openatccomponents.overview.maxFlow'),
211
- this.$t('openatccomponents.common.alarm'), {
212
- confirmButtonText: this.$t('eopenatccomponentsdge.common.confirm'),
213
- cancelButtonText: this.$t('openatccomponents.common.cancel'),
214
- type: 'warning'
215
- }).then(() => {
216
- getDuration(reqData).then(data => {
217
- if (data.data.success) {
218
- this.$message({
219
- type: 'success',
220
- message: this.$t('openatccomponents.pattern.success')
221
- })
222
- for (let i = 0; i < this.rings.length; i++) {
223
- for (let j = 0; j < this.rings[i].length; j++) {
224
- for (let h = 0; h < data.data.data.phase.length; h++) {
225
- if (this.rings[i][j].id === data.data.data.phase[h].id) {
226
- this.rings[i][j].value = data.data.data.phase[h].duration
227
- // this.rings[i][j].cycle = data.data.data.phase[h].cycle
228
- }
229
- }
230
- }
231
- }
232
- }
233
- }).catch(error => {
234
- console.log(error)
235
- })
236
- }).catch(() => {
237
- })
238
- } else {
239
- getDuration(reqData).then(data => {
240
- if (data.data.success) {
241
- this.$message({
242
- type: 'success',
243
- message: this.$t('openatccomponents.pattern.success')
244
- })
245
- for (let i = 0; i < this.rings.length; i++) {
246
- for (let j = 0; j < this.rings[i].length; j++) {
247
- for (let h = 0; h < data.data.data.phase.length; h++) {
248
- if (this.rings[i][j].id === data.data.data.phase[h].id) {
249
- this.rings[i][j].value = data.data.data.phase[h].duration
250
- // this.rings[i][j].cycle = data.data.data.phase[h].cycle
251
- }
252
- }
253
- }
254
- }
255
- }
256
- }).catch(error => {
257
- console.log(error)
258
- })
259
- }
260
- },
261
- addMin () {
262
- for (let i of this.list) {
263
- if (!i.flowperhour || !i.saturation) {
264
- i.length = this.list.length
265
- i.flowperhour = 0
266
- i.saturation = 1700
267
- }
268
- }
269
- }
270
- // addMinSplit () {
271
- // const globalParamModel = this.$store.getters.globalParamModel
272
- // let phaseList = globalParamModel.getParamsByType('phaseList')
273
- // for (let ls of this.list) {
274
- // let phase = phaseList.filter((item) => {
275
- // return item.id === ls.id
276
- // })[0]
277
- // if (!phase.redyellow) {
278
- // phase.redyellow = 0
279
- // }
280
- // if (!phase.yellow) {
281
- // phase.yellow = 0
282
- // }
283
- // if (!phase.redclear) {
284
- // phase.redclear = 0
285
- // }
286
- // if (!phase.flashgreen) {
287
- // phase.flashgreen = 0
288
- // }
289
- // if (!phase.phasewalk) {
290
- // phase.phasewalk = 0
291
- // }
292
- // if (!phase.pedclear) {
293
- // phase.pedclear = 0
294
- // }
295
- // // let temp1 = phase.redyellow + phase.yellow + phase.redclear + phase.flashgreen // 绿信比的最小值要大于最小绿+黄灯+全红+绿闪
296
- // // let temp2 = phase.phasewalk + phase.pedclear
297
- // // if (temp1 > temp2) {
298
- // // ls.minSplit = temp1
299
- // // } else {
300
- // // ls.minSplit = temp2
301
- // // }
302
- // // if (ls.mode !== 7 && ls.value < ls.minSplit) {
303
- // // ls.value = ls.minSplit
304
- // // }
305
- // // let temp1 = phase.yellow + phase.redclear + phase.flashgreen // 绿信比的最小值要大于最小绿+黄灯+全红+绿闪
306
- // let temp1 = phase.yellow + phase.redclear + phase.mingreen
307
- // let temp2 = phase.yellow + phase.redclear + phase.phasewalk + phase.pedclear
308
- // ls.minSplit = temp1 > temp2 ? temp1 : temp2
309
- // if (ls.mode !== 7 && ls.value < ls.minSplit) {
310
- // ls.value = ls.minSplit
311
- // this.$message.error(this.$t('openatccomponents.pattern.splitCheckMsg'))
312
- // }
313
- // }
314
- // },
315
- // getMaxCycle (pattern) {
316
- // let rings = pattern.rings
317
- // let maxCycle = 0
318
- // for (let ring of rings) {
319
- // if (ring.length === 0) continue
320
- // let cycle = 0
321
- // for (let r of ring) {
322
- // if (r.mode === 7) { // 忽略相位不计周期
323
- // continue
324
- // }
325
- // cycle = cycle + r.value
326
- // }
327
- // if (cycle > maxCycle) {
328
- // maxCycle = cycle
329
- // }
330
- // }
331
- // return maxCycle
332
- // },
333
- // doChange (val) {
334
- // // if (val.mode === 7) {
335
- // // val.value = 0
336
- // // } else {
337
- // // val.value = 30
338
- // // }
339
- // }
340
- }
341
- }
342
- </script>
343
- <style lang="scss" scoped>
344
- .col-content {
345
- width: 100%;
346
- }
347
- .kanbanOptimize {
348
- .common-board-column {
349
- max-width: unset !important;
350
- }
351
- }
352
- .optimizetype{
353
- // float: left;
354
- font-size: 14PX;
355
- margin:0 0 10PX 0;
356
- .el-input {
357
- width: 80PX;
358
- }
359
- .el-select{
360
- width: 145PX;
361
- }
362
- .el-button {
363
- margin-left: 10PX;
364
- }
365
- .optimiNum {
366
- padding-left: 10PX;
367
- }
368
- }
369
- </style>