From 7d4fea7918e2d4c95115990df36bfadb2a7d3bca Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Sat, 04 Feb 2023 10:47:32 +0800
Subject: [PATCH] 现有地图表点击事件调整

---
 src/views/home/components/leftContainer.vue |   57 +++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/src/views/home/components/leftContainer.vue b/src/views/home/components/leftContainer.vue
index 932832e..4d14efa 100644
--- a/src/views/home/components/leftContainer.vue
+++ b/src/views/home/components/leftContainer.vue
@@ -271,9 +271,6 @@
         // 获取所有数据并加载
         this.getHomeAllData()
 
-        this.inithouseEcharts()
-        this.clickLandChart()
-
         if (this.userInfo.dept_id != '1123598813738675201') {
             this.showBack = false
             this.isAllPoliceStation = false
@@ -566,6 +563,7 @@
                     xDate.push(item.name)
                     yDate.push(item.num)
                 })
+
                 this.inithouseEcharts(xDate, yDate)
             })
         },
@@ -678,13 +676,6 @@
             }
         },
 
-        initLandEcharts (landData) {
-            var chartDom = document.getElementById('landEcharts')
-            landMyChart = this.$echarts.init(chartDom)
-
-            landMyChart.setOption(this.initLandOptions(landData[0], landData[1]))
-        },
-
         initLandOptions (xDate, yDate) {
             return {
                 grid: {
@@ -783,16 +774,6 @@
                     this.getVillagePersonStatisticInfoByPoliceStationId(params.data.id)
                 } else {
                     this.$emit('showpeopledetail', params.data.id, params.data.name)
-                }
-            })
-        },
-
-        clickLandChart () {
-            landMyChart.on('click', params => {
-                if (this.tabTypeThree == 0) {
-                    this.$emit('showlanddetail', params.name, 2, params.data.id)
-                } else {
-                    this.$emit('showlanddetail', params.name, 1, params.data.id)
                 }
             })
         },
@@ -937,7 +918,6 @@
          * @return {*}
          */
         landTabClick (type) {
-
             this.tabTypeThree = type
 
             if (type == 0) {
@@ -945,7 +925,6 @@
             } else if (type == 1) {
                 this.getAreaStatisticInfo(1)
             }
-
         },
 
         /**
@@ -984,6 +963,40 @@
         },
 
         /**
+         * @description: 现有地图表渲染
+         * @param {*} landData
+         * @return {*}
+         */
+        initLandEcharts (landData) {
+            var chartDom = document.getElementById('landEcharts')
+
+            landMyChart = this.$echarts.init(chartDom)
+
+            landMyChart.setOption(this.initLandOptions(landData[0], landData[1]))
+
+            this.clickLandChart()
+        },
+
+        /**
+         * @description: 现有地图表点击事件
+         * @return {*}
+         */
+        clickLandChart () {
+            landMyChart.off('click')
+
+            landMyChart.on('click', params => {
+                console.log(params, 95959999)
+                if (this.tabTypeThree == 0) {
+                    this.$emit('showlanddetail', params.name, 2, params.data.id)
+                } else {
+                    this.$emit('showlanddetail', params.name, 1, params.data.id)
+                }
+            })
+        },
+
+
+
+        /**
          * @description: 视图窗口改变时,echarts图表重置
          * @return {*}
          */

--
Gitblit v1.9.3