1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
| <template> <div> <div id="home"> <el-row> <el-col :span="19"> <div class="grid-content bg-purple"> <div id="overview" style="height: 100px; width: 150px; float:left;"></div> <div id="map"></div> </div> </el-col> <el-col :span="5"> <div class="grid-content bg-purple-light"> <el-card id="mapOut" style="overflow-y: scroll;"> <el-card style=" padding: 5px;"> <div id="bookmarks"></div> </el-card> <el-card> <div id="layerListPane" data-dojo-type="dijit/layout/ContentPane"> <div id="layerList"></div> </div> </el-card>
<el-card> <div id="titlePane" class="esriLayerList" data-dojo-type="dijit/TitlePane"> <div id="measurementDiv"></div> </div> </el-card> <el-card shadow="always" class="box-card" style="width: 100%"> <div slot="header" class="clearfix"> <span>Lendge</span> <el-button style="float: right; padding: 3px 0" type="text" @click="lendgeVisible ? hideLendge() : showLendge()">{{this.lendgeVisible}} </el-button> </div> <div id="legendDiv"></div> </el-card> </el-card> </div> </el-col> </el-row> </div>
<div style="position: absolute; bottom: 20px; z-Index:999;"> <div id="basemapToggle"></div> </div> </div> </template>
<script> import * as esriLoader from 'esri-loader' import $ from 'jquery'
export default { data() { return { lendgeVisible: true } }, mounted() { esriLoader.setDefaultOptions({ version: '3.28' }) this.createMap() }, methods: { createMap: function () { esriLoader.loadModules(['esri/map', 'dojo/dom', 'dojo/on', 'esri/layers/ArcGISDynamicMapServiceLayer', 'esri/dijit/Scalebar', 'esri/dijit/OverviewMap', 'esri/dijit/BasemapToggle', 'esri/dijit/BasemapGallery', 'esri/dijit/Bookmarks', 'esri/dijit/Measurement', 'esri/dijit/Legend', 'esri/dijit/LayerList', 'esri/tasks/PrintTask', 'esri/tasks/PrintTemplate', 'esri/tasks/PrintParameters', 'dojo/domReady!'], { css: true }) .then(([Map, dom, on, ArcGISDynamicMapServiceLayer, Scalebar, OverviewMap, BasemapToggle, BasemapGallery, Bookmarks, Measurement, Legend, LayerList, PrintTask, PrintTemplate, PrintParameters]) => { var dongURL = 'http://localhost:6080/arcgis/rest/services/webgis/China_POI/MapServer' var donglayer = new ArcGISDynamicMapServiceLayer(dongURL) const map = new Map('map', { center: [108.934518, 34.35333], zoom: 7, logo: false, basemap: 'oceans' }) map.addLayer(donglayer) var overviewMapDijit = new OverviewMap({ map: map, visible: true }, 'overview') overviewMapDijit.startup() var basemapToggle = new BasemapToggle({ map: map, visible: true }, 'basemapToggle') basemapToggle.startup() var bookmarksList = [ { extent: { xmin: 106, ymin: 39, xmax: 112, ymax: 32 }, name: '陕西' }, { extent: { xmin: 111, ymin: 31, xmax: 117, ymax: 35 }, name: '河南' }, { extent: { xmin: 109, ymin: 35, xmax: 121, ymax: 42 }, name: '河北' }, { extent: { xmin: 115, ymin: 31, xmax: 121, ymax: 34 }, name: '江苏' }, { extent: { xmin: 90, ymin: 22, xmax: 114, ymax: 36 }, name: '四川' } ] const bookmarks = new Bookmarks({ map: map, bookmarks: bookmarksList, editable: true }, 'bookmarks') bookmarks.startup() var measurement = new Measurement({ map: map }, 'measurementDiv') measurement.startup() var myWidget = new LayerList({ map: map, layers: donglayer }, 'layerList') myWidget.startup() var legend = new Legend({ map: map }, 'legendDiv') legend.startup() }) }, hideLendge() { this.lendgeVisible = !this.lendgeVisible $('#legendDiv').hide() }, showLendge() { this.lendgeVisible = !this.lendgeVisible $('#legendDiv').show() }, opensuccess() { this.$message({ message: 'success', type: 'success' }) }, openWarning() { this.$message({ message: '非地理坐标系', type: 'warning' }) }
} } </script>
|