openatc-components 0.4.3 → 0.4.5

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.
@@ -32,7 +32,7 @@
32
32
  <div class="right-dir-road" v-if="roadDir === 'right'">
33
33
  <div class="centerText" v-if="crossType !== 'Customroads' && isHasPhase">
34
34
  <!-- 相位倒计时 -->
35
- <div class="phaseCountdown" v-show="isShowInterval" v-if="isLoaded && isHasPhase && isHasCountdown" :class="{'countdownBg': isLoaded}">
35
+ <div class="phaseCountdown" v-show="isShowInterval" v-if="isLoaded && isHasPhase && isHasCountdown && contrloType === 'ring'" :class="{'countdownBg': isLoaded}">
36
36
  <div v-for="curPhase in phaseCountdownList" :key="curPhase.id" :style="{color: curPhase.phaseCountdownColor}">
37
37
  <div v-if="curPhase.phaseCountdown !== undefined && curPhase.phaseCountdown !== -1" style="overflow: hidden;margin-bottom: 4px;">
38
38
  <span style="float: left;width: 42px;height: 42px;position: relative;border: 1px solid rgba(255, 255, 255, 0.1);margin-right: 5px;">
@@ -45,15 +45,13 @@
45
45
  </div>
46
46
  <!-- 阶段倒计时 -->
47
47
  <div class="phaseCountdown" v-show="isShowInterval" v-if="isLoaded && contrloType === 'stage'" :class="{'countdownBg': isLoaded}">
48
- <div v-for="curStage in stageCountdownList" :key="curStage.id" :style="{color: curStage.phaseCountdownColor}">
49
- <div style="overflow: hidden;margin-bottom: 4px;">
48
+ <div style="overflow: hidden;margin-bottom: 4px;" :style="{color: stageCountdownList[0].phaseCountdownColor}">
50
49
  <span style="float: left;width: 42px;height: 42px;position: relative;border: 1px solid rgba(255, 255, 255, 0.1);margin-right: 5px;">
51
- <xdr-dir-selector :Data="xdrData" :Datas="xdrpedData" Width="55px" Height="55px" Widths="55px" Heights="55px" :showlist="curStage.showlist" :roadDirection="roadDirection"></xdr-dir-selector>
50
+ <xdr-dir-selector :Data="xdrData" :Datas="xdrpedData" Width="55px" Height="55px" Widths="55px" Heights="55px" :showlist="dirListSetTheme(stageCountdownList)" :roadDirection="roadDirection"></xdr-dir-selector>
52
51
  </span>
53
52
  <span style="float: left;color: #fff;margin-right: 8px;width: 30px;">S{{crossStatusData.current_stage}}:</span>
54
53
  <span style="float: left;font-size: 25px;">{{crossStatusData.current_stagecd}}</span>
55
54
  </div>
56
- </div>
57
55
  </div>
58
56
  <!-- 手动刷新 -->
59
57
  <div v-if="!isLoaded">
@@ -109,7 +107,7 @@
109
107
  <div class="left-dir-road" v-if="roadDir === 'left'">
110
108
  <div class="centerText" v-if="crossType !== 'Customroads' && isHasPhase">
111
109
  <!-- 相位倒计时 -->
112
- <div class="phaseCountdown" v-show="isShowInterval" v-if="isLoaded && isHasPhase && isHasCountdown" :class="{'countdownBg': isLoaded}">
110
+ <div class="phaseCountdown" v-show="isShowInterval" v-if="isLoaded && isHasPhase && isHasCountdown && contrloType === 'ring'" :class="{'countdownBg': isLoaded}">
113
111
  <div v-for="curPhase in phaseCountdownList" :key="curPhase.id" :style="{color: curPhase.phaseCountdownColor}">
114
112
  <div v-if="curPhase.phaseCountdown !== undefined && curPhase.phaseCountdown !== -1" style="overflow: hidden;margin-bottom: 4px;">
115
113
  <span style="float: left;width: 42px;height: 42px;position: relative;border: 1px solid rgba(255, 255, 255, 0.1);margin-right: 5px;">
@@ -117,20 +115,18 @@
117
115
  </span>
118
116
  <span style="float: left;color: #fff;margin-right: 8px;width: 30px;">P{{curPhase.id}}:</span>
119
117
  <span style="float: left;font-size: 25px;">{{curPhase.phaseCountdown}}</span>
118
+ </div>
120
119
  </div>
121
- </div>
122
120
  </div>
123
121
  <!-- 阶段倒计时 -->
124
122
  <div class="phaseCountdown" v-show="isShowInterval" v-if="isLoaded && contrloType === 'stage'" :class="{'countdownBg': isLoaded}">
125
- <div v-for="curStage in stageCountdownList" :key="curStage.id" :style="{color: curStage.phaseCountdownColor}">
126
- <div style="overflow: hidden;margin-bottom: 4px;">
123
+ <div style="overflow: hidden;margin-bottom: 4px;" :style="{color: stageCountdownList[0].phaseCountdownColor}">
127
124
  <span style="float: left;width: 42px;height: 42px;position: relative;border: 1px solid rgba(255, 255, 255, 0.1);margin-right: 5px;">
128
- <xdr-dir-selector :Data="xdrData" :Datas="xdrpedData" Width="55px" Height="55px" Widths="55px" Heights="55px" :showlist="curStage.showlist" :roadDirection="roadDirection"></xdr-dir-selector>
125
+ <xdr-dir-selector :Data="xdrData" :Datas="xdrpedData" Width="55px" Height="55px" Widths="55px" Heights="55px" :showlist="dirListSetTheme(stageCountdownList)" :roadDirection="roadDirection"></xdr-dir-selector>
129
126
  </span>
