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 { 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'; //
// 01
// 01
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;
}
}
}
</style>
</style>

19
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":"202406241640252835372840",
// "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 {
}
}
}
};
</script>

Loading…
Cancel
Save