重新设计关阀分析模块
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import React, { useState } from "react";
|
||||
import {
|
||||
Box,
|
||||
Drawer,
|
||||
@@ -65,9 +65,6 @@ const BurstPipeAnalysisPanel: React.FC<BurstPipeAnalysisPanelProps> = ({
|
||||
const [internalOpen, setInternalOpen] = useState(true);
|
||||
const [currentTab, setCurrentTab] = useState(0);
|
||||
const [panelMode, setPanelMode] = useState<PanelMode>("burst");
|
||||
const previousMapText = useRef<{ junction?: string; pipe?: string } | null>(
|
||||
null,
|
||||
);
|
||||
|
||||
const data = useData();
|
||||
|
||||
@@ -75,10 +72,6 @@ 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);
|
||||
@@ -126,12 +119,6 @@ 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 ? "爆管分析" : "水质模拟";
|
||||
@@ -308,7 +295,6 @@ const BurstPipeAnalysisPanel: React.FC<BurstPipeAnalysisPanelProps> = ({
|
||||
{isBurstMode ? (
|
||||
<LocationResults
|
||||
results={locationResults}
|
||||
onAnalyze={handleAnalyzePipe}
|
||||
/>
|
||||
) : (
|
||||
<ContaminantResultsPanel schemeName={data?.schemeName} />
|
||||
@@ -318,9 +304,6 @@ const BurstPipeAnalysisPanel: React.FC<BurstPipeAnalysisPanelProps> = ({
|
||||
{isBurstMode && (
|
||||
<TabPanel value={currentTab} index={3}>
|
||||
<ValveIsolation
|
||||
initialPipeIds={selectedPipeIds}
|
||||
shouldFetch={valveAnalysisTriggered}
|
||||
onFetchComplete={() => setValveAnalysisTriggered(false)}
|
||||
loading={valveAnalysisLoading}
|
||||
result={valveAnalysisResult}
|
||||
onLoadingChange={setValveAnalysisLoading}
|
||||
|
||||
Reference in New Issue
Block a user