openatc-components 0.4.71 → 0.4.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,12 @@
10
10
  <span v-for="(ids,index3) in list.includedphases" :key="index3">
11
11
  {{$t('openatccomponents.phase.phase')}}{{ids}}<span v-if="index3+1!==list.includedphases.length">,</span>
12
12
  </span>
13
+ <span v-if="list.modifyphase && list.modifyphase.length>0">(<span v-for="(ids, index4) in list.modifyphase" :key="index4">
14
+ *P{{ ids
15
+ }}<span v-if="index4 + 1 !== list.modifyphase.length"
16
+ >,</span
17
+ >
18
+ </span>)</span>
13
19
  </div>
14
20
  <div style="cursor:pointer;">
15
21
  <div class="ring-phase">
@@ -22,6 +28,12 @@
22
28
  <span v-for="(ids,index3) in list.includedphases" :key="index3">
23
29
  {{$t('openatccomponents.phase.phase')}}{{ids}}<span v-if="index3+1!==list.includedphases.length">,</span>
24
30
  </span>
31
+ <span v-if="list.modifyphase && list.modifyphase.length>0">(<span v-for="(ids, index4) in list.modifyphase" :key="index4">
32
+ *P{{ ids
33
+ }}<span v-if="index4 + 1 !== list.modifyphase.length"
34
+ >,</span
35
+ >
36
+ </span>)</span>
25
37
  </div>
26
38
  </div>
27
39
  </div>
@@ -153,7 +165,16 @@ export default {
153
165
  const findItems = stageList.filter(j => (j.phases ? j.phases : j.stages).includes(i))
154
166
  if (findItems.length) findIndexs.push(...findItems.map(m => m.key))
155
167
  })
168
+ // 收集所有包含 modifyphase 中相位的阶段 key
169
+ let modifyIndexs = []
170
+ if (item.modifyphase !== undefined) {
171
+ item.modifyphase.forEach(i => {
172
+ const findItems = stageList.filter(j => j.phases.includes(i))
173
+ if (findItems.length) modifyIndexs.push(...findItems.map(m => m.key))
174
+ })
175
+ }
156
176
  findIndexs = Array.from(new Set(findIndexs))
