openatc-components 0.2.89 → 0.3.1

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.
@@ -0,0 +1,2 @@
1
+ import PhasePedSelect from './index.vue'
2
+ export default PhasePedSelect
@@ -0,0 +1,192 @@
1
+ /**
2
+ * Copyright (c) 2020 kedacom
3
+ * OpenATC is licensed under Mulan PSL v2.
4
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5
+ * You may obtain a copy of Mulan PSL v2 at:
6
+ * http://license.coscl.org.cn/MulanPSL2
7
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10
+ * See the Mulan PSL v2 for more details.
11
+ **/
12
+ <template>
13
+ <div class="PhasePedSelect">
14
+ <div class="item">
15
+ <div class="name">{{$t('openatccomponents.channel.phaseVehicle')}}:</div>
16
+ <div class="content">
17
+ <template v-for="(ring, index) in phaseDirection">
18
+ <div :class="ring.selected ? 'card-selected' : 'card'" :key="ring" @click="onCardClick(ring, index)" :style="getStyle(ring)">
19
+ <xdrdirselector
20
+ Width="75PX"
21
+ Height="75PX"
22
+ Widths="95PX"
23
+ Heights="65PX"
24
+ :showlist="ring.desc"
25
+ :roadDirection="roadDirection"></xdrdirselector>
26
+ <div class="num">{{ring.id}}</div>
27
+ </div>
28
+ </template>
29
+ </div>
30
+ </div>
31
+ <div class="item">
32
+ <div class="name">{{$t('openatccomponents.channel.phasePedestrian')}}:</div>
33
+ <div class="content">
34
+ <template v-for="(ring, index) in pedDirection">
35
+ <div :class="ring.selected ? 'card-selected' : 'card'" :key="ring" @click="onCardClick(ring, index)">
36
+ <xdrdirselector
37
+ Width="75PX"
38
+ Height="75PX"
39
+ Widths="65PX"
40
+ Heights="65PX"
41
+ :showlist="ring.desc"
42
+ :roadDirection="roadDirection"></xdrdirselector>
43
+ <div class="num">{{ring.id}}</div>
44
+ </div>
45
+ </template>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ </template>
50
+ <script>
51
+ import xdrdirselector from '../XRDDirSelector/XRDDirSelector.vue'
52
+ import { getTheme } from '../../../utils/auth'
53
+
54
+ export default {
55
+ name: 'PhasePedSelect',
56
+ components: {
57
+ xdrdirselector
58
+ // patternwalksvg
59
+ },
60
+ props: {
61
+ closePhaseRings: {
62
+ type: Array,
63
+ default: () => []
64
+ },
65
+ sidewalkPhaseData: {
66
+ type: Array,
67
+ default: () => []
68
+ },
69
+ headerText: {
70
+ type: String
71
+ },
72
+ list: {
73
+ type: Array,
74
+ default () {
75
+ return []
76
+ }
77
+ },
78
+ roadDirection: {
79
+ type: String
80
+ }
81
+ },
82
+ data () {
83
+ return {
84
+ themeColor: getTheme() === 'light' ? '#606266' : '#fff',
85
+ backgroundBase: getTheme() === 'light' ? '#606266' : '#fff',
86
+ backgroundSelected: getTheme() === 'light' ? '#606266' : '#fff',
87
+ phaseList: [],
88
+ pedPhaseList: [],
89
+ phaseDirection: [],
90
+ pedDirection: [],
91
+ params: {
92
+ 'phases':
93
+ [
94
+ {
95
+ 'id': 1,
96
+ 'type': 0
97
+ },
98
+ {
99
+ 'id': 2,
100
+ 'type': 2
101
+ },
102
+ {
103
+ 'id': 3,
104
+ 'type': 3
105
+ }
106
+ ]
107
+ }
108
+ }
109
+ },
110
+ watch: {
111
+ closePhaseRings (val) {
112
+ console.log('closePhaseRings', val)
113
+ console.log('sidewalkPhaseData', this.sidewalkPhaseData)
114
+ let tempPhaseList = []
115
+ for (let ring of this.closePhaseRings) {
116
+ let phases = ring.phases
117
+ tempPhaseList = [...tempPhaseList, ...phases]
118
+ }
119
+ tempPhaseList = tempPhaseList.sort((a, b) => a.id - b.id)
120
+ let tempPhaseListCopy = JSON.parse(JSON.stringify(tempPhaseList))
121
+ tempPhaseList = tempPhaseList.map(item => {
122
+ item.selected = false
123
+ item.desc.map(des => {
124
+ des.color = this.themeColor
125
+ des.peddirection = []
126
+ return des
127
+ })
128
+ return item
129
+ })
130
+ this.phaseDirection = JSON.parse(JSON.stringify(tempPhaseList))
131
+ let tempPedList = tempPhaseListCopy.filter(item => item.peddirection && item.peddirection.length > 0)
132
+ console.log('tempPhaseList', tempPedList)
133
+ tempPedList = tempPedList.map(item => {
134
+ item.selected = false
135
+ item.desc.map(des => {
136
+ des.id = 0
137
+ des.color = this.themeColor
138
+ des.peddirection = des.peddirection.map(dir => {
139
+ dir.color = this.themeColor
140
+ return dir
141
+ })
142
+ return des
143
+ })
144
+ return item
145
+ })
146
+ this.pedDirection = JSON.parse(JSON.stringify(tempPedList))
147
+ }
148
+ },
149
+ methods: {
150
+ onCardClick (item, index) {
151
+ item.selected = !item.selected
152
+ let res = this.getParams()
153
+ this.$emit('onPhasePedSelectChange', res)
154
+ },
155
+ getParams () {
156
+ console.log('phaseDirection', this.phaseDirection)
157
+ console.log('pedDirection', this.pedDirection)
158
+ console.log('closePhaseRings', this.closePhaseRings)
159
+ this.params.phases = []
160
+ for (let i = 0; i < this.phaseDirection.length; i++) {
161
+ let type = 0
162
+ let phase = this.phaseDirection[i]
163
+ let id = phase.id
164
+ let isPhaseSelected = phase.selected
165
+ if (isPhaseSelected) {
166
+ type = 2
167
+ }
168
+ let ped = this.pedDirection.find(item => item.id === id)
169
+ if (ped) {
170
+ let isPedSelected = ped.selected
171
+ if (isPhaseSelected && isPedSelected) {
172
+ type = 1
173
+ } else if (isPhaseSelected && !isPedSelected) {
174
+ type = 2
175
+ } else if (!isPhaseSelected && isPedSelected) {
176
+ type = 3
177
+ } else if (!isPhaseSelected && !isPedSelected) {
178
+ type = 0
179
+ }
180
+ }
181
+ let phaseItem = {
182
+ id: id,
183
+ type: type
184
+ }
185
+ this.params.phases.push(phaseItem)
186
+ }
187
+ let res = this.params.phases
188
+ return res
189
+ }
190
+ }
191
+ }
192
+ </script>
@@ -56,23 +56,23 @@
56
56
  </div>
