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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openatc-components",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "A Vue.js project",
5
5
  "author": "openatc developer",
6
6
  "private": false,
@@ -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
  },
@@ -195,8 +195,10 @@ export default class RingDataModel {
195
195
  let currPhaseid = ''
196
196
  let stageControType = 0
197
197
  let peddirections = []
198
+ let phasetype
198
199
  for (let stg of stage) {
199
200
  let phaseMode = data.phase.filter(item => item.id === stg)
201
+ phasetype = phaseMode[0].type
200
202
  let currPhase = this.phaseList.filter((item) => {
201
203
  return item.id === stg
202
204
  })[0]
@@ -235,7 +237,8 @@ export default class RingDataModel {
235
237
  color: '#606266',
236
238
  controltype: stageControType,
237
239
  peddirection: peddirections,
238
- sidewalkPhaseData: sidewalkPhaseData
240
+ sidewalkPhaseData: sidewalkPhaseData,
241
+ type: phasetype
239
242
  }
240
243
  return temp
241
244
  })
@@ -246,7 +249,8 @@ export default class RingDataModel {
246
249
  color: '#606266',
247
250
  controltype: stageControType,
248
251
  peddirection: peddirections,
249
- sidewalkPhaseData: sidewalkPhaseData
252
+ sidewalkPhaseData: sidewalkPhaseData,
253
+ type: phasetype
250
254
  }
251
255
  ]
252
256
  }
@@ -167,7 +167,7 @@ export default {
167
167
  // agentId: '12007_390',
168
168
  // agentId: '12014',
169
169
  reqUrl: 'http://192.168.13.103:10003/openatc',
170
- Token: 'eyJraWQiOiIxNzMwODU1NTQ1NzA3IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTczMDg1OTE0NSwiaWF0IjoxNzMwODUxOTQ1fQ.CBl61S3eRifl4qEtTmgVjOZGo2hqNSGQKPxG1bN-utU',
170
+ Token: 'eyJraWQiOiIxNzM1ODY3ODI0OTY0IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTczNTg3MTQyNCwiaWF0IjoxNzM1ODY0MjI0fQ.vgMCKzQK4Gt9y7LYCqo77JM4qk-lWazKzAajVKs8ugE',
171
171
  // agentId: '30003-352',
172
172
  // reqUrl: 'https://kints-dev.devdolphin.com/openatc',
173
173
  // Token: 'eyJraWQiOiIxNjUwNTA5MDI2ODk2IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJ4aWFvbWluZyIsImV4cCI6MTczNjkwOTAyNiwiaWF0IjoxNjUwNTA5MDI2fQ.-s4T-uMRmB2zf9yer87USKQXLY1a12Zq5lCOnqjNmfA',
@@ -10,7 +10,7 @@
10
10
  :Token="Token"></overview> -->
11
11
  <el-button @click="handleChangeOverview">切换overview组件</el-button>
12
12
  <overview-component
13
- :AgentId="agentId2"
13
+ :AgentId="agentid2"
14
14
  :isShowInterval="isShowInterval"
15
15
  :isShowMessage ="isShowMessage"/>
16
16
  </div>
@@ -26,7 +26,7 @@ export default {
26
26
  controlName: '步进',
27
27
  agentId: '13013',
28
28
  agentid1: 'gjnlahql',
29
- agentid2: '12007_390',
29
+ agentid2: '12007_001',
30
30
  isShowMessage: false,
31
31
  isShowInterval: true,
32
32
  sum: 0,