openatc-components 0.1.103 → 0.1.104

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,258 @@
1
+ <template>
2
+ <div class="tentativeplan-control">
3
+ <div class="title" style="margin-bottom: 18px;">{{$t('openatccomponents.overview.azimuthlocking')}}</div>
4
+ <el-row>
5
+ <el-col :span="12">
6
+ <el-form
7
+ ref="manual"
8
+ label-position="left"
9
+ :model="manualInfo"
10
+ label-width="100px">
11
+ <el-form-item
12
+ :label="$t('openatccomponents.overview.duration') + ':'"
13
+ prop="count">
14
+ <el-input-number :placeholder="$t('openatccomponents.common.input')" :min="0" :max="65535" :precision="0" :step="1" :controls="false" v-model.number="manualInfo.duration" size="mini"></el-input-number>
15
+ </el-form-item>
16
+ <el-form-item
17
+ :label="$t('openatccomponents.overview.yellowflash') + ':'"
18
+ prop="intersection">
19
+ <el-input-number :placeholder="$t('openatccomponents.common.input')" :min="0" :max="65535" :precision="0" :step="1" :controls="false" v-model.number="manualInfo.yellowflash" size="mini"></el-input-number>
20
+ </el-form-item>
21
+ <el-form-item
22
+ :label="$t('openatccomponents.overview.mingreen') + ':'"
23
+ prop="intersection">
24
+ <el-input-number :placeholder="$t('openatccomponents.common.input')" :min="0" :max="65535" :precision="0" :step="1" :controls="false" v-model.number="manualInfo.mingreen" size="mini"></el-input-number>
25
+ </el-form-item>
26
+ </el-form>
27
+ </el-col>
28
+ <el-col :span="12">
29
+ <el-form
30
+ ref="manual"
31
+ label-position="left"
32
+ :model="manualInfo"
33
+ label-width="100px">
34
+ <el-form-item
35
+ :label="$t('openatccomponents.overview.greenclear') + ':'"
36
+ prop="count">
37
+ <el-input-number :placeholder="$t('openatccomponents.common.input')" :min="0" :max="65535" :precision="0" :step="1" :controls="false" v-model.number="manualInfo.greenclear" size="mini"></el-input-number>
38
+ </el-form-item>
39
+ <el-form-item
40
+ :label="$t('openatccomponents.overview.allred') + ':'"
41
+ prop="intersection">
42
+ <el-input-number :placeholder="$t('openatccomponents.common.input')" :min="0" :max="65535" :precision="0" :step="1" :controls="false" v-model.number="manualInfo.allred" size="mini"></el-input-number>
43
+ </el-form-item>
44
+ </el-form>
45
+ </el-col>
46
+ </el-row>
47
+ <el-row>
48
+ <el-col :span="5">
49
+ <span class="model-label-title">{{$t('openatccomponents.overview.indirection')}}:</span>
50
+ </el-col>
51
+ <el-col :span="19">
52
+ <div class="control-model" v-for="(item, index) in imgs" :key="index">
53
+ <div :class="{'single-model-select':spanIndex.indexOf(index)>-1}" class="single-model" @click="boxShow(index,item)">
54
+ <div v-if="item.class" :class="item.class" style="border:0px"></div>
55
+ <div class="single-model-name">{{item.name}}</div>
56
+ </div>
57
+ </div>
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">
61
+ <div style="position:relative;" class="single-model">
62
+ <xdr-dir-selector Width="40PX" Height="40PX" :Data="showStyle" :showlist="item"></xdr-dir-selector>
63
+ <div style="height:65px;display:flex;flex-direction:row;justify-content:center;align-items:end;">
64
+ <div class="current-stage-num" style="width:20%;">{{index + 1}}</div>
65
+ <div style="width:70%;">
66
+ <i class="iconfont icon-feijidongche" 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="font-size:16PX;color:#454545;margin-left:10PX" v-if="item[item.length-1].controltype === 1"></i>
68
+ <i class="iconfont icon-BRT" 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="font-size:5PX;color:#454545;" v-if="item[item.length-1].controltype === 99"></i>
71
+ </div>
72
+ <i class="iconfont icon-gongjiaoche" 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="font-size:11PX;color:#606266;margin-left:10PX" v-if="item[item.length-1].controltype === 5"></i>
74
+ </div>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ </div>
79
+ <!-- </div> -->
80
+ </el-col>
81
+ </el-row>
82
+ <!-- <div class="model-label" style="width: auto;overflow: hidden;">
83
+ <span class="intitle">{{$t('openatccomponents.overview.indirection')}}:</span>
84
+ <div class="control-model" v-for="(item, index) in imgs" :key="index">
85
+ <div :class="{'single-model-select':spanIndex.indexOf(index)>-1}" class="single-model" @click="boxShow(index,item)">
86
+ <div v-if="item.class" :class="item.class" style="border:0px"></div>
87
+ <div class="single-model-name">{{item.name}}</div>
88
+ </div>
89
+ </div>
90
+ </div> -->
91
+ <div class="footer" v-if="realtimeStatusModalvisible">
92
+ <el-button @click="handleClose()">{{$t('openatccomponents.button.Back')}}</el-button>
93
+ <el-button type="primary" @click="handleManualControl()">{{$t('openatccomponents.overview.implement')}}</el-button>
94
+ </div>
95
+ <div class="footer" v-if="!realtimeStatusModalvisible">
96
+ <el-button @click="handleClose()">{{$t('openatccomponents.button.Back')}}</el-button>
97
+ <el-button type="primary" @click="handleManualControl()">{{$t('openatccomponents.overview.comfirm')}}</el-button>
98
+ </div>
99
+ </div>
100
+ </template>
101
+
102
+ <script>
103
+ import { getPhase } from './utils'
104
+ // import { getIframdevid } from '../../../../utils/auth'
105
+ import { getlockPhase, lockPhase } from '../../../../api/control'
106
+ import Stages from '../../Stages/index'
107
+ import RingDataModel from '../../../../utils/RingDataModel.js'
108
+ import { getMessageByCode } from '../../../../utils/responseMessage'
109
+ export default {
110
+ name: 'tentativeplancontrol',
111
+ components: {
112
+ Stages
113
+ },
114
+ props: {
115
+ realtimeStatusModalvisible: {
116
+ type: Boolean,
117
+ default: true
118
+ }
119
+ },
120
+ watch: {
121
+ sidewalkPhaseData: {
122
+ handler: function (val, oldVal) {
123
+ this.sidewalkPhaseData = val
124
+ },
125
+ // 深度观察监听
126
+ deep: true
127
+ }
128
+ },
129
+ computed: {
130
+ tankuangSize () {
131
+ let widths = ((100 / 2) - 2) + '%'
132
+ let styleObj = {
133
+ width: widths
134
+ }
135
+ return styleObj
136
+ },
137
+ imgs () {
138
+ let arrays = []
139
+ let images = getPhase()
140
+ images.forEach(v => {
141
+ let obj = Object.assign({}, v)
142
+ obj.name = this.$t(obj.name)
143
+ arrays.push(obj)
144
+ })
145
+ return arrays
146
+ }
147
+ },
148
+ data () {
149
+ return {
150
+ showStyle: {
151
+ top: '5PX',
152
+ left: '14px'
153
+ },
154
+ sidewalkPhaseData: [],
155
+ currentName: '',
156
+ lockList: [],
157
+ patternCycleEqual: true,
158
+ spanIndex: [],
159
+ directions: [],
160
+ manualInfo: {
161
+ allred: 2,
162
+ greenclear: 6,
163
+ mingreen: 15,
164
+ duration: 600,
165
+ yellowflash: 3
166
+ }
167
+ }
168
+ },
169
+ created () {
170
+ },
171
+ methods: {
172
+ checkId (val) {
173
+ if (val.id === 1) {
174
+ return 2
175
+ } else if (val.id === 5) {
176
+ return 1
177
+ } else if (val.id === 13) {
178
+ return 4
179
+ } else if (val.id === 9) {
180
+ return 3
181
+ } else if (val.id === 17) {
182
+ return 8
183
+ } else if (val.id === 21) {
184
+ return 5
185
+ } else if (val.id === 25) {
186
+ return 7
187
+ } else if (val.id === 29) {
188
+ return 6
189
+ }
190
+ },
191
+ getLockPhase (val) {
192
+ this.directions = [this.checkId(val)]
193
+ let param = {
194
+ 'agentid': 'config_test',
195
+ 'direction': this.directions
196
+ }
197
+ getlockPhase(param).then(res => {
198
+ if (res.data.success !== true) {
199
+ this.$message.error(getMessageByCode(res.data.code, this.$i18n.locale))
200
+ return
201
+ }
202
+ this.lockList = res.data.data
203
+ let ringDataModel = new RingDataModel({}, res.data.data)
204
+ this.sidewalkPhaseData = ringDataModel.getlockData()
205
+ })
206
+ },
207
+ boxShow (index, data) {
208
+ this.spanIndex = []
209
+ let arrIndex = this.spanIndex.indexOf(index)
210
+ if (arrIndex > -1) {
211
+ this.spanIndex.splice(arrIndex, 1)
212
+ } else {
213
+ this.spanIndex.push(index)
214
+ }
215
+ this.getLockPhase(data)
216
+ this.currentName = data.name
217
+ },
218
+ handleClose () {
219
+ this.$emit('closePhaseBack')
220
+ },
221
+ handleManualControl () {
222
+ if (this.directions.length === 0) {
223
+ this.$message.error(this.$t('openatccomponents.overview.directionnull'))
224
+ return
225
+ }
226
+ let submitdata = {
227
+ agentid: 'config_test',
228
+ direction: this.directions,
229
+ greenflash: this.manualInfo.greenclear,
230
+ duration: this.manualInfo.duration,
231
+ yellow: this.manualInfo.yellowflash,
232
+ redclear: this.manualInfo.allred,
233
+ mingreen: this.manualInfo.mingreen
234
+
235
+ }
236
+ lockPhase(submitdata).then(res => {
237
+ if (res.data.success !== true) {
238
+ this.$message.error(getMessageByCode(res.data.code, this.$i18n.locale))
239
+ }
240
+ this.$alert(this.$t('openatccomponents.common.download'), { type: 'success' })
241
+ })
242
+ }
243
+ }
244
+ }
245
+ </script>
246
+
247
+ <style lang="scss" scoped>
248
+ .single-model-select {
249
+ margin-right: 10px;
250
+ text-align: center;
251
+ cursor:pointer;
252
+ width: 70px;
253
+ height: 65px;
254
+ background-color: #a2cfff;
255
+ border-radius: 6px;
256
+ // border: solid 1PX #409eff;
257
+ }
258
+ </style>
@@ -0,0 +1,92 @@
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
+ import store from '../../../../store/index'
13
+ let images = [
14
+ {
15
+ id: 1,
16
+ // name: 'East-Straight',
17
+ name: 'openatccomponents.overview.es',
18
+ // img: require('./images/East-Straight.svg'),
19
+ class: 'iconfont icon-dongzhihang'
20
+ },
21
+ {
22
+ id: 5,
23
+ // name: 'West-Straight',
24
+ name: 'openatccomponents.overview.ws',
25
+ // img: require('./images/West-Straight.svg'),
26
+ class: 'iconfont icon-xizhihang'
27
+ },
28
+ {
29
+ id: 13,
30
+ // name: 'South-Straight',
31
+ name: 'openatccomponents.overview.ss',
32
+ // img: require('./images/South-Straight.svg'),
33
+ class: 'iconfont icon-nanzhihang'
34
+ },
35
+ {
36
+ id: 9,
37
+ // name: 'North-Straight',
38
+ name: 'openatccomponents.overview.ns',
39
+ // img: require('./images/North-Straight.svg'),
40
+ class: 'iconfont icon-beizhihang'
41
+ },
42
+ {
43
+ id: 17,
44
+ // name: 'South-Back',
45
+ name: 'openatccomponents.overview.ses',
46
+ // img: require('./images/South-Back.svg'),
47
+ class: 'iconfont icon-dongnanzhihang'
48
+ },
49
+ {
50
+ id: 21,
51
+ // name: 'South-Back',
52
+ name: 'openatccomponents.overview.sws',
53
+ // img: require('./images/South-Back.svg'),
54
+ class: 'iconfont icon-xinanzhihang'
55
+ },
56
+ {
57
+ id: 25,
58
+ // name: 'South-Back',
59
+ name: 'openatccomponents.overview.nes',
60
+ // img: require('./images/South-Back.svg'),
61
+ class: 'iconfont icon-dongbeizhihang'
62
+ },
63
+ {
64
+ id: 29,
65
+ // name: 'South-Back',
66
+ name: 'openatccomponents.overview.nws',
67
+ // img: require('./images/South-Back.svg'),
68
+ class: 'iconfont icon-xibeizhihang'
69
+ }
70
+ ]
71
+ const getPhase = () => {
72
+ if (store.getters.roadDirection === 'left') {
73
+ // 左行下,掉头图标替换
74
+ images.forEach((img) => {
75
+ if (img.id === 4) {
76
+ img.class = 'iconfont icon-dongtiaotou-yinni'
77
+ }
78
+ if (img.id === 8) {
79
+ img.class = 'iconfont icon-xitiaotou-yinni'
80
+ }
81
+ if (img.id === 12) {
82
+ img.class = 'iconfont icon-beitiaotou-yinni'
83
+ }
84
+ if (img.id === 16) {
85
+ img.class = 'iconfont icon-nantiaotou-yinni'
86
+ }
87
+ })
88
+ }
89
+ return images
90
+ }
91
+
92
+ export {getPhase}
@@ -125,6 +125,8 @@ export default {
125
125
  this.currentStage = this.crossStatusData.current_stage
126
126
  }
