Compare commits
3 Commits
4fbe845015
...
9d12b1960c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d12b1960c | ||
|
|
cbfce9164e | ||
|
|
62a97459d0 |
@@ -8,7 +8,7 @@ export default function Home() {
|
|||||||
return (
|
return (
|
||||||
<div className="relative w-full h-full overflow-hidden">
|
<div className="relative w-full h-full overflow-hidden">
|
||||||
<MapComponent>
|
<MapComponent>
|
||||||
<MapToolbar queryType="scheme" />
|
<MapToolbar queryType="scheme" schemeType="burst_analysis" />
|
||||||
<BurstPipeAnalysisPanel />
|
<BurstPipeAnalysisPanel />
|
||||||
</MapComponent>
|
</MapComponent>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default function Home() {
|
|||||||
return (
|
return (
|
||||||
<div className="relative w-full h-full overflow-hidden">
|
<div className="relative w-full h-full overflow-hidden">
|
||||||
<MapComponent>
|
<MapComponent>
|
||||||
<MapToolbar queryType="scheme" />
|
<MapToolbar queryType="scheme" schemeType="flushing_analysis" />
|
||||||
<FlushingAnalysisPanel />
|
<FlushingAnalysisPanel />
|
||||||
</MapComponent>
|
</MapComponent>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default function Home() {
|
|||||||
return (
|
return (
|
||||||
<div className="relative w-full h-full overflow-hidden">
|
<div className="relative w-full h-full overflow-hidden">
|
||||||
<MapComponent>
|
<MapComponent>
|
||||||
<MapToolbar queryType="scheme" />
|
<MapToolbar queryType="scheme" schemeType="contaminant_analysis" />
|
||||||
<WaterQualityPanel />
|
<WaterQualityPanel />
|
||||||
</MapComponent>
|
</MapComponent>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -25,11 +25,13 @@ import { config } from "@/config/config";
|
|||||||
interface ToolbarProps {
|
interface ToolbarProps {
|
||||||
hiddenButtons?: string[]; // 可选的隐藏按钮列表,例如 ['info', 'draw', 'style']
|
hiddenButtons?: string[]; // 可选的隐藏按钮列表,例如 ['info', 'draw', 'style']
|
||||||
queryType?: string; // 可选的查询类型参数
|
queryType?: string; // 可选的查询类型参数
|
||||||
|
schemeType?: string; // 可选的方案类型参数
|
||||||
HistoryPanel?: React.FC<any>; // 可选的自定义历史数据面板
|
HistoryPanel?: React.FC<any>; // 可选的自定义历史数据面板
|
||||||
}
|
}
|
||||||
const Toolbar: React.FC<ToolbarProps> = ({
|
const Toolbar: React.FC<ToolbarProps> = ({
|
||||||
hiddenButtons,
|
hiddenButtons,
|
||||||
queryType,
|
queryType,
|
||||||
|
schemeType,
|
||||||
HistoryPanel,
|
HistoryPanel,
|
||||||
}) => {
|
}) => {
|
||||||
const map = useMap();
|
const map = useMap();
|
||||||
@@ -388,7 +390,7 @@ const Toolbar: React.FC<ToolbarProps> = ({
|
|||||||
if (queryType === "scheme") {
|
if (queryType === "scheme") {
|
||||||
response = await fetch(
|
response = await fetch(
|
||||||
// `${config.BACKEND_URL}/queryschemesimulationrecordsbyidtime/?scheme_name=${schemeName}&id=${id}&querytime=${querytime}&type=${type}`
|
// `${config.BACKEND_URL}/queryschemesimulationrecordsbyidtime/?scheme_name=${schemeName}&id=${id}&querytime=${querytime}&type=${type}`
|
||||||
`${config.BACKEND_URL}/api/v1/scheme/query/by-id-time?scheme_name=${schemeName}&id=${id}&type=${type}&query_time=${querytime}`,
|
`${config.BACKEND_URL}/api/v1/scheme/query/by-id-time?scheme_type=${schemeType}&scheme_name=${schemeName}&id=${id}&type=${type}&query_time=${querytime}`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
response = await fetch(
|
response = await fetch(
|
||||||
@@ -400,7 +402,13 @@ const Toolbar: React.FC<ToolbarProps> = ({
|
|||||||
throw new Error("API request failed");
|
throw new Error("API request failed");
|
||||||
}
|
}
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
setComputedProperties(data.results[0] || {});
|
if (!data.result || data.result.length === 0) {
|
||||||
|
setComputedProperties({});
|
||||||
|
} else {
|
||||||
|
setComputedProperties(data.result[0] || {});
|
||||||
|
console.log("查询到的计算属性:", data.result[0]);
|
||||||
|
console.log(computedProperties);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error querying computed properties:", error);
|
console.error("Error querying computed properties:", error);
|
||||||
setComputedProperties({});
|
setComputedProperties({});
|
||||||
@@ -408,7 +416,7 @@ const Toolbar: React.FC<ToolbarProps> = ({
|
|||||||
};
|
};
|
||||||
// 仅当 currentTime 有效时查询
|
// 仅当 currentTime 有效时查询
|
||||||
if (currentTime !== -1 && queryType) queryComputedProperties();
|
if (currentTime !== -1 && queryType) queryComputedProperties();
|
||||||
}, [highlightFeatures, currentTime, selectedDate]);
|
}, [highlightFeatures, currentTime, selectedDate, queryType, schemeName, schemeType]);
|
||||||
|
|
||||||
// 从要素属性中提取属性面板需要的数据
|
// 从要素属性中提取属性面板需要的数据
|
||||||
const getFeatureProperties = useCallback(() => {
|
const getFeatureProperties = useCallback(() => {
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ const App = (props: React.PropsWithChildren<AppProps>) => {
|
|||||||
name: "Hydraulic Simulation",
|
name: "Hydraulic Simulation",
|
||||||
meta: {
|
meta: {
|
||||||
icon: <MdWater className="w-6 h-6" />,
|
icon: <MdWater className="w-6 h-6" />,
|
||||||
label: "水力模拟",
|
label: "事件模拟",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ const AnalysisParameters: React.FC = () => {
|
|||||||
source: sourceNode,
|
source: sourceNode,
|
||||||
concentration,
|
concentration,
|
||||||
duration,
|
duration,
|
||||||
pattern: pattern || "CONSTANT",
|
pattern: pattern || undefined,
|
||||||
scheme_name: schemeName,
|
scheme_name: schemeName,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ const AnalysisParameters: React.FC = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
{selectionMode === 'valve' && (
|
{selectionMode === 'valve' && (
|
||||||
<Box className="mb-2 p-2 bg-blue-50 text-xs text-blue-700 rounded">
|
<Box className="mb-2 p-2 bg-blue-50 text-xs text-blue-700 rounded">
|
||||||
点击地图上的阀门进行添加
|
💡 点击地图上的阀门进行添加
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
<Stack spacing={1} className="max-h-50 h-48 overflow-auto">
|
<Stack spacing={1} className="max-h-50 h-48 overflow-auto">
|
||||||
@@ -336,7 +336,7 @@ const AnalysisParameters: React.FC = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
{selectionMode === 'drainage' && (
|
{selectionMode === 'drainage' && (
|
||||||
<Box className="mb-2 p-2 bg-blue-50 text-xs text-blue-700 rounded">
|
<Box className="mb-2 p-2 bg-blue-50 text-xs text-blue-700 rounded">
|
||||||
点击地图上的节点作为排水点
|
💡 点击地图上的节点作为排水点
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
<Stack spacing={1} className="h-12 overflow-auto">
|
<Stack spacing={1} className="h-12 overflow-auto">
|
||||||
|
|||||||
Reference in New Issue
Block a user