From afd3fe35aeaae4f3984c94ca29d57b5a3a52107f Mon Sep 17 00:00:00 2001
From: suerprisePlus <15810472099@163.com>
Date: 星期二, 15 十月 2024 10:24:39 +0800
Subject: [PATCH] websocket接口对接

---
 src/components/mapOl/index.vue |   61 ++++++++++++++++--------------
 1 files changed, 33 insertions(+), 28 deletions(-)

diff --git a/src/components/mapOl/index.vue b/src/components/mapOl/index.vue
index a510f9e..27ed908 100644
--- a/src/components/mapOl/index.vue
+++ b/src/components/mapOl/index.vue
@@ -61,31 +61,31 @@
         initOlMap() {
             const baseLayer = mapData.baseLayer;
             const vecUrl = baseLayer.sUrl + baseLayer.vecLayer + baseLayer.lUrl
-            const geo= config.geoServer;
-            // var vectorLayer = new TileLayer({
-            //     source: new XYZ({
-            //         url: vecUrl + config.tdToken,
-            //     }),
-            // });
-            // const cvaUrl = baseLayer.sUrl + baseLayer.cvaLayer + baseLayer.lUrl
-            // var vectorLayer1 = new TileLayer({
-            //     source: new XYZ({
-            //         url: cvaUrl + config.tdToken,
-            //     }),
-            // });
-            var layer2 = new Image({
-                name: "Wms_Layer",
-                source: new ImageWMS({
-                    crossOrigin: "anonymous",
-                    url: geo.url + geo.wms,
-                    params: {
-                        FORMAT: "image/png",
-                        VERSION: "1.1.1",
-                        LAYERS: geo.layers[0],
-                    },
+            const geo = config.geoServer;
+            var vectorLayer = new TileLayer({
+                source: new XYZ({
+                    url: vecUrl + config.tdToken,
                 }),
             });
-            this.mapol.addLayer(layer2);
+            const cvaUrl = baseLayer.sUrl + baseLayer.cvaLayer + baseLayer.lUrl
+            var vectorLayer1 = new TileLayer({
+                source: new XYZ({
+                    url: cvaUrl + config.tdToken,
+                }),
+            });
+            // var layer2 = new Image({
+            //     name: "Wms_Layer",
+            //     source: new ImageWMS({
+            //         crossOrigin: "anonymous",
+            //         url: geo.url + geo.wms,
+            //         params: {
+            //             FORMAT: "image/png",
+            //             VERSION: "1.1.1",
+            //             LAYERS: geo.layers[0],
+            //         },
+            //     }),
+            // });
+            // this.mapol.addLayer(layer2);
             this.mapol = new Map({
                 target: 'mapView',
                 layers: [vectorLayer, vectorLayer1],
@@ -113,12 +113,17 @@
             if (this.parentData) {
                 if (this.parentData.indexOf('type') > -1) {
                     const data = JSON.parse(this.parentData)[0];
+
+                    console.log(data);
+
                     this.isShow = data.isShow
                     if (data.type == 'point') {
-                        const obj = mapConfig.getWKTParse(data.val.point)
+                        
+                        const obj = data.val.point.split(" ");
+                        console.log(obj);
                         this.formInline = {
-                            lon: obj.coordinates[0],
-                            lat: obj.coordinates[1],
+                            lon: obj[0],
+                            lat: obj[1],
                         }
                         this.addPointData(obj);
                     } else if (data.type == 'line') {
@@ -176,12 +181,12 @@
             this.mapol.addLayer(vectorLayer);
             this.mapol.getView().fit(extent, {
                 size: this.mapol.getSize(),
-                padding: [100, 100,200,100], // 鍥涗釜鏂瑰悜鐨勮竟璺濓紝鍙��
+                padding: [100, 100, 200, 100], // 鍥涗釜鏂瑰悜鐨勮竟璺濓紝鍙��
                 constrainResolution: false, // 鏄惁闄愬埗鍒嗚鲸鐜囷紝鍙��
             });
         },
         addPointData(res) {
-            const coord = res.coordinates;
+            const coord = res;
 
             const urlImg = config.sdkImg + 'Workers/image/mark.png';
             var geom = transform(

--
Gitblit v1.9.3