爆管分析页面,新增时间轴、工具栏,修改部分组件以满足页面功能需求

This commit is contained in:
JIANG
2025-10-24 16:28:57 +08:00
parent ad893ac19d
commit 7a615e08fc
14 changed files with 989 additions and 667 deletions

View File

@@ -56,10 +56,13 @@ interface LayerStyleState {
legendConfig: LegendStyleConfig;
isActive: boolean;
}
// 持久化存储
const STORAGE_KEYS = {
layerStyleStates: "styleEditor_layerStyleStates",
};
// StyleEditorPanel 组件 Props 接口
interface StyleEditorPanelProps {
layerStyleStates: LayerStyleState[];
setLayerStyleStates: React.Dispatch<React.SetStateAction<LayerStyleState[]>>;
}
// 预设颜色方案
const SINGLE_COLOR_PALETTES = [
{
@@ -108,7 +111,10 @@ const CLASSIFICATION_METHODS = [
// { name: "自然间断", value: "jenks_optimized" },
];
const StyleEditorPanel: React.FC = () => {
const StyleEditorPanel: React.FC<StyleEditorPanelProps> = ({
layerStyleStates,
setLayerStyleStates,
}) => {
const map = useMap();
const data = useData();
if (!data) {
@@ -123,7 +129,6 @@ const StyleEditorPanel: React.FC = () => {
setShowPipeText,
setJunctionText,
setPipeText,
updateLegendConfigs,
} = data;
const { open, close } = useNotification();
@@ -155,20 +160,7 @@ const StyleEditorPanel: React.FC = () => {
opacity: 0.9,
adjustWidthByProperty: true,
});
// 样式状态管理 - 存储多个图层的样式状态
const [layerStyleStates, setLayerStyleStates] = useState<LayerStyleState[]>(
() => {
const saved = sessionStorage.getItem(STORAGE_KEYS.layerStyleStates);
return saved ? JSON.parse(saved) : [];
}
);
// 保存layerStyleStates到sessionStorage
useEffect(() => {
sessionStorage.setItem(
STORAGE_KEYS.layerStyleStates,
JSON.stringify(layerStyleStates)
);
}, [layerStyleStates]);
// 颜色方案选择
const [singlePaletteIndex, setSinglePaletteIndex] = useState(0);
const [gradientPaletteIndex, setGradientPaletteIndex] = useState(0);
@@ -735,20 +727,6 @@ const StyleEditorPanel: React.FC = () => {
}
}, [styleConfig.colorType]);
// 获取所有激活的图例配置
useEffect(() => {
if (!updateLegendConfigs) return;
updateLegendConfigs(
layerStyleStates
.filter((state) => state.isActive && state.legendConfig.property)
.map((state) => ({
...state.legendConfig,
layerName: state.layerName,
layerId: state.layerId,
}))
);
}, [layerStyleStates]);
const getColorSetting = () => {
if (styleConfig.colorType === "single") {
return (