openatc-components 0.3.75 → 0.3.76

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.
@@ -11,6 +11,7 @@
11
11
  :showBarrier="showBarrier"
12
12
  :controlPhase="controlPhase"
13
13
  :isShowTip="isShowTip"
14
+ :isMove="isMove"
14
15
  :localPatternList="localPatternList"
15
16
  :showCondition="showCondition"
16
17
  :contrloType="contrloType"
@@ -24,6 +25,7 @@
24
25
  :cycle="cycle"
25
26
  :syncTime="syncTime"
26
27
  :style="{'margin-top': '25px'}"
28
+ @handleSplitMove="handleSplitMove"
27
29
  :patternStatusList="patternStatusList"
28
30
  :patternId="patternId"
29
31
  :cycles="cycles">
@@ -72,6 +74,10 @@ export default {
72
74
  stagesChange: {
73
75
  type: Array
74
76
  },
77
+ isMove: {
78
+ type: Boolean,
79
+ default: true
80
+ },
75
81
  isShowTip: {
76
82
  type: Boolean,
77
83
  default: true
@@ -108,6 +114,11 @@ export default {
108
114
  syncTime: {
109
115
  type: Number
110
116
  }
117
+ },
118
+ methods: {
119
+ handleSplitMove (data) {
120
+ this.$emit('handleSplitMove', data)
121
+ }
111
122
  }
112
123
  }
113
124
  </script>
@@ -50,7 +50,7 @@
50
50
  <el-tooltip class="item" effect="dark" placement="left">
51
51
  <div slot="content">{{element.name}}</div>
52
52
  <div class="common-phase-description">
53
- <xdrdirselector Width="70px" Height="70px" Widths="50px" Heights="50px" :Data="styles" :showlist="element.desc" :ISActiveMask="ISActiveMask" :MaskColor="MaskColor"></xdrdirselector>
53
+ <xdrdirselector Width="70px" Height="70px" Widths="58px" Heights="58px" :Datas="styles" :Data="showStyle" :showlist="element.desc" :ISActiveMask="ISActiveMask" :MaskColor="MaskColor"></xdrdirselector>
54
54
  </div>
55
55
  </el-tooltip>
56
56
  </el-col>
@@ -79,9 +79,13 @@ export default {
79
79
  },
80
80
  data () {
81
81
  return {
82
+ showStyle: {
83
+ left: '2px',
84
+ top: '0px'
85
+ },
82
86
  styles: {
83
87
  left: '1px',
84
- top: '0'
88
+ top: '0px'
85
89
  },
86
90
  typeOptions: [{
87
91
  value: 'flow-split-opt'
@@ -97,6 +101,9 @@ export default {
97
101
  type: String,
98
102
  default: 'Header'
99
103
  },
104
+ id: {
105
+ type: Number
106
+ },
100
107
  rings: {
101
108
  type: Object
102
109
  },
@@ -209,6 +216,7 @@ export default {
209
216
  }
210
217
  }
211
218
  }
219
+ this.$emit('optimizesucess', this.id)
212
220
  }
213
221
  }).catch(error => {
214
222
  console.log(error)
@@ -232,6 +240,7 @@ export default {
232
240
  }
233
241
  }
234
242
  }
243
+ this.$emit('optimizesucess', this.id)
235
244
  }
