openatc-components 0.2.7 → 0.2.8

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.
@@ -1,20 +1,9 @@
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
1
  <template>
13
2
  <div class="components-container board">
14
3
  <div class="common-board-column">
15
4
  <div class="common-board-column-header" style="position:relative">
16
5
  <span>{{$t('openatccomponents.pattern.stage')+(subIndex+1)}}</span>
17
- <span v-if="isRing" style="position: absolute;right: 0;">
6
+ <span v-if="this.contrloType === 'stage'" style="position: absolute;right: 0;">
18
7
  <el-button type="primary" @click="deleteStage(subIndex)" icon="el-icon-close"></el-button>
19
8
  </span>
20
9
  </div>
@@ -28,8 +17,7 @@
28
17
  </el-col>
29
18
  <el-col :span="12">
30
19
  <el-input-number
31
- v-if="isRing"
32
- class="stage-value"
20
+ v-if="this.contrloType === 'stage'"
33
21
  :controls="false"
34
22
  size="small"
35
23
  :disabled="true"
@@ -37,8 +25,7 @@
37
25
  v-model.number="stage.stageSplit">
38
26
  </el-input-number>
39
27
  <el-input-number
40
- v-if="!isRing"
41
- class="stage-value"
28
+ v-if="this.contrloType === 'ring' || !this.contrloType"
42
29
  :controls="false"
43
30
  size="small"
44
31
  v-model.number="stage.split"
@@ -53,74 +40,57 @@
53
40
  {{this.$t('openatccomponents.pattern.phase')}}
54
41
  </el-col>
55
42
  <el-col :span="12">
56
- <SelectCrossPhase
57
- v-if="isRing"
58
- type="phases"
59
- :pattern="false"
60
- :phaseOption="coordphaseOption"
61
- multiple
62
- :row="stage"
63
- style="width:100%;">
64
- </SelectCrossPhase>
65
- <!-- <el-select v-if="isRing" v-model="stage.phases" multiple :placeholder="$t('openatccomponents.common.select')">
43
+ <el-select v-if="this.contrloType === 'stage'" v-model="stage.stages" multiple :placeholder="$t('openatccomponents.common.select')">
66
44
  <el-option
67
45
  v-for="item in coordphaseOption"
68
46
  :key="item.value"
69
47
  :label="$t('openatccomponents.pattern.phase') + item.value"
70
48
  :value="item.value">
71
49
  </el-option>
72
- </el-select> -->
50
+ </el-select>
73
51
  <el-input
74
- v-if="!isRing"
75
- class="stage-value"
52
+ v-if="this.contrloType === 'ring' || !this.contrloType"
76
53
  size="small"
77
- :value="stage.phases.join(',')"
54
+ :value="stage.stageKanban?stage.stageKanban.join(','):''"
78
55
  ref="type"
79
- style="width:100%;align:left;"
80
56
  :disabled="true">
81
57
  </el-input>
82
58
  </el-col>
83
59
  </el-row>
84
- <el-row :gutter="0" v-if="isRing">
60
+ <el-row :gutter="0" v-if="this.contrloType === 'stage'">
85
61
  <el-col :span="12">
86
62
  {{this.$t('openatccomponents.pattern.green')}}
87
63
  </el-col>
88
64
  <el-col :span="12">
89
65
  <el-input-number
90
- class="stage-value"
91
66
  size="small"
92
67
  :controls="false"
93
- :min="0"
94
68
  v-model.number="stage.green"
95
69
  @change="stageSplitChange">
96
70
  </el-input-number>
97
71
  </el-col>
98
72
  </el-row>
99
- <el-row :gutter="0" v-if="isRing">
73
+ <el-row :gutter="0" v-if="this.contrloType === 'stage'">
100
74
  <el-col :span="12">
101
75
  {{this.$t('openatccomponents.pattern.yellow')}}
102
76
  </el-col>
103
77
  <el-col :span="12">
104
78
  <el-input-number
105
- class="stage-value"
106
79
  size="small"
107
80
  :controls="false"
108
- :min="0"
109
81
  v-model.number="stage.yellow"
110
82
  @change="stageSplitChange">
111
83
  </el-input-number>
112
84
  </el-col>
113
85
  </el-row>
114
- <el-row :gutter="0" v-if="isRing">
86
+ <el-row :gutter="0" v-if="this.contrloType === 'stage'">
115
87
  <el-col :span="12">
