ZZJ
2022-04-29 5ee0d36e051d591f930ba93ba660e45f10710c3f
src/views/equipmentManagement/equipmentList/components/Content.vue
@@ -34,6 +34,9 @@
import AMapLoader from "@amap/amap-jsapi-loader";
import InfoCard from "@/views/equipmentManagement/equipmentList/components/InfoCard";
import FormList from "@/views/equipmentManagement/equipmentList/components/FormList";
import bus from "@/plugin/bus";
export default {
  created() {
    window._AMapSecurityConfig = {
@@ -41,9 +44,16 @@
    };
  },
  mounted() {
    this.searchingBtn();
    //DOM初始化完成进行地图初始化
    this.initMap("");
    bus.$on("refleshNode", (node) => {
      this.nodes = node;
      this.initNode();
    });
  },
  beforeDestroy() {
    bus.$off("refleshNode");
  },
  components: {
    InfoCard, //设备信息弹层
    FormList, //表格
@@ -59,6 +69,7 @@
      center: [116.06157, 39.66157], //地图中心
      activeNode: null, //选中的地图节点
      geocoder: {},
      myMaker: null,
    };
  },
@@ -91,6 +102,9 @@
    },
    //初始化节点
    initNode() {
      if (this.myMaker) {
        this.myMaker.destroy();
      }
      this.nodes.filter((item, index) => {
        //查询行政位置
        this.geocoder.getAddress([item.lon, item.lat], (status, result) => {
@@ -123,6 +137,7 @@
          });
          this.map.add(marker);
          this.myMaker = marker;
        });
      });
    },
@@ -143,25 +158,6 @@
        this.isFull = false;
      }
      this.initMap(status);
    },
    // 查询列表
    searchingBtn() {
      let param = {
        page: 1,
        size: 999,
        // startTime: this.searchTime[0],
        // endTime: this.searchTime[1],
        inputText: "",
      };
      findDevList(param)
        .then((res) => {
          this.nodes = res.data.list;
          this.initMap("");
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};