Browse Source

#107 水浸错误检查由事件通知,收到错误后弹框,确认后调用指定接口关闭弹框

master
sige 1 year ago
parent
commit
e38e9adc95
  1. 40
      src/App.vue

40
src/App.vue

@ -1,7 +1,41 @@
<script setup></script>
<template> <template>
<router-view></router-view> <router-view></router-view>
<my-modal type="info" icon="warning"
v-model:visible="deviceAlert.visible"
:content="deviceAlert.content"
@ok="actionDeviceAlertOk"
></my-modal>
</template> </template>
<script setup>
import { useWebSocketStore } from '@/store'
import { onMounted, ref } from 'vue';
/** @var {webSocketStore} */
const webSocketStore = useWebSocketStore();
/** @var {Object} */
const deviceAlert = ref({
visible: false,
content: '',
key : null,
});
// on mounted
onMounted(mounted);
// on mounted
function mounted() {
webSocketStore.registerEventHandler('AlertEvent', handleAlertEvent);
}
// handle alert event
async function handleAlertEvent(data) {
deviceAlert.value.visible = true;
deviceAlert.value.content = data.displayInfo;
deviceAlert.value.key = data.alertContext;
await webSocketStore.call('AlertEventFrontEndConfirm', {alertContext:data.alertContext});
}
// action device alert ok
async function actionDeviceAlertOk() {
await webSocketStore.call('AlertEventUsrConfirm', {alertContext:deviceAlert.value.key});
}
<style scoped></style>
</script>
Loading…
Cancel
Save