116
88
  {{this.$t('openatccomponents.pattern.red')}}
117
89
  </el-col>
118
90
  <el-col :span="12">
119
91
  <el-input-number
120
- class="stage-value"
121
92
  size="small"
122
93
  :controls="false"
123
- :min="0"
124
94
  v-model.number="stage.red"
125
95
  @change="stageSplitChange">
126
96
  </el-input-number>
@@ -133,12 +103,11 @@
133
103
  </template>
134
104
  <script>
135
105
  import draggable from 'vuedraggable'
136
- import SelectCrossPhase from '../SelectCrossPhase/index.vue'
106
+
137
107
  export default {
138
- name: 'stage-bord',
108
+ name: 'stage-board',
139
109
  components: {
140
- draggable,
141
- SelectCrossPhase
110
+ draggable
142
111
  },
143
112
  data () {
144
113
  return {
@@ -158,8 +127,8 @@ export default {
158
127
  return []
159
128
  }
160
129
  },
161
- isRing: {
162
- type: Boolean
130
+ contrloType: {
131
+ type: String
163
132
  },
164
133
  options: {
165
134
  type: Object,
@@ -172,7 +141,7 @@ export default {
172
141
  default () {
173
142
  return {
174
143
  split: 0,
175
- // stages: [],
144
+ stages: [],
176
145
  phases: [],
177
146
  stageSplit: 0,
178
147
  green: 0,
@@ -193,30 +162,23 @@ export default {
193
162
  created () {
194
163
  },
195
164
  watch: {
196
- // stage: {
197
- // handler: function () {
198
- // if (this.isRing) {
199
- // let n = this.rowIndex
200
- // const globalParamModel = this.$store.getters.globalParamModel
201
- // let pattern = globalParamModel.getParamsByType('patternList')[n]
202
- // globalParamModel.getParamsByType('patternList')[n].cycle = this.getMaxCycle(pattern)
203
- // }
204
- // },
205
- // deep: true
206
- // }
165
+ stage: {
166
+ handler: function () {
167
+ if (this.contrloType) {
168
+ let n = this.rowIndex
169
+ const globalParamModel = this.$store.getters.globalParamModel
170
+ let pattern = globalParamModel.getParamsByType('patternList')[n]
171
+ globalParamModel.getParamsByType('patternList')[n].cycle = this.getMaxCycle(pattern)
172
+ }
173
+ },
174
+ deep: true
175
+ }
207
176
  },
208
177
  mounted () {
209
178
  },
210
179
  methods: {
211
180
  deleteStage (index) {
212
181
  this.stageInfo.splice(index, 1)
213
- this.stageInfo.forEach((item, index) => {
214
- item.key = index
215
- })
216
- // let n = this.rowIndex
217
- // const globalParamModel = this.$store.getters.globalParamModel
218
- // let pattern = globalParamModel.getParamsByType('patternList')[n]
219
- // globalParamModel.getParamsByType('patternList')[n].cycle = this.getMaxCycle(pattern)
220
182
  },
221
183
  getMaxCycle (pattern) {
222
184
  let rings = pattern.stagesList
@@ -265,23 +227,16 @@ export default {
265
227
  width: 100%;
266
228
  height: auto;
267
229
  margin: 5px 0;
268
- text-align: left;
269
230
  line-height: 40px;
231
+ // color: #FFFFFF;
270
232
  padding: 1px 1px;
271
233
  box-sizing: border-box;
272
234
  }
273
235
  .el-button--primary:hover, .el-button--primary:focus{
274
236
  background: #299BCC;
275
237
  border-color: #299BCC;
276
- color: #FFFFFF;
277
- }
278
- .stage-value {
279
- text-align: left;
280
- width: 100%;
238
+ // color: #FFFFFF;
281
239
  }
282
240
  </style>
283
241
  <style lang="scss">
284
- .stage-value .el-input__inner {
285
- text-align: center;
286
- }
287
242
  </style>
@@ -11,7 +11,6 @@
11
11
  :patternList="patternList"
12
12
  :controlPhase="controlPhase"
13
13
  :showCondition="showCondition"
14
- :allPatternList="allPatternList"
15
14
  :localPatternList="localPatternList"
16
15
  :phaseList="phaseList"
17
16
  :showBarrier="showBarrier"
@@ -508,9 +507,6 @@ export default {
508
507
  type: Boolean,
509
508
  default: false
510
509
  },
511
- allPatternList: {
512
- type: Array
513
- },
514
510
  controlPhase: {
515
511
  type: Object
516
512
  },
@@ -333,7 +333,7 @@
333
333
  }
334
334
  }
335
335
  .tentativeplan-control{
336
- // height: 100%;
336
+ height: 100%;
337
337
  padding: 21PX 0PX 21PX 28PX;
338
338
  min-width: 360PX;
339
339
  overflow: hidden !important;
@@ -1,417 +0,0 @@
1
- <template>
2
- <div>
3
- <el-select
4
- v-model="valuess"
5
- :multiple="multiple"
6
- :disabled="disabled"
7
- @visible-change="visibleChange($event)"
8
- :clearable="clearable"
9
- :filterable="filterable"
10
- :placeholder="$t('openatccomponents.common.select')"
11
- @change="onChange"
12
- @focus="onFocus"
13
- >
14
- <el-option
15
- id="aaa"
16
- v-for="(item, index) in Options"
17
- :key="index"
18
- :label="getLable(item.label)"
19
- :value="item.value"
20
- >
21
- <div class="single-model" @click="selectStages(item.value)">
22
- <xdrdirselector
23
- Width="60px"
24
- Height="60px"
25
- :showlist="item.item"
26
- ></xdrdirselector>
27
- <span
28
- style="
29
- float: right;
30
- margin-left: 10px;
31
- color: #8492a6;
32
- font-size: 13px;
33
- "
34
- >{{ item.label }}</span
35
- >
36
- </div>
37
- </el-option>
38
- </el-select>
39
- <span v-if="pattern">{{ getIncludedPhasesDesc(valuess) }}</span>
40
- <!-- <span id="xrd"></span> -->
41
- <!-- <xdrdirselector :Data="Data" :Datas="Datas" Width="60px" Height="60px" :showlist="dirArr"></xdrdirselector> -->
42
- </div>
43
- </template>
44
- <script>
45
- import { getTscControl } from '../../../api/control'
46
- import { getPhaseDesc } from '../../../utils/phasedesc.js'
47
- // import { uploadSingleTscParam } from '../../api/param'
48
- import { getMessageByCode } from '../../../utils/responseMessage'
49
- import xdrdirselector from '../XRDDirSelector/XRDDirSelector.vue'
50
- import PhaseDataModel from '../IntersectionMap/crossDirection/utils'
51
- // import CrossDiagramMgr from '@/EdgeMgr/controller/crossDiagramMgr'
52
- // import { getDirName } from './utils.js'
53
- import { getTheme } from '../../../utils/auth'
54
- export default {
55
- name: 'SelectCrossPhase',
56
- components: {
57
- xdrdirselector
58
- },
59
- props: {
60
- multiple: {
61
- type: Boolean,
62
- default: false
63
- },
64
- pattern: {
65
- type: Boolean,
66
- default: false
67
- },
68
- filterable: {
69
- type: Boolean,
70
- default: false
71
- },
72
- disabled: {
73
- type: Boolean,
74
- default: false
75
- },
76
- row: {
77
- type: Object
78
- },
79
- valueModel: {
80
- type: Array
81
- },
82
- type: {
83
- type: String || Array
84
- },
85
- phaseOption: {
86
- type: Array,
87
- default: () => []
88
- },
89
- // placeholder: {
90
- // type: String,
91
- // default: ''
92
- // },
93
- bizType: {
94
- type: String,
95
- default: ''
96
- },
97
- agentid: {
98
- type: String,
99
- default: '10501'
100
- },
101
- clearable: {
102
- type: Boolean,
103
- default: false
104
- }
105
- },
106
- data () {
107
- return {
108
- list: [],
109
- valuess: [],
110
- Data: {
111
- left: '60px',
112
- top: '10px'
113
- },
114
- Datas: {
115
- left: '60px',
116
- top: '10px'
117
- },
118
- Options: [],
119
- phaseList: [],
120
- dirArr: [],
121
- sidewalkPhaseData: []
122
- }
123
- },
124
- watch: {
125
- phaseOption: {
126
- handler (val) {
127
- this.phaseOption = val
128
- this.getPhase()
129
- this.showxdr(this.valuess)
130
- },
131
- deep: true
132
- },
133
- agentid (val) {
134
- // this.value = ''
135
- this.Options = []
136
- // this.onLoad()
137
- }
138
- },
139
- created () {
140
- this.PhaseDataModel = new PhaseDataModel()
141
- this.onLoad()
142
- },
143
- methods: {
144
- getLable (str) {
145
- const match = str.match(/\d+/)
146
- if (match) {
147
- return this.getPhaseDescs(Number(match[0]))
148
- }
149
- },
150
- // getXrd (data) {
151
- // let Profile = Vue.extend({
152
- // // template: 'xdrdirselector',
153
- // components: {
154
- // xdrdirselector
155
- // },
156
- // render (h) {
157
- // return h('xdrdirselector', {
158
- // props: {
159
- // Width: '60px',
160
- // Height: '60px',
161
- // showlist: data,
162
- // Data: {
163
- // left: '60px',
164
- // top: '10px'
165
- // },
166
- // Datas: {
167
- // left: '60px',
168
- // top: '10px'
169
- // }
170
- // }
171
- // })
172
- // }
173
- // })
174
- // let profile = new Profile()
175
- // profile.$mount('#xrd')
176
- // },
177
- getPhaseDescs (id) {
178
- let phasedesc = this.phaseOption.filter((item) => {
179
- return item.id === id
180
- })[0].direction
181
- if (phasedesc.length === 0) return id
182
- let description = getPhaseDesc(phasedesc, this.$i18n.locale)
183
- return id + '-' + description
184
- },
185
- showxdr (data) {
186
- let color = getTheme() === 'light' ? '#1E1E1E' : '#F1F3F4'
187
- this.dirArr = []
188
- this.phaseOption.filter((item) => {
189
- if (item.id === data) {
190
- if (item.direction.length === 0) {
191
- let recd = {
192
- id: 0,
193
- peddirection: this.getPed(item.peddirection),
194
- color: color
195
- }
196
- this.dirArr.push(recd)
197
- } else {
198
- for (let rec of item.direction) {
199
- let recd = {
200
- id: rec,
201
- peddirection: this.getPed(item.peddirection),
202
- color: color
203
- }
204
- this.dirArr.push(recd)
205
- }
206
- }
207
- }
208
- })
209
- },
210
- onFocus () {
211
- if (!this.Options || this.Options.length === 0) {
212
- this.onLoad()
213
- }
214
- },
215
- onLoad () {
216
- this.getPhase()
217
- // this.initData()
218
- },
219
- setOption (list) {
220
- if (this.row.callphase) {
221
- this.valuess = this.row.callphase
222
- this.showxdr(this.valuess)
223
- }
224
- if (this.row.phases) {
225
- this.valuess = this.row.phases
226
- }
227
- if (this.row.linkphase) {
228
- this.valuess = this.row.linkphase
229
- this.showxdr(this.valuess)
230
- }
231
- if (this.row.includedphases) {
232
- this.valuess = this.row.includedphases
233
- }
234
- if (this.row.data && this.row.data.phase) {
235
- this.valuess = this.row.data.phase
236
- this.showxdr(this.valuess)
237
- }
238
- let color = getTheme() === 'light' ? '#1E1E1E' : '#F1F3F4'
239
- this.Options = list.map((item, index) => {
240
- let dirArr = []
241
- if (item.direction.length === 0) {
242
- let recd = {
243
- id: 0,
244
- peddirection: this.getPed(item.peddirection),
245
- color: color
246
- }
247
- dirArr.push(recd)
248
- } else {
249
- for (let rec of item.direction) {
250
- let recd = {
251
- id: rec,
252
- peddirection: this.getPed(item.peddirection),
253
- color: color
254
- }
255
- dirArr.push(recd)
256
- }
257
- }
258
- let name = ''
259
- name = this.$t('openatccomponents.pattern.phase') + item.id
260
- // name = this.getPhaseDescs(item.id)
261
- return {
262
- label: name,
263
- item: dirArr,
264
- value: item.id
265
- }
266
- })
267
- },
268
- visibleChange (status) {
269
- if (!status) {
270
- this.showxdr(this.valuess)
271
- }
272
- },
273
- onChange (value) {
274
- if (this.type === 'callphase') {
275
- this.row.callphase = this.valuess
276
- } else if (this.type === 'linkphase') {
277
- this.row.linkphase = this.valuess
278
- } else if (this.type === 'phase') {
279
- this.row.data.phase = this.valuess
280
- } else if (this.multiple && this.type === 'phases') {
281
- this.row.phases = this.valuess
282
- } else if (this.multiple && this.type === 'includedphases') {
283
- this.row.includedphases = this.valuess
284
- }
285
- let option = this.Options.filter(item => item.value === value)[0]
286
- this.$emit('onChange', value, option, this.agentid, this.bizType)
287
- },
288
- selectStages (value) {
289
- this.$emit('selectStages', value)
290
- },
291
- getPhase () {
292
- this.getPedPhasePos(this.phaseOption)
293
- this.setOption(this.phaseOption)
294
- },
295
- initData () {
296
- let agentId = this.agentid
297
- getTscControl(agentId).then((data) => {
298
- if (!data.data.success) {
299
- if (data.data.code === '4003') {
300
- this.devStatus = 2
301
- this.$message.error(this.$t('openatccomponents.errorTip.devicenotonline'))
302
- return
303
- }
304
- this.$message.error(getMessageByCode(data.data.code, this.$i18n.locale))
305
- return
306
- }
307
- let TscData = JSON.parse(JSON.stringify(data.data.data.data))
308
- this.handleStageData(TscData) // 处理阶段(驻留)stage数据
309
- }).catch(error => {
310
- this.$message.error(error)
311
- console.log(error)
312
- })
313
- },
314
- getPed (data) {
315
- let ped = []
316
- let peddirections = []
317
- let color = getTheme() === 'light' ? '#1E1E1E' : '#F1F3F4'
318
- for (let walk of this.sidewalkPhaseData) {
319
- for (let ped of data) {
320
- let objs = {}
321
- objs.name = walk.name
322
- objs.id = walk.id
323
- objs.color = color
324
- if (ped === walk.id) {
325
- peddirections.push(objs)
326
- peddirections = Array.from(new Set(peddirections))
327
- }
328
- }
329
- }
330
- ped.push(...peddirections)
331
- return ped
332
- },
333
- getPedPhasePos (phaseList) {
334
- // 行人相位信息
335
- this.sidewalkPhaseData = []
336
- phaseList.forEach((ele, i) => {
337
- if (ele.peddirection) {
338
- ele.peddirection.forEach((dir, index) => {
339
- // 行人相位
340
- if (this.PhaseDataModel.getSidePos(dir)) {
341
- this.sidewalkPhaseData.push({
342
- // key: this.CrossDiagramMgr.getUniqueKey('pedphase'),
343
- phaseid: ele.id, // 相位id,用于对应相位状态
344
- id: dir,
345
- name: this.PhaseDataModel.getSidePos(dir).name
346
- })
347
- }
348
- })
349
- }
350
- })
351
- return this.sidewalkPhaseData
352
- },
353
- handleStageData (data) {
354
- this.stagesList = []
355
- let stages = data.stages
356
- for (let stage of stages) {
357
- let tempList = []
358
- let directionList = []
359
- for (let stg of stage) {
360
- let currPhase = this.phaseList.filter((item) => {
361
- return item.id === stg
362
- })[0]
363
- if (currPhase !== undefined) {
364
- directionList = [...currPhase.direction, ...directionList]
365
- }
366
- // directionList = [...currPhase.direction, ...directionList]
367
- }
368
- directionList = [...new Set(directionList)]
369
- tempList = directionList.map(dir => ({
370
- id: dir,
371
- color: '#606266'
372
- }))
373
- this.stagesList.push(tempList)
374
- }
375
- this.list = this.stagesList
376
- // this.setOption()
377
- },
378
- // init (val) {
379
- // let target = val
380
- // if (this.multiple) {
381
- // target = [val]
382
- // }
383
- // this.value = target
384
- // },
385
- getNameById (id) {
386
- let res = ''
387
- for (const item of this.Options) {
388
- if (id === item.agentid) {
389
- res = item.name
390
- break
391
- }
392
- }
393
- return res
394
- },
395
- getIncludedPhasesDesc (ids) {
396
- let str = ''
397
- for (let id of ids) {
398
- str = str + this.getPhaseDescs(id) + ' '
399
- }
400
- return str
401
- }
402
- }
403
- }
404
- </script>
405
- <style lang="scss">
406
-
407
- .el-select-dropdown__wrap {
408
- max-height: 500px !important;
409
- }
410
-
411
- #aaa{
412
- // :deep(.el-select-dropdown__item){
413
- margin: 10px 0 !important;
414
- // }
415
- }
416
-
417
- </style>