130
127
  <span style="float: left;color: #fff;margin-right: 8px;width: 30px;">S{{crossStatusData.current_stage}}:</span>
131
128
  <span style="float: left;font-size: 25px;">{{crossStatusData.current_stagecd}}</span>
132
129
  </div>
133
- </div>
134
130
  </div>
135
131
  <!-- 手动刷新 -->
136
132
  <div v-if="!isLoaded">
@@ -203,6 +199,8 @@ import BusMapSvg from './busIcon/busMapSvg'
203
199
  import { getMessageByCode } from '../../../../utils/responseMessage.js'
204
200
 
205
201
  import CrossDirectionConflictList from '../../../../utils/conflictList.js'
202
+ import RingDataModel from '../../../../utils/RingDataModel.js'
203
+ import { getTheme } from '../../../../utils/auth.js'
206
204
 
207
205
  export default {
208
206
  name: 'crossDiagram',
@@ -391,7 +389,8 @@ export default {
391
389
  left: '1px',
392
390
  top: '1px'
393
391
  },
394
- isHasCountdown: false
392
+ isHasCountdown: false,
393
+ contrloType: 'ring'
395
394
  }
396
395
  },
397
396
  methods: {
@@ -526,11 +525,6 @@ export default {
526
525
  item.id = ''
527
526
  item.phaseCountdownColor = '#fff'
528
527
  })
529
- this.stageCountdownList.forEach(item => {
530
- item.phaseCountdown = ''
531
- item.id = ''
532
- item.phaseCountdownColor = '#fff'
533
- })
534
528
  }
535
529
  if (this.compLanePhaseData.length) {
536
530
  const compLanePhaseData = this.compLanePhaseData.map(data => ({
@@ -730,30 +724,45 @@ export default {
730
724
  })
731
725
  })
732
726
  },
727
+ stagesList () {
728
+ let list = []
729
+ if (this.crossStatusData && this.crossStatusData.stages && this.crossInfo.phaseList && this.crossInfo.phaseList.length > 0) {
730
+ let ringDataModel = new RingDataModel(this.crossStatusData, this.crossInfo.phaseList)
731
+ list = ringDataModel.getStageData()
732
+ if (this.isShowCurrentStage) {
733
+ this.currentStage = this.crossStatusData.current_stage
734
+ }
735
+ }
736
+ return list
737
+ },
738
+ dirListSetTheme (list) {
739
+ let dirArr = []
740
+ let color = getTheme() === 'light' ? '#606266' : '#fff'
741
+ let pedColor = getTheme() === 'light' ? '#606266' : 'rgba(255, 255, 255, 0.6)'
742
+ for (let rec of list) {
743
+ let recd = {
744
+ ...rec,
745
+ color: color
746
+ }
747
+ dirArr.push(recd)
748
+ for (let i = 0; i < rec.peddirection.length; i++) {
749
+ rec.peddirection[i].color = pedColor
750
+ }
751
+ }
752
+ return dirArr
753
+ },
733
754
  getCurStageCountdown () {
734
755
  // 获取当前相位倒计时颜色
735
756
  this.stageCountdownList = []
736
- this.phaseStatusList.forEach(phaseInfo => {
737
- if (phaseInfo.id === this.curStage) {
738
- let countdownObj = {}
739
- countdownObj.id = phaseInfo.id
740
- countdownObj.phaseCountdown = phaseInfo.countdown
741
- countdownObj.phaseCountdownColor = this.ColorMap.get(phaseInfo.type)
742
- let curphasedir = this.phaseDirMap.get(phaseInfo.id)
743
- if (curphasedir !== undefined) {
744
- countdownObj.showlist = curphasedir.direction.map(dir => {
745
- return {
746
- id: dir,
747
- peddirection: this.getshowped(curphasedir.peddirection),
748
- color: '#fff'
749
- }
750
- })
751
- } else {
752
- countdownObj.showlist = []
753
- }
754
- this.stageCountdownList.push(countdownObj)
757
+ let stagesList = this.stagesList()
758
+ this.stageCountdownList = stagesList[this.curStage - 1]
759
+ this.stageCountdownList = this.stageCountdownList.map(phaseInfo => {
760
+ return {
761
+ ...phaseInfo,
762
+ phaseCountdownColor: this.ColorMap.get(phaseInfo.type)
755
763
  }
756
764
  })
765
+ // console.log(this.stageCountdownList)
757
766
  },
758
767
  getshowped (peddirection) {
759
768
  let peddirarr = peddirection.map(peddir => ({
@@ -765,6 +774,7 @@ export default {
765
774
  },
766
775
  getIntersectionInfo () {
767
776
  // 获取路口信息
777
+ this.contrloType = 'ring'
768
778
  const agentid = this.agentId
769
779
  getIntersectionInfo(agentid).then(res => {
770
780
  if (!res.data.success) {
@@ -802,6 +812,10 @@ export default {
802
812
  this.allPatternList = res.data.data.param.patternList
803
813
  if (this.allPatternList[0].rings === undefined || this.allPatternList[0].rings.length === 0) {
804
814
  this.contrloType = 'stage'
815
+ } else if (this.allPatternList[0].contrloType === 'stage') {
816
+ this.contrloType = 'stage'
817
+ } else {
818
+ this.contrloType = 'ring'
805
819
  }
806
820
  })
807
821
  },