|
|
@ -97,20 +97,30 @@ export async function setMarkerCluster(map, points, markerFun) { |
|
|
|
* @param {*} _markerClick marker 点击 |
|
|
|
* @returns |
|
|
|
*/ |
|
|
|
export async function setMarkToMap(item, data, _markerClick, content) { |
|
|
|
export async function setMarkToMap( |
|
|
|
item, |
|
|
|
data, |
|
|
|
_markerClick, |
|
|
|
content, |
|
|
|
{ iconCallback } = {} |
|
|
|
) { |
|
|
|
const { mapIns } = this.getMap(); |
|
|
|
|
|
|
|
if (!mapIns) return Message.error("地图加载失败!"); |
|
|
|
|
|
|
|
const normal = require(`@screen/images/layer${item.id.replace( |
|
|
|
/^\.|[^/]+(?=.svg$)/g, |
|
|
|
(data) => (data === "." ? "" : `${data}`) |
|
|
|
)}`);
|
|
|
|
const normal = |
|
|
|
normal || |
|
|
|
require(`@screen/images/layer${item.id.replace( |
|
|
|
/^\.|[^/]+(?=.svg$)/g, |
|
|
|
(data) => (data === "." ? "" : `${data}`) |
|
|
|
)}`);
|
|
|
|
|
|
|
|
const fault = require(`@screen/images/layer${item.id.replace( |
|
|
|
/^\.|[^/]+(?=.svg$)/g, |
|
|
|
(data) => (data === "." ? "" : `${data}_fault`) |
|
|
|
)}`);
|
|
|
|
const fault = |
|
|
|
fault || |
|
|
|
require(`@screen/images/layer${item.id.replace( |
|
|
|
/^\.|[^/]+(?=.svg$)/g, |
|
|
|
(data) => (data === "." ? "" : `${data}_fault`) |
|
|
|
)}`);
|
|
|
|
|
|
|
|
const faultBg = require(`@screen/images/mapBg/fault.svg`); |
|
|
|
const normalBg = require(`@screen/images/mapBg/normal.svg`); |
|
|
@ -124,6 +134,10 @@ export async function setMarkToMap(item, data, _markerClick, content) { |
|
|
|
const markerCluster = await setMarkerCluster( |
|
|
|
mapIns, |
|
|
|
data.map((item) => { |
|
|
|
const deviceIcon = |
|
|
|
iconCallback === "function" && |
|
|
|
iconCallback(item.deviceState == 1, item); |
|
|
|
|
|
|
|
return { |
|
|
|
weight: 1, |
|
|
|
lnglat: [item.longitude, item.latitude], |
|
|
@ -146,7 +160,9 @@ export async function setMarkToMap(item, data, _markerClick, content) { |
|
|
|
height: 18px; |
|
|
|
margin-left: 3px; |
|
|
|
margin-bottom: 6px; |
|
|
|
" src='${item.deviceState == 1 ? normal : fault}'> |
|
|
|
" src='${ |
|
|
|
deviceIcon ? deviceIcon : item.deviceState == 1 ? normal : fault |
|
|
|
}'> |
|
|
|
</div>`, |
|
|
|
}; |
|
|
|
}), |
|
|
|