feat(map): 修复点击右侧纯净地图会清空下方工具栏选中状态bug

master
LiuJiaNan 2026-07-27 17:09:33 +08:00
parent f32d44bad9
commit 936a96b184
1 changed files with 13 additions and 11 deletions

View File

@ -8,10 +8,10 @@ import bg8 from "~/assets/images/map_bi/bottom_utils/bg8.png";
import titleImg from "~/assets/images/map_bi/bottom_utils/title.png"; import titleImg from "~/assets/images/map_bi/bottom_utils/title.png";
import titleOnImg from "~/assets/images/map_bi/bottom_utils/title_on.png"; import titleOnImg from "~/assets/images/map_bi/bottom_utils/title_on.png";
import { NS_BI_MARK } from "~/enumerate/namespace"; import { NS_BI_MARK } from "~/enumerate/namespace";
import { branchOfficeUtilsList } from "~/pages/Container/Map/components/BottomUtils/branchOfficeUtilsList";
import { Context } from "~/pages/Container/Map/js/context"; import { Context } from "~/pages/Container/Map/js/context";
import usePeoplePosition from "~/pages/Container/Map/js/usePeoplePosition"; import usePeoplePosition from "~/pages/Container/Map/js/usePeoplePosition";
import PeopleTrajectorySelect from "~/pages/Container/Map/components/PeopleTrajectorySelect"; import PeopleTrajectorySelect from "../PeopleTrajectorySelect";
import { branchOfficeUtilsList } from "./branchOfficeUtilsList";
import { portUtilsList } from "./portUtilsList"; import { portUtilsList } from "./portUtilsList";
import { usePortUtilsAnimation } from "./usePortUtilsAnimation"; import { usePortUtilsAnimation } from "./usePortUtilsAnimation";
import "./index.less"; import "./index.less";
@ -75,13 +75,15 @@ function BottomUtils(props) {
setPeopleList, setPeopleList,
); );
const bottomUtilsMode = !pureMap && currentPort && !currentBranchOffice // 菜单数据只由地图层级决定;纯净地图仅隐藏工具栏,不能重置已选菜单。
const bottomUtilsBaseMode = currentPort && !currentBranchOffice
? "port" ? "port"
: !pureMap && currentPort && currentBranchOffice ? "branchOffice" : null; : currentPort && currentBranchOffice ? "branchOffice" : null;
const [list, setList] = useState(() => bottomUtilsMode === "port" const bottomUtilsMode = pureMap ? null : bottomUtilsBaseMode;
const [list, setList] = useState(() => bottomUtilsBaseMode === "port"
? portUtilsList ? portUtilsList
: bottomUtilsMode === "branchOffice" ? branchOfficeUtilsList : []); : bottomUtilsBaseMode === "branchOffice" ? branchOfficeUtilsList : []);
const [listMode, setListMode] = useState(bottomUtilsMode); const [listMode, setListMode] = useState(bottomUtilsBaseMode);
const { const {
parentControls: portUtilsParentControls, parentControls: portUtilsParentControls,
@ -112,17 +114,17 @@ function BottomUtils(props) {
}; };
useEffect(() => { useEffect(() => {
if (bottomUtilsMode === "port") { if (bottomUtilsBaseMode === "port") {
setList(portUtilsList); setList(portUtilsList);
} }
else if (bottomUtilsMode === "branchOffice") { else if (bottomUtilsBaseMode === "branchOffice") {
setList(branchOfficeUtilsList); setList(branchOfficeUtilsList);
} }
else { else {
setList([]); setList([]);
} }
setListMode(bottomUtilsMode); setListMode(bottomUtilsBaseMode);
}, [bottomUtilsMode]); }, [bottomUtilsBaseMode]);
useEffect(() => { useEffect(() => {
resetAllCheck(); resetAllCheck();