127
127
  }
128
+ console.log(list,'list')
129
+ console.log(this.phaseList,'this.phaseList')
128
130
  return list
129
131
  },
130
132
  stageStyle () {
@@ -145,9 +145,45 @@ export default class RingDataModel {
145
145
  this.busPhaseData = result
146
146
  return this.busPhaseData
147
147
  }
148
-
148
+ getlockData () {
149
+ let stagesTemp = []
150
+ let directionList = []
151
+ let sidewalkPhaseData = this.getPedPhasePos()
152
+ for (let phase of this.phaseList) {
153
+ let tempList = []
154
+ directionList = phase.direction
155
+ let peddirections = []
156
+ if (directionList) {
157
+ for (let walk of sidewalkPhaseData) {
158
+ for (let ped of phase.peddirection) {
159
+ // if (stg === walk.phaseid) {
160
+ let obj = {}
161
+ obj.name = walk.name
162
+ obj.id = walk.id
163
+ if (ped === walk.id) {
164
+ peddirections.push(obj)
165
+ peddirections = Array.from(new Set(peddirections))
166
+ }
167
+ // }
168
+ }
169
+ }
170
+ } else {
171
+ peddirections = []
172
+ }
173
+ tempList = directionList.map(dir => ({
174
+ id: dir,
175
+ color: '#606266',
176
+ controltype: phase.controltype,
177
+ peddirection: peddirections,
178
+ sidewalkPhaseData: sidewalkPhaseData
179
+ }))
180
+ stagesTemp.push(tempList)
181
+ }
182
+ return stagesTemp
183
+ }
149
184
  getStageData () {
150
185
  let data = this.crossStatusData
186
+ console.log(data, 'data')
151
187
  let stagesTemp = []
152
188
  let busPhaseData = this.getBusPos()
153
189
  let sidewalkPhaseData = this.getPedPhasePos()
@@ -210,7 +246,6 @@ export default class RingDataModel {
210
246
  stagesTemp.push(tempList)
211
247
  }
212
248
  this.stagesList = JSON.parse(JSON.stringify(stagesTemp))
213
- // console.log('this.stagesList', this.stagesList)
214
249
  return this.stagesList
215
250
  }
216
251
  }
