xiangpei
2025-02-22 39b926f58718ba6e27d7ca27b9f0623ff78318e1
src/views/components/Map/index.vue
@@ -40,7 +40,7 @@
export default {
  data() {
    return {
      zoom: 15,
      zoom: 11,
      map: null,
      contentRef: {},
      infoWin: {},
@@ -144,7 +144,7 @@
          //form表单中是否有坐标,有则定位到对应位置,没有则使用默认的
          // 104.65417 28.75572 测试数据
          // 四川省宜宾市翠屏区大观楼街道外南街71
          if (this.$props.mapList[0].addr) {
          if (this.$props.mapList.length>0&&this.$props.mapList[0].addr) {
            const { lng: lon, lat } = await this.getGeocode(
              this.$props.mapList[0].addr
            );
@@ -388,10 +388,10 @@
    makeAllMask(mapList) {
      // 清除之前的标记
      this.map && this.map.clearOverLays();
      var minX = mapList[0].longitude;
      var maxX = mapList[0].longitude;
      var minY = mapList[0].latitude;
      var maxY = mapList[0].latitude;
      var minX = 180;
      var maxX = -180;
      var minY = 90;
      var maxY = -90;
      var _this = this;
      mapList.map((item) => {
        const config = {
@@ -412,7 +412,9 @@
          projectAddr: item.projectAddress,
          projectStatus: item.usedStatus,
        };
        _this.makeMask(item.longitude, item.latitude, config);
        if (item.longitude && item.longitude > maxX) {
          maxX = item.longitude;
        }
@@ -426,6 +428,7 @@
          minY = item.latitude;
        }
      });
      this.moveTo(
        (parseFloat(maxX) + parseFloat(minX)) / 2,
        (parseFloat(maxY) + parseFloat(minY)) / 2