openatc-components 0.2.8 → 0.2.10

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,134 +1,286 @@
1
1
  <template>
2
2
  <div class="tentativeplan-control">
3
- <div class="title" style="margin-bottom: 18px;">{{$t('openatccomponents.overview.tentativeplan')}}</div>
3
+ <div class="title" style="margin-bottom: 18px">
4
+ {{ $t('openatccomponents.overview.tentativeplan') }}
5
+ </div>
4
6
  <el-row>
5
7
  <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.patternid') + ':'"
13
- prop="count">
14
- <el-select @change="selectPattern()" v-model="manualInfo.tempPatternid" class="col-inner" size="small" :placeholder="$t('openatccomponents.common.select')">
15
- <el-option
16
- v-for="item in patternSelect"
17
- :key="item.value"
18
- :label="item.label"
19
- :value="item.value">
20
- </el-option>
21
- </el-select>
22
- <!-- <el-input v-model="manualInfo.tempDuration" size="mini" :placeholder="$t('openatccomponents.common.input')"></el-input> -->
23
- </el-form-item>
24
- <el-form-item
25
- :label="$t('openatccomponents.overview.delay') + ':'"
26
- prop="intersection">
27
- <el-input-number :placeholder="$t('openatccomponents.common.input')" :min="0" :max="65535" :precision="0" :step="1" :controls="false" v-model.number="manualInfo.tempDelay" size="mini"></el-input-number>
28
- <!-- <el-input v-model="manualInfo.tempDelay" size="mini" :placeholder="$t('openatccomponents.common.input')"></el-input> -->
29
- </el-form-item>
30
- </el-form>
8
+ <el-form
9
+ ref="manual"
10
+ label-position="left"
11
+ :model="manualInfo"
12
+ label-width="100px"
13
+ >
14
+ <el-form-item
15
+ :label="$t('openatccomponents.overview.patternid') + ':'"
16
+ prop="count"
17
+ >
18
+ <el-select
19
+ @change="selectPattern()"
20
+ v-model="manualInfo.tempPatternid"
21
+ class="col-inner"
22
+ size="small"
23
+ :placeholder="$t('openatccomponents.common.select')"
24
+ >
25
+ <el-option
26
+ v-for="item in patternSelect"
27
+ :key="item.value"
28
+ :label="item.label"
29
+ :value="item.value"
30
+ >
31
+ </el-option>
32
+ </el-select>
33
+ <!-- <el-input v-model="manualInfo.tempDuration" size="mini" :placeholder="$t('openatccomponents.common.input')"></el-input> -->
34
+ </el-form-item>
35
+ <el-form-item
36
+ :label="$t('openatccomponents.overview.delay') + ':'"
37
+ prop="intersection"
38
+ >
39
+ <el-input-number
40
+ :placeholder="$t('openatccomponents.common.input')"
41
+ :min="0"
42
+ :max="65535"
43
+ :precision="0"
44
+ :step="1"
45
+ :controls="false"
46
+ v-model.number="manualInfo.tempDelay"
47
+ size="mini"
48
+ ></el-input-number>
49
+ <!-- <el-input v-model="manualInfo.tempDelay" size="mini" :placeholder="$t('openatccomponents.common.input')"></el-input> -->
50
+ </el-form-item>
51
+ </el-form>
31
52
  </el-col>
32
53
  <el-col :span="12">
33
- <el-form
34
- ref="manual"
35
- label-position="left"
36
- :model="manualInfo"
37
- label-width="100px">
38
- <el-form-item
39
- :label="$t('openatccomponents.overview.patternoffset') + ':'"
40
- prop="count">
41
- <el-input-number :placeholder="$t('openatccomponents.common.input')" :min="0" :max="65535" :precision="0" :step="1" :controls="false" v-model.number="manualInfo.offset" size="mini"></el-input-number>
42
- <!-- <el-input v-model="manualInfo.offset" size="mini" :placeholder="$t('openatccomponents.common.input')"></el-input> -->
43
- </el-form-item>
44
- <el-form-item
45
- :label="$t('openatccomponents.overview.duration') + ':'"
46
- prop="intersection">
47
- <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>
48
- <!-- <el-input v-model="manualInfo.duration" size="mini" :placeholder="$t('openatccomponents.common.input')"></el-input> -->
49
- </el-form-item>
50
- </el-form>
54
+ <el-form
55
+ ref="manual"
56
+ label-position="left"
57
+ :model="manualInfo"
58
+ label-width="100px"
59
+ >
60
+ <el-form-item
61
+ :label="$t('openatccomponents.overview.patternoffset') + ':'"
62
+ prop="count"
63
+ >
64
+ <el-input-number
65
+ :placeholder="$t('openatccomponents.common.input')"
66
+ :min="0"
67
+ :max="65535"
68
+ :precision="0"
69
+ :step="1"
70
+ :controls="false"
71
+ v-model.number="manualInfo.offset"
72
+ size="mini"
73
+ ></el-input-number>
74
+ <!-- <el-input v-model="manualInfo.offset" size="mini" :placeholder="$t('openatccomponents.common.input')"></el-input> -->
75
+ </el-form-item>
76
+ <el-form-item
77
+ :label="$t('openatccomponents.overview.duration') + ':'"
78
+ prop="intersection"
79
+ >
80
+ <el-input-number
81
+ :placeholder="$t('openatccomponents.common.input')"
82
+ :min="0"
83
+ :max="65535"
84
+ :precision="0"
85
+ :step="1"
86
+ :controls="false"
87
+ v-model.number="manualInfo.duration"
88
+ size="mini"
89
+ ></el-input-number>
90
+ <!-- <el-input v-model="manualInfo.duration" size="mini" :placeholder="$t('openatccomponents.common.input')"></el-input> -->
91
+ </el-form-item>
92
+ </el-form>
51
93
  </el-col>
52
94
  </el-row>
53
95
  <el-row>
54
- <div class="title" style="margin-top:18px; margin-bottom:10px">{{$t('openatccomponents.overview.patternstate')}}:
96
+ <el-radio
97
+ style="margin-left: 30px"
98
+ v-model="isRing"
99
+ :label="false"
100
+ @change="changeRing"
101
+ >{{ $t('openatccomponents.common.ringStyle') }}</el-radio
102
+ >
103
+ <el-radio v-model="isRing" :label="true" @change="changeStage">{{
104
+ $t('openatccomponents.common.stageStyle')
105
+ }}</el-radio>
106
+ <!-- <div class="title" style="margin-top:18px; margin-bottom:10px">{{$t('openatccomponents.overview.patternstate')}}:
55
107
  <span>({{$t('openatccomponents.overview.cycle')}}: {{cycle}} {{$t('openatccomponents.overview.patternoffset')}}: {{offset}})</span>
56
- </div>
57
- <stage-status
108
+ </div> -->
109
+ <!-- <stage-status
58
110
  :patternStatusList="patternOne.length===0?planPattern.rings:patternOne[0].rings"
59
111
  >
60
- </stage-status>
61
- <pattern-list
62
- :patternList="patternOne.length===0?planPattern.rings:patternOne"
63
- :patternStatusList="patternOne.length===0?planPattern.rings:patternOne[0].rings"
64
- :cycles="patternOne.length===0?planPattern.cycle:patternOne[0].cycle"
65
- :phaseList="phaseList">
66
- </pattern-list>
112
+ </stage-status> -->
113
+ <pattern-list
114
+ :key="keyChange"
115
+ :allPatternList="allPatternList"
116
+ :contrloType="!this.isRing ? 'ring' : 'stage'"
117
+ :stagesChange="
118
+ patternOne.length === 0
119
+ ? planPattern.stagesList
120
+ : patternOne[0].stagesList
121
+ "
122
+ :patternList="patternOne.length === 0 ? planPattern.rings : patternOne"
123
+ :patternStatusList="
124
+ patternOne.length === 0 ? planPattern.rings : patternOne[0].rings
125
+ "
126
+ :cycles="
127
+ patternOne.length === 0 ? planPattern.cycle : patternOne[0].cycle
128
+ "
129
+ :phaseList="phaseList"
130
+ >
131
+ </pattern-list>
67
132
  </el-row>
68
133
  <el-row>