57
57
  </div>
58
58
  <div v-if="currentName !==''" style="width: 100%; height: auto;overflow: hidden;">
59
- <div style="margin-top:20px" class="model-label-title">{{currentName}}{{$t('openatccomponents.overview.currentphase')}}:</div>
60
- <div class="control-model" v-for="(item, index) in sidewalkPhaseData" :key="index">
59
+ <div style="margin-top:20px" class="model-label-title">{{currentName}}{{$t('openatccomponents.overview.currentphase')}}:</div>
60
+ <div class="control-model" v-for="(item, index) in sidewalkPhaseData" :key="index">
61
61
  <div style="position:relative;" class="single-model" :style="{'backgroundColor': item[0].bgcolor}">
62
- <xdr-dir-selector Width="75PX" Height="75PX" Widths="65PX" Heights="65PX" :Data="showStyle" :Datas="showStyles" :showlist="dirListSetTheme(item)"></xdr-dir-selector>
63
- <div style="height:80px;display:flex;flex-direction:row;justify-content:center;align-items:end;">
64
- <div class="current-stage-num" :style="{color: themeColor}" style="width:20%;">{{index + 1}}</div>
65
- <div style="width:70%;">
66
- <i class="iconfont icon-feijidongche" :style="{color: themeColor}" style="font-size:11PX;color:#606266;margin-left:10PX" v-if="item[item.length-1].controltype === 6"></i>
67
- <i class="iconfont icon-lukouzhilu" :style="{color: themeColor2}" style="font-size:16PX;color:#454545;margin-left:10PX" v-if="item[item.length-1].controltype === 1"></i>
68
- <i class="iconfont icon-BRT" :style="{color: themeColor2}" style="font-size:11PX;color:#454545;margin-left:10PX" v-if="item[item.length-1].controltype === 4"></i>
69
- <div style="transform:scale(0.65);margin-left:10PX">
70
- <i class="iconfont icon-xuxiangwei-xin" :style="{color: themeColor2}" style="font-size:5PX;color:#454545;" v-if="item[item.length-1].controltype === 99"></i>
71
- </div>
72
- <i class="iconfont icon-gongjiaoche" :style="{color: themeColor}" style="font-size:11PX;color:#606266;margin-left:10PX" v-if="item[item.length-1].controltype === 3"></i>
73
- <i class="iconfont icon-youguidianche" :style="{color: themeColor}" style="font-size:11PX;color:#606266;margin-left:10PX" v-if="item[item.length-1].controltype === 5"></i>
74
- </div>
75
- </div>
62
+ <xdr-dir-selector Width="75PX" Height="75PX" Widths="65PX" Heights="65PX" :Data="showStyle" :Datas="showStyles" :showlist="dirListSetTheme(item)"></xdr-dir-selector>
63
+ <div style="height:80px;display:flex;flex-direction:row;justify-content:center;align-items:end;">
64
+ <div class="current-stage-num" :style="{color: themeColor}" style="width:20%;">{{index + 1}}</div>
65
+ <div style="width:70%;">
66
+ <i class="iconfont icon-feijidongche" :style="{color: themeColor}" style="font-size:11PX;color:#606266;margin-left:10PX" v-if="item[item.length-1].controltype === 6"></i>
67
+ <i class="iconfont icon-lukouzhilu" :style="{color: themeColor2}" style="font-size:16PX;color:#454545;margin-left:10PX" v-if="item[item.length-1].controltype === 1"></i>
68
+ <i class="iconfont icon-BRT" :style="{color: themeColor2}" style="font-size:11PX;color:#454545;margin-left:10PX" v-if="item[item.length-1].controltype === 4"></i>
69
+ <div style="transform:scale(0.65);margin-left:10PX">
70
+ <i class="iconfont icon-xuxiangwei-xin" :style="{color: themeColor2}" style="font-size:5PX;color:#454545;" v-if="item[item.length-1].controltype === 99"></i>
71
+ </div>
72
+ <i class="iconfont icon-gongjiaoche" :style="{color: themeColor}" style="font-size:11PX;color:#606266;margin-left:10PX" v-if="item[item.length-1].controltype === 3"></i>
73
+ <i class="iconfont icon-youguidianche" :style="{color: themeColor}" style="font-size:11PX;color:#606266;margin-left:10PX" v-if="item[item.length-1].controltype === 5"></i>
74
+ </div>
75
+ </div>
76
76
  </div>
