openatc-components 0.1.143 → 0.1.145

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
@@ -73,7 +73,8 @@ module.exports = {
73
73
 
74
74
  productionSourceMap: true,
75
75
  // https://webpack.js.org/configuration/devtool/#production
76
- devtool: '#source-map',
76
+ devtool: 'source-map',
77
+ // devtool: 'eval-source-map',
77
78
 
78
79
  // Gzip off by default as many popular static hosts such as
79
80
  // Surge or Netlify already gzip all static assets for you.
@@ -14,7 +14,7 @@
14
14
  <el-dialog
15
15
  :title="$t(`openatccomponents.faultrecord.faultDetail`)"
16
16
  :visible.sync="dialogFormVisible"
17
- width="60%"
17
+ :width="isFromAtc ? '45%' : '30%'"
18
18
  :append-to-body="true"
19
19
  :close-on-click-modal="false">
20
20
  <div class="content">
@@ -25,12 +25,14 @@
25
25
  :default-sort = "{prop: 'm_unFaultOccurTime', order: 'descending'}"
26
26
  >
27
27
  <el-table-column
28
+ v-if="isFromAtc"
28
29
  prop="m_unFaultOccurTime"
29
30
  :label="$t('openatccomponents.faultrecord.faultOccurtime')"
30
31
  sortable
31
32
  width="200">
32
33
  </el-table-column>
33
34
  <el-table-column
35
+ v-if="isFromAtc"
34
36
  prop="m_byFaultBoardType"
35
37
  :formatter="formatterBoardType"
36
38
  :label="$t('openatccomponents.faultrecord.boardCardType')"
@@ -55,6 +57,7 @@
55
57
  sortable>
56
58
  </el-table-column>
57
59
  <el-table-column
60
+ v-if="isFromAtc"
58
61
  prop="m_byFaultLevel"
59
62
  :formatter="m_byFaultLevel"
60
63
  :label="$t('openatccomponents.faultrecord.faultGrade')"
@@ -62,6 +65,7 @@
62
65
  width="120">
63
66
  </el-table-column>
64
67
  <el-table-column
68
+ v-if="isFromAtc"
65
69
  prop="enumerate"
66
70
  :label="$t('openatccomponents.faultrecord.enumerate')"
67
71
  align="center">
@@ -69,7 +73,7 @@
69
73
  <el-tag v-show="scope.row.enumerate" :type="scope.row.enumerate === '1'?'info':scope.row.enumerate === '2'?'success':scope.row.enumerate === '0'?'':''">{{formatterEnumerate(scope.row)}}</el-tag>
70
74
  </template>
71
75
  </el-table-column>
72
- <el-table-column :label="$t('openatccomponents.faultrecord.operation')" align="center">
76
+ <el-table-column v-if="isFromAtc" :label="$t('openatccomponents.faultrecord.operation')" align="center">
73
77
  <template slot-scope="scope">
74
78
  <el-button type="text" @click="handleEnumerateCheck(scope.row, '2')">{{$t('openatccomponents.button.confirm')}}</el-button>
75
79
  <el-button type="text" @click="handleEnumerateCheck(scope.row, '1')">{{$t('openatccomponents.button.ignore')}}</el-button>
@@ -93,6 +97,10 @@ export default {
93
97
  },
94
98
  agentId: {
95
99
  type: String
100
+ },
101
+ isFromAtc: {
102
+ type: Boolean,
103
+ default: true
96
104
  }
97
105
  },
