update
1.修改新疆应急图例等问题
This commit is contained in:
@@ -304,6 +304,7 @@ export const Map = {
|
|||||||
label: {
|
label: {
|
||||||
content: isFunction(extData?.content) && extData?.content(result[i]),
|
content: isFunction(extData?.content) && extData?.content(result[i]),
|
||||||
},
|
},
|
||||||
|
zIndex: 99,
|
||||||
...extData?.extOption,
|
...extData?.extOption,
|
||||||
});
|
});
|
||||||
arr.push(startMarker);
|
arr.push(startMarker);
|
||||||
@@ -460,6 +461,16 @@ export const Map = {
|
|||||||
});
|
});
|
||||||
this.infoWindow.open(this.map);
|
this.infoWindow.open(this.map);
|
||||||
},
|
},
|
||||||
|
createEmerInfoModal({ option, content }, flag = true) {
|
||||||
|
let { latitude, longitude } = option;
|
||||||
|
this.infoWindow = new AMap.InfoWindow({
|
||||||
|
position: [longitude, latitude],
|
||||||
|
offset: new AMap.Pixel(0, -8),
|
||||||
|
content: content,
|
||||||
|
closeWhenClickMap: flag,
|
||||||
|
});
|
||||||
|
this.infoWindow.open(this.map);
|
||||||
|
},
|
||||||
clearInfoModal() {
|
clearInfoModal() {
|
||||||
if (this.infoWindow) {
|
if (this.infoWindow) {
|
||||||
this.infoWindow?.setMap(null);
|
this.infoWindow?.setMap(null);
|
||||||
@@ -582,7 +593,7 @@ export const Map = {
|
|||||||
/**
|
/**
|
||||||
* @desc 创建应急人员Marker
|
* @desc 创建应急人员Marker
|
||||||
*/
|
*/
|
||||||
createEmergencyMarker(option) {
|
createEmergencyMarker(option: any, isLabel = true, callback?: Callback) {
|
||||||
this.clearEmergencyMarker();
|
this.clearEmergencyMarker();
|
||||||
const { sex, address, name, position } = option;
|
const { sex, address, name, position } = option;
|
||||||
const icon = sex == '1' ? female : male;
|
const icon = sex == '1' ? female : male;
|
||||||
@@ -590,15 +601,24 @@ export const Map = {
|
|||||||
position: position,
|
position: position,
|
||||||
icon: createIcon({ icon: watchIconR, iconSize: [80, 80], imageSize: [80, 80] }),
|
icon: createIcon({ icon: watchIconR, iconSize: [80, 80], imageSize: [80, 80] }),
|
||||||
offset: new AMap.Pixel(-40, -40), //设置偏移量
|
offset: new AMap.Pixel(-40, -40), //设置偏移量
|
||||||
label: {
|
...(isLabel
|
||||||
content: `<div class="alarm-content" style="width: 180px;z-index: 99" >
|
? {
|
||||||
|
label: {
|
||||||
|
content: `<div class="alarm-content" style="width: 180px;z-index: 99" >
|
||||||
<div style="text-align: center;padding-bottom: 6px">${name}</div>
|
<div style="text-align: center;padding-bottom: 6px">${name}</div>
|
||||||
<div style="text-wrap: wrap">${address}</div>
|
<div style="text-wrap: wrap">${address}</div>
|
||||||
</div>`,
|
</div>`,
|
||||||
offset: new AMap.Pixel(-120, -70),
|
offset: new AMap.Pixel(-120, -70),
|
||||||
},
|
},
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
});
|
});
|
||||||
this.map.add(this.emergencyMarker);
|
this.map.add(this.emergencyMarker);
|
||||||
|
this.emergencyMarker.on('click', () => {
|
||||||
|
if (callback && isFunction(callback)) {
|
||||||
|
callback(option);
|
||||||
|
}
|
||||||
|
});
|
||||||
// this.setZoomCenter(position);
|
// this.setZoomCenter(position);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -121,6 +121,7 @@
|
|||||||
centerMapFromList,
|
centerMapFromList,
|
||||||
columns,
|
columns,
|
||||||
contactListColumns,
|
contactListColumns,
|
||||||
|
createEmerInfo,
|
||||||
fromLists,
|
fromLists,
|
||||||
infoContentSpecial,
|
infoContentSpecial,
|
||||||
monitorColumns,
|
monitorColumns,
|
||||||
@@ -476,7 +477,12 @@
|
|||||||
address: res,
|
address: res,
|
||||||
sex: data.sex,
|
sex: data.sex,
|
||||||
};
|
};
|
||||||
Map.createEmergencyMarker(option);
|
option['latitude'] = option.lat;
|
||||||
|
option['longitude'] = option.lon;
|
||||||
|
Map.createEmerInfoModal({ option, content: createEmerInfo(option) }, false);
|
||||||
|
Map.createEmergencyMarker(option, false, (val: any) => {
|
||||||
|
Map.createEmerInfoModal({ option: val, content: createEmerInfo(val) }, false);
|
||||||
|
});
|
||||||
Map.map.setFitView([...arr, Map.emergencyMarker], false, [180, 180, 180, 180]);
|
Map.map.setFitView([...arr, Map.emergencyMarker], false, [180, 180, 180, 180]);
|
||||||
})
|
})
|
||||||
.catch((err: any) => {
|
.catch((err: any) => {
|
||||||
|
|||||||
@@ -1004,4 +1004,16 @@
|
|||||||
.no-top {
|
.no-top {
|
||||||
top: 50px !important;
|
top: 50px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.emer-content) {
|
||||||
|
width: 200px;
|
||||||
|
padding: 6px 10px 10px;
|
||||||
|
|
||||||
|
> div {
|
||||||
|
&:nth-child(1) {
|
||||||
|
text-align: center;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -278,6 +278,15 @@ export function infoContentSpecial(res: any) {
|
|||||||
</div>
|
</div>
|
||||||
</div> `;
|
</div> `;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function createEmerInfo(res: any) {
|
||||||
|
const { address, name } = res;
|
||||||
|
return `<div class="emer-content" >
|
||||||
|
<div>${name}</div>
|
||||||
|
<div>${address}</div>
|
||||||
|
</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
const columns1 = [
|
const columns1 = [
|
||||||
{
|
{
|
||||||
title: '姓名',
|
title: '姓名',
|
||||||
|
|||||||
Reference in New Issue
Block a user