<template>
|
<CardDialog
|
v-model="dialogVisible"
|
title="走航路线推荐"
|
draggable
|
:modal="false"
|
width="400px"
|
>
|
<template #default> </template>
|
<template #footer> </template>
|
</CardDialog>
|
</template>
|
|
<script setup>
|
import { ref, onMounted, onUnmounted } from 'vue';
|
import websocket from '@/api/websocket';
|
import websocketMsgParser from '@/views/sourcetrace/websocketMsgParser.js';
|
import mapLine from '@/utils/map/line';
|
|
const dialogVisible = ref(true);
|
|
onMounted(() => {
|
websocket.registerReceiveEvent(dealMsg);
|
});
|
onUnmounted(() => {
|
websocket.removeReceiveEvent(dealMsg);
|
});
|
|
function dealMsg(data) {
|
const { type, content } = websocketMsgParser.parseMsg(data);
|
// 污染分析结果 AnalysisResult
|
if (type == '2') {
|
const obj = JSON.parse(content);
|
console.log('污染分析结果: ', obj);
|
|
obj.sortedSceneList;
|
obj.time;
|
obj.advice;
|
obj.direction;
|
|
mapLine.drawDirection(obj.direction.paths.map((v) => [v.first, v.second]));
|
}
|
}
|
</script>
|