77
77
  </div>
78
78
  </div>
@@ -60,15 +60,13 @@
60
60
  </el-col>
61
61
  </el-row>
62
62
  <el-row>
63
- <div class="model-label">{{$t('openatccomponents.overview.mode')}}:</div>
63
+ <!-- <div class="model-label">{{$t('openatccomponents.overview.mode')}}:</div>
64
64
  <div style="width: 100%; overflow: hidden;margin-top: 20px;">
65
65
  <common-kanban
66
66
  v-for="ring in closePhaseRings"
67
67
  :key="ring.num" class="closephasekanban"
68
68
  :list="ring.phases"
69
69
  :header-text="$t('openatccomponents.pattern.ring') + ring.num"
70
- :Draggable="false"
71
- :sidewalkPhaseData="sidewalkPhaseData"
72
70
  :roadDirection="roadDirection"
73
71
  @handleSort="handleSort">
74
72
  <template v-slot:kanbantitle>
@@ -85,7 +83,12 @@
85
83
  </el-select>
86
84
  </template>
87
85
  </common-kanban>
88
- </div>
86
+ </div> -->
87
+ <PhasePedSelect :closePhaseRings="closePhaseRings"
88
+ :sidewalkPhaseData="sidewalkPhaseData"
89
+ :roadDirection="roadDirection"
90
+ @onPhasePedSelectChange="onPhasePedSelectChange"
91
+ ></PhasePedSelect>
89
92
  </el-row>
