refactor(map): 将区域area改名为港区portArea以统一命名

master
LiuJiaNan 2026-07-20 17:10:42 +08:00
parent 6c9b5054af
commit 0bc668f56f
10 changed files with 26 additions and 26 deletions

View File

@ -46,21 +46,21 @@ function CenterUtils() {
const { currentPort, currentBranchOffice, pureMap, mapMethods, actions } = useContext(Context); const { currentPort, currentBranchOffice, pureMap, mapMethods, actions } = useContext(Context);
const list = [ const list = [
{ label: "秦皇岛西", area: "2" }, { label: "秦皇岛西", portArea: 3 },
{ label: "秦皇岛港区", area: "" }, { label: "秦皇岛港区", portArea: 1 },
{ label: "秦皇岛东", area: "1" }, { label: "秦皇岛东", portArea: 2 },
]; ];
const [activeIndex, setActiveIndex] = useState(1); const [activePortArea, setActivePortArea] = useState(1);
const isVisible = currentPort === "00003" && !currentBranchOffice && !pureMap; const isVisible = currentPort === "00003" && !currentBranchOffice && !pureMap;
const onChangeArea = (index) => { const onChangePortArea = (portArea) => {
if (index === activeIndex) if (portArea === activePortArea)
return; return;
setActiveIndex(index); setActivePortArea(portArea);
actions.setArea(list[index].area); actions.setPortArea(portArea);
mapMethods.current.removeBranchOfficePoint(); mapMethods.current.removeBranchOfficePoint();
mapMethods.current.addBranchOfficePoint(list[index].area); mapMethods.current.addBranchOfficePoint(portArea);
actions.resetBottomUtils(); actions.resetBottomUtils();
}; };
@ -79,11 +79,11 @@ function CenterUtils() {
key={index} key={index}
className={`option option${index}`} className={`option option${index}`}
style={{ style={{
backgroundImage: `url(${activeIndex === index backgroundImage: `url(${activePortArea === item.portArea
? [tabLeftOnImg, tabMidOnImg, tabRightOnImg][index] ? [tabLeftOnImg, tabMidOnImg, tabRightOnImg][index]
: [tabLeftImg, tabMidImg, tabRightImg][index]})`, : [tabLeftImg, tabMidImg, tabRightImg][index]})`,
}} }}
onClick={() => onChangeArea(index)} onClick={() => onChangePortArea(item.portArea)}
> >
{item.label} {item.label}
</div> </div>
@ -91,7 +91,7 @@ function CenterUtils() {
</div> </div>
<div className="statistics"> <div className="statistics">
<AnimatePresence> <AnimatePresence>
{(activeIndex === 0 || activeIndex === 1) && ( {[1, 3].includes(activePortArea) && (
<motion.div key="west" {...statisticAnimation}> <motion.div key="west" {...statisticAnimation}>
<div className="statistic"> <div className="statistic">
<div className="title" style={{ backgroundImage: `url(${statisticsTitleImg})` }}>西港区</div> <div className="title" style={{ backgroundImage: `url(${statisticsTitleImg})` }}>西港区</div>
@ -104,7 +104,7 @@ function CenterUtils() {
)} )}
</AnimatePresence> </AnimatePresence>
<AnimatePresence> <AnimatePresence>
{(activeIndex === 2 || activeIndex === 1) && ( {[1, 2].includes(activePortArea) && (
<motion.div key="east" {...statisticAnimation}> <motion.div key="east" {...statisticAnimation}>
<div className="statistic"> <div className="statistic">
<div className="title" style={{ backgroundImage: `url(${statisticsTitleImg})` }}>东港区</div> <div className="title" style={{ backgroundImage: `url(${statisticsTitleImg})` }}>东港区</div>

View File

@ -20,7 +20,7 @@ import "./index.less";
const block3OptionsNavList = ["分公司统计", "相关方单位统计"]; const block3OptionsNavList = ["分公司统计", "相关方单位统计"];
function Index() { function Index() {
const { currentPort, area, currentBranchOffice } = useContext(Context); const { currentPort, portArea, currentBranchOffice } = useContext(Context);
const [block1OptionsList, setBlock1OptionsList] = useState([ const [block1OptionsList, setBlock1OptionsList] = useState([
{ label: "分公司企业数", img: img3, count: 0 }, { label: "分公司企业数", img: img3, count: 0 },

View File

@ -18,7 +18,7 @@ import "./index.less";
const block3OptionsNavList = ["传感器数据列表", "报警信息列表"]; const block3OptionsNavList = ["传感器数据列表", "报警信息列表"];
const QiXiang = () => { const QiXiang = () => {
const { currentPort, area, currentBranchOffice } = useContext(Context); const { currentPort, portArea, currentBranchOffice } = useContext(Context);
const [block1OptionsList, setBlock1OptionsList] = useState([ const [block1OptionsList, setBlock1OptionsList] = useState([
{ title: "风速监测", img: qixiang_icon1, count: "-" }, { title: "风速监测", img: qixiang_icon1, count: "-" },
{ title: "温度监测", img: qixiang_icon2, count: "-" }, { title: "温度监测", img: qixiang_icon2, count: "-" },

View File

@ -16,7 +16,7 @@ import { initEcharts1 } from "./echarts";
import "./index.less"; import "./index.less";
const WeiXian = () => { const WeiXian = () => {
const { currentPort, area, currentBranchOffice } = useContext(Context); const { currentPort, portArea, currentBranchOffice } = useContext(Context);
const [block3List, setBlock3List] = useState([ const [block3List, setBlock3List] = useState([
{ WORK_TYPE: "动火作业", STATUS_NAME: "现场负责人", USER_NAME: "李长健" }, { WORK_TYPE: "动火作业", STATUS_NAME: "现场负责人", USER_NAME: "李长健" },
{ WORK_TYPE: "动火作业", STATUS_NAME: "延时监火", USER_NAME: "运行乙班" }, { WORK_TYPE: "动火作业", STATUS_NAME: "延时监火", USER_NAME: "运行乙班" },

View File

@ -8,7 +8,7 @@ import "./index.less";
const { Option } = Select; const { Option } = Select;
const XiaoFang = () => { const XiaoFang = () => {
const { currentPort, area, currentBranchOffice } = useContext(Context); const { currentPort, portArea, currentBranchOffice } = useContext(Context);
const [form] = Form.useForm(); const [form] = Form.useForm();
const [deviceTypeList, setDeviceTypeList] = useState([ const [deviceTypeList, setDeviceTypeList] = useState([
{ name: "地下消防栓栓体", bianma: "dxxfsst" }, { name: "地下消防栓栓体", bianma: "dxxfsst" },

View File

@ -10,7 +10,7 @@ import { Context } from "~/pages/Container/Map/js/context";
import "./index.less"; import "./index.less";
const ZhongDian = () => { const ZhongDian = () => {
const { currentPort, area, currentBranchOffice } = useContext(Context); const { currentPort, portArea, currentBranchOffice } = useContext(Context);
const [block1OptionsList, setBlock1OptionsList] = useState([ const [block1OptionsList, setBlock1OptionsList] = useState([
{ lable: "视频总数", count: 0 }, { lable: "视频总数", count: 0 },

View File

@ -16,7 +16,7 @@ const headerAnimation = {
}; };
function Header() { function Header() {
const { currentPort, currentBranchOffice, mapMethods, area, headerTitle, actions } = useContext(Context); const { currentPort, currentBranchOffice, mapMethods, portArea, headerTitle, actions } = useContext(Context);
const isPortTitle = headerTitle === "秦港股份安全监管平台"; const isPortTitle = headerTitle === "秦港股份安全监管平台";
@ -48,7 +48,7 @@ function Header() {
mapMethods.current.removeFourColorDiagram(); mapMethods.current.removeFourColorDiagram();
mapMethods.current.removeWall(); mapMethods.current.removeWall();
// setTimeout(() => { // setTimeout(() => {
mapMethods.current.addBranchOfficePoint(area); mapMethods.current.addBranchOfficePoint(portArea);
// }, 2000); // }, 2000);
} }
else if (currentPort) { else if (currentPort) {

View File

@ -36,7 +36,7 @@ function Map(props) {
selectBranchOffice: data => dispatch({ type: MAP_ACTION.SELECT_BRANCH_OFFICE, payload: data }), selectBranchOffice: data => dispatch({ type: MAP_ACTION.SELECT_BRANCH_OFFICE, payload: data }),
selectMark: data => dispatch({ type: MAP_ACTION.SELECT_MARK, payload: data }), selectMark: data => dispatch({ type: MAP_ACTION.SELECT_MARK, payload: data }),
resetMark: () => dispatch({ type: MAP_ACTION.RESET_MARK }), resetMark: () => dispatch({ type: MAP_ACTION.RESET_MARK }),
setArea: area => dispatch({ type: MAP_ACTION.SET_AREA, payload: area }), setPortArea: portArea => dispatch({ type: MAP_ACTION.SET_PORT_AREA, payload: portArea }),
setBottomUtilsIndex: index => dispatch({ type: MAP_ACTION.SET_BOTTOM_UTILS_INDEX, payload: index }), setBottomUtilsIndex: index => dispatch({ type: MAP_ACTION.SET_BOTTOM_UTILS_INDEX, payload: index }),
resetBottomUtils: () => dispatch({ type: MAP_ACTION.RESET_BOTTOM_UTILS }), resetBottomUtils: () => dispatch({ type: MAP_ACTION.RESET_BOTTOM_UTILS }),
resetRightUtils: () => dispatch({ type: MAP_ACTION.RESET_RIGHT_UTILS }), resetRightUtils: () => dispatch({ type: MAP_ACTION.RESET_RIGHT_UTILS }),

View File

@ -7,7 +7,7 @@ export const initialMapState = {
coverMaskVisible: false, coverMaskVisible: false,
currentPort: "", currentPort: "",
currentBranchOffice: "", currentBranchOffice: "",
area: "", portArea: "",
bottomUtilsCurrentIndex: "", bottomUtilsCurrentIndex: "",
pureMap: false, pureMap: false,
headerTitle: "秦港股份安全监管平台", headerTitle: "秦港股份安全监管平台",
@ -22,7 +22,7 @@ export const MAP_ACTION = {
SELECT_BRANCH_OFFICE: "selectBranchOffice", SELECT_BRANCH_OFFICE: "selectBranchOffice",
SELECT_MARK: "selectMark", SELECT_MARK: "selectMark",
RESET_MARK: "resetMark", RESET_MARK: "resetMark",
SET_AREA: "setArea", SET_PORT_AREA: "setPortArea",
SET_BOTTOM_UTILS_INDEX: "setBottomUtilsIndex", SET_BOTTOM_UTILS_INDEX: "setBottomUtilsIndex",
RESET_BOTTOM_UTILS: "resetBottomUtils", RESET_BOTTOM_UTILS: "resetBottomUtils",
RESET_RIGHT_UTILS: "resetRightUtils", RESET_RIGHT_UTILS: "resetRightUtils",
@ -66,8 +66,8 @@ export function mapReducer(state, action) {
modalData: {}, modalData: {},
}; };
} }
case MAP_ACTION.SET_AREA: case MAP_ACTION.SET_PORT_AREA:
return { ...state, area: action.payload }; return { ...state, portArea: action.payload };
case MAP_ACTION.SET_BOTTOM_UTILS_INDEX: case MAP_ACTION.SET_BOTTOM_UTILS_INDEX:
return { ...state, bottomUtilsCurrentIndex: action.payload }; return { ...state, bottomUtilsCurrentIndex: action.payload };
case MAP_ACTION.RESET_BOTTOM_UTILS: case MAP_ACTION.RESET_BOTTOM_UTILS:

View File

@ -467,7 +467,7 @@ export default function useMapMethods(viewerRef) {
}; };
// 添加分公司点 // 添加分公司点
const addBranchOfficePoint = async (area = "", pointInfo = null) => { const addBranchOfficePoint = async (portArea = "", pointInfo = null) => {
mitt.emit(changeCoverMaskVisibleMittKey, true); mitt.emit(changeCoverMaskVisibleMittKey, true);
let branchOfficePoint = []; let branchOfficePoint = [];
if (!pointInfo) { if (!pointInfo) {