新增全部清洗状态和提示;重新设计定位结果页面
This commit is contained in:
@@ -19,7 +19,10 @@ import {
|
||||
} from "@mui/icons-material";
|
||||
import AnalysisParameters from "./AnalysisParameters";
|
||||
import SchemeQuery from "./SchemeQuery";
|
||||
import LocationResults from "./LocationResults";
|
||||
import LocationResults, { LocationResult } from "./LocationResults";
|
||||
import axios from "axios";
|
||||
import { config } from "@config/config";
|
||||
import { useNotification } from "@refinedev/core";
|
||||
interface SchemeDetail {
|
||||
burst_ID: string[];
|
||||
burst_size: number[];
|
||||
@@ -74,6 +77,10 @@ const BurstPipeAnalysisPanel: React.FC<BurstPipeAnalysisPanelProps> = ({
|
||||
|
||||
// 持久化方案查询结果
|
||||
const [schemes, setSchemes] = useState<SchemeRecord[]>([]);
|
||||
// 定位结果数据
|
||||
const [locationResults, setLocationResults] = useState<LocationResult[]>([]);
|
||||
|
||||
const { open } = useNotification();
|
||||
|
||||
// 使用受控或非受控状态
|
||||
const isOpen = controlledOpen !== undefined ? controlledOpen : internalOpen;
|
||||
@@ -88,6 +95,24 @@ const BurstPipeAnalysisPanel: React.FC<BurstPipeAnalysisPanelProps> = ({
|
||||
const handleTabChange = (_event: React.SyntheticEvent, newValue: number) => {
|
||||
setCurrentTab(newValue);
|
||||
};
|
||||
|
||||
const handleLocateScheme = async (scheme: SchemeRecord) => {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`${config.BACKEND_URL}/postgresql/burst-locate-result/${scheme.schemeName}`
|
||||
);
|
||||
setLocationResults(response.data);
|
||||
setCurrentTab(2); // 切换到定位结果标签页
|
||||
} catch (error) {
|
||||
console.error("获取定位结果失败:", error);
|
||||
open?.({
|
||||
type: "error",
|
||||
message: "获取定位结果失败",
|
||||
description: "无法从服务器获取该方案的定位结果",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const drawerWidth = 520;
|
||||
|
||||
return (
|
||||
@@ -214,19 +239,21 @@ const BurstPipeAnalysisPanel: React.FC<BurstPipeAnalysisPanelProps> = ({
|
||||
<SchemeQuery
|
||||
schemes={schemes}
|
||||
onSchemesChange={setSchemes}
|
||||
onLocate={(id) => {
|
||||
console.log("定位方案:", id);
|
||||
// TODO: 在地图上定位
|
||||
}}
|
||||
onLocate={handleLocateScheme}
|
||||
/>
|
||||
</TabPanel>
|
||||
|
||||
<TabPanel value={currentTab} index={2}>
|
||||
<LocationResults
|
||||
onLocate={(coordinates) => {
|
||||
console.log("定位到:", coordinates);
|
||||
results={locationResults}
|
||||
onLocate={(result) => {
|
||||
console.log("定位到:", result.locate_result);
|
||||
// TODO: 地图定位到指定坐标
|
||||
}}
|
||||
onLocateAll={(results) => {
|
||||
console.log("定位全部结果:", results);
|
||||
// TODO: 地图定位到所有结果坐标
|
||||
}}
|
||||
onViewDetail={(id) => {
|
||||
console.log("查看节点详情:", id);
|
||||
// TODO: 显示节点详细信息
|
||||
|
||||
Reference in New Issue
Block a user