openatc-components 0.5.2 → 0.5.3

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.
@@ -50,7 +50,7 @@
50
50
  <div v-if="(this.contrloType === 'ring' || !this.contrloType) && patternType !== 'rcp'">
51
51
  <div class="ring-first" v-for="(list, index1) in patternInfo" :key="index1">
52
52
  <draggable :move="move" @end="endDrag(index1)" :disabled="isMove" :list="list">
53
- <div style="position: relative;" :style="{'height': '35px','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' : isBorder ? 'hovercell' : ''">
53
+ <div class="cell-click-area" @click="cellClick(item.id)" style="position: relative;" :style="{'height': '35px','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' : isBorder ? 'hovercell' : ''">
54
54
  <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'}">
55
55
  <el-tooltip placement="top-start" effect="light">
56
56
  <div slot="content">{{$t('openatccomponents.phase.phase')}}{{item.id}}:{{item.split}}</div>
@@ -63,7 +63,7 @@
63
63
  <div @click="focusInput(item.id)" class="ring-nums">{{$t('openatccomponents.phase.phase')}}{{item.id}}</div>
64
64
  <div v-if="isMove" class="ring-nums">{{item.split}}</div>
65
65
  <el-input-number
66
- v-if="!isMove"
66
+ v-if="!isMove && !controlStates[item.id]"
67
67
  class="ring-nums"
68
68
  :ref="'inputNumbers' + item.id"
69
69
  size="small"
@@ -77,6 +77,21 @@
77
77
  </div>
78
78
  </div>
79
79
  </el-tooltip>
80
+ <div
81
+ v-if="isShowTip"
82
+ class="box"
83
+ style="position: absolute; width:40px;left: 35px; top: 1px;z-index:999"
84
+ >
85
+ <el-input-number
86
+ v-if="controlStates[item.id]"
87
+ :ref="'inputNumbers' + item.id"
88
+ size="small"
89
+ :min="0"
90
+ :step="1"
91
+ v-model.number="item.split"
92
+ @change="handleEdit(item)"
93
+ ></el-input-number>
94
+ </div>
80
95
  <div style="width:50px;" v-for="(bus,index3) in busPhaseData" :key="index3">
81
96
  <i class="iconfont icon-lukouzhilu" style="position: absolute;top: 8px;left:70px;font-size:12px;color:#454545;" v-if="bus.controltype === 1 && bus.phaseid===item.id"></i>
82
97
  <i class="iconfont icon-BRT" style="position: absolute;top: 8px;left:70px;font-size:12px;color:#454545;" v-if="bus.controltype === 4 && bus.phaseid===item.id"></i>
@@ -165,6 +180,7 @@ export default {
165
180
  barrierHeight: '',
166
181
  stageCycle: '',
167
182
  barrierList: [],
183
+ controlStates: {},
168
184
  barrierArr: [],
169
185
  newCycle: this.cycles,
170
186
  patternIds: this.patternId,
@@ -426,6 +442,12 @@ export default {
426
442
  // 深度观察监听
427
443
  deep: true
428
444
  }
445
+ },
446
+ mounted () {
447
+ document.addEventListener('click', this.handleDocumentClick)
448
+ },
449
+ beforeDestroy () {
450
+ document.removeEventListener('click', this.handleDocumentClick)
429
451
  },
430
452
  created () {
431
453
  this.globalParamModel = this.$store.getters.globalParamModel
@@ -451,6 +473,29 @@ export default {
451
473
  }
452
474
  },
453
475
  methods: {
476
+ cellClick (itemId) {
477
+ for (const key in this.controlStates) {
478
+ if (key !== itemId) {
479
+ this.$set(this.controlStates, key, false)
480
+ }
481
+ }
482
+ this.$set(this.controlStates, itemId, !this.controlStates[itemId])
483
+ },
484
+ handleDocumentClick (event) {
485
+ const path = event.composedPath ? event.composedPath() : []
486
+ const clickedInsideCell = path.some(el => {
487
+ return el.classList && (el.classList.contains('cell-click-area') || el.classList.contains('ring-first'))
488
+ })
489
+
490
+ if (clickedInsideCell) {
491
+ return
492
+ }
493
+ for (const key in this.controlStates) {
494
+ if (this.controlStates[key]) {
495
+ this.$set(this.controlStates, key, false)
496
+ }
497
+ }
498
+ },
454
499
  move (e) {
455
500
  // 这里的e表示即将停靠的元素。
456
501
  let result = this.barrierArr.filter(item => item.includes(e.relatedContext.element.id))[0]