openatc-components 0.4.16 → 0.4.18

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.4.16",
3
+ "version": "0.4.18",
4
4
  "description": "A Vue.js project",
5
5
  "author": "openatc developer",
6
6
  "private": false,
@@ -24,7 +24,7 @@
24
24
  </el-select>
25
25
  <span class="optimiNum">{{$t('openatccomponents.pattern.optimizecycle')}}</span>
26
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> -->
27
+ <el-button v-if="isTentative" type="primary" @click="optimize()">{{$t('openatccomponents.pattern.inoptimize')}}</el-button>
28
28
  </div>
29
29
  <el-table class="tb-edit" ref="singleTables" row-key="id" :data="tableRing" element-loading-text="Loading" :max-height="tableHeight" fit highlight-current-row id="footerBtn">
30
30
  <el-table-column prop="id" sortable align="center" :label="$t('openatccomponents.overview.id')">
@@ -40,11 +40,13 @@
40
40
  <el-table-column class="table-column" :label="$t('openatccomponents.overview.flow')" align="center">
41
41
  <template slot-scope="scope">
42
42
  <el-input-number :controls="false" class="col-content" size="small" :step="1" v-model.number="scope.row.flowperhour" ref="type"></el-input-number>
43
+ <!-- <span>{{scope.row.flowperhour}}</span> -->
43
44
  </template>
44
45
  </el-table-column>
45
46
  <el-table-column align="center" :label="$t('openatccomponents.overview.saturationflow')">
46
47
  <template slot-scope="scope">
47
48
  <el-input-number :controls="false" class="col-content" size="small" :step="1" v-model.number="scope.row.saturation" ref="types"></el-input-number>
49
+ <!-- <span>{{scope.row.saturation}}</span> -->
48
50
  </template>
49
51
  </el-table-column>
50
52
  </el-table>
@@ -96,7 +98,7 @@
96
98
  <script>
97
99
  import draggable from 'vuedraggable'
98
100
  import { getDuration } from '../../../api/cross'
99
- import xdrdirselector from '../XRDDirSelector/XRDDirSelector'
101
+ import xdrdirselector from '../XRDDirSelector/XRDDirSelector.vue'
100
102
 
