let BMapGL = (window as any).BMapGL;
export function setMarker(markers: any[], map: any) {
const points: any = []
markers.forEach((item) => {
const { lat, lnt: lng } = item;
const point = new BMapGL.Point(lng, lat);
point.data = item
points.push(point)
const marker = new BMapGL.Marker(point);
map.addOverlay(marker);
marker.addEventListener("click", function () {
const infoWindow = new BMapGL.InfoWindow(
`
`,
{
width: 200, // 信息窗口宽度
height: 100, // 信息窗口高度
title: item.stationName,
}
);
map.openInfoWindow(infoWindow, point); //开启信息窗口
});
});
return points
}
export function setMarker2(markers: any[], map: any) {
const points: any = []
markers.forEach((item) => {
const { lat, lnt: lng } = item.stationInfo;
const point = new BMapGL.Point(lng, lat);
points.push(point)
const marker = new BMapGL.Marker(point);
map.addOverlay(marker);
marker.addEventListener("click", function () {
const infoWindow = new BMapGL.InfoWindow(
`
环路名称:${item.name}
所属换热站:
${item.stationInfo.name}
一网供水温度:
${item.outTemperature1}
一网回水温度:
${item.inTemperature1}
`,
{
width: 200, // 信息窗口宽度
height: 100, // 信息窗口高度
title: item.stationName,
}
);
map.openInfoWindow(infoWindow, point); //开启信息窗口
});
});
return points
}