From c68862b95480660ac8adf50a62e947075307e653 Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Wed, 22 Jul 2026 08:52:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(api):=20=E4=BC=98=E5=8C=96=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B0=83=E7=94=A8=E9=BB=98=E8=AE=A4=E5=80=BC=E5=8F=8A?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E7=82=B9=E4=BD=8D=E5=BC=B9=E7=AA=97=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 各接口调用解构时添加 data 默认空数组或空对象,避免空值异常 - 地图标记点新增 isShowModal 参数,控制弹窗是否显示 - 点位点击事件中根据 isShowModal 判断是否触发弹窗显示事件 - 修正样式中 .scroll 容器高度及溢出处理 - 统一接口返回数据默认值处理,提升稳定性和健壮性 --- .../Container/Map/components/BottomUtils/index.js | 3 ++- .../IndexInfo/Bottom/RecordStatsPanel/index.js | 2 +- .../IndexInfo/Bottom/VideoPatrolPanel/index.js | 4 ++-- .../IndexInfo/LeftPanel/RectificationPanel/index.js | 2 +- .../IndexInfo/LeftPanel/WeatherPanel/index.js | 7 +++---- .../IndexInfo/LeftPanel/WorkStatusPanel/index.js | 2 +- .../IndexInfo/RightPanel/AlarmPanel/index.js | 2 +- .../IndexInfo/RightPanel/PartnerPanel/index.js | 2 +- .../Content/IndexInfo/RightPanel/WorkPanel/index.js | 4 ++-- .../Content/port/Index/BasicInfoPanel/index.js | 2 +- .../Content/port/Index/PersonnelStatsPanel/index.js | 2 +- .../Content/port/Index/RiskStatsPanel/index.js | 2 +- .../Map/components/Content/port/WeiXian/index.less | 13 +++++-------- .../port/XiaoFang/FireDeviceListPanel/index.js | 2 +- src/pages/Container/Map/js/mapMethods.js | 5 +++-- src/pages/Container/Map/js/pointClickEvent.js | 3 ++- 16 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/pages/Container/Map/components/BottomUtils/index.js b/src/pages/Container/Map/components/BottomUtils/index.js index e71d4f7..6ba9b23 100644 --- a/src/pages/Container/Map/components/BottomUtils/index.js +++ b/src/pages/Container/Map/components/BottomUtils/index.js @@ -107,12 +107,13 @@ function BottomUtils(props) { const check = !list[index].list[index1].check; if (check) { if (item1.request) { - const { data } = await props[item1.request]({ portArea, corpinfoId: currentBranchOffice, pageIndex: 1, pageSize: 9999 }); + const { data = [] } = await props[item1.request]({ portArea, corpinfoId: currentBranchOffice, pageIndex: 1, pageSize: 9999 }); mapMethods.current.addMarkPoint(data, { markType: item1.type, markIcon: item1.markIcon, subLabel: item1.label, titleKey: item1.titleKey, + isShowModal: item1.isShowModal, }); } } diff --git a/src/pages/Container/Map/components/Content/IndexInfo/Bottom/RecordStatsPanel/index.js b/src/pages/Container/Map/components/Content/IndexInfo/Bottom/RecordStatsPanel/index.js index 4be326c..edd6ce0 100644 --- a/src/pages/Container/Map/components/Content/IndexInfo/Bottom/RecordStatsPanel/index.js +++ b/src/pages/Container/Map/components/Content/IndexInfo/Bottom/RecordStatsPanel/index.js @@ -12,7 +12,7 @@ function RecordStatsPanel(props) { const [list, setList] = useState([]); useEffect(() => { const loadList = async () => { - const { data } = await props.getXgfStatisticsListRecordProjectStatistics(); + const { data = [] } = await props.getXgfStatisticsListRecordProjectStatistics(); setList(data); }; diff --git a/src/pages/Container/Map/components/Content/IndexInfo/Bottom/VideoPatrolPanel/index.js b/src/pages/Container/Map/components/Content/IndexInfo/Bottom/VideoPatrolPanel/index.js index 9bf8be8..8e73848 100644 --- a/src/pages/Container/Map/components/Content/IndexInfo/Bottom/VideoPatrolPanel/index.js +++ b/src/pages/Container/Map/components/Content/IndexInfo/Bottom/VideoPatrolPanel/index.js @@ -14,7 +14,7 @@ function VideoPatrolPanel(props) { const [active, setActive] = useState(""); const [playUrl, setPlayUrl] = useState(""); const loadPlayUrl = async (cameraNumber) => { - const { data, success } = await props.getFixedCameraPlayUrl({ + const { data = {}, success } = await props.getFixedCameraPlayUrl({ indexCode: cameraNumber, }); if (success && data) @@ -35,7 +35,7 @@ function VideoPatrolPanel(props) { }; useEffect(() => { const loadVideoList = async () => { - const { data } = await props.getFixedCameraVideoList(); + const { data = [] } = await props.getFixedCameraVideoList(); setList(data); if (data.length) { selectCorp(data[0]); diff --git a/src/pages/Container/Map/components/Content/IndexInfo/LeftPanel/RectificationPanel/index.js b/src/pages/Container/Map/components/Content/IndexInfo/LeftPanel/RectificationPanel/index.js index fe19c39..29514bf 100644 --- a/src/pages/Container/Map/components/Content/IndexInfo/LeftPanel/RectificationPanel/index.js +++ b/src/pages/Container/Map/components/Content/IndexInfo/LeftPanel/RectificationPanel/index.js @@ -13,7 +13,7 @@ function RectificationPanel(props) { const [list, setList] = useState([]); useEffect(() => { const loadList = async () => { - const { data } = await props.getHiddenStatisticsByCorp({ + const { data = [] } = await props.getHiddenStatisticsByCorp({ pageIndex: 1, pageSize: 999, }); diff --git a/src/pages/Container/Map/components/Content/IndexInfo/LeftPanel/WeatherPanel/index.js b/src/pages/Container/Map/components/Content/IndexInfo/LeftPanel/WeatherPanel/index.js index 2989152..4e27b54 100644 --- a/src/pages/Container/Map/components/Content/IndexInfo/LeftPanel/WeatherPanel/index.js +++ b/src/pages/Container/Map/components/Content/IndexInfo/LeftPanel/WeatherPanel/index.js @@ -18,14 +18,13 @@ function WeatherPanel(props) { useEffect(() => { const loadData = async () => { - const [{ result }, { data }] = await Promise.all([ - props.getWeather(), - props.getEventReportListUnfinished(), - ]); + const { result = {} } = await props.getWeather(); setWeather({ ...result.now, alertTitle: result.alerts?.[0]?.title || "当前暂无气象预警", }); + + const { data = [] } = await props.getEventReportListUnfinished(); setEmergencyList(data); }; loadData(); diff --git a/src/pages/Container/Map/components/Content/IndexInfo/LeftPanel/WorkStatusPanel/index.js b/src/pages/Container/Map/components/Content/IndexInfo/LeftPanel/WorkStatusPanel/index.js index 86ef294..2726a67 100644 --- a/src/pages/Container/Map/components/Content/IndexInfo/LeftPanel/WorkStatusPanel/index.js +++ b/src/pages/Container/Map/components/Content/IndexInfo/LeftPanel/WorkStatusPanel/index.js @@ -137,7 +137,7 @@ function WorkStatusPanel(props) { }; useMount(() => { const loadChartData = async () => { - const { data } = await props.getProjectTaskScoreCount(); + const { data = [] } = await props.getProjectTaskScoreCount(); initEcharts(chartRef, chartInstance, data); }; diff --git a/src/pages/Container/Map/components/Content/IndexInfo/RightPanel/AlarmPanel/index.js b/src/pages/Container/Map/components/Content/IndexInfo/RightPanel/AlarmPanel/index.js index 8171910..cc53987 100644 --- a/src/pages/Container/Map/components/Content/IndexInfo/RightPanel/AlarmPanel/index.js +++ b/src/pages/Container/Map/components/Content/IndexInfo/RightPanel/AlarmPanel/index.js @@ -13,7 +13,7 @@ function AlarmPanel(props) { const [list, setList] = useState([]); useEffect(() => { const loadList = async () => { - const { data } = await props.getAlarmRecordScreenIotDeviceAlarmPage(); + const { data = [] } = await props.getAlarmRecordScreenIotDeviceAlarmPage(); setList(data); }; diff --git a/src/pages/Container/Map/components/Content/IndexInfo/RightPanel/PartnerPanel/index.js b/src/pages/Container/Map/components/Content/IndexInfo/RightPanel/PartnerPanel/index.js index 9e9d489..e35c0f3 100644 --- a/src/pages/Container/Map/components/Content/IndexInfo/RightPanel/PartnerPanel/index.js +++ b/src/pages/Container/Map/components/Content/IndexInfo/RightPanel/PartnerPanel/index.js @@ -13,7 +13,7 @@ function PartnerPanel(props) { const [list, setList] = useState([]); useEffect(() => { const loadList = async () => { - const { data } = await props.getXgfStatisticsListCorpStatistics(); + const { data = [] } = await props.getXgfStatisticsListCorpStatistics(); setList(data); }; diff --git a/src/pages/Container/Map/components/Content/IndexInfo/RightPanel/WorkPanel/index.js b/src/pages/Container/Map/components/Content/IndexInfo/RightPanel/WorkPanel/index.js index 36e5c8d..8221853 100644 --- a/src/pages/Container/Map/components/Content/IndexInfo/RightPanel/WorkPanel/index.js +++ b/src/pages/Container/Map/components/Content/IndexInfo/RightPanel/WorkPanel/index.js @@ -29,8 +29,8 @@ function WorkPanel(props) { ]); useEffect(() => { const loadStatistics = async () => { - const { data: eightWorkData } = await props.getEightWorkInfoDangerWorkStatistics(); - const { data: keyProjectData } = await props.getKeyProjectLargeScreenStatistics(); + const { data: eightWorkData = {} } = await props.getEightWorkInfoDangerWorkStatistics(); + const { data: keyProjectData = {} } = await props.getKeyProjectLargeScreenStatistics(); setList((prevState) => { prevState[1].doingCount = eightWorkData.doingCount; prevState[1].appliedCount = eightWorkData.appliedCount; diff --git a/src/pages/Container/Map/components/Content/port/Index/BasicInfoPanel/index.js b/src/pages/Container/Map/components/Content/port/Index/BasicInfoPanel/index.js index 007d349..1660fc7 100644 --- a/src/pages/Container/Map/components/Content/port/Index/BasicInfoPanel/index.js +++ b/src/pages/Container/Map/components/Content/port/Index/BasicInfoPanel/index.js @@ -24,7 +24,7 @@ function BasicInfoPanel(props) { useEffect(() => { const loadStatistics = async () => { - const { data } = await props.getCorpInfoCorpUserSummary({ portArea }); + const { data = {} } = await props.getCorpInfoCorpUserSummary({ portArea }); const counts = [ data.branchCorpCount, data.relatedCorpCount, diff --git a/src/pages/Container/Map/components/Content/port/Index/PersonnelStatsPanel/index.js b/src/pages/Container/Map/components/Content/port/Index/PersonnelStatsPanel/index.js index 83f366b..c582abc 100644 --- a/src/pages/Container/Map/components/Content/port/Index/PersonnelStatsPanel/index.js +++ b/src/pages/Container/Map/components/Content/port/Index/PersonnelStatsPanel/index.js @@ -20,7 +20,7 @@ function PersonnelStatsPanel(props) { const loadStatistics = async (enterpriseType) => { setIsVisible(false); - const { data } = await props.getCorpInfoCorpUserStatisticPage({ + const { data = [] } = await props.getCorpInfoCorpUserStatisticPage({ portArea, enterpriseType, }); diff --git a/src/pages/Container/Map/components/Content/port/Index/RiskStatsPanel/index.js b/src/pages/Container/Map/components/Content/port/Index/RiskStatsPanel/index.js index af016a9..aa2bbd9 100644 --- a/src/pages/Container/Map/components/Content/port/Index/RiskStatsPanel/index.js +++ b/src/pages/Container/Map/components/Content/port/Index/RiskStatsPanel/index.js @@ -51,7 +51,7 @@ function RiskStatsPanel(props) { useEffect(() => { const loadStatistics = async () => { - const { data } = await props.getRiskPointCorpRiskLevel({ portArea }); + const { data = [] } = await props.getRiskPointCorpRiskLevel({ portArea }); const countByLevel = Object.fromEntries( data.map(item => [item.level, item.count]), ); diff --git a/src/pages/Container/Map/components/Content/port/WeiXian/index.less b/src/pages/Container/Map/components/Content/port/WeiXian/index.less index 5c2fdbb..f3dc1b4 100644 --- a/src/pages/Container/Map/components/Content/port/WeiXian/index.less +++ b/src/pages/Container/Map/components/Content/port/WeiXian/index.less @@ -93,6 +93,11 @@ .table { margin-top: 5px; + .scroll{ + height: 400px; + overflow-y: hidden; + } + .tr { display: flex; @@ -133,14 +138,6 @@ padding-left: 0; } } - - .empty { - flex: 1; - text-align: center; - font-size: 12px; - color: #fff; - padding: 5px; - } } } } diff --git a/src/pages/Container/Map/components/Content/port/XiaoFang/FireDeviceListPanel/index.js b/src/pages/Container/Map/components/Content/port/XiaoFang/FireDeviceListPanel/index.js index 33b109a..b3f1070 100644 --- a/src/pages/Container/Map/components/Content/port/XiaoFang/FireDeviceListPanel/index.js +++ b/src/pages/Container/Map/components/Content/port/XiaoFang/FireDeviceListPanel/index.js @@ -17,7 +17,7 @@ function FireDeviceListPanel(props) { useEffect(() => { const loadDeviceList = async () => { setIsVisible(false); - const { data } = await props.getFirePointDeviceList({ + const { data = [] } = await props.getFirePointDeviceList({ portArea, ...queryParams, pageIndex: 1, diff --git a/src/pages/Container/Map/js/mapMethods.js b/src/pages/Container/Map/js/mapMethods.js index 6631d54..4cc562d 100644 --- a/src/pages/Container/Map/js/mapMethods.js +++ b/src/pages/Container/Map/js/mapMethods.js @@ -130,7 +130,7 @@ export default function useMapMethods(viewerRef, request) { // 添加分公司点 const addBranchOfficePoint = async (portArea = 1, pointInfo = null) => { - const { data } = await request.getCorpInfoListAll({ eqPortArea: portArea, inType: [0, 1, 2, 6] }); + const { data = [] } = await request.getCorpInfoListAll({ eqPortArea: portArea, inType: [0, 1, 2, 6] }); mitt.emit(changeCoverMaskVisibleMittKey, true); let branchOfficePoint = []; if (!pointInfo) { @@ -348,6 +348,7 @@ export default function useMapMethods(viewerRef, request) { * @param options.markType {String} 扎点类型 * @param options.subLabel {String} 二级标题(用于弹窗标题) * @param options.titleKey {String} 标题键(用于从item中获取标题) + * @param options.isShowModal {Boolean} 是否显示弹窗 */ const addMarkPoint = async (pointList, options) => { if (!options.markType) @@ -367,7 +368,7 @@ export default function useMapMethods(viewerRef, request) { position: getPosition(item.longitude || item.lng, item.latitude || item.lat), billboard: await getBillboard({ image: options.markIcon, name }), monitorItems: { - data: { ...item, markType: `标记点_${options.markType}`, title: options.subLabel }, + data: { ...item, markType: `标记点_${options.markType}`, title: options.subLabel, isShowModal: options.isShowModal ?? true }, }, }), ); diff --git a/src/pages/Container/Map/js/pointClickEvent.js b/src/pages/Container/Map/js/pointClickEvent.js index e269858..530c8b6 100644 --- a/src/pages/Container/Map/js/pointClickEvent.js +++ b/src/pages/Container/Map/js/pointClickEvent.js @@ -103,7 +103,8 @@ export default function usePointClickEvent(viewerRef, mapMethods) { }; const clickMarkPoint = (data) => { - mitt.emit(clickMarkPointMittKey, data); + if (data.isShowModal) + mitt.emit(clickMarkPointMittKey, data); }; // 点位点击