openatc-components 0.4.55 → 0.4.57

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.15.10:8012/openatc',
19
+ target: 'http://192.168.13.103:10003/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',
@@ -15,6 +15,7 @@
15
15
  :isMove="isMove"
16
16
  :localPatternList="localPatternList"
17
17
  :showCondition="showCondition"
18
+ :patternType="patternType"
18
19
  :contrloType="contrloType"
19
20
  :allPatternList="allPatternList"
20
21
  :stagesChange="stagesChange"
@@ -103,6 +104,9 @@ export default {
103
104
  patternId: {
104
105
  type: Number
105
106
  },
107
+ patternType: {
108
+ type: String
109
+ },
106
110
  agentId: {
107
111
  type: String
108
112
  },
@@ -0,0 +1,2 @@
1
+ import OptimizeKanban from './OptimizeKanban.vue'
2
+ export default OptimizeKanban
@@ -0,0 +1,369 @@
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="kanbanOptimize">
14
+ <div v-if="this.nowNumber === 1" class="optimizetype">
15
+ <span>{{$t('openatccomponents.pattern.optimizetype')}}</span>
16
+ <el-select v-model="value" clearable :placeholder="$t('openatccomponents.common.select')">
17
+ <el-option
18
+ v-for="item in typeOptions"
19
+ :key="item.value"
20
+ :label="$t('openatccomponents.overview.type' + item.value)"
21
+ :value="item.value"
22
+ >
23
+ </el-option>
24
+ </el-select>
25
+ <span class="optimiNum">{{$t('openatccomponents.pattern.optimizecycle')}}</span>
26
+ <el-input v-model="optimizecycle" clearable :placeholder="$t('openatccomponents.common.enter')"></el-input>
27
+ <!-- <el-button type="primary" @click="onOptimizeClick()">{{$t('openatccomponents.pattern.inoptimize')}}</el-button> -->
28
+ </div>
29
+ <div class="common-board-column" :style="{marginTop:this.nowNumber === 1 ? 0 : '50px',marginLeft:this.nowNumber === 1 ? 0 : 0}">
30
+ <div class="common-board-column-header">
31
+ {{headerText}}
32
+ </div>
33
+ <div class="openatccomponents-board-table-header">
34
+ <el-row :gutter="13">
35
+ <el-col :span="4">{{this.$t('openatccomponents.overview.phase')}}
36
+ </el-col>
37
+ <el-col :span="10">{{this.$t('openatccomponents.overview.flow')}}
38
+ </el-col>
39
+ <el-col :span="10">{{this.$t('openatccomponents.overview.saturationflow')}}
40
+ </el-col>
41
+ </el-row>
42
+ </div>
43
+ <draggable
44
+ class="common-board-column-content"
45
+ :list="list"
46
+ :options="options">
47
+ <div class="common-board-item" v-for="element in list" :key="element.id">
48
+ <el-row :gutter="13">
49
+ <el-col :span="4">
50
+ <el-tooltip class="item" effect="dark" placement="left">
51
+ <div slot="content">{{element.name}}</div>
52
+ <div class="common-phase-description">
53
+ <xdrdirselector Width="70px" Height="70px" Widths="58px" Heights="58px" :Datas="styles" :Data="showStyle" :showlist="element.desc" :ISActiveMask="ISActiveMask" :MaskColor="MaskColor"></xdrdirselector>
54
+ </div>
55
+ </el-tooltip>
56
+ </el-col>
57
+ <el-col :span="10">
58
+ <el-input-number :controls="false" class="col-content" size="small" :step="1" v-model.number="element.flowperhour" ref="type" :disabled="element.mode === 7"></el-input-number>
59
+ </el-col>
60
+ <el-col :span="10">
61
+ <el-input-number :controls="false" class="col-content" size="small" :step="1" v-model.number="element.saturation" ref="types" :disabled="element.mode === 7"></el-input-number>
62
+ </el-col>
63
+ </el-row>
64
+ </div>
65
+ </draggable>
66
+ </div>
67
+ </div>
68
+ </template>
69
+ <script>
70
+ import draggable from 'vuedraggable'
71
+ import { getDuration } from '@/api/cross'
72
+ import xdrdirselector from '@/components/XRDDirSelector'
73
+
74
+ export default {
75
+ name: 'patternOptimize',
76
+ components: {
77
+ draggable,
78
+ xdrdirselector
79
+ },
80
+ data () {
81
+ return {
82
+ showStyle: {
83
+ left: '7px',
84
+ top: '0px'
85
+ },
86
+ styles: {
87
+ left: '7px',
88
+ top: '0px'
89
+ },
90
+ typeOptions: [{
91
+ value: 'flow-split-opt'
92
+ }, {
93
+ value: 'cycle-opt'
94
+ }],
95
+ value: 'flow-split-opt',
96
+ optimizecycle: 0
97
+ }
98
+ },
99
+ props: {
100
+ headerText: {
101
+ type: String,
102
+ default: 'Header'
103
+ },
104
+ id: {
105
+ type: Number
106
+ },
107
+ rings: {
108
+ type: Array
109
+ },
110
+ nowNumber: {
111
+ type: Number
112
+ },
113
+ phaseList: {
114
+ type: Array
115
+ },
116
+ options: {
117
+ type: Object,
118
+ default () {
119
+ return {}
120
+ }
121
+ },
122
+ list: {
123
+ type: Array,
124
+ default () {
125
+ return []
126
+ }
127
+ },
128
+ // index: {
129
+ // type: Number
130
+ // },
131
+ ISActiveMask: {
132
+ type: Boolean,
133
+ default: true
134
+ },
135
+ // 当phase的描述为空时,显示的图形颜色。
136
+ MaskColor: {
137
+ type: String,
138
+ default: '#000000'
139
+ }
140
+ },
141
+ created () {
142
+ // this.addMinSplit()
143
+ this.addMin()
144
+ },
145
+ computed () {
146
+
147
+ },
148
+ watch: {
149
+ list: {
150
+ handler: function () {
151
+ // let list = this.$refs.type
152
+ // let flow = this.$refs.types
153
+ // console.log(this.list, 'list')
154
+ // let cycle = 0
155
+ // let n = this.index
156
+ // for (let i = 0; i < list.length; i++) {
157
+ // cycle = cycle + Number(list[i].currentValue)
158
+ // }
159
+ // const globalParamModel = this.$store.getters.globalParamModel
160
+ // // let MaxCycle = globalParamModel.getParamsByType('patternList')[n].cycle
161
+ // let pattern = globalParamModel.getParamsByType('patternList')[n]
162
+ // globalParamModel.getParamsByType('patternList')[n].cycle = this.getMaxCycle(pattern)
163
+ // this.addMinSplit()
164
+ // this.$emit('handleSplit', n)
165
+ },
166
+ deep: true
167
+ }
168
+ },
169
+ methods: {
170
+ onOptimizeClick () {
171
+ let msg = this.$t('openatccomponents.pattern.algorithmEngineOptimization')
172
+ const loading = this.$loading({
173
+ lock: true,
174
+ text: msg,
175
+ spinner: 'el-icon-loading',
176
+ background: 'rgba(0, 0, 0, 0.7)'
177
+ })
178
+ setTimeout(() => {
179
+ loading.close()
180
+ this.handeleOptimizeClick()
181
+ }, 1000)
182
+ },
183
+ handeleOptimizeClick () {
184
+ let newPha = []
185
+ for (let i = 0; i < this.rings.length; i++) {
186
+ newPha.push(...this.rings[i])
187
+ }
188
+ let phaseData = newPha.map(item => {
189
+ return {
190
+ id: item.id,
191
+ flowperhour: item.flowperhour,
192
+ saturation: item.saturation
193
+ }
194
+ })
195
+ let patternList = this.$store.state.globalParam.tscParam.patternList
196
+ let pattern = patternList.filter((item) => item.id === this.id)[0]
197
+ let reqData = {
198
+ 'type': this.value,
199
+ 'optcycle': this.optimizecycle ? this.optimizecycle : 0,
200
+ 'phaseList': this.phaseList,
201
+ 'pattern': pattern,
202
+ 'phases': phaseData
203
+ }
204
+ let isValidata = []
205
+ for (let j = 0; j < newPha.length; j++) {
206
+ let comNum = (newPha[j].length / 4) * 1700 * 0.8
207
+ isValidata.push(newPha[j].flowperhour > comNum)
208
+ }
209
+ if (isValidata.includes(true)) {
210
+ this.$confirm(this.$t('openatccomponents.overview.maxFlow'),
211
+ this.$t('openatccomponents.common.alarm'), {
212
+ confirmButtonText: this.$t('eopenatccomponentsdge.common.confirm'),
213
+ cancelButtonText: this.$t('openatccomponents.common.cancel'),
214
+ type: 'warning'
215
+ }).then(() => {
216
+ getDuration(reqData).then(data => {
217
+ if (data.data.success) {
218
+ this.$message({
219
+ type: 'success',
220
+ message: this.$t('openatccomponents.pattern.success')
221
+ })
222
+ for (let i = 0; i < this.rings.length; i++) {
223
+ for (let j = 0; j < this.rings[i].length; j++) {
224
+ for (let h = 0; h < data.data.data.phase.length; h++) {
225
+ if (this.rings[i][j].id === data.data.data.phase[h].id) {
226
+ this.rings[i][j].value = data.data.data.phase[h].duration
227
+ // this.rings[i][j].cycle = data.data.data.phase[h].cycle
228
+ }
229
+ }
230
+ }
231
+ }
232
+ }
233
+ }).catch(error => {
234
+ console.log(error)
235
+ })
236
+ }).catch(() => {
237
+ })
238
+ } else {
239
+ getDuration(reqData).then(data => {
240
+ if (data.data.success) {
241
+ this.$message({
242
+ type: 'success',
243
+ message: this.$t('openatccomponents.pattern.success')
244
+ })
245
+ for (let i = 0; i < this.rings.length; i++) {
246
+ for (let j = 0; j < this.rings[i].length; j++) {
247
+ for (let h = 0; h < data.data.data.phase.length; h++) {
248
+ if (this.rings[i][j].id === data.data.data.phase[h].id) {
249
+ this.rings[i][j].value = data.data.data.phase[h].duration
250
+ // this.rings[i][j].cycle = data.data.data.phase[h].cycle
251
+ }
252
+ }
253
+ }
254
+ }
255
+ }
256
+ }).catch(error => {
257
+ console.log(error)
258
+ })
259
+ }
260
+ },
261
+ addMin () {
262
+ for (let i of this.list) {
263
+ if (!i.flowperhour || !i.saturation) {
264
+ i.length = this.list.length
265
+ i.flowperhour = 0
266
+ i.saturation = 1700
267
+ }
268
+ }
269
+ }
270
+ // addMinSplit () {
271
+ // const globalParamModel = this.$store.getters.globalParamModel
272
+ // let phaseList = globalParamModel.getParamsByType('phaseList')
273
+ // for (let ls of this.list) {
274
+ // let phase = phaseList.filter((item) => {
275
+ // return item.id === ls.id
276
+ // })[0]
277
+ // if (!phase.redyellow) {
278
+ // phase.redyellow = 0
279
+ // }
280
+ // if (!phase.yellow) {
281
+ // phase.yellow = 0
282
+ // }
283
+ // if (!phase.redclear) {
284
+ // phase.redclear = 0
285
+ // }
286
+ // if (!phase.flashgreen) {
287
+ // phase.flashgreen = 0
288
+ // }
289
+ // if (!phase.phasewalk) {
290
+ // phase.phasewalk = 0
291
+ // }
292
+ // if (!phase.pedclear) {
293
+ // phase.pedclear = 0
294
+ // }
295
+ // // let temp1 = phase.redyellow + phase.yellow + phase.redclear + phase.flashgreen // 绿信比的最小值要大于最小绿+黄灯+全红+绿闪
296
+ // // let temp2 = phase.phasewalk + phase.pedclear
297
+ // // if (temp1 > temp2) {
298
+ // // ls.minSplit = temp1
299
+ // // } else {
300
+ // // ls.minSplit = temp2
301
+ // // }
302
+ // // if (ls.mode !== 7 && ls.value < ls.minSplit) {
303
+ // // ls.value = ls.minSplit
304
+ // // }
305
+ // // let temp1 = phase.yellow + phase.redclear + phase.flashgreen // 绿信比的最小值要大于最小绿+黄灯+全红+绿闪
306
+ // let temp1 = phase.yellow + phase.redclear + phase.mingreen
307
+ // let temp2 = phase.yellow + phase.redclear + phase.phasewalk + phase.pedclear
308
+ // ls.minSplit = temp1 > temp2 ? temp1 : temp2
309
+ // if (ls.mode !== 7 && ls.value < ls.minSplit) {
310
+ // ls.value = ls.minSplit
311
+ // this.$message.error(this.$t('openatccomponents.pattern.splitCheckMsg'))
312
+ // }
313
+ // }
314
+ // },
315
+ // getMaxCycle (pattern) {
316
+ // let rings = pattern.rings
317
+ // let maxCycle = 0
318
+ // for (let ring of rings) {
319
+ // if (ring.length === 0) continue
320
+ // let cycle = 0
321
+ // for (let r of ring) {
322
+ // if (r.mode === 7) { // 忽略相位不计周期
323
+ // continue
324
+ // }
325
+ // cycle = cycle + r.value
326
+ // }
327
+ // if (cycle > maxCycle) {
328
+ // maxCycle = cycle
329
+ // }
330
+ // }
331
+ // return maxCycle
332
+ // },
333
+ // doChange (val) {
334
+ // // if (val.mode === 7) {
335
+ // // val.value = 0
336
+ // // } else {
337
+ // // val.value = 30
338
+ // // }
339
+ // }
340
+ }
341
+ }
342
+ </script>
343
+ <style lang="scss" scoped>
344
+ .col-content {
345
+ width: 100%;
346
+ }
347
+ .kanbanOptimize {
348
+ .common-board-column {
349
+ max-width: unset !important;
350
+ }
351
+ }
352
+ .optimizetype{
353
+ // float: left;
354
+ font-size: 14PX;
355
+ margin:0 0 10PX 0;
356
+ .el-input {
357
+ width: 80PX;
358
+ }
359
+ .el-select{
360
+ width: 145PX;
361
+ }
362
+ .el-button {
363
+ margin-left: 10PX;
364
+ }
365
+ .optimiNum {
366
+ padding-left: 10PX;
367
+ }
368
+ }
369
+ </style>
@@ -11,8 +11,33 @@
11
11
  **/
12
12
  <template>
13
13
  <div class="main-patternstatus">
14
+ <!-- rcp模式 -->
15
+ <div v-if="patternType === 'rcp'">
16
+ <div class="ring-first" v-for="(list, index1) in patternRcp" :key="index1">
17
+ <div style="position: relative" :style="{height: '34px',paddingRight: '1px',float: 'left',width:
18
+ ((item.split + (item.sum ? item.sum : 0)) /(item.cycle > cycles ? item.cycle : cycles)) *100 +'%',}"
19
+ v-for="(item, index2) in list" :key="index2">
20
+ <div class="first-1" :style="{ width:
21
+ (Number(item.greenWidth.replace('%', '')) /
22
+ Number((((item.split + (item.sum ? item.sum : 0)) /
23
+ (item.cycle > cycles ? item.cycle : cycles)) * 100 + '%').replace('%', ''))) * 100 + '%', height: '34px',background: '#7ccc66'}">
24
+ </div>
25
+ <el-tooltip placement="top-start" effect="light">
26
+ <div v-if="item.id" slot="content">P{{ item.id }}:{{ item.split }}</div>
27
+ <div v-if="item.id" style="cursor: pointer">
28
+ <div
29
+ class="box"
30
+ style="position: absolute; width:40px; left: 0; top: 5px"
31
+ >
32
+ <div class="ring-nums">P{{ item.id }}:{{ item.split }}</div>
33
+ </div>
34
+ </div>
35
+ </el-tooltip>
36
+ </div>
37
+ </div>
38
+ </div>
14
39
  <!-- 环模式true -->
