From accee1dd51c5109a032fc2dedf53f2bd600b76a1 Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Mon, 20 Jul 2026 14:35:04 +0800 Subject: [PATCH] =?UTF-8?q?refactor(map):=20=E8=B0=83=E6=95=B4=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=8F=98=E9=87=8F=E5=90=8D=E5=92=8C=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将所有点位配置中的 mapIcon 属性修改为 markIcon - 将所有点位配置中的 mapType 属性修改为 markType --- .../BottomUtils/branchOfficeUtilsList.js | 48 +++++++++---------- .../components/BottomUtils/portUtilsList.js | 48 +++++++++---------- src/pages/Container/Map/index.js | 2 +- src/pages/Container/Map/js/initMap.js | 2 +- src/pages/Container/Map/js/mapMethods.js | 30 ++++++------ src/pages/Container/Map/js/pointClickEvent.js | 8 ++-- 6 files changed, 69 insertions(+), 69 deletions(-) diff --git a/src/pages/Container/Map/components/BottomUtils/branchOfficeUtilsList.js b/src/pages/Container/Map/components/BottomUtils/branchOfficeUtilsList.js index 31bc7e4..8503577 100644 --- a/src/pages/Container/Map/components/BottomUtils/branchOfficeUtilsList.js +++ b/src/pages/Container/Map/components/BottomUtils/branchOfficeUtilsList.js @@ -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, }, ], }, diff --git a/src/pages/Container/Map/components/BottomUtils/portUtilsList.js b/src/pages/Container/Map/components/BottomUtils/portUtilsList.js index 66b23f3..b847707 100644 --- a/src/pages/Container/Map/components/BottomUtils/portUtilsList.js +++ b/src/pages/Container/Map/components/BottomUtils/portUtilsList.js @@ -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, }, ], }, diff --git a/src/pages/Container/Map/index.js b/src/pages/Container/Map/index.js index f44d6f3..b3b810e 100644 --- a/src/pages/Container/Map/index.js +++ b/src/pages/Container/Map/index.js @@ -51,7 +51,7 @@ function Map(props) { initMap(); - if (query.mapType === "港口") { + if (query.markType === "港口") { const entered = externalEntryPort(query); if (!entered) message.warning("港口入口参数不完整,无法定位到对应港口"); diff --git a/src/pages/Container/Map/js/initMap.js b/src/pages/Container/Map/js/initMap.js index 9015778..2fe2615 100644 --- a/src/pages/Container/Map/js/initMap.js +++ b/src/pages/Container/Map/js/initMap.js @@ -150,7 +150,7 @@ export default function useInitMap() { id, name, corpinfoId: data.corpinfoId, - mapType: "港口", + markType: "港口", isExternalEntry: "1", position: { x: Number(longitude), y: Number(latitude) }, }, diff --git a/src/pages/Container/Map/js/mapMethods.js b/src/pages/Container/Map/js/mapMethods.js index 758e5b9..ce53313 100644 --- a/src/pages/Container/Map/js/mapMethods.js +++ b/src/pages/Container/Map/js/mapMethods.js @@ -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 { diff --git a/src/pages/Container/Map/js/pointClickEvent.js b/src/pages/Container/Map/js/pointClickEvent.js index 83255ae..54685fc 100644 --- a/src/pages/Container/Map/js/pointClickEvent.js +++ b/src/pages/Container/Map/js/pointClickEvent.js @@ -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); };