69
- <el-tabs v-model="activeList" type="card">
70
- <el-tab-pane :label="$t('openatccomponents.pattern.ringConfig')" name="ring">
71
- <div style="width: 100%; overflow: hidden;margin-top: 20px;">
72
- <kan-ban v-for="n in ringCount"
73
- :key="n" class="closephasekanban"
74
- :index="n"
75
- :options="options"
76
- :list="patternOne.length===0?planPattern.rings[n-1]:patternOne[0].rings[n-1]"
77
- :phaseList="phaseList"
78
- :header-text="$t('openatccomponents.pattern.ring')+n"
79
- @handleSplit="handleSplit">
80
- </kan-ban>
81
- </div>
134
+ <el-tabs v-model="activeList" type="card">
135
+ <el-tab-pane
136
+ v-if="!isRing"
137
+ :label="$t('openatccomponents.pattern.ringConfig')"
138
+ name="ring"
139
+ >
140
+ <div style="width: 100%; overflow: hidden; margin-top: 20px">
141
+ <kan-ban
142
+ v-for="n in ringCount"
143
+ :key="n"
144
+ class="closephasekanban"
145
+ :index="n"
146
+ :options="options"
147
+ :list="
148
+ patternOne.length === 0
149
+ ? planPattern.rings[n - 1]
150
+ : patternOne[0].rings[n - 1]
151
+ "
152
+ :phaseList="phaseList"
153
+ :header-text="$t('openatccomponents.pattern.ring') + n"
154
+ @handleSplit="handleSplit"
155
+ >
156
+ </kan-ban>
157
+ </div>
82
158
  </el-tab-pane>
83
- <!-- <el-tab-pane :label="$t('openatccomponents.pattern.stageConfig')" name="kanban">
84
- <el-scrollbar :vertical="true">
85
- <div class="stage-panel-contener">
86
- <stage-board v-for="(stage,index) in patternOne.length===0?stagesList:patternOne[0].stagesList"
87
- class="closephasekanban"
88
- :key="index"
89
- :stage="stage"
90
- :options="options"
91
- :stageInfo="patternOne.length===0?stagesList:patternOne[0].stagesList"
92
- :coordphaseOption="coordphaseOption"
93
- :subIndex="index"
94
- @onStageSplitChange="onStageSplitChange"
95
- @stageSplitChange="stageSplitChange"
96
- @onStageDelaystartChange="onStageDelaystartChange"
97
- @onStageAdvanceendChange="onStageAdvanceendChange"
98
- >
99
- </stage-board>
159
+ <!-- <el-tab-pane v-if="isRing" :label="$t('openatccomponents.pattern.stageConfig')" name="kanban">
160
+ <div class="stage-panel-contener">
161
+ <StageKanban
162
+ v-for="(stage, index) in scope.row.stagesList"
163
+ class="kanban todo"
164
+ :key="index"
165
+ :stage="stage"
166
+ :stageInfo="scope.row.stagesList"
167
+ :isRing="isRing"
168
+ :options="scope.row.options"
169
+ :coordphaseOption="coordphaseOption"
170
+ :rowIndex="scope.$index"
171
+ :subIndex="index"
172
+ @onStageSplitChange="onStageSplitChange"
173
+ @stageSplitChange="stageSplitChange"
174
+ @onStageDelaystartChange="onStageDelaystartChange"
175
+ @onStageAdvanceendChange="onStageAdvanceendChange"
176
+ />
177
+ <div v-if="isRing" style="margin-left: 20px">
178
+ <el-button
179
+ type="primary"
180
+ @click="addStage(scope.row.stagesList)"
181
+ icon="el-icon-plus"
182
+ circle
183
+ ></el-button>
100
184
  </div>
