完善关阀分析页面设计

This commit is contained in:
JIANG
2026-02-03 10:56:49 +08:00
parent a3f4b477bc
commit 6f0ef342e9
8 changed files with 846 additions and 240 deletions
@@ -29,7 +29,7 @@ import axios from "axios";
import { config } from "@config/config";
import { useNotification } from "@refinedev/core";
import { useData } from "@app/OlMap/MapComponent";
import { LocationResult, SchemeRecord } from "./types";
import { LocationResult, SchemeRecord, ValveIsolationResult } from "./types";
interface TabPanelProps {
children?: React.ReactNode;
@@ -75,6 +75,13 @@ const BurstPipeAnalysisPanel: React.FC<BurstPipeAnalysisPanelProps> = ({
const [schemes, setSchemes] = useState<SchemeRecord[]>([]);
// 定位结果数据
const [locationResults, setLocationResults] = useState<LocationResult[]>([]);
// 选中的管段ID数组
const [selectedPipeIds, setSelectedPipeIds] = useState<string[]>([]);
// 关阀分析状态提升到父组件
const [valveAnalysisTriggered, setValveAnalysisTriggered] = useState(false);
// 关阀分析结果和加载状态
const [valveAnalysisLoading, setValveAnalysisLoading] = useState(false);
const [valveAnalysisResult, setValveAnalysisResult] = useState<ValveIsolationResult | null>(null);
const { open } = useNotification();
@@ -109,6 +116,12 @@ const BurstPipeAnalysisPanel: React.FC<BurstPipeAnalysisPanelProps> = ({
}
};
const handleAnalyzePipe = (pipeIds: string[]) => {
setSelectedPipeIds(pipeIds);
setValveAnalysisTriggered(true);
setCurrentTab(3);
};
const drawerWidth = 520;
const isBurstMode = panelMode === "burst";
const panelTitle = isBurstMode ? "爆管分析" : "水质模拟";
@@ -283,7 +296,10 @@ const BurstPipeAnalysisPanel: React.FC<BurstPipeAnalysisPanelProps> = ({
<TabPanel value={currentTab} index={2}>
{isBurstMode ? (
<LocationResults results={locationResults} />
<LocationResults
results={locationResults}
onAnalyze={handleAnalyzePipe}
/>
) : (
<ContaminantResultsPanel schemeName={data?.schemeName} />
)}
@@ -291,7 +307,15 @@ const BurstPipeAnalysisPanel: React.FC<BurstPipeAnalysisPanelProps> = ({
{isBurstMode && (
<TabPanel value={currentTab} index={3}>
<ValveIsolation />
<ValveIsolation
initialPipeIds={selectedPipeIds}
shouldFetch={valveAnalysisTriggered}
onFetchComplete={() => setValveAnalysisTriggered(false)}
loading={valveAnalysisLoading}
result={valveAnalysisResult}
onLoadingChange={setValveAnalysisLoading}
onResultChange={setValveAnalysisResult}
/>
</TabPanel>
)}
</Box>