openatc-components 0.4.44 → 0.4.46

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.
@@ -119,7 +119,7 @@ import { setIframdevid } from '../../../utils/auth.js'
119
119
  import { getMessageByCode } from '../../../utils/responseMessage'
120
120
  import PhaseDataModel from '../IntersectionMap/crossDirection/utils.js'
121
121
  import CrossDiagramMgr from '../../../EdgeMgr/controller/crossDiagramMgr.js'
122
- import { getChannelizatonChart } from '../../../api/cross'
122
+ import { getChannelizatonChart, getDetectorStatus } from '../../../api/cross'
123
123
  export default {
124
124
  name: 'overview-component',
125
125
  components: {
@@ -196,7 +196,9 @@ export default {
196
196
  commonHeight: undefined, // 左右侧面板的高度值
197
197
  graphicMode: false,
198
198
  resetcomponent: true,
199
- curHomePage: 'Graphical'
199
+ curHomePage: 'Graphical',
200
+ detectorList: [],
201
+ pedestrainDetectorList: []
200
202
  }
201
203
  },
202
204
  computed: {
@@ -308,6 +310,9 @@ export default {
308
310
  this.contrloType = this.allPatternList[0].contrloType
309
311
  }
310
312
  this.overlap = res.data.data.param.overlaplList
313
+ this.detectorList = res.data.data.param.detectorList
314
+ this.pedestrainDetectorList = res.data.data.param.pedestrainDetectorList
315
+ this.handleDetectorTimer()
311
316
  resolve(res.data.data)
312
317
  // this.phaseList = res.data.data.param.phaseList
313
318
  // this.patternPlan()
@@ -736,6 +741,9 @@ export default {
736
741
  this.initData()
737
742
  // 配置工具没参数的时候
738
743
  this.getIntersectionInfo(this.agentId)
744
+ if (this.curHomePage === 'Channelization') {
745
+ this.getDetectorStatus()
746
+ }
739
747
  })
740
748
  },
741
749
  getPhase () {
@@ -784,14 +792,61 @@ export default {
784
792
  }
785
793
  this.platform = res.data.data.platform
786
794
  })
795
+ },
796
+ getDetectorStatus () {
797
+ this.detIntervalFlag = false
798
+ // let agentid = getIframdevid()
799
+ return new Promise((resolve, reject) => {
800
+ getDetectorStatus(this.agentId).then(data => {
801
+ this.detIntervalFlag = true
802
+ if (!data.data.success) {
803
+ if (data.data.code === '4002' && data.data.data.errorCode === '4209') {
804
+ let success = data.data.data.content.success
805
+ if (success !== 0) {
806
+ let errormsg = 'openatccomponents.overview.putTscControlError' + success
807
+ console.log(this.$t(errormsg))
808
+ return
809
+ }
810
+ }
811
+ let parrenterror = getMessageByCode(data.data.code, this.$i18n.locale)
812
+ if (data.data.data) {
813
+ // 子类型错误
814
+ let childErrorCode = data.data.data.errorCode
815
+ if (childErrorCode) {
816
+ let childerror = getMessageByCode(data.data.data.errorCode, this.$i18n.locale)
817
+ console.log(parrenterror + ',' + childerror)
818
+ }
819
+ } else {
820
+ console.log(parrenterror)
821
+ }
822
+ this.clearDetectorStatusTimer()
823
+ return
824
+ }
825
+ this.detectorStatusData = JSON.parse(JSON.stringify(data.data.data))
826
+ resolve(this.detectorStatusData)
827
+ })
828
+ })
829
+ },
830
+ handleDetectorTimer () {
831
+ this.clearDetectorStatusTimer()
832
+ if (this.detectorList.length > 0 || this.pedestrainDetectorList.length > 0) {
833
+ this.detectorStatusTimer = setInterval(() => {
834
+ if (this.detIntervalFlag) {
835
+ this.getDetectorStatus()
836
+ }
837
+ }, 1000)
838
+ }
839
+ },
840
+ handleClearInterval () {
841
+ this.isResend = false
842
+ this.clearPatternInterval() // 清除定时器
843
+ this.clearVolumeInterval()
844
+ this.clearDetectorStatusTimer()
845
+ this.clearRegisterMessageTimer() // 清除定时器
787
846
  }
788
847
  },
789
848
  destroyed () {
790
- this.isResend = false
791
- this.clearPatternInterval() // 清除定时器
792
- this.clearVolumeInterval()
793
- this.clearDetectorStatusTimer()
794
- this.clearRegisterMessageTimer() // 清除定时器
849
+ this.handleClearInterval()
795
850
  this.getPlatform()
796
851
  }
797
852
  }