From 588dfcfbcfceec9acd6373c8ce3019e4796d9f56 Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Thu, 23 Jul 2026 17:34:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(map):=20=E4=BF=AE=E5=A4=8D=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=88=86=E5=85=AC=E5=8F=B8=E7=82=B9=E6=97=B6=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化请求数据赋值,避免重复请求 - 在无pointInfo时使用请求到的数据赋值 - 保证filterNull函数处理正确的数组数据 - 改进代码可读性与逻辑流畅性 --- src/pages/Container/Map/js/mapMethods.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/Container/Map/js/mapMethods.js b/src/pages/Container/Map/js/mapMethods.js index 120b5d9..fefb010 100644 --- a/src/pages/Container/Map/js/mapMethods.js +++ b/src/pages/Container/Map/js/mapMethods.js @@ -130,11 +130,15 @@ export default function useMapMethods(viewerRef, request) { // 添加分公司点 const addBranchOfficePoint = async (portArea = "", pointInfo = null) => { - const { data = [] } = await request.getCorpInfoListAll({ eqPortArea: portArea, inType: [0, 1, 2, 6] }); + let requestData = []; + if (!pointInfo) { + const { data = [] } = await request.getCorpInfoListAll({ eqPortArea: portArea, inType: [0, 1, 2, 6] }); + requestData = data; + } mitt.emit(changeCoverMaskVisibleMittKey, true); let branchOfficePoint = []; if (!pointInfo) { - branchOfficePoint = filterNull(data); + branchOfficePoint = filterNull(requestData); } else { branchOfficePoint = filterNull([pointInfo]);