管道式消毒机
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB

2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <router-view></router-view>
  3. <my-modal type="info" icon="warning"
  4. v-model:visible="deviceAlert.visible"
  5. :content="deviceAlert.content"
  6. @ok="actionDeviceAlertOk"
  7. ></my-modal>
  8. </template>
  9. <script setup>
  10. import { useWebSocketStore } from '@/store'
  11. import { onMounted, ref } from 'vue';
  12. /** @var {webSocketStore} */
  13. const webSocketStore = useWebSocketStore();
  14. /** @var {Object} */
  15. const deviceAlert = ref({
  16. visible: false,
  17. content: '',
  18. key : null,
  19. });
  20. // on mounted
  21. onMounted(mounted);
  22. // on mounted
  23. function mounted() {
  24. webSocketStore.registerEventHandler('AlertEvent', handleAlertEvent);
  25. }
  26. // handle alert event
  27. async function handleAlertEvent(data) {
  28. deviceAlert.value.visible = true;
  29. deviceAlert.value.content = data.displayInfo;
  30. deviceAlert.value.key = data.alertContext;
  31. await webSocketStore.call('AlertEventFrontEndConfirm', {alertContext:data.alertContext});
  32. }
  33. // action device alert ok
  34. async function actionDeviceAlertOk() {
  35. await webSocketStore.call('AlertEventUsrConfirm', {alertContext:deviceAlert.value.key});
  36. }
  37. </script>