From 2a99e1fa805bd78c7e10ab937e136ff627c3b271 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 08 Dec 2023 15:23:20 +0800
Subject: [PATCH] PC路网处理

---
 src/components/campusNav/index.vue |   34 +++++++++++++----
 src/components/leftNav/index.vue   |   18 +++++----
 src/components/map/index.vue       |    9 +++-
 3 files changed, 43 insertions(+), 18 deletions(-)

diff --git a/src/components/campusNav/index.vue b/src/components/campusNav/index.vue
index 82f7c99..a2950b0 100644
--- a/src/components/campusNav/index.vue
+++ b/src/components/campusNav/index.vue
@@ -101,6 +101,17 @@
 
 let overlayLayer
 
+let pathUrl = [
+    {
+        key: 1,
+        url: "https://fkxt.jxstnu.edu.cn/changjing/arcgis155/rest/services/hjzlw/NAServer/%E8%B7%AF%E5%BE%84/solve",
+    },
+    {
+        key: 2,
+        url: "https://fkxt.jxstnu.edu.cn/changjing/arcgis155/rest/services/fllw/NAServer/%E8%B7%AF%E5%BE%84/solve",
+    }
+]
+
 export default {
     name: 'campusNav',
     data () {
@@ -309,6 +320,14 @@
             this.pathBoxList = []
             this.pathBoxShow = false
 
+            if (CamPusNavLayer.campusStartLayer != null) {
+                CamPusNavLayer.campusStartLayer.getSource().clear()
+            }
+
+            if (CamPusNavLayer.campusEndLayer != null) {
+                CamPusNavLayer.campusEndLayer.getSource().clear()
+            }
+
             if (CamPusNavLayer.campusRouteLayer != null) {
                 CamPusNavLayer.campusRouteLayer.getSource().clear()
                 this.isOverRouter = false
@@ -319,7 +338,7 @@
             this.$store.commit('SET_GETTONAME', '')
             this.$store.commit('SET_STARTINGPOINT', null)
             this.$store.commit('SET_CAMPUSNAVFLAG', false)
-            that.$store.commit('set_closeMapClick', false)
+            this.$store.commit('set_closeMapClick', false)
         },
 
         tabClick (param) {
@@ -354,6 +373,8 @@
             }))
 
             var routes = ''
+
+            let curPath = pathUrl.find(item => item.key == this.layoutElement.campusValue)
 
             var startLog = Number(this.startingPoint[0]).toFixed(6)
             var startLat = Number(this.startingPoint[1]).toFixed(6)
@@ -545,7 +566,7 @@
             } else {
                 if (this.navigationWay == '步行') {
                     axios
-                        .get('https://dev.jxpskj.com:8023/arcgis/rest/services/jglw/NAServer/%E8%B7%AF%E5%BE%84/solve', {
+                        .get(curPath.url, {
                             params: {
                                 stops: { features: [{ geometry: { x: startLog, y: startLat } }, { geometry: { x: endLog, y: endLat } }] },
                                 returnDirections: false,
@@ -568,16 +589,13 @@
 
                             this.pathBoxList = []
 
-                            res.data.routes.features[0].geometry.paths[0].forEach((item) => {
-                                routes += `${item[0]},${item[1]};`
+                            let polyLineData = res.data.routes.features[0].geometry.paths[0].map(item => {
+                                return [item[0], item[1]]
                             })
 
                             this.pathBoxShow = true
 
-                            routes =
-                                startLog + ',' + startLat + ';' + routes + endLog + ',' + endLat
-
-                            CamPusNavLayer.campusRouteLayer.getSource().addFeature(that.drawPolyline(routes))
+                            CamPusNavLayer.campusRouteLayer.getSource().addFeature(that.drawPolyline(polyLineData))
 
                             if (this.twoOrThree == '真三维') {
                                 global.viewer.flyTo(CamPusNavLayer.campusRouteLayer)
diff --git a/src/components/leftNav/index.vue b/src/components/leftNav/index.vue
index 3ae6e6e..50e5c03 100644
--- a/src/components/leftNav/index.vue
+++ b/src/components/leftNav/index.vue
@@ -129,17 +129,19 @@
         }
     },
     created () {
+        this.map2D.addLayer(this.leftNavBQ)
+        this.map2D.addLayer(this.leftNavDL)
+        this.map2D.addLayer(this.leftNavSJ)
+        this.map2D.addLayer(this.leftNavHD)
+        this.map2D.addLayer(this.leftNavTC)
+        this.map2D.addLayer(this.leftNavCR)
     },
     mounted () {
         const that = this
+
         // 初始化新增标签图层
         that.$EventBus.$on('closeTagLayer', () => {
-            this.map2D.addLayer(this.leftNavBQ)
-            this.map2D.addLayer(this.leftNavDL)
-            this.map2D.addLayer(this.leftNavSJ)
-            this.map2D.addLayer(this.leftNavHD)
-            this.map2D.addLayer(this.leftNavTC)
-            this.map2D.addLayer(this.leftNavCR)
+
 
             that.leftNavData.forEach(item => {
                 if (item.layer && item.flag == true) {
@@ -274,8 +276,8 @@
 
                 this.leftNavData[0].flag = true
                 this.leftNavData[0].img = this.leftNavData[0].checked
-                this.leftNavData[5].flag = true
-                this.leftNavData[5].img = this.leftNavData[5].checked
+                this.leftNavData[4].flag = true
+                this.leftNavData[4].img = this.leftNavData[4].checked
 
                 this.leftNavBQ.setVisible(true)
                 this.leftNavCR.setVisible(true)
diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index 83eddc8..27741a2 100644
--- a/src/components/map/index.vue
+++ b/src/components/map/index.vue
@@ -174,6 +174,8 @@
 
                     this.$refs.leftNav.initialize(newData)
 
+                    this.$refs.campusNavRoute.closeModel()
+
                     this.createdLayers(newData)
                 })
             }
@@ -239,6 +241,7 @@
             })
         })
     },
+
     methods: {
         createdLayers (campusKey) {
             const that = this
@@ -361,7 +364,9 @@
                 let result = res.data.data
 
                 this.$store.dispatch('setOurDataInPoput', {
-                    item: result
+                    item: result,
+                    lng: event.event.coordinate[0],
+                    lat: event.event.coordinate[1]
                 })
 
                 this.openPopups({
@@ -385,7 +390,7 @@
 
         mapClick (e) {
             this.$refs.campusNavRoute.shortcutShow(e)
-            // this.$refs.campusBuildingSearch.shortcutShow(e)
+            this.$refs.campusBuildingSearch.shortcutShow(e)
         },
 
         campusCut (campusKey) {

--
Gitblit v1.9.3