quanyawei
2024-01-11 1b3f8b875ed16cad81abf8f69e5f347561c76085
地图优化
1 files modified
16 ■■■■ changed files
src/views/toCarryOutLegislativeReforms/components/locationMap.vue 16 ●●●● patch | view | raw | blame | history
src/views/toCarryOutLegislativeReforms/components/locationMap.vue
@@ -42,6 +42,14 @@
          >
            查询
          </el-button>
          <el-button
            v-if="$parent.mapType==='edit'"
            type="primary"
            :disabled="placeSearchName===''"
            @click="close"
          >
            确定
          </el-button>
        </div>
        <div id="mapd" />
      </div>
@@ -60,7 +68,7 @@
      map: null,
      geolocation: null,
      marker: null,
      placeSearchName: null,
      placeSearchName: '',
      mapPlaceSearch: null,
      position: [],
      positionInput: ''
@@ -133,13 +141,17 @@
          map: map,
          position: that.$parent.position
        })
        that.positionInput = that.$parent.position.join(',')
        that.positionInput = that.toFixed(that.$parent.position[0], 8) + ',' + that.toFixed(that.$parent.position[1], 8)
        that.marker.setMap(map)
        that.map.setCenter(that.$parent.position)
        that.marker.setAnimation('AMAP_ANIMATION_BOUNCE')
        this.placeSearchName = this.$parent.address
      }
    },
    toFixed (str, decimalPlaces) {
      const num = parseFloat(str)
      return num.toFixed(decimalPlaces)
    },
    getAddress (position) {
      AMap.plugin('AMap.Geocoder', () => {
        const geocoder = new AMap.Geocoder({})