Browse Source

外部平台离线通知

develop
lau572 2 weeks ago
parent
commit
ad70a44840
  1. 61
      ruoyi-ui/src/views/JiHeExpressway/components/WarningNotify.vue
  2. 19
      ruoyi-ui/src/views/websocket.vue

61
ruoyi-ui/src/views/JiHeExpressway/components/WarningNotify.vue

@ -20,16 +20,17 @@ import { WarningType as warningTypeMapping, DirectionTypes as gzDirectionMapping
import { param } from "../../../utils"; import { param } from "../../../utils";
import { checkPermi } from "@/utils/permission.js"; import { checkPermi } from "@/utils/permission.js";
import { checkRole } from '@/utils/permission'
export default { export default {
name: "WarningNotify", name: "WarningNotify",
props: { props: {
}, },
components: { components: {
}, },
provide() { provide() {
return { return {
} }
}, },
data() { data() {
@ -46,10 +47,10 @@ export default {
} }
}, },
computed: { computed: {
}, },
watch: { watch: {
}, },
methods: { methods: {
// //
@ -84,7 +85,7 @@ export default {
time:para.content.event.warningTime, time:para.content.event.warningTime,
type: "signal", type: "signal",
level: "info", level: "info",
duration: 4000 duration: 4000
} }
} else if(checkPermi(["home:notice:event"]) && para.subEvent === 'trafficFlowDataEarlyWarning'){ // } else if(checkPermi(["home:notice:event"]) && para.subEvent === 'trafficFlowDataEarlyWarning'){ //
obj = { obj = {
@ -92,7 +93,7 @@ export default {
time:'', time:'',
type: "trafficJam", type: "trafficJam",
level: "warning", level: "warning",
duration: 4000 duration: 4000
} }
} else if(checkPermi(["home:notice:deviceOffline"]) && para.subEvent === 'deviceOfflineRecord'){ } else if(checkPermi(["home:notice:deviceOffline"]) && para.subEvent === 'deviceOfflineRecord'){
obj = { obj = {
@ -100,7 +101,7 @@ export default {
time:'', time:'',
type: "equipmentTrouble", type: "equipmentTrouble",
level: "danger", level: "danger",
duration: 4000 duration: 4000
} }
} else if(para.subEvent === '3'){ } else if(para.subEvent === '3'){
para.content.content = para.content.earlyWorningContent para.content.content = para.content.earlyWorningContent
@ -109,7 +110,27 @@ export default {
time:'', time:'',
type: "abnormalWeather", type: "abnormalWeather",
level: "warning", 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){ if(!obj.level){
@ -170,7 +191,7 @@ export default {
click: function(){ click: function(){
_this.showDialog(para) _this.showDialog(para)
} }
} }
}, },
[ [
_this.$createElement( _this.$createElement(
@ -257,7 +278,9 @@ export default {
}); });
} else if(info.subEvent==='deviceOfflineRecord'){ } else if(info.subEvent==='deviceOfflineRecord'){
this.activeId = info.content.deviceOfflineRecord.id.toString(); this.activeId = info.content.deviceOfflineRecord.id.toString();
this.modelDeviceVisible = true; this.modelDeviceVisible = true;
} else if(info.subEvent==='externalPlatformOffline'){
} else { } else {
this.activeName = info.eventState this.activeName = info.eventState
request({ request({
@ -296,23 +319,23 @@ export default {
return; return;
} }
// SpeechSynthesisUtterance // SpeechSynthesisUtterance
const utterance = new SpeechSynthesisUtterance(text); const utterance = new SpeechSynthesisUtterance(text);
// //
utterance.lang = 'zh-CN'; // utterance.lang = 'zh-CN'; //
// 01 // 01
utterance.volume = 10; utterance.volume = 10;
// 1 // 1
utterance.rate = 1; utterance.rate = 1;
// "default", "female", "male" // "default", "female", "male"
utterance.pitch = 1; utterance.pitch = 1;
// 使SpeechSynthesis // 使SpeechSynthesis
window.speechSynthesis.speak(utterance); window.speechSynthesis.speak(utterance);
} }
}, },
mounted() { mounted() {
@ -532,4 +555,4 @@ $warningColor: #FFD294;
} }
} }
} }
</style> </style>

19
ruoyi-ui/src/views/websocket.vue

@ -31,13 +31,13 @@ export default {
// websocket // websocket
this.socket.initialize({ this.socket.initialize({
// url: 'ws://' + location.hostname + ':' + port + path, // 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.66.196:7789" + path,
// url: 'ws://10.168.77.128:7789/ws', // url: 'ws://10.168.77.128:7789/ws',
// url: "ws://10.7.179.15" + ":" + port + path, // url: "ws://10.7.179.15" + ":" + port + path,
// url: "ws://10.168.64.171" + ":" + port + path, // url: "ws://10.168.64.171" + ":" + port + path,
// url: 'ws://10.168.78.127'+ ':' + 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, password: password,
tokenSN: this.token, tokenSN: this.token,
heartRate: interval, heartRate: interval,
@ -107,6 +107,7 @@ export default {
case "0": case "0":
case "3": case "3":
case "2": case "2":
case "externalPlatformOffline":
case "trafficFlowDataEarlyWarning": case "trafficFlowDataEarlyWarning":
this.$emit("newEvent", params); this.$emit("newEvent", params);
break; break;
@ -130,7 +131,7 @@ export default {
case "eventProcess": case "eventProcess":
this.$root.$emit('update-eventProcess', content); this.$root.$emit('update-eventProcess', content);
break; break;
// //
default: 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":""}} // 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-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); const audio = new Audio(audioSrc);
audio.play(); audio.play();
@ -177,7 +178,7 @@ export default {
// "earlyWorningContent":"202406241640252835372840", // "earlyWorningContent":"202406241640252835372840",
// "earlyWorningTitle":"","roadName":"G35广","sectionName":"G35广","earlyWorningLevel":3,"orgCode":"370124", // "earlyWorningTitle":"","roadName":"G35广","sectionName":"G35广","earlyWorningLevel":3,"orgCode":"370124",
// "earlyWorningContentNotic":"","stationName":"","warningLevelString":"YELLOW_ALERT","earlyWarningTypeStringNumber":"6", // "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": {} // "params": {}
// }, // },
// "content": "K112+037(K112+037)" // "content": "K112+037(K112+037)"
// } // }
// } // }
@ -211,8 +212,8 @@ export default {
// "subEvent": "deviceState", // "subEvent": "deviceState",
// "content": [ // "content": [
// { // {
// "id": 896, // "id": 896,
// "iotDeviceId": "K67+240tynb", // "iotDeviceId": "K67+240tynb",
// "deviceType":"2", // "deviceType":"2",
// deviceState // deviceState
// } // }
@ -224,6 +225,6 @@ export default {
} }
} }
} }
}; };
</script> </script>

Loading…
Cancel
Save