101
- </el-scrollbar>
102
- </el-tab-pane> -->
103
- <el-tab-pane :label="$t('openatccomponents.pattern.parameters')" name="parame">
104
- <el-row>
105
- <expend-config
106
- v-for="(j,index) in ringCounts"
107
- :key="index"
108
- class="expendkanban"
109
- :options="options"
110
- :header-text="$t('openatccomponents.pattern.ring')+j"
111
- :list="patternOne.length===0?planPattern.rings[j-1]:patternOne[0].rings[j-1]"
112
- >
113
- </expend-config>
114
- <div class="forbiddenstage">
115
- {{$t('openatccomponents.pattern.forbiddenstage')}}
116
- <el-input class="stage-value" size="small" v-model="forbiddenstage"></el-input>
117
- </div>
118
- <div class="forbiddenstage">
119
- {{$t('openatccomponents.pattern.screenstage')}}
120
- <el-input class="stage-value" size="small" v-model="screenstage"></el-input>
121
- </div>
122
- <div class="forbiddenstage">
123
- {{$t('openatccomponents.pattern.coordinatestage')}}
124
- <el-input class="stage-value" size="small" v-model="coordinatestage"></el-input>
125
- </div>
126
- </el-row>
127
- </el-tab-pane>
128
- <el-tab-pane :label="$t('openatccomponents.pattern.overLap')" name="overlap">
129
- <el-row :gutter="20">
130
- <el-col :span="24" >
131
- <over-lap
185
+ </div>
186
+ </el-tab-pane> -->
187
+ <el-tab-pane
188
+ v-if="isRing"
189
+ :label="$t('openatccomponents.pattern.stageConfig')"
190
+ name="ring"
191
+ >
192
+ <div class="stage-panel-contener">
193
+ <stage-bord
194
+ v-for="(stage, index) in patternOne.length === 0
195
+ ? planPattern.stagesList
196
+ : patternOne[0].stagesList"
197
+ class="kanban todo"
198
+ :key="index"
199
+ :stage="stage"
200
+ :options="options"
201
+ :isRing="isRing"
202
+ :stageInfo="
203
+ patternOne.length === 0
204
+ ? planPattern.stagesList
205
+ : patternOne[0].stagesList
206
+ "
207
+ :coordphaseOption="coordphaseOption"
208
+ :subIndex="index"
209
+ @onStageSplitChange="onStageSplitChange"
210
+ @stageSplitChange="stageSplitChange"
211
+ @onStageDelaystartChange="onStageDelaystartChange"
212
+ @onStageAdvanceendChange="onStageAdvanceendChange"
213
+ >
214
+ </stage-bord>
215
+ <div v-if="isRing" style="margin-left: 20px">
216
+ <el-button
217
+ type="primary"
218
+ @click="
219
+ addStage(
220
+ patternOne.length === 0
221
+ ? planPattern.stagesList
222
+ : patternOne[0].stagesList
223
+ )
224
+ "
225
+ icon="el-icon-plus"
226
+ circle
227
+ ></el-button>
228
+ </div>
229
+ </div>
230
+ </el-tab-pane>
231
+ <el-tab-pane
232
+ v-if="!isRing"
233
+ :label="$t('openatccomponents.pattern.parameters')"
234
+ name="parame"
235
+ >
236
+ <el-row>
237
+ <expend-config
238
+ v-for="(j, index) in ringCounts"
239
+ :key="index"
240
+ class="expendkanban"
241
+ :options="options"
242
+ :header-text="$t('openatccomponents.pattern.ring') + j"
243
+ :list="
244
+ patternOne.length === 0
245
+ ? planPattern.rings[j - 1]
246
+ : patternOne[0].rings[j - 1]
247
+ "
248
+ >
249
+ </expend-config>
250
+ <div class="forbiddenstage">
251
+ {{ $t('openatccomponents.pattern.forbiddenstage') }}
252
+ <el-input
253
+ class="stage-value"
254
+ size="small"
255
+ v-model="forbiddenstage"
256
+ ></el-input>
257
+ </div>
258
+ <div class="forbiddenstage">
259
+ {{ $t('openatccomponents.pattern.screenstage') }}
260
+ <el-input
261
+ class="stage-value"
262
+ size="small"
263
+ v-model="screenstage"
264
+ ></el-input>
265
+ </div>
266
+ <div class="forbiddenstage">
267
+ {{ $t('openatccomponents.pattern.coordinatestage') }}
268
+ <el-input
269
+ class="stage-value"
270
+ size="small"
271
+ v-model="coordinatestage"
272
+ ></el-input>
273
+ </div>
274
+ </el-row>
275
+ </el-tab-pane>
276
+ <el-tab-pane
277
+ v-if="!isRing"
278
+ :label="$t('openatccomponents.pattern.overLap')"
279
+ name="overlap"
280
+ >
281
+ <el-row :gutter="20">
282
+ <el-col :span="24">
283
+ <over-lap
132
284
  :stageList="stagesList"
