zxl
2025-03-25 6ae0fcef149ddbe614746023a58a3885b3ac4bde
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
            );
@@ -281,17 +281,10 @@
    },
    showProjectStatusStr(status) {
      switch (status) {
        case "1":
          return "储备项目";
        case "2":
          return "前期项目";
        case "3":
          return "实施项目";
        case "4":
          return "竣工项目";
        case "5":
          return "异常项目";
        case "pendding":
          return "未开工";
        case "working":
          return "已开工";
        default:
          return "异常项目";
      }
@@ -388,10 +381,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 = {
@@ -410,9 +403,11 @@
            ? item.yearInvestAmount + "元"
            : "暂无数据",
          projectAddr: item.projectAddress,
          projectStatus: item.usedStatus,
          projectStatus: item.projectStatus,
        };
        _this.makeMask(item.longitude, item.latitude, config);
        if (item.longitude && item.longitude > maxX) {
          maxX = item.longitude;
        }
@@ -426,6 +421,7 @@
          minY = item.latitude;
        }
      });
      this.moveTo(
        (parseFloat(maxX) + parseFloat(minX)) / 2,
        (parseFloat(maxY) + parseFloat(minY)) / 2