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