|
@@ -115,24 +115,29 @@ const initDeviceMarkers = () => {
|
|
}
|
|
}
|
|
|
|
|
|
const createDeviceMarker = (device: IotDeviceVO, point: any) => {
|
|
const createDeviceMarker = (device: IotDeviceVO, point: any) => {
|
|
|
|
+ // 根据设备是否在线选择不同的图标
|
|
|
|
+ const iconUrl = device.ifInline === 3
|
|
|
|
+ ? 'https://iot.deepoil.cc/images/ding300.svg'
|
|
|
|
+ : 'https://iot.deepoil.cc/images/dingou.svg';
|
|
|
|
+
|
|
const marker = new (window as any).BMap.Marker(point, {
|
|
const marker = new (window as any).BMap.Marker(point, {
|
|
icon: new (window as any).BMap.Icon(
|
|
icon: new (window as any).BMap.Icon(
|
|
- 'https://iot.deepoil.cc/images/ding300.svg',
|
|
|
|
|
|
+ iconUrl,
|
|
new (window as any).BMap.Size(28, 30),
|
|
new (window as any).BMap.Size(28, 30),
|
|
{
|
|
{
|
|
anchor: new (window as any).BMap.Size(14, 25)
|
|
anchor: new (window as any).BMap.Size(14, 25)
|
|
// imageOffset: new (window as any).BMap.Size(0, -5)
|
|
// imageOffset: new (window as any).BMap.Size(0, -5)
|
|
}
|
|
}
|
|
)
|
|
)
|
|
- })
|
|
|
|
|
|
+ });
|
|
|
|
|
|
// 添加点击事件
|
|
// 添加点击事件
|
|
marker.addEventListener('click', () => {
|
|
marker.addEventListener('click', () => {
|
|
- showDeviceInfoWindow(device, point)
|
|
|
|
- })
|
|
|
|
|
|
+ showDeviceInfoWindow(device, point);
|
|
|
|
+ });
|
|
|
|
|
|
- return marker
|
|
|
|
-}
|
|
|
|
|
|
+ return marker;
|
|
|
|
+};
|
|
|
|
|
|
const createClusterLabel = (cluster: Cluster, point: any) => {
|
|
const createClusterLabel = (cluster: Cluster, point: any) => {
|
|
const label = new (window as any).BMap.Label(cluster.count.toString(), {
|
|
const label = new (window as any).BMap.Label(cluster.count.toString(), {
|