98
106
  data () {
@@ -948,7 +948,8 @@ export default {
948
948
  this.fillGap(ringTeams, val)
949
949
  }
950
950
  let barrier = this.step2(ringTeams, newPattern)
951
- this.barrierList = barrier.map(j => {
951
+ let barrierLeft = barrier.map(item => item - 0.3)// 屏障左移显示出人行横道
952
+ this.barrierList = barrierLeft.map(j => {
952
953
  return (j / (this.max ? this.max : this.newCycle) * 100) + '%'
953
954
  })
954
955
  // this.barrierList.unshift(0)
@@ -11,7 +11,7 @@
11
11
  **/
12
12
  <template>
13
13
  <div class="scheme-config openatc-scheme-config" style="height: 100%;">
14
- <fault-detail-modal ref="faultDetail" :agentId="agentId" @refreshFault="getFaultById"></fault-detail-modal>
14
+ <fault-detail-modal ref="faultDetail" :agentId="agentId" :isFromAtc="isFromAtc" @refreshFault="getFaultById"></fault-detail-modal>
15
15
  <div style="height: 100%;">
16
16
  <transition name="fade-right" mode="out-in"
17
17
  :enter-active-class="toPage === 1 ? 'animated fadeInRight' : 'animated fadeInLeft'"
@@ -205,6 +205,10 @@ export default {
205
205
  roadDirection: {
206
206
  type: String,
207
207
  default: 'right'
208
+ },
209
+ isFromAtc: {
210
+ type: Boolean,
211
+ default: true
208
212
  }
209
213
  },
210
214
  data () {
@@ -231,6 +231,7 @@ import dateObj from './utils.js'
231
231
  // import routeChart from './pattern/planChart/index'
232
232
  // import PlanExecute from './components/planExecute'
233
233
  import { GetDeviceByIds } from '../../../api/device.js'
234
+ import { getAllPatternOfDevs } from '../../../api/route'
234
235
  const { monthsModel, daysModelCh, daysModelEn, datesModel, monthsModelEn, datesModelEn } = dateObj
235
236
  export default {
236
237
  name: 'PatternConfig',
@@ -385,7 +386,7 @@ export default {
385
386
  // this.getAllPlan()
386
387
  },
387
388
  methods: {
388
- handeAgentidsChange () {
389
+ async handeAgentidsChange () {
389
390
  let devs = []
390
391
  for (let agentid of this.agentids) {
391
392
  let item = {
@@ -396,25 +397,128 @@ export default {
396
397
  devs.push(item)
397
398
  }
398
399
  let _this = this
399
- this.$nextTick(() => {
400
+ this.$nextTick(async () => {
400
401
  let route = {
401
402
  devs: devs
402
403
  }
403
404
  let optPatternList
405
+ // console.log('_this.opt', _this.opt)
406
+ // console.log('_this.optPatternList', _this.opt.optPatternList)
407
+ // console.log('_this.length', _this.opt.optPatternList.length)
404
408
  if (_this.opt && _this.opt.optPatternList && _this.opt.optPatternList.length > 0) {
405
409
  route = _this.opt.optPatternList[0]
406
410
  let arr = []
407
411
  for (let dev of route.devs) {
408
412
  arr.push(dev.agentid)
409
413
  }
410
- if (arr.length === this.agentids.length && arr.join('') !== this.agentids.join('')) {
414
+ // console.log('arr.length', arr)
415
+ // console.log('this.agentids', this.agentids)
416
+ // console.log('this.len', arr.length === this.agentids.length)
417
+ // console.log('this.jon', arr.join('') !== this.agentids.join(''))
418
+ // console.log('this.jon', arr.join(''), this.agentids.join(''))
419
+ // if (arr.length === this.agentids.length && arr.join('') !== this.agentids.join('')) {
420
+ if (arr.length === this.agentids.length) {
411
421
  optPatternList = _this.opt.optPatternList
422
+ // check and reset data
423
+ // console.log('checkAndResetListBefore', optPatternList)
424
+ let opt = await this.checkAndResetList(optPatternList)
425
+ // console.log('checkAndResetListAfter.opt', optPatternList)
426
+ optPatternList = opt.optPatternList
427
+ // console.log('checkAndResetListAfter', optPatternList)
412
428
  }
413
429
  }
414
430
  this.route = route
415
431
  _this.onAgentidsChange('', optPatternList, _this.agentids)
416
432
  })
417
433
  },
434
+ async checkAndResetList (optPatternList) {
435
+ let res = JSON.parse(JSON.stringify(optPatternList))
436
+ let resetFlag = false
437
+ for (let opt of optPatternList) {
438
+ if (opt.devs && opt.devs.length > 0) {
439
+ for (let dev of opt.devs) {
440
+ if (!dev.feature || dev.feature.patternList) {
441
+ resetFlag = true
442
+ break
443
+ }
444
+ }
445
+ }
446
+ if (resetFlag) {
447
+ break
448
+ }
449
+ }
450
+ if (resetFlag) {
451
+ res = await this.getFullOptList(optPatternList)
452
+ }
453
+ return res
454
+ },
455
+ async getAllPatternOfRoute (agentids) {
456
+ if (agentids.length === 0) return
457
+ return new Promise((resolve, reject) => {
458
+ getAllPatternOfDevs(agentids).then(res => {
459
+ if (!res.data.success) {
460
+ let agentid = res.data.data.agentid
461
+ let commomMsg = this.$t('openatccomponents.greenwaveoptimize.device') + agentid
462
+ let data = res
463
+ let parrenterror = getMessageByCode(data.data.code, this.$i18n.locale)
464
+ if (data.data.data) {
465
+ // 子类型错误
466
+ let childErrorCode = data.data.data.errorCode
467
+ if (childErrorCode) {
468
+ let childerror = getMessageByCode(data.data.data.errorCode, this.$i18n.locale)
469
+ this.$message.error(parrenterror + ',' + childerror + ',' + commomMsg)
470
+ }
471
+ } else {
472
+ this.$message.error(parrenterror + ',' + commomMsg)
473
+ }
474
+ console.error('ErrorOcurrred')
475
+ resolve([])
476
+ }
477
+ let allPatternList = res.data.data.devs
478
+ resolve(allPatternList)
479
+ })
480
+ })
481
+ },
482
+ async getFullOptList (optPatternList) {
483
+ let allPatternList = await this.getAllPatternOfRoute(this.agentids)
484
+ // console.log('allPatternList', allPatternList)
485
+ let res = {
486
+ 'optPatternList': []
487
+ }
488
+ for (let i = 0; i < optPatternList.length; i++) {
489
+ let opt = optPatternList[i]
490
+ let opteItem = {
491
+ 'id': i + 1,
492
+ 'name': opt.name,
493
+ title: opt.name,
494
+ 'tabName': i + 1 + '',
495
+ 'devs': []
496
+ }
497
+ for (let j = 0; j < opt.devs.length; j++) {
498
+ let dev = opt.devs[j]
499
+ let patternList = allPatternList.filter(ap => ap.agentid === dev.agentid)[0].feature.patternList
500
+ let patternItem = patternList.filter(pattern => pattern.id === dev.patternid)[0]
501
+ let devItem = {
502
+ 'agentid': dev.agentid,
503
+ 'patternid': dev.patternid,
504
+ 'isused': dev.isused,
505
+ 'id': j + 1,
506
+ 'offset': patternItem.offset,
507
+ 'cycle': patternItem.cycle,
508
+ 'patternId': patternItem.id,
509
+ 'desc': patternItem.desc,
510
+ 'patternDesc': patternItem.patternDesc,
511
+ 'feature': {
512
+ 'patternList': patternList
513
+ }
514
+ }
515
+ opteItem.devs.push(devItem)
516
+ }
517
+ res.optPatternList.push(opteItem)
518
+ }
519
+ // console.log('getFullOptList', res)
520
+ return res
521
+ },
418
522
  handlePlanChart (routeData, patternList, greenwave, allPatternList) {
419
523
  let chartData = {
420
524
  routeData,
@@ -902,9 +1006,12 @@ export default {
902
1006
  this.resetTab()
903
1007
  this.chooseId = id
904
1008
  // this.agentids = agentids
1009
+ // console.log('this.optPatternList', optPatternList)
905
1010
  if (optPatternList && optPatternList.length > 0) {
906
1011
  this.editableTabs = JSON.parse(JSON.stringify(optPatternList))
1012
+ // console.log('this.editableTabs', this.editableTabs)
907
1013
  } else {
1014
+ // console.log(222)
908
1015
  this.editableTabs[0].devs = this.route.devs
909
1016
  }
910
1017
  this.tabIndex = this.editableTabs.length