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