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