suerprisePlus
2024-10-15 afd3fe35aeaae4f3984c94ca29d57b5a3a52107f
src/views/visualization/index.vue
@@ -54,6 +54,7 @@
import statistics from '@/views/visual/statistics/index.vue'
import semanticFunction from '@/views/dataManager/semanticFunction/index.vue'
import msgList from './msgList.vue';
import { point } from '@turf/turf';
export default {
    components: {
        mapView, leftMenu,
@@ -78,6 +79,7 @@
    },
    beforeDestroy() {
        if (this.wsSocket) {
            this.wsSocket.close();
            this.wsSocket.onclose = () => {
                console.log('WebSocket连接关闭');
                this.wsSocket = null
@@ -87,7 +89,7 @@
    },
    mounted() {
        if (!this.wsSocket) {
            // this.createSocket();
            this.createSocket();
        }
    },
    methods: {
@@ -111,12 +113,31 @@
                if (event.data != "连接成功") {
                    const obj = JSON.parse(event.data)
                    this.leftChartData = {
                        type: 'left1',
                        val: obj
                    if (obj.type == "rain") {
                        this.$store.state.mapLayers.disasterRain.val = [obj]
                    } else if (obj.type == "snow") {
                        this.$store.state.mapLayers.disasterSnow.val = [obj]
                    } else if (obj.type == "fire") {
                        this.$store.state.mapLayers.disasterFire.val = [obj]
                    } else if (obj.type == "error") {
                        this.$store.state.mapLayers.msgList
                        if (this.$store.state.mapLayers.msgList.length == 0) {
                            this.$store.state.mapLayers.msgList.push(obj)
                        } else {
                            var rs = this.$store.state.mapLayers.msgList;
                            var st = rs.filter(item => {
                                if (item.msg == obj.msg && item.point == obj.point && item.line == obj.line) {
                                    return item
                    }
                            })
                            if (st.length <= 0) {
                                this.$store.state.mapLayers.msgList.push(obj)
                            }
                        }
                    }
                }
            };
        },