101
103
  export default {
102
104
  name: 'patternOptimize',
@@ -129,6 +131,10 @@ export default {
129
131
  type: String,
130
132
  default: 'Header'
131
133
  },
134
+ isTentative: {
135
+ type: Boolean,
136
+ default: false
137
+ },
132
138
  tableRing: {
133
139
  type: Array
134
140
  },
@@ -177,7 +183,7 @@ export default {
177
183
  },
178
184
  created () {
179
185
  // this.addMinSplit()
180
- this.addMin()
186
+ // this.addMin()
181
187
  },
182
188
  watch: {
183
189
  list: {
@@ -294,23 +294,20 @@
294
294
  name="patternOptimize"
295
295
  >
296
296
  <pattern-optimize
297
- v-for="n in optimizes"
298
- :key="n"
299
297
  class="expendkanban"
300
- :list="
301
- patternOne.length === 0
302
- ? planPattern.rings[n - 1]
303
- : patternOne[0].rings[n - 1]
304
- "
305
298
  :rings="patternOne.length === 0 ? planPattern : patternOne[0]"
306
299
  :phaseList="phaseList"
307
- :options="options"
308
- :header-text="$t('openatccomponents.pattern.ring') + n"
309
- :index="n"
310
- :nowNumber="n"
300
+ :tableRing="tableRing"
301
+ :showStyle="showStyle"
302
+ :styles="styles"
303
+ :isTentative="true"
311
304
  @handleSplit="handleSplit"
312
305
  >
313
306
  </pattern-optimize>
307
+ <!-- ref="patternOptimize"
308
+ :tableRing="tableRing"
309
+ :id="selectedRow.id"
310
+ @optimizesucess="optimizesucess" -->
314
311
  </el-tab-pane>
315
312
  </el-tabs>
316
313
  </el-row>
@@ -325,7 +322,8 @@
325
322
 
326
323
  <script>
327
324
  import { hasPermission } from '../../../../utils/auth'
328
-
325
+ import PhaseDataModel from '../../IntersectionMap/crossDirection/utils.js'
326
+ import CrossDiagramMgr from '../../../../EdgeMgr/controller/crossDiagramMgr.js'
329
327
  export default {
330
328
  name: 'tentativeplancontrol',
331
329
  props: {
@@ -398,7 +396,16 @@ export default {
398
396
  options: {
399
397
  group: 'pattern'
400
398
  },
399
+ styles: {
400
+ left: '2px',
401
+ top: 0
402
+ },
403
+ showStyle: {
404
+ left: '2px',
405
+ top: 0
406
+ },
401
407
  max: '',
408
+ tableRing: [],
402
409
  contrloType: '',
403
410
  patternCycleEqual: true,
404
411
  // activeList: 'ring',
@@ -422,6 +429,8 @@ export default {
422
429
  }
423
430
  },
424
431
  created () {
432
+ this.PhaseDataModel = new PhaseDataModel()
433
+ this.CrossDiagramMgr = new CrossDiagramMgr()
425
434
  this.patternPlan()
426
435
  this.getCycle()
427
436
  if (this.patternOne.length === 0) {
@@ -759,7 +768,7 @@ export default {
759
768
  for (let phase of this.phaseList) {
760
769
  let ring = {}
761
770
  ring.name = 'Phase ' + phase.id
762
- ring.desc = this.getPhaseDescription(phase.direction)
771
+ ring.desc = this.getPhaseDescription(phase)
763
772
  ring.id = phase.id
764
773
  ring.value = 30
765
774
  ring.mode = 2
@@ -779,6 +788,15 @@ export default {
779
788
  let barrier = this.handleCurrentChange(newPattern.rings)
780
789
  newPattern.barriers = barrier
781
790
  this.planPattern = newPattern
791
+ const flatArray = this.planPattern.rings.flat().filter(item => item !== null)
792
+ this.tableRing = flatArray.map(item => {
793
+ return {
794
+ id: item.id,
795
+ desc: item.desc,
796
+ flowperhour: item.flowperhour ? item.flowperhour : 0,
797
+ saturation: item.saturation ? item.saturation : 0
798
+ }
799
+ })
782
800
  },
783
801
  getCycle () {
784
802
  for (let rings of this.planPattern.rings) {
@@ -817,12 +835,71 @@ export default {
817
835
  }
818
836
  }
819
837
  },
838
+ // getPhaseDescription (phaseList) {
839
+ // if (!phaseList) return
840
+ // let list = []
841
+ // for (let id of phaseList) {
842
+ // let obj = {}
843
+ // obj.id = id
844
+ // obj.color = '#454545'
845
+ // list.push(obj)
846
+ // }
847
+ // return list
848
+ // },
849
+ getPedPhasePos () {
850
+ // 行人相位信息
851
+ this.sidewalkPhaseData = []
852
+ // let phaseList = this.globalParamModel.getParamsByType('phaseList')
853
+ this.phaseList.forEach((ele, i) => {
854
+ if (ele.peddirection) {
855
+ ele.peddirection.forEach((dir, index) => {
856
+ // 行人相位
857
+ if (this.PhaseDataModel.getSidePos(dir)) {
858
+ this.sidewalkPhaseData.push({
859
+ key: this.CrossDiagramMgr.getUniqueKey('pedphase'),
860
+ phaseid: ele.id, // 相位id,用于对应相位状态
861
+ id: dir,
862
+ name: this.PhaseDataModel.getSidePos(dir).name
863
+ })
864
+ }
865
+ })
866
+ }
867
+ })
868
+ return this.sidewalkPhaseData
869
+ },
820
870
  getPhaseDescription (phaseList) {
821
- if (!phaseList) return
822
871
  let list = []
823
- for (let id of phaseList) {
872
+ let peddirections = []
873
+ let sidewalkPhaseData = this.getPedPhasePos()
874
+ for (let walk of sidewalkPhaseData) {
875
+ if (phaseList.peddirection) {
876
+ for (let ped of phaseList.peddirection) {
877
+ // if (stg === walk.phaseid) {
878
+ let obj = {}
879
+ obj.name = walk.name
880
+ obj.id = walk.id
881
+ if (ped === walk.id) {
882
+ peddirections.push(obj)
883
+ peddirections = Array.from(new Set(peddirections))
884
+ }
885
+ // }
886
+ }
887
+ } else {
888
+ peddirections = []
889
+ }
890
+ }
891
+ if (phaseList.direction.length > 0) {
892
+ for (let id of phaseList.direction) {
893
+ let obj = {}
894
+ obj.id = id
895
+ obj.peddirection = peddirections
896
+ obj.color = '#454545'
897
+ list.push(obj)
898
+ }
899
+ } else {
824
900
  let obj = {}
825
- obj.id = id
901
+ obj.id = ''
902
+ obj.peddirection = peddirections
826
903
  obj.color = '#454545'
827
904
  list.push(obj)
828
905
  }
@@ -906,6 +983,15 @@ export default {
906
983
  // if (this.patternOne[0].contrloType === 'stage') {
907
984
  // this.changeStage()
908
985
  // }
986
+ const flatArray = this.patternOne[0].rings.flat().filter(item => item !== null)
987
+ this.tableRing = flatArray.map(item => {
988
+ return {
989
+ id: item.id,
990
+ desc: item.desc,
991
+ flowperhour: item.flowperhour ? item.flowperhour : 0,
992
+ saturation: item.saturation ? item.saturation : 0
993
+ }
994
+ })
909
995
  this.manualInfo.offset = this.offset
910
996
  for (let rings of this.patternOne[0].rings) {
911
997
  if (rings.length === 0) continue
@@ -11,7 +11,46 @@
11
11
  **/
12
12
  <template>
13
13
  <div>
14
- <div v-if="this.nowNumber === 1" class="optimizetype">
14
+ <div 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
+ <el-table class="tb-edit" ref="singleTables" row-key="id" :data="tableRing" element-loading-text="Loading" :max-height="tableHeight" fit highlight-current-row id="footerBtn">
30
+ <el-table-column prop="id" sortable align="center" :label="$t('openatccomponents.overview.id')">
31
+ <template slot-scope="scope">
32
+ <span>{{scope.row.id}}</span>
33
+ </template>
34
+ </el-table-column>
35
+ <el-table-column class="table-column" :label="$t('openatccomponents.overview.phase')" align="center">
36
+ <template slot-scope="scope">
37
+ <xdrdirselector Width="70px" Height="70px" Widths="58px" Heights="58px" :Datas="styles" :Data="showStyle" :showlist="scope.row.desc" :ISActiveMask="ISActiveMask" :MaskColor="MaskColor"></xdrdirselector>
38
+ </template>
39
+ </el-table-column>
40
+ <el-table-column class="table-column" :label="$t('openatccomponents.overview.flow')" align="center">
41
+ <template slot-scope="scope">
42
+ <el-input-number :controls="false" class="col-content" size="small" :step="1" v-model.number="scope.row.flowperhour" ref="type"></el-input-number>
43
+ <!-- <span>{{scope.row.flowperhour}}</span> -->
44
+ </template>
45
+ </el-table-column>
46
+ <el-table-column align="center" :label="$t('openatccomponents.overview.saturationflow')">
47
+ <template slot-scope="scope">
48
+ <el-input-number :controls="false" class="col-content" size="small" :step="1" v-model.number="scope.row.saturation" ref="types"></el-input-number>
49
+ <!-- <span>{{scope.row.saturation}}</span> -->
50
+ </template>
51
+ </el-table-column>
52
+ </el-table>
53
+ <!-- <div v-if="this.nowNumber === 1" class="optimizetype">
15
54
  <span>{{$t('openatccomponents.pattern.optimizetype')}}</span>
16
55
  <el-select v-model="value" clearable :placeholder="$t('openatccomponents.common.select')">
17
56
  <el-option
@@ -68,7 +107,7 @@
68
107
  </el-row>
69
108
  </div>
70
109
  </draggable>
71
- </div>
110
+ </div> -->
72
111
  </div>
73
112
  </template>
74
113
  <script>
@@ -84,14 +123,15 @@ export default {
84
123
  },
85
124
  data () {
86
125
  return {
87
- showStyle: {
88
- left: '2px',
89
- top: '0px'
90
- },
91
- styles: {
92
- left: '1px',
93
- top: '0px'
94
- },
126
+ // showStyle: {
127
+ // left: '2px',
128
+ // top: '0px'
129
+ // },
130
+ // styles: {
131
+ // left: '1px',
132
+ // top: '0px'
133
+ // },
134
+ tableHeight: 400,
95
135
  typeOptions: [{
96
136
  value: 'flow-split-opt'
97
137
  }, {
@@ -106,6 +146,15 @@ export default {
106
146
  type: String,
107
147
  default: 'Header'
108
148
  },
149
+ tableRing: {
150
+ type: Array
151
+ },
152
+ showStyle: {
153
+ type: Object
154
+ },
155
+ styles: {
156
+ type: Object
157
+ },
109
158
  contrloType: {
110
159
  type: String
111
160
  },
@@ -154,12 +203,12 @@ export default {
154
203
  },
155
204
  created () {
156
205
  // this.addMinSplit()
157
- this.addMin()
206
+ // this.addMin()
158
207
  },
159
208
  watch: {
160
209
  list: {
161
210
  handler: function () {
162
- this.addMin()
211
+ // this.addMin()
163
212
  // let list = this.$refs.type
164
213
  // let flow = this.$refs.types
165
214
  // console.log(this.list, 'list')
@@ -179,7 +228,7 @@ export default {
179
228
  },
180
229
  stageData: {
181
230
  handler: function () {
182
- this.addMins()
231
+ // this.addMins()
183
232
  // let list = this.$refs.type
184
233
  // let flow = this.$refs.types
185
234
  // console.log(this.list, 'list')
@@ -201,16 +250,19 @@ export default {
201
250
  methods: {
202
251
  optimize () {
203
252
  let _that = this
204
- let newPha = []
205
- for (let i = 0; i < _that.rings.rings.length; i++) {
206
- newPha.push(..._that.rings.rings[i])
207
- }
208
- let phaseData = newPha.map(item => {
209
- return {
210
- id: item.id,
211
- flowperhour: item.flowperhour,
212
- saturation: item.saturation
213
- }
253
+ // let newPha = []
254
+ // for (let i = 0; i < _that.rings.rings.length; i++) {
255
+ // newPha.push(..._that.rings.rings[i])
256
+ // }
257
+ // let phaseData = newPha.map(item => {
258
+ // return {
259
+ // id: item.id,
260
+ // flowperhour: item.flowperhour,
261
+ // saturation: item.saturation
262
+ // }
263
+ // })
264
+ this.tableRing.map(item => {
265
+ delete item.desc
214
266
  })
215
267
  // let patternList = _that.$store.state.globalParam.tscParam.patternList
216
268
  // console.log(patternList, 'patternList')
@@ -220,12 +272,12 @@ export default {
220
272
  'optcycle': _that.optimizecycle,
221
273
  'phaseList': _that.phaseList,
222
274
  'pattern': pattern,
223
- 'phases': phaseData
275
+ 'phases': this.tableRing
224
276
  }
225
277
  let isValidata = []
226
- for (let j = 0; j < newPha.length; j++) {
227
- let comNum = (newPha[j].length / 4) * 1700 * 0.8
228
- isValidata.push(newPha[j].flowperhour > comNum)
278
+ for (let j = 0; j < this.tableRing.length; j++) {
279
+ let comNum = (this.tableRing[j].length / 4) * 1700 * 0.8
280
+ isValidata.push(this.tableRing[j].flowperhour > comNum)
229
281
  }
230
282
  if (isValidata.includes(true)) {
231
283
  this.$confirm(this.$t('openatccomponents.overview.maxFlow'),
@@ -270,25 +322,25 @@ export default {
270
322
  console.log(error)
271
323
  })
272
324
  }
273
- },
274
- addMins () {
275
- for (let i of this.stageData) {
276
- if (!i.flowperhour || !i.saturation) {
277
- i.flowperhour = 0
278
- i.saturation = 1700
279
- i.length = this.list.length
280
- }
281
- }
282
- },
283
- addMin () {
284
- for (let i of this.list) {
285
- if (!i.flowperhour || !i.saturation) {
286
- i.flowperhour = 0
287
- i.saturation = 1700
288
- i.length = this.list.length
289
- }
290
- }
291
325
  }
326
+ // addMins () {
327
+ // for (let i of this.stageData) {
328
+ // if (!i.flowperhour || !i.saturation) {
329
+ // i.flowperhour = 0
330
+ // i.saturation = 1700
331
+ // i.length = this.list.length
332
+ // }
333
+ // }
334
+ // },
335
+ // addMin () {
336
+ // for (let i of this.list) {
337
+ // if (!i.flowperhour || !i.saturation) {
338
+ // i.flowperhour = 0
339
+ // i.saturation = 1700
340
+ // i.length = this.list.length
341
+ // }
342
+ // }
343
+ // }
292
344
  }
293
345
  }
294
346
  </script>
@@ -297,7 +349,7 @@ export default {
297
349
  width: 100%;
298
350
  }
299
351
  .optimizetype{
300
- position: absolute;
352
+ // position: absolute;
301
353
  margin:0 0 10PX 0;
302
354
  .el-input {
303
355
  width: 80PX;
@@ -10,7 +10,7 @@
10
10
  * See the Mulan PSL v2 for more details.
11
11
  **/
12
12
  <template>
13
- <div :style="{position: 'relative'}">
13
+ <div :style="{position: 'relative',height: '40px'}">
14
14
  <div :style="{position: 'absolute', left: Data?Data.left:0, top: Data?Data.top:0}">
15
15
  <svg
16
16
  version="1.1"