fix(burst-location): explain normal data source
This commit is contained in:
@@ -239,6 +239,19 @@ const AnalysisParameters: React.FC<Props> = ({ onResult }) => {
|
|||||||
<MenuItem value="simulation">模拟方案</MenuItem>
|
<MenuItem value="simulation">模拟方案</MenuItem>
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
<Typography
|
||||||
|
variant="caption"
|
||||||
|
sx={{
|
||||||
|
mt: 0.75,
|
||||||
|
display: "block",
|
||||||
|
color: "text.secondary",
|
||||||
|
lineHeight: 1.6,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{isSimulationMode
|
||||||
|
? "爆管数据读取所选方案模拟结果,正常数据读取实时模拟结果,两者使用同一爆管时间窗。"
|
||||||
|
: "爆管数据读取所选监测时间窗,正常数据默认读取前一天同一时段的监测数据。"}
|
||||||
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{isSimulationMode && (
|
{isSimulationMode && (
|
||||||
|
|||||||
@@ -75,6 +75,33 @@ const toneStyles: Record<
|
|||||||
const formatDateTime = (value?: string) =>
|
const formatDateTime = (value?: string) =>
|
||||||
value ? dayjs(value).format("MM-DD HH:mm") : "-";
|
value ? dayjs(value).format("MM-DD HH:mm") : "-";
|
||||||
|
|
||||||
|
const formatDateTimeRange = (start?: string, end?: string) => {
|
||||||
|
if (!start || !end) return "-";
|
||||||
|
return `${formatDateTime(start)} 至 ${formatDateTime(end)}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getDataSourceLabel = (result: BurstLocationResult) =>
|
||||||
|
result.data_source === "simulation" ? "模拟方案" : "监测数据";
|
||||||
|
|
||||||
|
const getNormalDataDescription = (result: BurstLocationResult) => {
|
||||||
|
switch (result.observed_source) {
|
||||||
|
case "simulation_scheme_burst_realtime_normal_timerange":
|
||||||
|
return "正常数据读取实时模拟结果,与爆管数据使用同一时间窗。";
|
||||||
|
case "scada_burst_scada_normal_timerange":
|
||||||
|
return "正常数据读取监测数据;未单独指定正常时间窗时,默认使用爆管时段前一天同一时段。";
|
||||||
|
case "scada_burst_payload_normal_timerange":
|
||||||
|
return "爆管数据读取监测数据,正常数据来自请求载荷。";
|
||||||
|
case "simulation_scheme_timerange":
|
||||||
|
return "历史方案记录:爆管数据和正常数据均读取方案模拟结果。";
|
||||||
|
case "scada_timerange":
|
||||||
|
return "历史方案记录:爆管数据和正常数据使用同一监测时间窗。";
|
||||||
|
case "request_payload":
|
||||||
|
return "爆管数据和正常数据均来自请求载荷。";
|
||||||
|
default:
|
||||||
|
return "正常数据按后端返回的数据源规则选择。";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const MetricCard = ({ label, value, hint, tone }: MetricCardProps) => {
|
const MetricCard = ({ label, value, hint, tone }: MetricCardProps) => {
|
||||||
const style = toneStyles[tone];
|
const style = toneStyles[tone];
|
||||||
return (
|
return (
|
||||||
@@ -214,6 +241,16 @@ const LocationResults: React.FC<Props> = ({ result }) => {
|
|||||||
const burstTime = result.scada_window?.burst_start
|
const burstTime = result.scada_window?.burst_start
|
||||||
? formatDateTime(result.scada_window.burst_start)
|
? formatDateTime(result.scada_window.burst_start)
|
||||||
: "-";
|
: "-";
|
||||||
|
const burstWindow = formatDateTimeRange(
|
||||||
|
result.scada_window?.burst_start,
|
||||||
|
result.scada_window?.burst_end,
|
||||||
|
);
|
||||||
|
const normalWindow = formatDateTimeRange(
|
||||||
|
result.scada_window?.normal_start,
|
||||||
|
result.scada_window?.normal_end,
|
||||||
|
);
|
||||||
|
const sourceLabel = getDataSourceLabel(result);
|
||||||
|
const normalDataDescription = getNormalDataDescription(result);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box className="h-full overflow-auto p-1">
|
<Box className="h-full overflow-auto p-1">
|
||||||
@@ -287,6 +324,31 @@ const LocationResults: React.FC<Props> = ({ result }) => {
|
|||||||
tone="green"
|
tone="green"
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
<Box className="rounded-lg border border-gray-200 bg-gray-50 px-3 py-2">
|
||||||
|
<Box className="mb-1 flex flex-wrap items-center gap-1.5">
|
||||||
|
<Chip
|
||||||
|
size="small"
|
||||||
|
label={sourceLabel}
|
||||||
|
color={result.data_source === "simulation" ? "secondary" : "primary"}
|
||||||
|
sx={{ height: 22, fontSize: "0.72rem", fontWeight: 600 }}
|
||||||
|
/>
|
||||||
|
<Typography variant="caption" className="text-gray-600">
|
||||||
|
正常数据选择说明
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
<Typography variant="caption" className="block leading-5 text-gray-700">
|
||||||
|
{normalDataDescription}
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="caption" className="mt-1 block leading-5 text-gray-500">
|
||||||
|
爆管窗口: {burstWindow};正常窗口: {normalWindow}
|
||||||
|
</Typography>
|
||||||
|
{result.data_source === "simulation" && result.simulation_scheme?.name ? (
|
||||||
|
<Typography variant="caption" className="mt-1 block truncate text-purple-600">
|
||||||
|
爆管方案: {result.simulation_scheme.name}
|
||||||
|
</Typography>
|
||||||
|
) : null}
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{/* Candidate List */}
|
{/* Candidate List */}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ export interface BurstLocationResult {
|
|||||||
scada_window?: {
|
scada_window?: {
|
||||||
burst_start?: string;
|
burst_start?: string;
|
||||||
burst_end?: string;
|
burst_end?: string;
|
||||||
|
normal_start?: string;
|
||||||
|
normal_end?: string;
|
||||||
};
|
};
|
||||||
pressure_samples?: {
|
pressure_samples?: {
|
||||||
burst?: number;
|
burst?: number;
|
||||||
@@ -51,6 +53,8 @@ export interface BurstLocationSchemeDetail {
|
|||||||
scada_window?: {
|
scada_window?: {
|
||||||
burst_start?: string;
|
burst_start?: string;
|
||||||
burst_end?: string;
|
burst_end?: string;
|
||||||
|
normal_start?: string;
|
||||||
|
normal_end?: string;
|
||||||
};
|
};
|
||||||
result_summary?: {
|
result_summary?: {
|
||||||
located_pipe?: string;
|
located_pipe?: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user