| | |
| | | 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 = { |
| | |
| | | }; |
| | | }, |
| | | mounted() { |
| | | this.searchingBtn(); |
| | | //DOM初始化完成进行地图初始化 |
| | | this.initMap(""); |
| | | bus.$on("refleshNode", (node) => { |
| | | this.nodes = node; |
| | | this.initNode(); |
| | | }); |
| | | }, |
| | | beforeDestroy() { |
| | | bus.$off("refleshNode"); |
| | | }, |
| | | |
| | | components: { |
| | | InfoCard, //设备信息弹层 |
| | | FormList, //表格 |
| | |
| | | center: [116.06157, 39.66157], //地图中心 |
| | | activeNode: null, //选中的地图节点 |
| | | geocoder: {}, |
| | | myMaker: null, |
| | | }; |
| | | }, |
| | | |
| | |
| | | }, |
| | | //初始化节点 |
| | | initNode() { |
| | | if (this.myMaker) { |
| | | this.myMaker.destroy(); |
| | | } |
| | | this.nodes.filter((item, index) => { |
| | | //查询行政位置 |
| | | this.geocoder.getAddress([item.lon, item.lat], (status, result) => { |
| | |
| | | }); |
| | | |
| | | this.map.add(marker); |
| | | this.myMaker = marker; |
| | | }); |
| | | }); |
| | | }, |
| | |
| | | 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); |
| | | }); |
| | | }, |
| | | }, |
| | | }; |