15
- <div v-if="this.contrloType === 'ring' || !this.contrloType">
40
+ <div v-if="(this.contrloType === 'ring' || !this.contrloType) && patternType !== 'rcp'">
16
41
  <div class="ring-first" v-for="(list, index1) in patternInfo" :key="index1">
17
42
  <draggable :move="move" @end="endDrag(index1)" :disabled="isMove" :list="list">
18
43
  <div style="position: relative;" :style="{'height': '35px','float':'left','width':((item.split+(item.sum?item.sum:0)) / (max?max:item.cycle) * 100) + '%'}" v-for="(item,index2) in list" :key="index2" :class="item.mode === 7 ? 'direction' : isBorder ? 'hovercell' : ''">
@@ -71,7 +96,7 @@
71
96
  <div v-for="(list, index1) in stageLists" :key="index1">
72
97
  <!-- <div> -->
73
98
  <div class="first-1" :style="{'width':list.greenWidth,'height':'34px','position':'relative','background':'#7ccc66'}">
74
- <el-tooltip placement="top-start" effect="light">
99
+ <el-tooltip v-if="list.stageSplit > 0" placement="top-start" effect="light">
75
100
  <div slot="content">
76
101
  <span class="ring-nums" v-for="(pha,index) in list.phases" :key="index">
