Riku
2025-06-04 d0f07e25103d7c7845c3b9534e8c66b5905447c0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<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>