236
245
  }).catch(error => {
237
246
  console.log(error)
@@ -14,8 +14,9 @@
14
14
  <!-- 环模式true -->
15
15
  <div v-if="this.contrloType === 'ring' || !this.contrloType">
16
16
  <div class="ring-first" v-for="(list, index1) in patternInfo" :key="index1">
17
- <div style="position: relative;" :style="{'height': '34px','float':'left','width':((item.split+(item.sum?item.sum:0)) / (max?max:item.cycle) * 100) + '%'}" v-for="(item,index2) in list" :key="index2" :class="item.mode===7?'direction': ''">
18
- <div class="first-1" :class="item.mode === 8 ? 'mask' : item.mode === 9 ? 'yellowClass' : ''" :style="{'width':Number(item.greenWidth.replace('%', ''))/Number((((item.split+(item.sum?item.sum:0)) / (max?max:item.cycle) * 100) + '%').replace('%', ''))*100+'%','height':'34px','background':'#7ccc66'}">
17
+ <draggable :move="move" @end="endDrag(index1)" :disabled="isMove" :list="list">
18
+ <div style="position: relative;" :style="{'height': '34px','float':'left','width':((item.split+(item.sum?item.sum:0)) / (max?max:item.cycle) * 100) + '%'}" v-for="(item,index2) in list" :key="index2" :class="item.mode===7?'direction': ''">
19
+ <div class="first-1" :class="item.mode === 8 ? 'mask' : item.mode === 9 ? 'yellowClass' : ''" :style="{'width':Number(item.greenWidth.replace('%', ''))/Number((((item.split+(item.sum?item.sum:0)) / (max?max:item.cycle) * 100) + '%').replace('%', ''))*100+'%','height':'34px','background':'#7ccc66'}">
19
20
  <el-tooltip placement="top-start" effect="light">
20
21
  <div slot="content">{{$t('openatccomponents.phase.phase')}}{{item.id}}:{{item.split}}</div>
21
22
  <div style="cursor:pointer;">
@@ -25,7 +26,18 @@
25
26
  </div>
26
27
  <div v-if="isShowTip" class="box" style="position: absolute; left:40px; width:40px; top: -1px;">
27
28
  <div class="ring-nums">{{$t('openatccomponents.phase.phase')}}{{item.id}}</div>
28
- <div class="ring-nums">{{item.split}}</div>
29
+ <div v-if="isMove" class="ring-nums">{{item.split}}</div>
30
+ <el-input-number
31
+ v-if="!isMove"
32
+ class="ring-nums"
33
+ size="small"
34
+ :controls="false"
35
+ :min="0"
36
+ :step="1"
37
+ v-model.number="item.split"
38
+ @change="handleEdit(item)"
39
+ style="width: 24px"
40
+ ></el-input-number>
29
41
  </div>
30
42
  </div>
31
43
  </el-tooltip>
@@ -41,7 +53,8 @@
41
53
  <div class="first-1" :class="item.mode === 8 ? 'mask' : item.mode === 9 ? 'yellowClass' : ''" :style="{'width':Number(item.flashgreen.replace('%', ''))/Number((((item.split+(item.sum?item.sum:0)) / (max?max:item.cycle) * 100).toFixed(3) + '%').replace('%', ''))*100+'%','height':'34px','float':'left','background': 'linear-gradient(to right, #ffffff 50%, #7ccc66 0)','background-size': '4px 100%'}"></div>
42
54
  <div class="first-1" :class="item.mode === 8 ? 'mask' : item.mode === 9 ? 'yellowClass' : ''" :style="{'width':Number(item.yellowWidth.replace('%', ''))/Number((((item.split+(item.sum?item.sum:0)) / (max?max:item.cycle) * 100) + '%').replace('%', ''))*100+'%','height':'34px','background':'#f9dc6a'}"></div>
43
55
  <div class="first-1" :class="item.mode === 8 ? 'mask' : item.mode === 9 ? 'yellowClass' : ''" :style="{'width':Number(item.redWidth.replace('%', ''))/Number((((item.split+(item.sum?item.sum:0)) / (max?max:item.cycle) * 100).toFixed(3) + '%').replace('%', ''))*100+'%','height':'34px','background':'#f27979'}"></div>
44
- </div>
56
+ </div>
57
+ </draggable>
45
58
  </div>
46
59
  <div v-if="showBarrier">
47
60
  <div v-for="(item, index) in barrierList" :key="index + '1'">
@@ -100,6 +113,7 @@
100
113
  <script>
101
114
  // import patternwalksvg from '../PatternWalkSvg/PatternWalkSvg'
102
115
  import xdrdirselector from '../XRDDirSelector/XRDDirSelector'
116
+ import draggable from 'vuedraggable'
103
117
  // import PatternWalkSvg from '../IntersectionMap/crossDirection/baseImg/PatternWalkSvg'
104
118
  import PhaseDataModel from '../IntersectionMap/crossDirection/utils.js'
105
119
  import CrossDiagramMgr from '../../../EdgeMgr/controller/crossDiagramMgr.js'
@@ -107,6 +121,7 @@ export default {
107
121
  name: 'pattern-list',
108
122
  components: {
109
123
  // patternwalksvg,
124
+ draggable,
110
125
  xdrdirselector
111
126
  },
112
127
  data () {
@@ -114,6 +129,7 @@ export default {
114
129
  barrierHeight: '',
115
130
  stageCycle: '',
116
131
  barrierList: [],
132
+ barrierArr: [],
117
133
  newCycle: this.cycles,
118
134
  patternIds: this.patternId,
119
135
  newPatterns: [],
@@ -142,6 +158,10 @@ export default {
142
158
  stagesChange: {
143
159
  type: Array
144
160
  },
161
+ isMove: {
162
+ type: Boolean,
163
+ default: true
164
+ },
145
165
  controlPhase: {
146
166
  type: Object
147
167
  },
@@ -343,11 +363,11 @@ export default {
343
363
  handler: function (val, oldVal) {
344
364
  this.handleBarrierHeight() // 计算屏障高度
345
365
  if (this.patternStatusList && this.newCycle) {
346
- setTimeout(() => {
347
- this.handleCurrentChange(this.patternStatusList)
348
- this.handleBarrierHeight()
349
- }, 10)
366
+ // setTimeout(() => {
367
+ this.handleCurrentChange(this.patternStatusList)
350
368
  this.handleBarrierHeight()
369
+ // }, 10)
370
+ // this.handleBarrierHeight()
351
371
  }
352
372
  },
353
373
  // 深度观察监听
@@ -375,6 +395,60 @@ export default {
375
395
  }
376
396
  },
377
397
  methods: {
398
+ move (e) {
399
+ // 这里的e表示即将停靠的元素。
400
+ let result = this.barrierArr.filter(item => item.includes(e.relatedContext.element.id))[0]
401
+ if (!result.includes(e.draggedContext.element.id)) {
402
+ return false
403
+ }
404
+ },
405
+ endDrag (index) {
406
+ // 拖动后对原数据排序
407
+ const idIndexMap = {}
408
+ this.patternInfo.forEach((subArray, subArrayIndex) => {
409
+ subArray.forEach((item, index) => {
410
+ idIndexMap[item.id] = { subArrayIndex, index }
411
+ })
412
+ })
413
+ this.patternStatusList.forEach((subArray, subArrayIndex) => {
414
+ if (subArray.length > 0) {
415
+ subArray.sort((aItem, bItem) => {
416
+ const aIndex = idIndexMap[aItem.id] ? idIndexMap[aItem.id].index : Infinity
417
+ const bIndex = idIndexMap[bItem.id] ? idIndexMap[bItem.id].index : Infinity
418
+ return aIndex - bIndex
419
+ })
420
+ }
421
+ })
422
+ },
423
+ handleEdit (val) {
424
+ this.patternStatusList.map(d => {
425
+ d.map(r => {
426
+ if (r.id === val.id) {
427
+ r.value = val.split
428
+ }
429
+ })
430
+ })
431
+ // this.handleCurrentChange(this.patternStatusList)
432
+ this.$emit('handleSplitMove', this.patternId)
433
+ },
434
+ getMaxCycle (pattern) {
435
+ // let rings = pattern.rings
436
+ let maxCycle = 0
437
+ for (let ring of pattern) {
438
+ if (ring.length === 0) continue
439
+ let cycle = 0
440
+ for (let r of ring) {
441
+ if (r.mode === 7) { // 忽略相位不计周期
442
+ continue
443
+ }
444
+ cycle = cycle + r.value
445
+ }
446
+ if (cycle > maxCycle) {
447
+ maxCycle = cycle
448
+ }
449
+ }
450
+ return maxCycle
451
+ },
378
452
  getPed (data) {
379
453
  let ped = []
380
454
  for (let stg of data) {
@@ -1179,6 +1253,7 @@ export default {
1179
1253
  }
1180
1254
  }
1181
1255
  let resArr = ringArr.map(item => item.data)
1256
+ this.barrierArr = resArr
1182
1257
  let ringTeam = this.step1(this.phaseList, resArr)
1183
1258
  let ringTeams = ringTeam.filter(item => item.length !== 0)
1184
1259
  if (this.patternList) {
@@ -5,6 +5,7 @@
5
5
  :contrloType="contrloType"
6
6
  :stagesChange="stagesChange"
7
7
  :isShowTip="isShowTip"
8
+ :isMove="isMove"
8
9
  :patternStatusList="patternStatusList"
9
10
  :cycles="cycles"
10
11
  :cycle="cycle"
@@ -19,6 +20,7 @@
19
20
  :agentId="agentId"
20
21
  :controlData="controlData"
21
22
  :syncTime="syncTime"
23
+ @handleSplitMove="handleSplitMove"
22
24
  :isPhase="isPhase"
23
25
  >
24
26
  </BoardCard>
@@ -502,6 +504,10 @@ export default {
502
504
  type: Boolean,
503
505
  default: true
504
506
  },
507
+ isMove: {
508
+ type: Boolean,
509
+ default: true
510
+ },
505
511
  contrloType: {
506
512
  type: String
507
513
  },
@@ -581,6 +587,11 @@ export default {
581
587
  // if (this.$route.query !== undefined && Object.keys(this.$route.query).length) {
582
588
  // this.resetCrossDiagram()
583
589
  // }
590
+ },
591
+ methods: {
592
+ handleSplitMove (data) {
593
+ this.$emit('handleSplitMove', data)
594
+ }
584
595
  }
585
596
  }
586
597
  </script>