133
285
  :overlap="overlap"
134
286
  :checked="true"
@@ -136,33 +288,50 @@
136
288
  :cycle="overLapCycle"
137
289
  >
138
290
  </over-lap>
139
- </el-col>
140
- </el-row>
141
- </el-tab-pane>
142
- <el-tab-pane :label="$t('openatccomponents.pattern.patternOptimize')" name="patternOptimize">
143
- <pattern-optimize
144
- v-for="n in optimizes"
145
- :key="n" class="expendkanban"
146
- :list="patternOne.length===0?planPattern.rings[n-1]:patternOne[0].rings[n-1]"
147
- :rings="patternOne.length===0?planPattern:patternOne[0]"
148
- :phaseList="phaseList"
149
- :options="options"
150
- :header-text="$t('openatccomponents.pattern.ring')+n"
151
- :index="n"
152
- :nowNumber="n"
153
- @handleSplit="handleSplit"
154
- >
155
- </pattern-optimize>
156
- </el-tab-pane>
157
- </el-tabs>
291
+ </el-col>
292
+ </el-row>
293
+ </el-tab-pane>
294
+ <el-tab-pane
295
+ v-if="!isRing"
296
+ :label="$t('openatccomponents.pattern.patternOptimize')"
297
+ name="patternOptimize"
298
+ >
299
+ <pattern-optimize
300
+ v-for="n in optimizes"
301
+ :key="n"
302
+ class="expendkanban"
303
+ :list="
304
+ patternOne.length === 0
305
+ ? planPattern.rings[n - 1]
306
+ : patternOne[0].rings[n - 1]
307
+ "
308
+ :rings="patternOne.length === 0 ? planPattern : patternOne[0]"
309
+ :phaseList="phaseList"
310
+ :options="options"
311
+ :header-text="$t('openatccomponents.pattern.ring') + n"
312
+ :index="n"
313
+ :nowNumber="n"
314
+ @handleSplit="handleSplit"
315
+ >
316
+ </pattern-optimize>
317
+ </el-tab-pane>
318
+ </el-tabs>
158
319
  </el-row>
159
320
  <div class="footer" v-if="realtimeStatusModalvisible">
160
- <el-button @click="handleClose()">{{$t('openatccomponents.button.Back')}}</el-button>
161
- <el-button type="primary" @click="handleManualControl()">{{$t('openatccomponents.overview.implement')}}</el-button>
321
+ <el-button @click="handleClose()">{{
322
+ $t('openatccomponents.button.Back')
323
+ }}</el-button>
324
+ <el-button type="primary" @click="handleManualControl()">{{
325
+ $t('openatccomponents.overview.implement')
326
+ }}</el-button>
162
327
  </div>
163
328
  <div class="footer" v-if="!realtimeStatusModalvisible">
164
- <el-button @click="handleClose()">{{$t('openatccomponents.button.Back')}}</el-button>
165
- <el-button type="primary" @click="handleManualControl()">{{$t('openatccomponents.overview.comfirm')}}</el-button>
329
+ <el-button @click="handleClose()">{{
330
+ $t('openatccomponents.button.Back')
331
+ }}</el-button>
332
+ <el-button type="primary" @click="handleManualControl()">{{
333
+ $t('openatccomponents.overview.comfirm')
334
+ }}</el-button>
166
335
  </div>
167
336
  </div>
168
337
  </template>
