From 91b1e8f5b37b0ae003b3a505d3d37dc4f902478c Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Thu, 4 May 2023 17:39:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E6=95=85=E9=9A=9C=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=88=9D=E7=A8=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/newMap/display/errrorMessageBox.vue | 210 +++++++++--------- 1 file changed, 104 insertions(+), 106 deletions(-) diff --git a/src/views/newMap/display/errrorMessageBox.vue b/src/views/newMap/display/errrorMessageBox.vue index d977dd899..cb9cc5982 100644 --- a/src/views/newMap/display/errrorMessageBox.vue +++ b/src/views/newMap/display/errrorMessageBox.vue @@ -2,7 +2,7 @@
-
{{ finishDealAlarmMessage }}
+
{{ alarmDetailMessageList.length }}
- -
- -
- 故障信息 - 详情 -
-
- 时间:{{ showAlarmInfo.time }} -
-
- 级别:{{ showAlarmInfo.level }} -
-
- 设备:{{ showAlarmInfo.deviceCode }} -
-
- 类型:{{ showAlarmInfo.type }} -
-
- 信息:{{ showAlarmInfo.description }} -
-
- -
- 辅助决策信息 -
-
- (1)信息报送人员/群组:{{ showDecisionMessage.personGroup }} -
-
- (2)电话通报:{{ showDecisionMessage.telephoneNotified }} -
-
-
- +
@@ -188,7 +147,6 @@ export default { return { dialogVisible: false, dealAlarmMessage:[true, false], - showAlarmMessage:false, showAlarmMessageList:false, tableData: [{ date: '2023-04-17', @@ -203,13 +161,6 @@ export default { message:'新的故障信息', tag: '重大故障' }], - showAlarmInfo:{ - time:'', - level:'', - deviceCode:'', - type:'', - description:'' - }, decisionMessage:[{ personGroup:'主要领导、应急管理部负责人、应急管理室负责人报送,并发党群信息群;故障群/应急群发布。', telephoneNotified:'如故障属于I类信息,分公司值班领导、主要领导、党群工作部、线网管控中心负责人、分管领导、应急管理部负责人、应急管理室负责人。' @@ -225,8 +176,8 @@ export default { ['TRAIN_DELAY', '列车延误'] ]), showDecisionMessage:{}, - itemsstyle: ['item0', 'item1', 'item2'], - items: [{show:false}, {show:false}, {show:false}] + alarmDetailMessageList:[], + itemsstyle: ['item0', 'item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7', 'item8', 'item9'] }; }, computed: { @@ -241,13 +192,26 @@ export default { } }, watch: { - alarmDetailMessage() { - if (this.alarmDetailMessage.length == 1) { this.showAlarmPlayAlarmMusic(); } else { console.log(this.alarmDetailMessage, 555555); } + alarmDetailMessage(newValue, oldValue) { + if (newValue.length > 0) { + const clone = JSON.parse(JSON.stringify(this.alarmDetailMessage)); + this.alarmDetailMessageList.push(...clone); + let index; + this.alarmDetailMessageList.forEach((item, i)=>{ + this.$set(item, 'show', true); + if (new Date(newValue[0].time).getTime() - new Date(item.time).getTime() > 90000) { + index = i; + } + }); + if (index !== undefined) { + this.alarmDetailMessageList.splice(0, index + 1); + } + this.showAlarmPlayAlarmMusic(); + } } }, beforeDestroy() { this.$store.dispatch('socket/setSimulationAlarmInfo', []); - document.getElementsByTagName('body')[0].style.setProperty('--bg-color', 'yellow'); }, methods: { @@ -258,33 +222,29 @@ export default { this.$refs.audio.play(); }, showAlarmPlayAlarmMusic() { - this.playAlarmMusic(); + if (this.$refs.audio.paused) { + this.playAlarmMusic(); + } this.showAlarm(); }, showAlarm() { - this.items.forEach((item)=>{ - item.show = !item.show; - }); - if (this.alarmDetailMessage.length > 0) { - const station = this.$store.getters['map/getDeviceByCode'](this.alarmDetailMessage[0].deviceCode); - this.showAlarmInfo.time = this.alarmDetailMessage[0].time; - this.showAlarmInfo.level = this.mapAlarmMessage.get(this.alarmDetailMessage[0].level); - this.showAlarmInfo.deviceCode = '列车' + station.serviceNumber + station.tripNumber; - this.showAlarmInfo.type = this.mapAlarmMessage.get(this.alarmDetailMessage[0].type); - const index = this.alarmDetailMessage[0].description.indexOf('列车'); - this.showAlarmInfo.description = this.alarmDetailMessage[0].description.slice(0, index) + this.showAlarmInfo.deviceCode + this.alarmDetailMessage[0].description.substring(index + 7); - if (this.alarmDetailMessage[0].color === 'Y') { - document.getElementsByTagName('body')[0].style.setProperty('--bg-color', 'yellow'); - this.showDecisionMessage = this.decisionMessage[0]; - } else if (this.alarmDetailMessage[0].color === 'O') { - document.getElementsByTagName('body')[0].style.setProperty('--bg-color', 'orange'); - this.showDecisionMessage = this.decisionMessage[1]; + this.alarmDetailMessageList.forEach((showAlarmMessage)=>{ + showAlarmMessage.show = true; + const station = this.$store.getters['map/getDeviceByCode'](showAlarmMessage.deviceCode); + showAlarmMessage.levelNew = this.mapAlarmMessage.get(showAlarmMessage.level); + showAlarmMessage.deviceCodeNew = '列车' + station.serviceNumber + station.tripNumber; + showAlarmMessage.typeNew = this.mapAlarmMessage.get(showAlarmMessage.type); + const index = showAlarmMessage.description.indexOf('列车'); + showAlarmMessage.descriptionNew = showAlarmMessage.description.slice(0, index) + showAlarmMessage.deviceCodeNew + showAlarmMessage.description.substring(index + 7); + if (showAlarmMessage.color === 'Y') { + showAlarmMessage.showDecisionMessage = this.decisionMessage[0]; + } else if (showAlarmMessage.color === 'O') { + showAlarmMessage.showDecisionMessage = this.decisionMessage[1]; } else { - this.showDecisionMessage = this.decisionMessage[1]; - document.getElementsByTagName('body')[0].style.setProperty('--bg-color', 'red'); + showAlarmMessage.showDecisionMessage = this.decisionMessage[1]; } - } - this.showAlarmMessage = !this.showAlarmMessage; + }); + this.showAlarmMessageList = true; }, handleSelectionChange(val) { if (val.length === this.tableData.length) { @@ -316,17 +276,11 @@ export default { }); }, goToDetail(index, row) { - console.log(row); /* const routeUrl = this.$router.resolve({ path: '/thirdLogin' // query: { id: 96 } }); window.open(routeUrl.href, '_blank'); */ - if (index == 0) { - window.open('https://www.baidu.com', 'baidu'); - } else { - window.open('http://localhost:9000/tmms/traindispatch/7', 'dispatch'); - } // }, @@ -334,19 +288,16 @@ export default { return row.tag === value; }, goToAlarmDetail() { - window.open('https://www.baidu.com', 'baidu'); } } };