177
+ modifyIndexs = Array.from(new Set(modifyIndexs))
157
178
  if (this.cycleChange) {
158
179
  const globalParamModel = this.$store.getters.globalParamModel
159
180
  let pattern = globalParamModel.getParamsByType('patternList')
@@ -168,7 +189,7 @@ export default {
168
189
  peddirection: this.getPedPhasePos(item.peddirection),
169
190
  sidewalkPhaseData: this.getPedPhasePos(item.peddirection),
170
191
  stageLists: stageList.map(sta => {
171
- const find = findIndexs.includes(sta.key)
192
+ const find = findIndexs.includes(sta.key) && !modifyIndexs.includes(sta.key)
172
193
  return {
173
194
  ...sta,
174
195
  direction: this.getRoad(item),
@@ -757,6 +757,20 @@ export default {
757
757
  let addRing1 = [...new Set(resultArrs[1])].filter(item => newCurrent[h].includes(item))
758
758
  ring1s.push(addRing1)
759
759
  }
760
+ // 双环相位数不等的时候
761
+ if (newRings.length > 1) {
762
+ if (newRings[0].length !== newRings[1].length) {
763
+ for (let h = 0; h < newCurrent.length; h++) {
764
+ let adds = [...new Set(ringsequence[0])].filter(item => newCurrent[h].includes(item))
765
+ ring1.push(adds)
766
+ }
767
+ let ring1s = [] // 环1与关系2的并集
768
+ for (let h = 0; h < newCurrent.length; h++) {
769
+ let addRing1 = [...new Set(ringsequence[1])].filter(item => newCurrent[h].includes(item))
770
+ ring1s.push(addRing1)
771
+ }
772
+ }
773
+ }
760
774
  barrierRing1.push(...ring1, ...ring1s)
761
775
  let resultList = []
762
776
  if (newRings.length > 1) {
@@ -1043,6 +1057,20 @@ export default {
1043
1057
  let addRing1 = [...new Set(resultArrs[1])].filter(item => newCurrent[h].includes(item))
1044
1058
  ring1s.push(addRing1)
1045
1059
  }
1060
+ // 双环相位数不等的时候
1061
+ if (newRings.length > 1) {
1062
+ if (newRings[0].length !== newRings[1].length) {
1063
+ for (let h = 0; h < newCurrent.length; h++) {
1064
+ let adds = [...new Set(ringsequence[0])].filter(item => newCurrent[h].includes(item))
1065
+ ring1.push(adds)
1066
+ }
1067
+ let ring1s = [] // 环1与关系2的并集
1068
+ for (let h = 0; h < newCurrent.length; h++) {
1069
+ let addRing1 = [...new Set(ringsequence[1])].filter(item => newCurrent[h].includes(item))
1070
+ ring1s.push(addRing1)
1071
+ }
1072
+ }
1073
+ }
1046
1074
  barrierRing1.push(...ring1, ...ring1s)
1047
1075
  let resultList = []
1048
1076
  if (newRings.length > 1) {
@@ -1292,6 +1320,20 @@ export default {
1292
1320
  let addRing1 = [...new Set(resultArrs[1])].filter(item => newCurrent[h].includes(item))
1293
1321
  ring1s.push(addRing1)
1294
1322
  }
1323
+ // 双环相位数不等的时候
1324
+ if (newRings.length > 1) {
1325
+ if (newRings[0].length !== newRings[1].length) {
1326
+ for (let h = 0; h < newCurrent.length; h++) {
1327
+ let adds = [...new Set(ringsequence[0])].filter(item => newCurrent[h].includes(item))
1328
+ ring1.push(adds)
1329
+ }
1330
+ let ring1s = [] // 环1与关系2的并集
1331
+ for (let h = 0; h < newCurrent.length; h++) {
1332
+ let addRing1 = [...new Set(ringsequence[1])].filter(item => newCurrent[h].includes(item))
1333
+ ring1s.push(addRing1)
1334
+ }
1335
+ }
1336
+ }
1295
1337
  barrierRing1.push(...ring1, ...ring1s)
1296
1338
  let resultList = []
1297
1339
  if (newRings.length >= 1) {
@@ -1350,9 +1392,6 @@ export default {
1350
1392
  if (this.patternList) {
1351
1393
  this.setBarrier(ringTeams, val)
1352
1394
  }
1353
- if (newRings.length > 1) {
1354
- this.fillGap(ringTeams, val)
1355
- }
1356
1395
  if (this.cycleChange) {
1357
1396
  const globalParamModel = this.$store.getters.globalParamModel
1358
1397
  let pattern = globalParamModel.getParamsByType('patternList')
@@ -1362,6 +1401,9 @@ export default {
1362
1401
  } else {
1363
1402
  this.max = ''
1364
1403
  }
1404
+ if (newRings.length > 1) {
1405
+ this.fillGap(ringTeams, val)
1406
+ }
1365
1407
  let barrier = this.step2(ringTeams, newPattern)
1366
1408
  let barrierLeft = barrier.map(item => item)// 屏障左移显示出人行横道
1367
1409
  this.barrierList = barrierLeft.map(j => {
@@ -0,0 +1,310 @@
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>
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="optimize()">{{$t('openatccomponents.pattern.inoptimize')}}</el-button>
28
+ </div>
29
+ <div class="common-board-column" style="margin-top: 50px;">
30
+ <div class="common-board-column-header">
31
+ {{headerText}}
32
+ </div>
33
+ <div class="common-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="stageData"
46
+ :options="options">
47
+ <div class="common-board-item" v-for="element in stageData" :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 v-if="element.desc.length > 0" 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 '../XRDDirSelector/XRDDirSelector'
73
+
74
+ export default {
75
+ name: 'StageOptimize',
76
+ components: {
77
+ draggable,
78
+ xdrdirselector
79
+ },
80
+ data () {
81
+ return {
82
+ showStyle: {
83
+ left: '2px',
84
+ top: '0px'
85
+ },
86
+ styles: {
87
+ left: '1px',
88
+ top: '0px'
89
+ },
90
+ typeOptions: [{
91
+ value: 'flow-split-opt'
92
+ }, {
93
+ value: 'cycle-opt'
94
+ }],
95
+ value: '',
96
+ optimizecycle: 0
97
+ }
98
+ },
99
+ props: {
100
+ headerText: {
101
+ type: String,
102
+ default: 'Header'
103
+ },
104
+ contrloType: {
105
+ type: String
106
+ },
107
+ stageData: {
108
+ type: Array
109
+ },
110
+ stagesChange: {
111
+ type: Array
112
+ },
113
+ id: {
114
+ type: Number
115
+ },
116
+ rings: {
117
+ type: Object
118
+ },
119
+ nowNumber: {
120
+ type: Number
121
+ },
122
+ phaseList: {
123
+ type: Array
124
+ },
125
+ options: {
126
+ type: Object,
127
+ default () {
128
+ return {}
129
+ }
130
+ },
131
+ list: {
132
+ type: Array,
133
+ default () {
134
+ return []
135
+ }
136
+ },
137
+ // index: {
138
+ // type: Number
139
+ // },
140
+ ISActiveMask: {
141
+ type: Boolean,
142
+ default: true
143
+ },
144
+ // 当phase的描述为空时,显示的图形颜色。
145
+ MaskColor: {
146
+ type: String,
147
+ default: '#000000'
148
+ }
149
+ },
150
+ created () {
151
+ // this.addMinSplit()
152
+ this.addMin()
153
+ },
154
+ watch: {
155
+ list: {
156
+ handler: function () {
157
+ this.addMin()
158
+ // let list = this.$refs.type
159
+ // let flow = this.$refs.types
160
+ // console.log(this.list, 'list')
161
+ // let cycle = 0
162
+ // let n = this.index
163
+ // for (let i = 0; i < list.length; i++) {
164
+ // cycle = cycle + Number(list[i].currentValue)
165
+ // }
166
+ // const globalParamModel = this.$store.getters.globalParamModel
167
+ // // let MaxCycle = globalParamModel.getParamsByType('patternList')[n].cycle
168
+ // let pattern = globalParamModel.getParamsByType('patternList')[n]
169
+ // globalParamModel.getParamsByType('patternList')[n].cycle = this.getMaxCycle(pattern)
170
+ // this.addMinSplit()
171
+ // this.$emit('handleSplit', n)
172
+ },
173
+ deep: true
174
+ },
175
+ stageData: {
176
+ handler: function () {
177
+ this.addMins()
178
+ // let list = this.$refs.type
179
+ // let flow = this.$refs.types
180
+ // console.log(this.list, 'list')
181
+ // let cycle = 0
182
+ // let n = this.index
183
+ // for (let i = 0; i < list.length; i++) {
184
+ // cycle = cycle + Number(list[i].currentValue)
185
+ // }
186
+ // const globalParamModel = this.$store.getters.globalParamModel
187
+ // // let MaxCycle = globalParamModel.getParamsByType('patternList')[n].cycle
188
+ // let pattern = globalParamModel.getParamsByType('patternList')[n]
189
+ // globalParamModel.getParamsByType('patternList')[n].cycle = this.getMaxCycle(pattern)
190
+ // this.addMinSplit()
191
+ // this.$emit('handleSplit', n)
192
+ },
193
+ deep: true
194
+ }
195
+ },
196
+ methods: {
197
+ optimize () {
198
+ let _that = this
199
+ let newPha = []
200
+ for (let i = 0; i < _that.rings.rings.length; i++) {
201
+ newPha.push(..._that.rings.rings[i])
202
+ }
203
+ let phaseData = newPha.map(item => {
204
+ return {
205
+ id: item.id,
206
+ flowperhour: item.flowperhour,
207
+ saturation: item.saturation
208
+ }
209
+ })
210
+ // let patternList = _that.$store.state.globalParam.tscParam.patternList
211
+ // console.log(patternList, 'patternList')
212
+ let pattern = _that.rings
213
+ let reqData = {
214
+ 'type': _that.value,
215
+ 'optcycle': _that.optimizecycle,
216
+ 'phaseList': _that.phaseList,
217
+ 'pattern': pattern,
218
+ 'phases': phaseData
219
+ }
220
+ let isValidata = []
221
+ for (let j = 0; j < newPha.length; j++) {
222
+ let comNum = (newPha[j].length / 4) * 1700 * 0.8
223
+ isValidata.push(newPha[j].flowperhour > comNum)
224
+ }
225
+ if (isValidata.includes(true)) {
226
+ this.$confirm(this.$t('openatccomponents.overview.maxFlow'),
227
+ this.$t('openatccomponents.common.alarm'), {
228
+ confirmButtonText: this.$t('openatccomponents.common.confirm'),
229
+ cancelButtonText: this.$t('openatccomponents.common.cancel'),
230
+ type: 'warning'
231
+ }).then(() => {
232
+ getDuration(reqData).then(data => {
233
+ if (data.data.success) {
234
+ _that.$message({
235
+ type: 'success',
236
+ message: _that.$t('openatccomponents.pattern.success')
237
+ })
238
+ for (let i = 0; i < _that.stagesChange.length; i++) {
239
+ if (_that.stagesChange[i].key === data.data.data.phase[i].id - 1) {
240
+ _that.stagesChange[i].stageSplit = data.data.data.phase[i].duration
241
+ }
242
+ }
243
+ this.$emit('optimizestage', this.id)
244
+ }
245
+ }).catch(error => {
246
+ console.log(error)
247
+ })
248
+ }).catch(() => {
249
+ })
250
+ } else {
251
+ getDuration(reqData).then(data => {
252
+ if (data.data.success) {
253
+ _that.$message({
254
+ type: 'success',
255
+ message: _that.$t('openatccomponents.pattern.success')
256
+ })
257
+ for (let i = 0; i < _that.stagesChange.length; i++) {
258
+ if (_that.stagesChange[i].key === data.data.data.phase[i].id - 1) {
259
+ _that.stagesChange[i].stageSplit = data.data.data.phase[i].duration
260
+ }
261
+ }
262
+ this.$emit('optimizestage', this.id)
263
+ }
264
+ }).catch(error => {
265
+ console.log(error)
266
+ })
267
+ }
268
+ },
269
+ addMins () {
270
+ for (let i of this.stageData) {
271
+ if (!i.flowperhour || !i.saturation) {
272
+ i.flowperhour = 0
273
+ i.saturation = 1700
274
+ i.length = this.list.length
275
+ }
276
+ }
277
+ },
278
+ addMin () {
279
+ for (let i of this.list) {
280
+ if (!i.flowperhour || !i.saturation) {
281
+ i.flowperhour = 0
282
+ i.saturation = 1700
283
+ i.length = this.list.length
284
+ }
285
+ }
286
+ }
287
+ }
288
+ }
289
+ </script>
290
+ <style lang="scss" scoped>
291
+ .col-content {
292
+ width: 100%;
293
+ }
294
+ .optimizetype{
295
+ position: absolute;
296
+ margin:0 0 10PX 0;
297
+ .el-input {
298
+ width: 80PX;
299
+ }
300
+ .el-select{
301
+ width: 145PX;
302
+ }
303
+ .el-button {
304
+ margin-left: 10PX;
305
+ }
306
+ .optimiNum {
307
+ padding-left: 10PX;
308
+ }
309
+ }
310
+ </style>