更新历史数据面板显示和设计;更新scada数据全部清洗api数据格式;更新scada数据显示模拟数据;更新scada数据面板,非清洗状态下能显示两条数据;新增注释,未来准备修复矢量瓦片样式更新时闪烁的问题;

This commit is contained in:
JIANG
2025-12-15 17:40:05 +08:00
parent 2fc9075cce
commit fd064f3aa9
5 changed files with 437 additions and 413 deletions

View File

@@ -280,17 +280,18 @@ const buildDataset = (
});
} else {
deviceIds.forEach((id) => {
const value =
point.values[`${id}_clean`] ??
point.values[`${id}_raw`] ??
point.values[`${id}_sim`] ??
point.values[id];
entry[id] =
typeof value === "number"
? Number.isFinite(value)
? parseFloat(value.toFixed(fractionDigits))
: null
: value ?? null;
["raw", "clean", "sim"].forEach((suffix) => {
const key = `${id}_${suffix}`;
const value = point.values[key];
if (value !== undefined && value !== null) {
entry[key] =
typeof value === "number"
? Number.isFinite(value)
? parseFloat(value.toFixed(fractionDigits))
: null
: value ?? null;
}
});
});
}
@@ -762,27 +763,71 @@ const SCADADataPanel: React.FC<SCADADataPanelProps> = ({
}));
}
} else {
return deviceIds.map((id, index) => ({
name: deviceLabels?.[id] ?? id,
type: "line",
symbol: "none",
sampling: "lttb",
itemStyle: { color: colors[index % colors.length] },
data: dataset.map((item) => item[id]),
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: colors[index % colors.length],
return deviceIds.flatMap((id, index) => {
const series = [];
["raw", "clean", "sim"].forEach((suffix, sIndex) => {
const key = `${id}_${suffix}`;
const hasData = dataset.some(
(item) => item[key] !== null && item[key] !== undefined
);
if (hasData) {
series.push({
name: `${deviceLabels?.[id] ?? id} (${
suffix === "raw"
? "原始"
: suffix === "clean"
? "清洗"
: "模拟"
})`,
type: "line",
symbol: "none",
sampling: "lttb",
itemStyle: {
color: colors[(index * 3 + sIndex) % colors.length],
},
data: dataset.map((item) => item[key]),
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: colors[(index * 3 + sIndex) % colors.length],
},
{
offset: 1,
color: "rgba(255, 255, 255, 0)",
},
]),
opacity: 0.3,
},
});
}
});
// 如果没有clean/raw/sim数据则使用fallback
if (series.length === 0) {
series.push({
name: deviceLabels?.[id] ?? id,
type: "line",
symbol: "none",
sampling: "lttb",
itemStyle: { color: colors[index % colors.length] },
data: dataset.map((item) => item[id]),
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: colors[index % colors.length],
},
{
offset: 1,
color: "rgba(255, 255, 255, 0)",
},
]),
opacity: 0.3,
},
{
offset: 1,
color: "rgba(255, 255, 255, 0)",
},
]),
opacity: 0.3,
},
}));
});
}
return series;
});
}
};