refactor(map): 调整相关变量名和参数名
- 将所有点位配置中的 mapIcon 属性修改为 markIcon - 将所有点位配置中的 mapType 属性修改为 markTypemaster
parent
a5d0f2588b
commit
accee1dd51
|
|
@ -30,55 +30,55 @@ export const branchOfficeUtilsList = [
|
|||
label: "动火作业",
|
||||
type: "hotWork",
|
||||
check: false,
|
||||
mapIcon: pointIco9,
|
||||
markIcon: pointIco9,
|
||||
},
|
||||
{
|
||||
label: "受限空间作业",
|
||||
type: "confinedSpace",
|
||||
check: false,
|
||||
mapIcon: pointIco10,
|
||||
markIcon: pointIco10,
|
||||
},
|
||||
{
|
||||
label: "临时用电作业",
|
||||
type: "electricity",
|
||||
check: false,
|
||||
mapIcon: pointIco11,
|
||||
markIcon: pointIco11,
|
||||
},
|
||||
{
|
||||
label: "高处作业",
|
||||
type: "highWork",
|
||||
check: false,
|
||||
mapIcon: pointIco12,
|
||||
markIcon: pointIco12,
|
||||
},
|
||||
{
|
||||
label: "断路作业",
|
||||
type: "cutRoad",
|
||||
check: false,
|
||||
mapIcon: pointIco13,
|
||||
markIcon: pointIco13,
|
||||
},
|
||||
{
|
||||
label: "动土作业",
|
||||
type: "breakGround",
|
||||
check: false,
|
||||
mapIcon: pointIco14,
|
||||
markIcon: pointIco14,
|
||||
},
|
||||
{
|
||||
label: "吊装作业",
|
||||
type: "hoisting",
|
||||
check: false,
|
||||
mapIcon: pointIco15,
|
||||
markIcon: pointIco15,
|
||||
},
|
||||
{
|
||||
label: "盲板抽堵作业",
|
||||
type: "blindBoard",
|
||||
check: false,
|
||||
mapIcon: pointIco16,
|
||||
markIcon: pointIco16,
|
||||
},
|
||||
{
|
||||
label: "摄像头",
|
||||
check: false,
|
||||
type: "camera",
|
||||
mapIcon: pointIco3,
|
||||
markIcon: pointIco3,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -89,19 +89,19 @@ export const branchOfficeUtilsList = [
|
|||
{
|
||||
label: "口门",
|
||||
check: false,
|
||||
mapIcon: pointIco1,
|
||||
markIcon: pointIco1,
|
||||
type: "car",
|
||||
},
|
||||
{
|
||||
label: "人员",
|
||||
check: false,
|
||||
mapIcon: pointIco33,
|
||||
markIcon: pointIco33,
|
||||
type: "person",
|
||||
},
|
||||
{
|
||||
label: "车辆",
|
||||
check: false,
|
||||
mapIcon: pointIco2,
|
||||
markIcon: pointIco2,
|
||||
type: "car",
|
||||
},
|
||||
{
|
||||
|
|
@ -118,7 +118,7 @@ export const branchOfficeUtilsList = [
|
|||
label: "摄像头",
|
||||
check: false,
|
||||
type: "camera",
|
||||
mapIcon: pointIco3,
|
||||
markIcon: pointIco3,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -129,38 +129,38 @@ export const branchOfficeUtilsList = [
|
|||
{
|
||||
label: "消防救援队",
|
||||
check: false,
|
||||
mapIcon: pointIco4,
|
||||
markIcon: pointIco4,
|
||||
type: "xfjyd01",
|
||||
},
|
||||
{
|
||||
label: "消防控制室",
|
||||
check: false,
|
||||
type: "xfkzs01",
|
||||
mapIcon: pointIco5,
|
||||
markIcon: pointIco5,
|
||||
},
|
||||
{
|
||||
label: "消防泵房",
|
||||
check: false,
|
||||
type: "xfbf01",
|
||||
mapIcon: pointIco6,
|
||||
markIcon: pointIco6,
|
||||
},
|
||||
{
|
||||
label: "消防水源",
|
||||
check: false,
|
||||
type: "xfsy01",
|
||||
mapIcon: pointIco7,
|
||||
markIcon: pointIco7,
|
||||
},
|
||||
{
|
||||
label: "消防点位",
|
||||
check: false,
|
||||
type: "point",
|
||||
mapIcon: pointIco8,
|
||||
markIcon: pointIco8,
|
||||
},
|
||||
{
|
||||
label: "报警设备",
|
||||
check: false,
|
||||
type: "alarm",
|
||||
mapIcon: pointIco32,
|
||||
markIcon: pointIco32,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -188,13 +188,13 @@ export const branchOfficeUtilsList = [
|
|||
label: "气象站",
|
||||
type: "293187ddfd984c9ab3fd716aef58da0e",
|
||||
check: false,
|
||||
mapIcon: pointIco17,
|
||||
markIcon: pointIco17,
|
||||
},
|
||||
{
|
||||
label: "风速站",
|
||||
type: "2da29f00852a4653ba3e760b9de57412",
|
||||
check: false,
|
||||
mapIcon: pointIco19,
|
||||
markIcon: pointIco19,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -206,13 +206,13 @@ export const branchOfficeUtilsList = [
|
|||
label: "重点工程定位",
|
||||
check: false,
|
||||
type: "project",
|
||||
mapIcon: pointIco30,
|
||||
markIcon: pointIco30,
|
||||
},
|
||||
{
|
||||
label: "视频定位",
|
||||
check: false,
|
||||
type: "video",
|
||||
mapIcon: pointIco31,
|
||||
markIcon: pointIco31,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -224,7 +224,7 @@ export const branchOfficeUtilsList = [
|
|||
label: "摄像头",
|
||||
check: false,
|
||||
type: "platCamera",
|
||||
mapIcon: pointIco3,
|
||||
markIcon: pointIco3,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ export const portUtilsList = [
|
|||
check: false,
|
||||
img: ico1,
|
||||
checkImg: ico1On,
|
||||
mapIcon: pointIco1,
|
||||
markIcon: pointIco1,
|
||||
type: "car",
|
||||
},
|
||||
{
|
||||
|
|
@ -105,7 +105,7 @@ export const portUtilsList = [
|
|||
check: false,
|
||||
img: ico2,
|
||||
checkImg: ico2On,
|
||||
mapIcon: pointIco33,
|
||||
markIcon: pointIco33,
|
||||
type: "person",
|
||||
},
|
||||
{
|
||||
|
|
@ -113,7 +113,7 @@ export const portUtilsList = [
|
|||
check: false,
|
||||
img: ico2,
|
||||
checkImg: ico2On,
|
||||
mapIcon: pointIco2,
|
||||
markIcon: pointIco2,
|
||||
type: "car",
|
||||
},
|
||||
{
|
||||
|
|
@ -136,7 +136,7 @@ export const portUtilsList = [
|
|||
type: "camera",
|
||||
img: ico3,
|
||||
checkImg: ico3On,
|
||||
mapIcon: pointIco3,
|
||||
markIcon: pointIco3,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -151,7 +151,7 @@ export const portUtilsList = [
|
|||
check: false,
|
||||
img: ico4,
|
||||
checkImg: ico4On,
|
||||
mapIcon: pointIco4,
|
||||
markIcon: pointIco4,
|
||||
type: "xfjyd01",
|
||||
},
|
||||
{
|
||||
|
|
@ -160,7 +160,7 @@ export const portUtilsList = [
|
|||
type: "xfkzs01",
|
||||
img: ico5,
|
||||
checkImg: ico5On,
|
||||
mapIcon: pointIco5,
|
||||
markIcon: pointIco5,
|
||||
},
|
||||
{
|
||||
label: "消防泵房",
|
||||
|
|
@ -168,7 +168,7 @@ export const portUtilsList = [
|
|||
type: "xfbf01",
|
||||
img: ico6,
|
||||
checkImg: ico6On,
|
||||
mapIcon: pointIco6,
|
||||
markIcon: pointIco6,
|
||||
},
|
||||
{
|
||||
label: "消防水源",
|
||||
|
|
@ -176,7 +176,7 @@ export const portUtilsList = [
|
|||
type: "xfsy01",
|
||||
img: ico7,
|
||||
checkImg: ico7On,
|
||||
mapIcon: pointIco7,
|
||||
markIcon: pointIco7,
|
||||
},
|
||||
{
|
||||
label: "消防点位",
|
||||
|
|
@ -184,7 +184,7 @@ export const portUtilsList = [
|
|||
type: "point",
|
||||
img: ico8,
|
||||
checkImg: ico8On,
|
||||
mapIcon: pointIco8,
|
||||
markIcon: pointIco8,
|
||||
},
|
||||
{
|
||||
label: "报警设备",
|
||||
|
|
@ -192,7 +192,7 @@ export const portUtilsList = [
|
|||
type: "alarm",
|
||||
img: ico28,
|
||||
checkImg: ico28On,
|
||||
mapIcon: pointIco32,
|
||||
markIcon: pointIco32,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -208,7 +208,7 @@ export const portUtilsList = [
|
|||
check: false,
|
||||
img: ico9,
|
||||
checkImg: ico9On,
|
||||
mapIcon: pointIco9,
|
||||
markIcon: pointIco9,
|
||||
},
|
||||
{
|
||||
label: "受限空间作业",
|
||||
|
|
@ -216,7 +216,7 @@ export const portUtilsList = [
|
|||
check: false,
|
||||
img: ico10,
|
||||
checkImg: ico10On,
|
||||
mapIcon: pointIco10,
|
||||
markIcon: pointIco10,
|
||||
},
|
||||
{
|
||||
label: "临时用电作业",
|
||||
|
|
@ -224,7 +224,7 @@ export const portUtilsList = [
|
|||
check: false,
|
||||
img: ico11,
|
||||
checkImg: ico11On,
|
||||
mapIcon: pointIco11,
|
||||
markIcon: pointIco11,
|
||||
},
|
||||
{
|
||||
label: "高处作业",
|
||||
|
|
@ -232,7 +232,7 @@ export const portUtilsList = [
|
|||
check: false,
|
||||
img: ico12,
|
||||
checkImg: ico12On,
|
||||
mapIcon: pointIco12,
|
||||
markIcon: pointIco12,
|
||||
},
|
||||
{
|
||||
label: "断路作业",
|
||||
|
|
@ -240,7 +240,7 @@ export const portUtilsList = [
|
|||
check: false,
|
||||
img: ico13,
|
||||
checkImg: ico13On,
|
||||
mapIcon: pointIco13,
|
||||
markIcon: pointIco13,
|
||||
},
|
||||
{
|
||||
label: "动土作业",
|
||||
|
|
@ -248,7 +248,7 @@ export const portUtilsList = [
|
|||
check: false,
|
||||
img: ico14,
|
||||
checkImg: ico14On,
|
||||
mapIcon: pointIco14,
|
||||
markIcon: pointIco14,
|
||||
},
|
||||
{
|
||||
label: "吊装作业",
|
||||
|
|
@ -256,7 +256,7 @@ export const portUtilsList = [
|
|||
check: false,
|
||||
img: ico15,
|
||||
checkImg: ico15On,
|
||||
mapIcon: pointIco15,
|
||||
markIcon: pointIco15,
|
||||
},
|
||||
{
|
||||
label: "盲板抽堵作业",
|
||||
|
|
@ -264,7 +264,7 @@ export const portUtilsList = [
|
|||
check: false,
|
||||
img: ico16,
|
||||
checkImg: ico16On,
|
||||
mapIcon: pointIco16,
|
||||
markIcon: pointIco16,
|
||||
},
|
||||
{
|
||||
label: "摄像头",
|
||||
|
|
@ -272,7 +272,7 @@ export const portUtilsList = [
|
|||
type: "camera",
|
||||
img: ico3,
|
||||
checkImg: ico3On,
|
||||
mapIcon: pointIco3,
|
||||
markIcon: pointIco3,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -288,7 +288,7 @@ export const portUtilsList = [
|
|||
check: false,
|
||||
img: ico17,
|
||||
checkImg: ico17On,
|
||||
mapIcon: pointIco17,
|
||||
markIcon: pointIco17,
|
||||
},
|
||||
{
|
||||
label: "风速站",
|
||||
|
|
@ -296,7 +296,7 @@ export const portUtilsList = [
|
|||
check: false,
|
||||
img: ico19,
|
||||
checkImg: ico19On,
|
||||
mapIcon: pointIco19,
|
||||
markIcon: pointIco19,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -334,7 +334,7 @@ export const portUtilsList = [
|
|||
type: "platCamera",
|
||||
img: ico26,
|
||||
checkImg: ico26On,
|
||||
mapIcon: pointIco3,
|
||||
markIcon: pointIco3,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -350,7 +350,7 @@ export const portUtilsList = [
|
|||
type: "project",
|
||||
img: ico27,
|
||||
checkImg: ico27On,
|
||||
mapIcon: pointIco30,
|
||||
markIcon: pointIco30,
|
||||
},
|
||||
{
|
||||
label: "视频定位",
|
||||
|
|
@ -358,7 +358,7 @@ export const portUtilsList = [
|
|||
type: "video",
|
||||
img: ico26,
|
||||
checkImg: ico26On,
|
||||
mapIcon: pointIco31,
|
||||
markIcon: pointIco31,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ function Map(props) {
|
|||
|
||||
initMap();
|
||||
|
||||
if (query.mapType === "港口") {
|
||||
if (query.markType === "港口") {
|
||||
const entered = externalEntryPort(query);
|
||||
if (!entered)
|
||||
message.warning("港口入口参数不完整,无法定位到对应港口");
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ export default function useInitMap() {
|
|||
id,
|
||||
name,
|
||||
corpinfoId: data.corpinfoId,
|
||||
mapType: "港口",
|
||||
markType: "港口",
|
||||
isExternalEntry: "1",
|
||||
position: { x: Number(longitude), y: Number(latitude) },
|
||||
},
|
||||
|
|
|
|||
|
|
@ -453,7 +453,7 @@ export default function useMapMethods(viewerRef) {
|
|||
name: item.name,
|
||||
position: getPosition(item.position.x, item.position.y),
|
||||
billboard: await getBillboard({ image: portEntityBillboardImage, name: item.name }),
|
||||
monitorItems: { data: { ...item, mapType: "港口" } },
|
||||
monitorItems: { data: { ...item, markType: "港口" } },
|
||||
}),
|
||||
);
|
||||
getViewer().dataSources.add(entityCollection);
|
||||
|
|
@ -485,7 +485,7 @@ export default function useMapMethods(viewerRef) {
|
|||
position: getPosition(item.longitude, item.latitude),
|
||||
billboard: await getBillboard({ image: branchOfficeEntityBillboardImage, name: item.corpName }),
|
||||
monitorItems: {
|
||||
data: { ...item, id: item.corpinfoId, mapType: "分公司" },
|
||||
data: { ...item, id: item.corpinfoId, markType: "分公司" },
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
|
@ -680,20 +680,20 @@ export default function useMapMethods(viewerRef) {
|
|||
/**
|
||||
* desc: 添加点位
|
||||
* @param {Array} pointList
|
||||
* @param options {Object: {mapIcon, type, subLabel}} 配置项
|
||||
* @param options.mapIcon {String} 扎点图标
|
||||
* @param options.mapType {String} 扎点类型
|
||||
* @param options {Object: {markIcon, type, subLabel}} 配置项
|
||||
* @param options.markIcon {String} 扎点图标
|
||||
* @param options.markType {String} 扎点类型
|
||||
* @param options.subLabel {String} 二级标题(用于弹窗标题)
|
||||
*/
|
||||
const addMarkPoint = async (pointList, options) => {
|
||||
if (!options.mapType)
|
||||
throw new Error("请传入mapType(扎点类型)");
|
||||
if (!options.mapIcon)
|
||||
throw new Error("请传入mapIcon(扎点图标)");
|
||||
if (!options.markType)
|
||||
throw new Error("请传入markType(扎点类型)");
|
||||
if (!options.markIcon)
|
||||
throw new Error("请传入markIcon(扎点图标)");
|
||||
mitt.emit(changeCoverMaskVisibleMittKey, true);
|
||||
await chunkedLoad(pointList, 10, async (item) => {
|
||||
const entityCollection = createEntityCollection(
|
||||
`markEntityCollection_${options.mapType}`,
|
||||
`markEntityCollection_${options.markType}`,
|
||||
);
|
||||
const name = item.MAP_POINT_NAME || item.AREA_NAME || "";
|
||||
entityCollection.entities.add(
|
||||
|
|
@ -701,9 +701,9 @@ export default function useMapMethods(viewerRef) {
|
|||
id: createId(),
|
||||
name,
|
||||
position: getPosition(item.LONGITUDE, item.LATITUDE),
|
||||
billboard: await getBillboard({ image: options.mapIcon, name }),
|
||||
billboard: await getBillboard({ image: options.markIcon, name }),
|
||||
monitorItems: {
|
||||
data: { ...item, mapType: `标记点_${options.mapType}`, title: options.subLabel },
|
||||
data: { ...item, markType: `标记点_${options.markType}`, title: options.subLabel },
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
|
@ -712,15 +712,15 @@ export default function useMapMethods(viewerRef) {
|
|||
const dataSource = await addMergedEntityCollection(
|
||||
getViewer(),
|
||||
"markEntityCollection",
|
||||
options.mapType,
|
||||
options.markType,
|
||||
);
|
||||
enabledClustering(dataSource);
|
||||
mitt.emit(changeCoverMaskVisibleMittKey, false);
|
||||
};
|
||||
|
||||
// 删除点位
|
||||
const removeMarkPoint = (mapType) => {
|
||||
removeEntityCollection(getViewer(), `markEntityCollectionMerged${mapType ? `_${mapType}` : ""}`);
|
||||
const removeMarkPoint = (markType) => {
|
||||
removeEntityCollection(getViewer(), `markEntityCollectionMerged${markType ? `_${markType}` : ""}`);
|
||||
};
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -111,15 +111,15 @@ export default function usePointClickEvent(viewerRef, mapMethods) {
|
|||
const pointClickEvent = (pick) => {
|
||||
const data = pick.monitorItems.data;
|
||||
closePopup();
|
||||
if (data.isExternalEntry === "1" && data.mapType === "港口") {
|
||||
if (data.isExternalEntry === "1" && data.markType === "港口") {
|
||||
clickPortPointEnter(data);
|
||||
return;
|
||||
}
|
||||
if (data.mapType === "港口")
|
||||
if (data.markType === "港口")
|
||||
clickPortPoint(data);
|
||||
if (data.mapType === "分公司")
|
||||
if (data.markType === "分公司")
|
||||
clickBranchOfficePoint(data);
|
||||
if (data.mapType.includes("标记点"))
|
||||
if (data.markType.includes("标记点"))
|
||||
clickMarkPoint(data);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue