feat: 完善仓库建筑绑定、质检预警规则与大屏展示

这个提交包含在:
wikiboss
2026-10-28 17:30:49 +08:00
父节点 d4ff221fa3
当前提交 ffff286274
共有 18 个文件被更改,包括 614 次插入 和 318 次删除

查看文件

@@ -6,6 +6,7 @@ import {
DESIGN_THEME,
XISHUI_GRANARY_DATA,
XISHUI_HOTSPOT_COORDS,
resolveHotspotCoord,
buildQualityHtml,
buildQualityHudHtml,
mapVarietyToForecastType,
@@ -14,8 +15,9 @@ import {
buildForecastCompareChartOption,
fetchGranaryForecast,
getGranaryQualityReport,
generateDepotAlerts
} from './grain_monitor_core.js';
generateDepotAlerts,
syncAlertMarqueeSpeed
} from './grain_monitor_core.js?v=20261028_chart3';
// 全局状态
const STATE = {
@@ -108,6 +110,7 @@ function loadGranaryData() {
renderKPIs();
renderHotspots();
renderMiniGrid();
renderDetailPanels();
renderDepotAlerts();
return;
}
@@ -160,6 +163,9 @@ function renderDepotAlerts() {
const marqueeTrack = document.getElementById('alert-marquee-track');
if (!marqueeTrack) return;
const alerts = generateDepotAlerts(STATE.list, STATE.envData);
const signature = alerts.map(a => `${a.id}|${a.text}`).join('\n');
if (marqueeTrack.dataset.alertSignature === signature && marqueeTrack.childElementCount > 0) return;
marqueeTrack.dataset.alertSignature = signature;
marqueeTrack.innerHTML = '';
const displayAlerts = alerts.length > 0 ? (alerts.length === 1 ? alerts : alerts.concat(alerts)) : [];
displayAlerts.forEach(alert => {
@@ -180,6 +186,7 @@ function renderDepotAlerts() {
}
marqueeTrack.appendChild(pill);
});
requestAnimationFrame(() => syncAlertMarqueeSpeed(marqueeTrack));
}
// 4. 渲染顶部关键 KPIs
@@ -199,12 +206,10 @@ function renderHotspots() {
const container = document.getElementById('aerial-hotspots');
if (!container) return;
const hotspotCoords = STATE.customCoords ? { ...XISHUI_HOTSPOT_COORDS, ...STATE.customCoords } : XISHUI_HOTSPOT_COORDS;
container.innerHTML = '';
STATE.list.forEach(item => {
const rawCoord = hotspotCoords[item.id] || hotspotCoords[item.num] || hotspotCoords[item.name];
const rawCoord = resolveHotspotCoord(item, STATE.customCoords, XISHUI_HOTSPOT_COORDS);
if (!rawCoord) return;
const coord = {
@@ -602,7 +607,7 @@ async function initOrUpdateForecastCharts(granaryItem) {
setupForecastEnvControls();
const currentReport = getGranaryQualityReport(grainName, currentItem.rawContent || currentItem.content || {});
const currentReport = getGranaryQualityReport(grainName, currentItem.rawContent || currentItem.content || {}, currentItem.qualityTest);
// 1. 0 毫秒即时秒出基础图表 (杜绝任何白屏与残亮点)
const baselineList = [
@@ -642,6 +647,7 @@ async function initOrUpdateForecastCharts(granaryItem) {
const initialFuture30 = initialSeries.metrics.map(m => ({
key: m.key,
name: m.name,
unit: m.unit,
predictedValue: m.values[3] !== undefined ? m.values[3] : m.values[m.values.length - 1]
}));
const initialCompareOption = buildForecastCompareChartOption(grainType, currentReport?.items || [], initialFuture30);
@@ -667,7 +673,7 @@ async function initOrUpdateForecastCharts(granaryItem) {
const series = generateForecastSeries(grainType, currentReport, forecastList, STATE.forecastEnv);
if (trendTitleEl) {
trendTitleEl.textContent = `${currentItem.name} (${grainName}) 质量指标多周期演变推演 (当前实测与未来 7~60天)`;
trendTitleEl.textContent = `${currentItem.name} (${grainName}) 多周期趋势`;
}
const trendOption = buildForecastTrendChartOption(series);
if (trendOption) {
@@ -677,11 +683,12 @@ async function initOrUpdateForecastCharts(granaryItem) {
const future30Targets = series.metrics.map(m => ({
key: m.key,
name: m.name,
unit: m.unit,
predictedValue: m.values[3] !== undefined ? m.values[3] : m.values[m.values.length - 1]
}));
if (compareTitleEl) {
compareTitleEl.textContent = `${currentItem.name} 现状实测 vs 未来30天预测终值偏离评估`;
compareTitleEl.textContent = `${currentItem.name} 未来30天 · 变化对比`;
}
const compareOption = buildForecastCompareChartOption(grainType, currentReport?.items || [], future30Targets);
if (compareOption) {