supermap.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <!--&lt;!&ndash; **************************************NO.5 地图*************************************** &ndash;&gt;-->
  2. <!--<template>-->
  3. <!-- <div class="map-container">-->
  4. <!-- <div id="enterprisemap" style="width: 100%;height: 100%;"></div>-->
  5. <!-- </div>-->
  6. <!--</template>-->
  7. <!--<script>-->
  8. <!-- import L from 'leaflet'-->
  9. <!-- import '@supermap/iclient-leaflet'-->
  10. <!-- import 'leaflet/dist/leaflet.css'-->
  11. <!-- export default {-->
  12. <!-- name: 'spuermap',-->
  13. <!-- data() {-->
  14. <!-- return {-->
  15. <!-- mapUrl: 'http://121.36.228.94:8090/iserver/services/map-JiLin/rest/maps/JiLin',-->
  16. <!-- map: null,-->
  17. <!-- lat: '',-->
  18. <!-- lng: '',-->
  19. <!-- iconMarker: new L.Icon({-->
  20. <!-- iconUrl: require('@/assets/images/icon-danger.png'),-->
  21. <!-- iconSize: [65, 60],-->
  22. <!-- iconAnchor: [12, 41],-->
  23. <!-- popupAnchor: [17, -34],-->
  24. <!-- shadowSize: [41, 41]-->
  25. <!-- }),-->
  26. <!-- marker: {},-->
  27. <!-- layers: [],-->
  28. <!-- myGroup: undefined-->
  29. <!-- }-->
  30. <!-- },-->
  31. <!-- mounted() {-->
  32. <!-- this.initMap()-->
  33. <!-- },-->
  34. <!-- props:{-->
  35. <!-- setLatLng : Function-->
  36. <!-- },-->
  37. <!-- methods: {-->
  38. <!-- clearM: async function() {-->
  39. <!-- if (this.myGroup != undefined) {-->
  40. <!-- // await this.initMap()-->
  41. <!-- this.myGroup.clearLayers()-->
  42. <!-- }-->
  43. <!-- this.layers = []-->
  44. <!-- },-->
  45. <!-- setMarker(lat,lng){-->
  46. <!-- this.clearM()-->
  47. <!-- let marker = window.L.marker([lat, lng], {-->
  48. <!-- icon: this.iconMarker-->
  49. <!-- })-->
  50. <!-- this.layers.push(marker)-->
  51. <!-- this.myGroup = window.L.layerGroup(this.layers)-->
  52. <!-- this.map.addLayer(this.myGroup)-->
  53. <!-- this.map.panTo([lat,lng])-->
  54. <!-- // let center = window.L.LonLat(104.07, 30.67);-->
  55. <!-- // this.map.setCenter(center,7)-->
  56. <!-- },-->
  57. <!-- initMap() {-->
  58. <!-- let lat = 43.875228-->
  59. <!-- let lon = 125.379896-->
  60. <!-- this.map = window.L.map('enterprisemap', {-->
  61. <!-- crs: window.L.CRS.EPSG4326,-->
  62. <!-- center: [lat, lon],-->
  63. <!-- maxZoom: 18,-->
  64. <!-- zoom: 10,-->
  65. <!-- editable: true,-->
  66. <!-- zoomControl: false-->
  67. <!-- })-->
  68. <!-- window.L.supermap.tiledMapLayer(this.mapUrl).addTo(this.map)-->
  69. <!-- let that = this-->
  70. <!-- this.map.on('click', function(e) {-->
  71. <!-- that.clearM()-->
  72. <!-- let lat = e.latlng.lat-->
  73. <!-- let lng = e.latlng.lng-->
  74. <!-- let marker = window.L.marker([lat, lng], {-->
  75. <!-- icon: that.iconMarker-->
  76. <!-- })-->
  77. <!-- that.setLatLng(lat,lng)-->
  78. <!-- that.layers.push(marker)-->
  79. <!-- that.myGroup = window.L.layerGroup(that.layers)-->
  80. <!-- that.map.addLayer(that.myGroup)-->
  81. <!-- })-->
  82. <!-- // this.map.on('click', function(e) {-->
  83. <!-- // console.log(e)-->
  84. <!-- // let lat = e.latlng.lat-->
  85. <!-- // let lng = e.latlng.lng-->
  86. <!-- // // let marker = L.marker([lat, lng], {-->
  87. <!-- // // icon: this.iconMarker-->
  88. <!-- // // })-->
  89. <!-- // // this.layers.push(marker)-->
  90. <!-- // // this.myGroup = L.layerGroup(this.layers)-->
  91. <!-- // // this.map.addLayer(this.myGroup)-->
  92. <!-- // // this.map.addLayer(this.marker)-->
  93. <!-- // })-->
  94. <!-- }-->
  95. <!-- }-->
  96. <!-- }-->
  97. <!--</script>-->
  98. <!--<style rel="stylesheet/scss" lang="scss">-->
  99. <!-- .map-container {-->
  100. <!-- width: 100%;-->
  101. <!-- height: 100%;-->
  102. <!-- color: #fff;-->
  103. <!-- background-color: #01020c;-->
  104. <!-- box-shadow: rgba(1, 2, 12, 1) 0px 0px 25px inset;-->
  105. <!-- .leaflet-left {-->
  106. <!-- .leaflet-control {-->
  107. <!-- margin-top: 60px;-->
  108. <!-- }-->
  109. <!-- }-->
  110. <!-- .leaflet-right {-->
  111. <!-- display: none;-->
  112. <!-- }-->
  113. <!-- }-->
  114. <!--</style>-->