openatc-components 0.4.4 → 0.4.6

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/config/index.js CHANGED
@@ -16,7 +16,7 @@ module.exports = {
16
16
  // target: 'http://192.168.14.2:8012/openatc',//'http://172.16.239.139:8080/',//设置你调用的接口域名和端口号
17
17
  // target: 'https://dolphin-test.kedacom.com/openatc',
18
18
  // target: 'http://192.168.13.105:11003/openatc',
19
- target: 'http://192.168.13.103:10003/openatc',
19
+ target: 'http://192.168.13.112:30003/openatc',
20
20
  // target: 'http://10.165.32.135:30555/openatc',
21
21
  // target: 'http://192.168.15.11:8012/openatc',
22
22
  // target: 'http://192.168.13.103:10003/openatc',
@@ -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,7 @@ 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'
206
203
 
207
204
  export default {
208
205
  name: 'crossDiagram',
@@ -391,7 +388,8 @@ export default {
391
388
  left: '1px',
392
389
  top: '1px'
393
390
  },
394
- isHasCountdown: false
391
+ isHasCountdown: false,
392
+ contrloType: 'ring'
395
393
  }
396
394
  },
397
395
  methods: {
@@ -526,11 +524,6 @@ export default {
526
524
  item.id = ''
527
525
  item.phaseCountdownColor = '#fff'
528
526
  })
529
- this.stageCountdownList.forEach(item => {
530
- item.phaseCountdown = ''
531
- item.id = ''
532
- item.phaseCountdownColor = '#fff'
533
- })
534
527
  }
535
528
  if (this.compLanePhaseData.length) {
536
529
  const compLanePhaseData = this.compLanePhaseData.map(data => ({
@@ -730,30 +723,43 @@ export default {
730
723
  })
731
724
  })
732
725
  },
726
+ stagesList () {
727
+ let list = []
728
+ if (this.crossStatusData && this.crossStatusData.stages && this.crossInfo.phaseList && this.crossInfo.phaseList.length > 0) {
729
+ let ringDataModel = new RingDataModel(this.crossStatusData, this.crossInfo.phaseList)
730
+ list = ringDataModel.getStageData()
731
+ if (this.isShowCurrentStage) {
732
+ this.currentStage = this.crossStatusData.current_stage
733
+ }
734
+ }
735
+ return list
736
+ },
737
+ dirListSetTheme (list) {
738
+ let dirArr = []
739
+ for (let rec of list) {
740
+ let recd = {
741
+ ...rec,
742
+ color: '#fff'
743
+ }
744
+ dirArr.push(recd)
745
+ for (let i = 0; i < rec.peddirection.length; i++) {
746
+ rec.peddirection[i].color = 'rgba(255, 255, 255, 0.6)'
747
+ }
748
+ }
749
+ return dirArr
750
+ },
733
751
  getCurStageCountdown () {
734
752
  // 获取当前相位倒计时颜色
735
753
  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)
754
+ let stagesList = this.stagesList()
755
+ this.stageCountdownList = stagesList[this.curStage - 1]
756
+ this.stageCountdownList = this.stageCountdownList.map(phaseInfo => {
757
+ return {
758
+ ...phaseInfo,
759
+ phaseCountdownColor: this.ColorMap.get(phaseInfo.type)
755
760
  }
756
761
  })
762
+ // console.log(this.stageCountdownList)
757
763
  },
758
764
  getshowped (peddirection) {
759
765
  let peddirarr = peddirection.map(peddir => ({
@@ -765,6 +771,7 @@ export default {
765
771
  },
766
772
  getIntersectionInfo () {
767
773
  // 获取路口信息
774
+ this.contrloType = 'ring'
768
775
  const agentid = this.agentId
769
776
  getIntersectionInfo(agentid).then(res => {
770
777
  if (!res.data.success) {
@@ -802,6 +809,10 @@ export default {
802
809
  this.allPatternList = res.data.data.param.patternList
803
810
  if (this.allPatternList[0].rings === undefined || this.allPatternList[0].rings.length === 0) {
804
811
  this.contrloType = 'stage'
812
+ } else if (this.allPatternList[0].contrloType === 'stage') {
813
+ this.contrloType = 'stage'
814
+ } else {
815
+ this.contrloType = 'ring'
805
816
  }
806
817
  })
807
818
  },