@@ -94,7 +94,7 @@ export default {
94
94
  return {
95
95
  roadDirection: 'right',
96
96
  // reqUrl: 'http://192.168.13.103:10003/openatc',
97
- agentId: '10002-739',
97
+ agentId: '12007_390',
98
98
  // agentId: '0351-01',
99
99
  reqUrl: 'http://192.168.13.103:10003/openatc',
100
100
  Token: 'eyJraWQiOiIxNjcwNTUzNTE1MDc3IiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTc1Njk1MzUxNSwiaWF0IjoxNjcwNTUzNTE1fQ.oR9e2Fn5mVmJ4CjZV6zUOdq_23Y84RkuyhK_WppsD_o',
@@ -104,6 +104,16 @@
104
104
  "url": "/devs",
105
105
  "method": "get"
106
106
  },
107
+ {
108
+ "key": "getlockPhase",
109
+ "url": "/devs/direction/phases",
110
+ "method": "post"
111
+ },
112
+ {
113
+ "key": "lockPhase",
114
+ "url": "/devs/direction/lockPhases",
115
+ "method": "post"
116
+ },
107
117
  {
108
118
  "key": "gettimeplan",
109
119
  "url": "/fixedtimeplan",
@@ -62,6 +62,13 @@
62
62
  line-height: 28PX;
63
63
  padding-right: 12PX;
64
64
  }
65
+ .model-label-title {
66
+ font-size: 14PX;
67
+ font-weight: 400;
68
+ line-height: 28PX;
69
+ color: $--color-text-secondary;
70
+ padding-right: 12PX;
71
+ }
65
72
  .single-model {
66
73
  margin-right: 10PX;
67
74
  text-align: center;