fix:地图点位异步处理

This commit is contained in:
HH 2024-06-20 16:50:53 +08:00
parent 2083077397
commit 7aa8abc47c
6 changed files with 84 additions and 49 deletions

View File

@ -43,7 +43,7 @@
"vite"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"volar.tsPlugin": true,
"typescript.tsdk": "node_modules/typescript/lib",

View File

@ -57,6 +57,29 @@ export function emerWareHouseDetail(params) {
method: "GET",
});
}
/**
*
*/
export function emerEventList(params) {
return request({
url: `/screen/index/emerEventList`,
method: "GET",
params: params
});
}
/**
*
*/
export function domicileList(params) {
return request({
url: `/screen/index/domicileList`,
method: "GET",
params: params
});
}
// 地图信息:整体信息
export function emerMapInfo(params) {
return request({

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -14,6 +14,8 @@ import {
emerShelterList,
emerRiskPoolList,
emerWareHouseList,
emerEventList,
domicileList,
emerShelterDetail,
emerWareHouseDetail,
emerRiskPoolDetail,
@ -138,7 +140,7 @@ const getEmerShelterList = () => {
emerShelterList({}).then((res: any) => {
res.data.forEach((item) => {
// console.log(item, "item===>");
addMark(item.lng, item.lat, "icon-bncs", 1, item.othrefugeid);
addMark(item.lng, item.lat, "icon-bncs", 1, item.othrefugeid, item);
});
});
};
@ -147,7 +149,7 @@ const getEmerRiskPoolList = () => {
emerRiskPoolList({}).then((res: any) => {
res.data.forEach((item) => {
// console.log(item, "item===>");
addMark(item.lon, item.lat, "icon-wl", 2, item.poolId);
addMark(item.lon, item.lat, "icon-wl", 2, item.poolId, item);
});
});
};
@ -156,7 +158,26 @@ const getEmerWareHouseList = () => {
emerWareHouseList({}).then((res: any) => {
res.data.forEach((item) => {
// console.log(item, "item===>");
addMark(item.lon, item.lat, "icon-hj", 3, item.houseId);
addMark(item.lon, item.lat, "icon-hj", 3, item.houseId, item);
});
});
};
//
const getemerEventList = () => {
emerEventList({}).then((res: any) => {
res.data.forEach((item) => {
// console.log(item, "item===>");
addMark(item.lon, item.lat, "icon-sb", 4, item.emerEventId, item);
});
});
};
//
const getdomicileList = () => {
domicileList({}).then((res: any) => {
res.data.forEach((item) => {
// console.log(item, "item===>");
addMark(item.lon, item.lat, "icon-fj", 5, item.emerEventId, item);
});
});
};
@ -179,6 +200,10 @@ const loadLayer = (insideJson: string, outJson: string) => {
getEmerRiskPoolList();
//
getEmerWareHouseList();
//
getemerEventList();
//
getdomicileList();
};
/**
@ -371,63 +396,54 @@ const datatext4 = ref("xxxxxxx地址");
* 加载点击区域
*/
const loadAreaChild = (attrTemp: any) => {
// graphicLayer.value = new mars3d.layer.GraphicLayer();
// map.addLayer(graphicLayer.value);
graphicLayer.value.bindPopup((event: any) => {
// console.log(event, "event====>");
console.log(event.graphic, "event====>");
let attr = event.graphic.attr || {};
// console.log(attr, "attr==>");
console.log(
event.graphic.objectsToExclude?.id,
"event.graphic.objectsToExclude?.id===>"
);
let title = "点位";
let item = event.graphic.objectsToExclude?.item
switch (event.graphic.objectsToExclude?.type || -1) {
case 1:
title = "避难场所";
emerShelterDetail({
id: event.graphic.objectsToExclude?.id,
}).then((res: any) => {
attr["场所名称:"] = res.data.name;
attr["占地面积:"] = res.data.space;
attr["地址:"] = res.data.address;
attr["场所名称:"] = item.name;
attr["占地面积:"] = item.space;
attr["地址:"] = item.address;
attr["跳转:"] = `<button
onclick="
window.open('https://dfxs.sczysoft.com/#/emer/shelter', '_blank');
"
>详情</button>`;
});
// getemerShelterDetail(id);
break;
case 2:
title = "风险池";
emerRiskPoolDetail({ id: event.graphic.objectsToExclude?.id }).then(
(res: any) => {
attr["风险地址:"] = res.data.address;
attr["风险类型:"] = res.data.typeName;
title = item.name;
attr["风险地址:"] = item.address;
attr["风险类型:"] = item.typeName;
attr["跳转:"] = `<button
onclick="
window.open('https://dfxs.sczysoft.com/#/emer/point', '_blank');
"
>详情</button>`;
}
);
break;
case 3:
title = "应急仓库";
emerWareHouseDetail({ id: event.graphic.objectsToExclude?.id }).then(
(res: any) => {
attr["地址:"] = res.data.address;
attr["管理员:"] = res.data.nameId;
attr["联系电话:"] = res.data.telephone;
attr["地址:"] = item.address;
attr["管理员:"] = item.nameId;
attr["联系电话:"] = item.telephone;
attr["跳转:"] = `<button
onclick="
window.open('https://dfxs.sczysoft.com/#/emer/house', '_blank');
"
>详情</button>`;
}
);
break;
case 4:
title = "应急上报事件";
attr["上报标题:"] = item.title;
attr["所属地区:"] = item.areaName;
attr["上报地址:"] = item.address;
break;
case 5:
title = "户籍信息";
attr["上报标题:"] = item.name;
attr["所属地区:"] = item.areaName;
break;
default:
@ -438,11 +454,6 @@ const loadAreaChild = (attrTemp: any) => {
attr["应急仓库:"] = wholeNumber.value.emerWareHouseNum;
break;
}
// return mars3d.Util.getTemplateHtml({
// title,
// template: "all",
// attr,
// });
return mars3d.Util.getTemplateHtml({
title,
template: "all",
@ -489,10 +500,11 @@ const addMark = (
lat: number,
imgName: string,
type: number,
id: string
id: string,
item:object
) => {
const graphic = new mars3d.graphic.BillboardEntity({
objectsToExclude: { type, id },
objectsToExclude: { type, id, item },
position: new mars3d.LngLatPoint(lng, lat),
style: {
image: getImageUrl(imgName),

View File

@ -164,7 +164,7 @@
width="100"
/>
<el-table-column
prop="createTimeString"
prop="createTime"
label="上报时间"
align="center"
width="100"