@@ -215,6 +384,7 @@ export default {
215
384
  return {
216
385
  stagesList: [],
217
386
  phaseRings: [],
387
+ keyChange: false,
218
388
  overLapCycle: 0,
219
389
  options: {
220
390
  group: 'pattern'
@@ -222,6 +392,8 @@ export default {
222
392
  max: '',
223
393
  patternCycleEqual: true,
224
394
  activeList: 'ring',
395
+ isRing: false,
396
+ // isChange: false,
225
397
  ringCount: 1,
226
398
  ringCounts: 1,
227
399
  barriers: [],
@@ -247,9 +419,137 @@ export default {
247
419
  this.initData()
248
420
  },
249
421
  methods: {
422
+ addStage (row) {
423
+ // this.isChange = false
424
+ if (row.length > 15) {
425
+ this.$message.error(
426
+ this.$t('edge.pattern.mostlist')
427
+ )
428
+ return
429
+ }
430
+ if (this.patternOne.length !== 0) {
431
+ this.patternOne[0].stagesList.push({
432
+ key: row.length,
433
+ green: 25,
434
+ yellow: 3,
435
+ red: 2,
436
+ phases: [],
437
+ stageSplit: 30
438
+ })
439
+ } else {
440
+ this.planPattern.stagesList.push({
441
+ key: row.length,
442
+ green: 25,
443
+ yellow: 3,
444
+ red: 2,
445
+ phases: [],
446
+ stageSplit: 30
447
+ })
448
+ }
449
+ },
450
+ changeRing () {
451
+ // this.contrloType = 'stage'
452
+ this.isRing = false
453
+ // const globalParamModel = this.$store.getters.globalParamModel
454
+ // let pattern = globalParamModel.getParamsByType('patternList')
455
+ // let pattern = this.allPatternList
456
+ this.getCycle()
457
+ this.patternOne = this.allPatternList.filter(item => {
458
+ return item.id === Number(this.manualInfo.tempPatternid)
459
+ })
460
+ // if (this.isChange) {
461
+ // for (let i = 0; i < pattern.length; i++) {
462
+ this.handleStageData(this.patternOne.rings)
463
+ // }
464
+ // } else {
465
+ // for (let i = 0; i < pattern.length; i++) {
466
+ // this.setStageList(pattern[i].stagesList, pattern[i].id)
467
+ // }
468
+ // }
469
+ },
470
+ changeStage () {
471
+ this.isRing = true
472
+ this.getStageCycle()
473
+ },
474
+ getStageCycle () {
475
+ // this.patternOne.length === 0 ? this.allPatternList this.patternOne
476
+ if (this.patternOne.length === 0) {
477
+ this.setStageList(this.planPattern.stagesList, this.planPattern.id)
478
+ } else {
479
+ // this.patternOne = this.allPatternList.filter(item => {
480
+ // return item.id === Number(this.manualInfo.tempPatternid)
481
+ // })
482
+ this.setStageList(this.patternOne[0].stagesList, this.patternOne[0].id)
483
+ }
484
+ // let pattern = this.allPatternList
485
+ // for (let i = 0; i < pattern.length; i++) {
486
+ // this.patternOne[0].cycle = this.changeStageCycle(pattern[i])
487
+ // }
488
+ },
489
+ // changeStageCycle (pattern) {
490
+ // let rings = pattern.stagesList
491
+ // let stageCycleList = rings.map(item => {
492
+ // if (item.stageSplit) {
493
+ // return item.stageSplit
494
+ // } else {
495
+ // return 0
496
+ // }
497
+ // })
498
+ // let maxCycle = stageCycleList.reduce((a, b) => {
499
+ // return a + b
500
+ // }, 0)
501
+ // return maxCycle
502
+ // },
503
+ setStageList (stageChange, id) {
504
+ // let patternList = this.globalParamModel.getParamsByType('patternList')
505
+ // let patternList = this.allPatternList
506
+ let stagesList = []
507
+ for (let i = 0; i < stageChange.length; i++) {
508
+ let stage = JSON.parse(JSON.stringify(stageChange[i]))
509
+ let stageItem = this.getStageItems(stage.phases, i, stageChange)
510
+ stagesList.push(JSON.parse(JSON.stringify(stageItem)))
511
+ }
512
+ (this.patternOne.length === 0 ? this.planPattern : this.patternOne).map(item => { // 添加特征参数stage
513
+ if (item.id === id) {
514
+ if (this.isRing) {
515
+ item.contrloType = 'stage'
516
+ } else {
517
+ item.contrloType = 'ring'
518
+ }
519
+ item.stagesList = JSON.parse(JSON.stringify(stagesList.filter(item => item.stageSplit)))
520
+ }
521
+ })
522
+ this.stagesList = stagesList.filter(item => item.stageSplit)
523
+ },
524
+ getStageItems (stageArr, i, stageChange) {
525
+ let res = {
526
+ key: i,
527
+ split: this.narr[i], // 阶段绿性比
528
+ phases: stageArr,
529
+ delaystart: 0,
530
+ advanceend: 0
531
+ }
532
+ for (let rings of stageChange) {
533
+ if (i === rings.key) {
534
+ res.green = rings.green ? rings.green : rings.green === 0 ? 0 : 25
535
+ res.yellow = rings.yellow ? rings.yellow : rings.yellow === 0 ? 0 : 3
536
+ res.red = rings.red ? rings.red : rings.red === 0 ? 0 : 2
537
+ res.phases = rings.phases ? rings.phases : stageArr
538
+ // res.stageSplit = rings.split ? rings.split : 30
539
+ if (rings.split) {
540
+ res.stageSplit = rings.split
541
+ } else if (rings.stageSplit) {
542
+ res.stageSplit = rings.stageSplit
543
+ } else {
544
+ res.stageSplit = 0
545
+ }
546
+ }
547
+ }
548
+ return res
549
+ },
250
550
  tranform (arr) { // 分barrier
251
551
  let newMap = new Map()
252
- arr.forEach(({id, current}) => {
552
+ arr.forEach(({ id, current }) => {
253
553
  const find = newMap.get(current.join())
254
554
  if (find) newMap.get(current.join()).push(id)
255
555
  else newMap.set(current.join(), [id])
@@ -422,7 +722,7 @@ export default {
422
722
  if (listObj[b]) {
423
723
  const find = retItem.find(r => r.ring === listObj[b])
424
724
  if (find) find.data.push(b)
425
- else retItem.push({ring: listObj[b], data: [b]})
725
+ else retItem.push({ ring: listObj[b], data: [b] })
426
726
  }
427
727
  })
428
728
  ret.push(retItem)
@@ -433,6 +733,7 @@ export default {
433
733
  let Pattern = {
434
734
  offset: 0,
435
735
  cycle: 0,
736
+ stagesList: [],
436
737
  rings: [[], [], [], []]
437
738
  }
438
739
  var newPattern = JSON.parse(JSON.stringify(Pattern))
@@ -525,13 +826,13 @@ export default {
525
826
  }
526
827
  },
527
828
  stageSplitChange (diff, rowIndex, subIndex) {
528
- let row = this.patternList[rowIndex]
529
- let ringsList = row.stagesList
829
+ let row = this.patternOne.length === 0 ? this.planPattern : this.patternOne
830
+ let ringsList = this.patternOne.length === 0 ? row.stagesList : row[0].stagesList
530
831
  for (let rings of ringsList) {
531
- if (subIndex === rings.key) {
532
- rings.stageSplit = (rings.green ? rings.green : 0) + (rings.yellow ? rings.yellow : 0) + (rings.red ? rings.red : 0)
533
- continue
534
- }
832
+ // if (subIndex === rings.key) {
833
+ rings.stageSplit = (rings.green ? rings.green : 0) + (rings.yellow ? rings.yellow : 0) + (rings.red ? rings.red : 0)
834
+ continue
835
+ // }
535
836
  }
536
837
  },
537
838
  onStageDelaystartChange (diff, rowIndex, subIndex) {
@@ -583,6 +884,9 @@ export default {
583
884
  this.patternOne = this.allPatternList.filter(item => {
584
885
  return item.id === selectId
585
886
  })
887
+ // if (this.patternOne[0].contrloType === 'stage') {
888
+ // this.changeStage()
889
+ // }
586
890
  this.manualInfo.offset = this.offset
587
891
  for (let rings of this.patternOne[0].rings) {
588
892
  if (rings.length === 0) continue
@@ -721,12 +1025,13 @@ export default {
721
1025
  },
722
1026
  initData () {
723
1027
  // 判断有几个环,就创建几个看板
724
- // let phaseList = this.globalParamModel.getParamsByType('phaseList')
725
- this.coordphaseOption = this.phaseList.map(ele => {
726
- return {
727
- value: ele.id
728
- }
729
- })
1028
+ // let phaseList = this.globalParamModel.getParamsByType('phaseList')
1029
+ // this.coordphaseOption = this.phaseList.map(ele => {
1030
+ // return {
1031
+ // value: ele.id
1032
+ // }
1033
+ // })
1034
+ this.coordphaseOption = this.phaseList
730
1035
  // this.overlap = this.globalParamModel.getParamsByType('overlaplList')
731
1036
  // this.agentId = getIframdevid()
732
1037
  let rings = []
@@ -743,10 +1048,10 @@ export default {
743
1048
  this.ringCounts = this.ringCounts.sort(this.sortNumbers) // 把数组中的值按照从小到大的顺序重新排序
744
1049
  this.optimizes = Array.from(new Set(rings)) // 去除数组重复的元素
745
1050
  this.optimizes = this.optimizes.sort(this.sortNumbers) // 把数组中的值按照从小到大的顺序重新排序
746
- // this.increaseId()
747
- // this.getCycle()
748
- // this.updatePhaseDescription()
749
- // this.getOptionsOfRing()
1051
+ // this.increaseId()
1052
+ // this.getCycle()
1053
+ // this.updatePhaseDescription()
1054
+ // this.getOptionsOfRing()
750
1055
  },
751
1056
  sortNumbers (a, b) {
752
1057
  return a - b
@@ -774,6 +1079,20 @@ export default {
774
1079
  }
775
1080
  return isequal
776
1081
  },
1082
+ getMaxCycleStage (pattern) {
1083
+ let rings = pattern.stagesList
1084
+ let stageCycleList = rings.map(item => {
1085
+ if (item.stageSplit) {
1086
+ return item.stageSplit
1087
+ } else {
1088
+ return 0
1089
+ }
1090
+ })
1091
+ let maxCycle = stageCycleList.reduce((a, b) => {
1092
+ return a + b
1093
+ }, 0)
1094
+ return maxCycle
1095
+ },
777
1096
  getMaxCycle (pattern) {
778
1097
  let rings = pattern.rings
779
1098
  let maxCycle = 0
@@ -819,13 +1138,31 @@ export default {
819
1138
  // duration: this.manualInfo.tempDuration !== undefined ? Number(this.manualInfo.tempDuration) : 0,
820
1139
  data: {}
821
1140
  }
1141
+ if (this.manualInfo.tempPatternid) {
1142
+ submitdata.terminal = Number(this.manualInfo.tempPatternid)
1143
+ }
822
1144
  if (this.patternOne.length === 0) {
823
- submitdata.data.cycle = this.getMaxCycle(this.planPattern)
1145
+ if (this.isRing) {
1146
+ submitdata.data.cycle = this.getMaxCycleStage(this.planPattern)
1147
+ } else {
1148
+ submitdata.data.cycle = this.getMaxCycle(this.planPattern)
1149
+ }
1150
+ submitdata.data.stagesList = this.planPattern.stagesList
824
1151
  } else {
825
- submitdata.data.cycle = this.getMaxCycle(this.patternOne[0])
1152
+ if (this.isRing) {
1153
+ submitdata.data.cycle = this.getMaxCycleStage(this.patternOne[0])
1154
+ } else {
1155
+ submitdata.data.cycle = this.getMaxCycle(this.patternOne[0])
1156
+ }
1157
+ submitdata.data.stagesList = this.patternOne[0].stagesList
826
1158
  }
827
1159
  submitdata.data.offset = this.offset
828
- submitdata.data.rings = this.rings
1160
+ if (this.patternOne.length === 0) {
1161
+ submitdata.data.rings = this.planPattern.rings
1162
+ } else {
1163
+ submitdata.data.rings = this.patternOne[0].rings
1164
+ }
1165
+ // submitdata.data.rings = this.patternOne.length === 0 ? this.planPattern.rings : this.patternOne[0].rings
829
1166
  // this.checkPatternRules(submitdata.data.rings)
830
1167
  if (this.patternCycleEqual) {
831
1168
  this.$emit('closePhaseControl', submitdata)