90
93
  <div class="footer">
91
94
  <el-button v-if="isShowBack" @click="handleClose()">{{$t('openatccomponents.button.Back')}}</el-button>
@@ -98,9 +101,13 @@
98
101
  <script>
99
102
  import RingDataModel from '../../../../utils/RingDataModel.js'
100
103
  import { hasPermission } from '../../../../utils/auth'
104
+ import PhasePedSelect from '../../PhasePedSelect/index'
101
105
 
102
106
  export default {
103
107
  name: 'LockPhaselControl',
108
+ components: {
109
+ PhasePedSelect
110
+ },
104
111
  props: {
105
112
  phaseList: {
106
113
  type: Array
@@ -124,6 +131,7 @@ export default {
124
131
  },
125
132
  data () {
126
133
  return {
134
+ params: {},
127
135
  closePhaseRings: [],
128
136
  sidewalkPhaseData: [],
129
137
  manualInfo: {
@@ -152,6 +160,9 @@ export default {
152
160
  }
153
161
  },
154
162
  methods: {
163
+ onPhasePedSelectChange (params) {
164
+ this.phases = params
165
+ },
155
166
  handleClose () {
156
167
  this.$emit('closePhaseBack')
157
168
  },
@@ -175,7 +186,7 @@ export default {
175
186
  if (this.manualInfo.tempMingreen !== undefined) {
176
187
  submitdata.data.mingreen = Number(this.manualInfo.tempMingreen)
177
188
  }
178
- submitdata.data.phases = this.handleSubmitPhaseLocking()
189
+ submitdata.data.phases = this.phases
179
190
  this.$emit('closePhaseControl', submitdata)
180
191
  },
181
192
  handleSubmitPhaseLocking () {
@@ -467,6 +467,7 @@ export default {
467
467
  green: 25,
468
468
  yellow: 3,
469
469
  red: 2,
470
+ stageNo: 0,
470
471
  phases: [],
471
472
  stageSplit: 30
472
473
  })
@@ -556,6 +557,7 @@ export default {
556
557
  res.yellow = rings.yellow ? rings.yellow : rings.yellow === 0 ? 0 : 3
557
558
  res.red = rings.red ? rings.red : rings.red === 0 ? 0 : 2
558
559
  res.phases = rings.phases ? rings.phases : stageArr
560
+ res.stageNo = rings.stageNo ? rings.stageNo : 0
559
561
  // res.stageSplit = rings.split ? rings.split : 30
560
562
  if (rings.split) {
561
563
  res.stageSplit = rings.split
@@ -96,6 +96,21 @@
96
96
  </el-input-number>
97
97
  </el-col>
98
98
  </el-row>
99
+ <el-row :gutter="0" v-if="isRing">
100
+ <el-col :span="6">
101
+ {{this.$t('openatccomponents.pattern.stageno')}}
102
+ </el-col>
103
+ <el-col :span="18">
104
+ <el-input-number
105
+ class="stage-value"
106
+ size="small"
107
+ :controls="false"
108
+ :min="0"
109
+ v-model.number="stage.stageNo"
110
+ @change="stageSplitChange">
111
+ </el-input-number>
112
+ </el-col>
113
+ </el-row>
99
114
  <el-row :gutter="0" v-if="isRing">
100
115
  <el-col :span="6">
101
116
  {{this.$t('openatccomponents.pattern.yellow')}}
@@ -10,7 +10,7 @@
10
10
  * See the Mulan PSL v2 for more details.
11
11
  **/
12
12
  <template>
13
- <div :style="{position: 'reletive'}">
13
+ <div :style="{position: 'reletive', width: '100%', height: '100%'}">
14
14
  <div :style="{position: 'absolute', left: Data?Data.left:0, top: Data?Data.top:0}">
15
15
  <svg
16
16
  version="1.1"