Forráskód Böngészése

update ChartMap.vue

reghao 7 hónapja
szülő
commit
e2d1dbc6d4
4 módosított fájl, 22 hozzáadás és 28 törlés
  1. 2 9
      src/router/chart.js
  2. 7 0
      src/router/map.js
  3. 9 19
      src/views/map/ChartMap.vue
  4. 4 0
      src/views/map/MapIndex.vue

+ 2 - 9
src/router/chart.js

@@ -1,5 +1,4 @@
 const ChartIndex = () => import('views/chart/ChartIndex')
-const ChartMap = () => import('views/chart/ChartMap')
 const HeatMap = () => import('views/chart/HeatMap')
 const LineChart = () => import('views/chart/LineChart')
 const Timeline = () => import('views/chart/Timeline')
@@ -12,14 +11,8 @@ export default {
   children: [
     {
       path: '',
-      name: '地图',
-      component: ChartMap,
-      meta: { needAuth: false }
-    },
-    {
-      path: '/chart/map',
-      name: '地图',
-      component: ChartMap,
+      name: '折线图',
+      component: LineChart,
       meta: { needAuth: false }
     },
     {

+ 7 - 0
src/router/map.js

@@ -1,6 +1,7 @@
 const MapIndex = () => import('views/map/MapIndex')
 const AMap = () => import('views/map/AMap')
 const PhotoMap = () => import('views/map/PhotoMap')
+const ChartMap = () => import('views/map/ChartMap')
 const OpenLayersMap = () => import('views/map/OpenLayersMap')
 
 export default {
@@ -21,6 +22,12 @@ export default {
       component: PhotoMap,
       meta: { needAuth: false }
     },
+    {
+      path: '/map/chart',
+      name: '数据地图',
+      component: ChartMap,
+      meta: { needAuth: false }
+    },
     {
       path: '/map/ol',
       name: 'OpenLayers地图',

+ 9 - 19
src/views/chart/ChartMap.vue → src/views/map/ChartMap.vue

@@ -1,25 +1,12 @@
 <template>
-  <el-row>
-    <el-col :md="16">
-      <div ref="chartsDOM" style="width: 800px;height:600px;" />
-    </el-col>
-    <el-col :md="8">
-      <el-card>
-        <div slot="header" class="clearfix">
-          <span>ChartMap</span>
-          <el-button style="float: right; padding: 3px 0" type="text" @click="onRefresh">更新</el-button>
-        </div>
-        <div id="chart2" style="height:400px;" />
-      </el-card>
-    </el-col>
-  </el-row>
+  <div ref="chartsDOM" style="width: 1080px;height:960px;" />
 </template>
 
 <script>
 import * as echarts from 'echarts'
 import { getChartGeoJson } from '@/api/chart'
-// import chinaData from '@/assets/json/china.json'
-// import sichuanData from '@/assets/json/sichuan_full.json'
+// import chinaData from '@/assets/json/china_full.json'
+// import sichuanData from '@/assets/json/sichuan_level3.json'
 
 export default {
   name: 'ChartMap',
@@ -32,7 +19,7 @@ export default {
     // 初始化统计图对象
     this.myChart = echarts.init(this.$refs['chartsDOM'])
     // this.initChart1()
-    this.initChart2()
+    // this.initChart2()
   },
   created() {
     document.title = 'ChartMap'
@@ -48,9 +35,12 @@ export default {
         }
       })
 
-      var mapName = 'china'
+      var mapName = 'sichuan'
       var mapData = {}
+
+      // mapName = 'china'
       // mapData = chinaData
+
       var dataList = this.getDataList(mapData, 1000)
       var chartOption = this.getChartOption1(mapName, dataList)
       // 注册地图(地图数据来自本地或后端的 geojson 格式数据)
@@ -129,7 +119,7 @@ export default {
           map: mapName,
           roam: true,
           label: {
-            show: true
+            show: false
           },
           data: dataList // 数据
         }]

+ 4 - 0
src/views/map/MapIndex.vue

@@ -21,6 +21,10 @@
             <i class="el-icon-map-location" />
             <span slot="title">照片地图</span>
           </el-menu-item>
+          <el-menu-item index="/map/chart">
+            <i class="el-icon-map-location" />
+            <span slot="title">数据地图</span>
+          </el-menu-item>
           <el-menu-item index="/map/ol">
             <i class="el-icon-map-location" />
             <span slot="title">OL地图</span>