diff --git a/src/app/(main)/monitoring-place-optimization/page.tsx b/src/app/(main)/monitoring-place-optimization/page.tsx
index 917acf3..274703a 100644
--- a/src/app/(main)/monitoring-place-optimization/page.tsx
+++ b/src/app/(main)/monitoring-place-optimization/page.tsx
@@ -7,7 +7,7 @@ export default function Home() {
return (
-
+
diff --git a/src/components/olmap/BurstPipeAnalysis/AnalysisParameters.tsx b/src/components/olmap/BurstPipeAnalysis/AnalysisParameters.tsx
index 56f51cd..9ea065f 100644
--- a/src/components/olmap/BurstPipeAnalysis/AnalysisParameters.tsx
+++ b/src/components/olmap/BurstPipeAnalysis/AnalysisParameters.tsx
@@ -41,7 +41,7 @@ const AnalysisParameters: React.FC = () => {
const [pipePoints, setPipePoints] = useState([]);
const [startTime, setStartTime] = useState(dayjs(new Date()));
- const [duration, setDuration] = useState(3000);
+ const [duration, setDuration] = useState(3600);
const [schemeName, setSchemeName] = useState(
"FANGAN" + new Date().getTime()
);
@@ -52,6 +52,14 @@ const AnalysisParameters: React.FC = () => {
useState | null>(null);
const [highlightFeatures, setHighlightFeatures] = useState([]);
const [analyzing, setAnalyzing] = useState(false);
+
+ // 检查是否所有必要参数都已填写
+ const isFormValid =
+ pipePoints.length > 0 &&
+ startTime !== null &&
+ duration > 0 &&
+ schemeName.trim() !== "";
+
// 初始化管道图层和高亮图层
useEffect(() => {
if (!map) return;
@@ -254,11 +262,11 @@ const AnalysisParameters: React.FC = () => {
const burst_size = pipePoints.map((pipe) =>
parseInt(pipe.area.toString(), 10)
);
+ // 格式化开始时间,去除秒部分
const modify_pattern_start_time = startTime
- ? startTime.format("YYYY-MM-DDTHH:mm:ssZ")
+ ? startTime.format("YYYY-MM-DDTHH:mm:00Z")
: "";
const modify_total_duration = duration;
-
const body = {
name: network,
modify_pattern_start_time: modify_pattern_start_time,
@@ -464,7 +472,7 @@ const AnalysisParameters: React.FC = () => {
variant="contained"
size="large"
onClick={handleAnalyze}
- disabled={analyzing}
+ disabled={analyzing || !isFormValid}
className="bg-blue-600 hover:bg-blue-700"
>
{analyzing ? "方案提交分析中..." : "方案分析"}
diff --git a/src/components/olmap/SCADADataPanel.tsx b/src/components/olmap/SCADADataPanel.tsx
index 73ff8c5..ee8909e 100644
--- a/src/components/olmap/SCADADataPanel.tsx
+++ b/src/components/olmap/SCADADataPanel.tsx
@@ -258,13 +258,12 @@ const SCADADataPanel: React.FC = ({
headerName: deviceLabels?.[id] ?? id,
minWidth: 140,
flex: 1,
- valueFormatter: (params) => {
- const value = (params as any).value;
- return value === null || value === undefined
- ? "--"
- : Number.isFinite(Number(value))
- ? Number(value).toFixed(fractionDigits)
- : String(value);
+ valueFormatter: (value: any) => {
+ if (value === null || value === undefined) return "--";
+ if (Number.isFinite(Number(value))) {
+ return Number(value).toFixed(fractionDigits);
+ }
+ return String(value);
},
}));
@@ -305,52 +304,70 @@ const SCADADataPanel: React.FC = ({
);
};
- const chartSection = hasData ? (
-
- value instanceof Date
- ? dayjs(value).format("MM-DD HH:mm")
- : String(value),
- },
- ]}
- yAxis={[{ label: "值" }]}
- series={deviceIds.map((id) => ({
- dataKey: id,
- label: deviceLabels?.[id] ?? id,
- showMark: false,
- curve: "linear",
- }))}
- slotProps={{
- legend: {
- direction: "row",
- position: { horizontal: "middle", vertical: "bottom" },
- },
- loadingOverlay: {
- style: { backgroundColor: "transparent" },
- },
- }}
- />
- ) : (
- renderEmpty()
- );
+ const renderChart = () => {
+ if (!hasData) return renderEmpty();
- const tableSection = hasData ? (
-
- ) : (
- renderEmpty()
- );
+ return (
+
+ value instanceof Date
+ ? dayjs(value).format("MM-DD HH:mm")
+ : String(value),
+ },
+ ]}
+ yAxis={[{ label: "值" }]}
+ series={deviceIds.map((id) => ({
+ dataKey: id,
+ label: deviceLabels?.[id] ?? id,
+ showMark: false,
+ curve: "linear",
+ }))}
+ slotProps={{
+ legend: {
+ direction: "row",
+ position: { horizontal: "middle", vertical: "bottom" },
+ },
+ loadingOverlay: {
+ style: { backgroundColor: "transparent" },
+ },
+ }}
+ />
+ );
+ };
+
+ const renderTable = () => {
+ if (!hasData) return renderEmpty();
+
+ console.debug("[SCADADataPanel] 表格数据:", {
+ rowsCount: rows.length,
+ columnsCount: columns.length,
+ sampleRow: rows[0],
+ columns: columns.map(c => c.field),
+ });
+
+ return (
+
+ );
+ };
return (
= ({
)}
- {activeTab === "chart" ? chartSection : tableSection}
+ {activeTab === "chart" ? renderChart() : renderTable()}