77
102
  {{$t('openatccomponents.phase.phase')}}{{pha}}
@@ -134,6 +159,7 @@ export default {
134
159
  newCycle: this.cycles,
135
160
  patternIds: this.patternId,
136
161
  newPatterns: [],
162
+ patternRcp: [],
137
163
  newList: [],
138
164
  isControl: true,
139
165
  contrloCycle: 0,
@@ -170,6 +196,9 @@ export default {
170
196
  controlPhase: {
171
197
  type: Object
172
198
  },
199
+ patternType: {
200
+ type: String
201
+ },
173
202
  contrloType: {
174
203
  type: String
175
204
  },
@@ -342,6 +371,9 @@ export default {
342
371
  cycles: {
343
372
  handler: function (val, oldVal) {
344
373
  this.newCycle = this.cycles
374
+ if (this.patternType === 'rcp') {
375
+ this.handleRcp(this.patternStatusList)
376
+ }
345
377
  },
346
378
  // 深度观察监听
347
379
  deep: true
@@ -366,6 +398,9 @@ export default {
366
398
  },
367
399
  patternStatusList: {
368
400
  handler: function (val, oldVal) {
401
+ if (this.patternType === 'rcp') {
402
+ this.handleRcp(this.patternStatusList)
403
+ }
369
404
  this.handleBarrierHeight() // 计算屏障高度
370
405
  if (this.patternStatusList && this.newCycle) {
371
406
  // setTimeout(() => {
@@ -398,6 +433,9 @@ export default {
398
433
  if (this.contrloType === 'stage') {
399
434
  this.getStage()
400
435
  }
436
+ if (this.patternType === 'rcp') {
437
+ this.handleRcp(this.patternStatusList)
438
+ }
401
439
  },
402
440
  methods: {
403
441
  move (e) {
@@ -485,6 +523,48 @@ export default {
485
523
  }
486
524
  return ped
487
525
  },
526
+ handleRcp (val) {
527
+ this.patternRcp = []
528
+ let valSplit = val.map(item => {
529
+ return item.map(val => {
530
+ return val.splitchain
531
+ })
532
+ })
533
+ let splitCycle = valSplit.length > 0 ? valSplit.map(item => {
534
+ return item.length > 0 ? item.reduce((a, b) => {
535
+ return a + b
536
+ }) : 0
537
+ }) : 0
538
+ let cycle = Math.max(...splitCycle)// 每个环的周期最大值
539
+ for (let rings of val) {
540
+ if (rings.length === 0) continue
541
+ let list = []
542
+ for (let ring of rings) {
543
+ if (ring.splitchain === 0) continue
544
+ let obj = {}
545
+ let split = ring.splitchain
546
+ obj.split = split
547
+ obj.cycle = cycle
548
+ obj.id = ring.phases
549
+ // if (ring.sum) {
550
+ // obj.sum = ring.sum
551
+ // obj.redWidth = ((currPhase.redclear + ring.sum) / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
552
+ // } else {
553
+ // obj.redWidth = (currPhase.redclear / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
554
+ // }
555
+ // obj.mode = ring.mode
556
+ obj.greenWidth = (split / (cycle > this.cycles ? cycle : this.cycles)) * 100 + '%'
557
+ // obj.flashgreen = (currPhase.flashgreen / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
558
+ // obj.yellowWidth = (currPhase.yellow / (this.fixCycle ? this.fixCycle : this.max ? this.max : this.newCycle) * 100) + '%'
559
+ // 忽略相位不显示
560
+ // let mode = ring.mode
561
+ // if (mode !== 7) { // 忽略相位不显示
562
+ list.push(obj)
563
+ // }
564
+ }
565
+ this.patternRcp.push(list)
566
+ }
567
+ },
488
568
  handleStageData (data) {
489
569
  if (!data) return
490
570
  let peddirections = this.getPed(data)
@@ -236,7 +236,7 @@ export default {
236
236
  getMaxCycle (pattern) {
237
237
  let rings = pattern.stagesList
238
238
  let stageCycleList = rings.map(item => {
239
- return item.stageSplit ? item.stageSplit : item.split
239
+ return (item.stageSplit || item.stageSplit === 0) ? item.stageSplit : item.split
240
240
  })
241
241
  let maxCycle = stageCycleList.reduce((a, b) => {
242
242
  return a + b
@@ -3,6 +3,7 @@
3
3
  <BoardCard
4
4
  :patternId="patternId"
5
5
  :contrloType="contrloType"
6
+ :patternType="patternType"
6
7
  :stagesChange="stagesChange"
7
8
  :isShowTip="isShowTip"
8
9
  :isBorder="isBorder"
@@ -552,6 +553,9 @@ export default {
552
553
  patternStatusList: {
553
554
  type: Array
554
555
  },
556
+ patternType: {
557
+ type: String
558
+ },
555
559
  patternId: {
556
560
  type: Number
557
561
  },