From ad70a44840e5e6db4cb6bb65a5eff6d984c6fc38 Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Thu, 14 Nov 2024 15:26:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E9=83=A8=E5=B9=B3=E5=8F=B0=E7=A6=BB?= =?UTF-8?q?=E7=BA=BF=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/WarningNotify.vue | 61 +++++++++++++------ ruoyi-ui/src/views/websocket.vue | 19 +++--- 2 files changed, 52 insertions(+), 28 deletions(-) diff --git a/ruoyi-ui/src/views/JiHeExpressway/components/WarningNotify.vue b/ruoyi-ui/src/views/JiHeExpressway/components/WarningNotify.vue index d871ca62..8a2b97a6 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/components/WarningNotify.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/components/WarningNotify.vue @@ -20,16 +20,17 @@ import { WarningType as warningTypeMapping, DirectionTypes as gzDirectionMapping import { param } from "../../../utils"; import { checkPermi } from "@/utils/permission.js"; +import { checkRole } from '@/utils/permission' export default { name: "WarningNotify", props: { - + }, components: { }, provide() { return { - + } }, data() { @@ -46,10 +47,10 @@ export default { } }, computed: { - + }, watch: { - + }, methods: { //点击事件回调 @@ -84,7 +85,7 @@ export default { time:para.content.event.warningTime, type: "signal", level: "info", - duration: 4000 + duration: 4000 } } else if(checkPermi(["home:notice:event"]) && para.subEvent === 'trafficFlowDataEarlyWarning'){ //预警事件 obj = { @@ -92,7 +93,7 @@ export default { time:'', type: "trafficJam", level: "warning", - duration: 4000 + duration: 4000 } } else if(checkPermi(["home:notice:deviceOffline"]) && para.subEvent === 'deviceOfflineRecord'){ obj = { @@ -100,7 +101,7 @@ export default { time:'', type: "equipmentTrouble", level: "danger", - duration: 4000 + duration: 4000 } } else if(para.subEvent === '3'){ para.content.content = para.content.earlyWorningContent @@ -109,7 +110,27 @@ export default { time:'', type: "abnormalWeather", level: "warning", - duration: 4000 + duration: 4000 + } + } else if(checkRole(["admin"]) && para.subEvent === 'externalPlatformOffline'){ + if (para.content.type == '1'){ + para.content.content = 'GIS+BIM系统异常' + } else if(para.content.type == '2'){ + para.content.content = '数字孪生系统异常' + } else if(para.content.type == '3'){ + para.content.content = '收费运营系统异常' + } else if(para.content.type == '4'){ + para.content.content = '桥梁监测系统异常' + } else { + para.content.content = '光纤在线检测系统异常' + } + + obj = { + content: para.content.content, + time:'', + type: "externalPlatformOffline", + level: "danger", + duration: 0 } } if(!obj.level){ @@ -170,7 +191,7 @@ export default { click: function(){ _this.showDialog(para) } - } + } }, [ _this.$createElement( @@ -257,7 +278,9 @@ export default { }); } else if(info.subEvent==='deviceOfflineRecord'){ this.activeId = info.content.deviceOfflineRecord.id.toString(); - this.modelDeviceVisible = true; + this.modelDeviceVisible = true; + } else if(info.subEvent==='externalPlatformOffline'){ + } else { this.activeName = info.eventState request({ @@ -296,23 +319,23 @@ export default { return; } - // 创建SpeechSynthesisUtterance实例 + // 创建SpeechSynthesisUtterance实例 const utterance = new SpeechSynthesisUtterance(text); - // 设置语音的语言 - utterance.lang = 'zh-CN'; // 中文简体 + // 设置语音的语言 + utterance.lang = 'zh-CN'; // 中文简体 - // 设置语音的音量(0到1之间) + // 设置语音的音量(0到1之间) utterance.volume = 10; - // 设置语音的语速(1是正常语速) + // 设置语音的语速(1是正常语速) utterance.rate = 1; - // 设置语音的音调(可以是"default", "female", "male") + // 设置语音的音调(可以是"default", "female", "male") utterance.pitch = 1; - // 使用SpeechSynthesis接口播放语音 - window.speechSynthesis.speak(utterance); + // 使用SpeechSynthesis接口播放语音 + window.speechSynthesis.speak(utterance); } }, mounted() { @@ -532,4 +555,4 @@ $warningColor: #FFD294; } } } - \ No newline at end of file + diff --git a/ruoyi-ui/src/views/websocket.vue b/ruoyi-ui/src/views/websocket.vue index a67e22af..229e6766 100644 --- a/ruoyi-ui/src/views/websocket.vue +++ b/ruoyi-ui/src/views/websocket.vue @@ -31,13 +31,13 @@ export default { // 建立 websocket 连接 this.socket.initialize({ // url: 'ws://' + location.hostname + ':' + port + path, - //url: 'wss://' + locatoin.hostname + ':' + window.location.port + '/ws' || 80 + '/ws', + url: 'wss://' + locatoin.hostname + ':' + window.location.port + '/ws' || 80 + '/ws', // url: "ws://10.168.66.196:7789" + path, // url: 'ws://10.168.77.128:7789/ws', // url: "ws://10.7.179.15" + ":" + port + path, // url: "ws://10.168.64.171" + ":" + port + path, // url: 'ws://10.168.78.127'+ ':' + port + path, - url: 'ws://127.0.0.1'+ ':' + 7789 + '/ws', + // url: 'ws://127.0.0.1'+ ':' + 7789 + '/ws', password: password, tokenSN: this.token, heartRate: interval, @@ -107,6 +107,7 @@ export default { case "0": case "3": case "2": + case "externalPlatformOffline": case "trafficFlowDataEarlyWarning": this.$emit("newEvent", params); break; @@ -130,7 +131,7 @@ export default { case "eventProcess": this.$root.$emit('update-eventProcess', content); break; - // + // default: } }; @@ -154,7 +155,7 @@ export default { // let params = {"subEvent":"eventProcess","content":{"id":3598,"eventId":"a026a03962d94089b67858d6c7e6cd42","operationTime":"2024-08-27 11:39:11","operator":"1","operatorName":"管理员","source":1,"processName":"","context":"这是处置记录","type":"text","remark":""}} // _this.$root.$emit('update-eventProcess', params.content); // 消息数字 - // _this.$root.$emit('update-warning', Math.floor(Math.random() * 20)); + // _this.$root.$emit('update-warning', Math.floor(Math.random() * 20)); // 事件弹窗 const audio = new Audio(audioSrc); audio.play(); @@ -177,7 +178,7 @@ export default { // "earlyWorningContent":"平阴县气象台2024年06月24日16时40分发布高温黄色预警信号。受大陆暖高压脊影响,预计25日至28日我县将出现大范围持续性高温天气,全部乡镇和街道最高气温可达35~37℃,其中28日部分地区最高气温可达40℃左右。请注意防范。", // "earlyWorningTitle":"高温黄色","roadName":"G35济广高速","sectionName":"G35济广高速济南段","earlyWorningLevel":3,"orgCode":"370124", // "earlyWorningContentNotic":"","stationName":"平阴","warningLevelString":"YELLOW_ALERT","earlyWarningTypeStringNumber":"6", - // "earlyWorningSignal":"6yj1","warningLevelStringNumber":"1","earlyWorningIssueDate":"2024-06-24T16:40:00","earlyWarningTypeString":"HYPERTHERMIA"} + // "earlyWorningSignal":"6yj1","warningLevelStringNumber":"1","earlyWorningIssueDate":"2024-06-24T16:40:00","earlyWarningTypeString":"HYPERTHERMIA"} // } //设备故障 @@ -201,7 +202,7 @@ export default { // "params": {} // }, // "content": "K112+037菏泽方向远端机(K112+037)发生故障" - + // } // } @@ -211,8 +212,8 @@ export default { // "subEvent": "deviceState", // "content": [ // { - // "id": 896, - // "iotDeviceId": "K67+240tynb", + // "id": 896, + // "iotDeviceId": "K67+240tynb", // "deviceType":"2", // deviceState // } @@ -224,6 +225,6 @@ export default { } } } - + };