feat(testing): 增加质检报告独立编辑与详情页面,不再使用弹窗
这个提交包含在:
@@ -1,3 +1,4 @@
|
||||
import { fetchSiteData, showSiteDataState } from './site_data.js?v=20261028_demo3';
|
||||
import {
|
||||
calcScreenScale,
|
||||
normalizeGranaryList,
|
||||
@@ -21,7 +22,7 @@ import {
|
||||
resolveHotspotCoord,
|
||||
generateDepotAlerts,
|
||||
syncAlertMarqueeSpeed
|
||||
} from './grain_monitor_core.js?v=20261028_chart3';
|
||||
} from './grain_monitor_core.js?v=20261028_demo3';
|
||||
|
||||
// 全局状态
|
||||
const STATE = {
|
||||
@@ -92,28 +93,18 @@ function updateClock() {
|
||||
|
||||
// 3. 加载数据
|
||||
async function fetchGranaryData() {
|
||||
const endpoints = ['/api/index/granaryList', 'https://grain.gynhc.com/api/index/granaryList'];
|
||||
for (const apiUrl of endpoints) {
|
||||
try {
|
||||
const res = await fetch(apiUrl, { cache: 'no-cache', signal: AbortSignal.timeout(2000) });
|
||||
if (!res.ok) continue;
|
||||
const json = await res.json();
|
||||
if (json && json.data && Array.isArray(json.data.list) && json.data.list.length > 0) {
|
||||
const list = json.data.list;
|
||||
STATE.list = normalizeGranaryList({ ...json, data: { ...json.data, list } });
|
||||
if (json.data && json.data.coords) {
|
||||
STATE.customCoords = json.data.coords;
|
||||
}
|
||||
console.log(`✓ 成功从 [${apiUrl}] 在线加载`, STATE.list.length, '个仓房/油罐数据');
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
// 当前端点连接失败,自动尝试下一端点
|
||||
}
|
||||
try {
|
||||
const data = await fetchSiteData('center');
|
||||
STATE.list = normalizeGranaryList({ data });
|
||||
STATE.customCoords = data.coords || {};
|
||||
STATE.activeId = STATE.list.some(item => item.id === STATE.activeId) ? STATE.activeId : (STATE.list[0]?.id || null);
|
||||
showSiteDataState('center', STATE.list.length ? 'live' : 'empty', STATE.list.length, STATE.list.some(item => item.isDemo));
|
||||
} catch (_) {
|
||||
STATE.list = [];
|
||||
STATE.customCoords = {};
|
||||
STATE.activeId = null;
|
||||
showSiteDataState('center', 'unavailable', 0);
|
||||
}
|
||||
|
||||
console.warn('在线与本地 API 均不可用,使用内置官方完整数据集');
|
||||
STATE.list = normalizeGranaryList(DEFAULT_GRANARY_DATA);
|
||||
}
|
||||
|
||||
// 3.1 加载微气候环境工况
|
||||
@@ -192,7 +183,7 @@ function renderKPIs() {
|
||||
document.getElementById('kpi-oil-count').textContent = `${s.oilTankCount} 座`;
|
||||
const filterLabels = {
|
||||
all: `全部 (${STATE.list.length})`,
|
||||
warehouse: `平房仓群 (${s.warehouseCount})`,
|
||||
warehouse: `粮仓群 (${s.warehouseCount + s.siloCount})`,
|
||||
oilTank: `储油罐区 (${s.oilTankCount})`
|
||||
};
|
||||
document.querySelectorAll('.filter-btn[data-filter]').forEach(button => {
|
||||
@@ -444,8 +435,8 @@ function renderLeftPanel(item, params) {
|
||||
document.getElementById('param-granary-type').textContent = b.warehouseType;
|
||||
document.getElementById('param-granary-variety').textContent = b.varieties;
|
||||
document.getElementById('param-granary-nature').textContent = b.natureName;
|
||||
document.getElementById('param-granary-addr').textContent = b.addr || b.productArea || '安徽/河南';
|
||||
document.getElementById('param-granary-year').textContent = b.harvestYear || b.machiningYear || '2024';
|
||||
document.getElementById('param-granary-addr').textContent = item.isOilTank ? b.productArea : b.addr;
|
||||
document.getElementById('param-granary-year').textContent = item.isOilTank ? b.machiningYear : b.harvestYear;
|
||||
document.getElementById('param-granary-enter').textContent = b.enterTime || '2024-08';
|
||||
document.getElementById('param-granary-custodian').textContent = b.custodian || '肖胜利';
|
||||
document.getElementById('param-granary-mgmt').textContent = b.managementForm || '直接管理';
|
||||
@@ -482,6 +473,12 @@ function renderLeftPanel(item, params) {
|
||||
<span class="param-value">立式储油罐密闭</span>
|
||||
</div>
|
||||
`;
|
||||
} else if (params.type === 'grainSilo') {
|
||||
sizeGrid.innerHTML = `<div class="param-item"><span class="param-label">筒仓直径</span><span class="param-value highlight">${s.diameter}</span></div>
|
||||
<div class="param-item"><span class="param-label">装粮线高</span><span class="param-value highlight">${s.height}</span></div>
|
||||
<div class="param-item"><span class="param-label">粮堆体积</span><span class="param-value">${s.volume}</span></div>
|
||||
<div class="param-item"><span class="param-label">扣除体积</span><span class="param-value">${s.decVolume}</span></div>
|
||||
<div class="param-item"><span class="param-label">储粮方式</span><span class="param-value">${b.storageMethod}</span></div>`;
|
||||
} else {
|
||||
sizeGrid.innerHTML = `
|
||||
<div class="param-item">
|
||||
@@ -537,6 +534,12 @@ function renderRightPanel(item, params) {
|
||||
|
||||
const report = params.qualityReport;
|
||||
if (!report) return;
|
||||
if (report.empty) {
|
||||
if (qualityTitle) qualityTitle.textContent = `${report.variety}品质全参数舱 · 未录入化验记录`;
|
||||
if (qualityExtra) qualityExtra.textContent = '暂无化验数据';
|
||||
qualityGrid.innerHTML = buildQualityHudHtml(report);
|
||||
return;
|
||||
}
|
||||
|
||||
// 标题与总体状态指示徽章 (短小精悍,杜绝截断)
|
||||
if (qualityTitle) {
|
||||
@@ -545,9 +548,12 @@ function renderRightPanel(item, params) {
|
||||
statusBadge = `<span class="quality-badge status-danger" style="margin-left: 5px;">⚠️ ${report.summary.dangerCount}项超标</span>`;
|
||||
} else if (report.summary.warnCount > 0) {
|
||||
statusBadge = `<span class="quality-badge status-warn" style="margin-left: 5px;">⚠️ ${report.summary.warnCount}项预警</span>`;
|
||||
} else {
|
||||
} else if (!report.summary.unknownCount) {
|
||||
statusBadge = `<span class="quality-badge status-normal" style="margin-left: 5px;">✓ 健康达标</span>`;
|
||||
}
|
||||
if (report.summary.unknownCount > 0) {
|
||||
statusBadge += `<span class="quality-badge status-unknown" style="margin-left: 5px;">${report.summary.unknownCount}项待核实</span>`;
|
||||
}
|
||||
qualityTitle.innerHTML = `<span>${report.variety}品质全参数舱</span>${statusBadge}`;
|
||||
}
|
||||
|
||||
@@ -646,7 +652,7 @@ async function initOrUpdateForecastCharts(granaryItem) {
|
||||
|
||||
setupForecastEnvControls();
|
||||
|
||||
const currentReport = getGranaryQualityReport(grainName, currentItem.rawContent || currentItem.content || {}, currentItem.qualityTest);
|
||||
const currentReport = getGranaryQualityReport(grainName, currentItem.rawContent || currentItem.content || {}, currentItem.qualityTest, { requireRecordedData: currentItem.dataSource === 'database' });
|
||||
|
||||
// 1. 0 毫秒即时秒出基础图表 (杜绝任何白屏与残亮点)
|
||||
const baselineList = [
|
||||
@@ -687,6 +693,9 @@ async function initOrUpdateForecastCharts(granaryItem) {
|
||||
key: m.key,
|
||||
name: m.name,
|
||||
unit: m.unit,
|
||||
warn: m.warn,
|
||||
alert: m.alert,
|
||||
direction: m.direction,
|
||||
predictedValue: m.values[3] !== undefined ? m.values[3] : m.values[m.values.length - 1]
|
||||
}));
|
||||
const initialCompareOption = buildForecastCompareChartOption(grainType, currentReport?.items || [], initialFuture30);
|
||||
@@ -723,6 +732,9 @@ async function initOrUpdateForecastCharts(granaryItem) {
|
||||
key: m.key,
|
||||
name: m.name,
|
||||
unit: m.unit,
|
||||
warn: m.warn,
|
||||
alert: m.alert,
|
||||
direction: m.direction,
|
||||
predictedValue: m.values[3] !== undefined ? m.values[3] : m.values[m.values.length - 1]
|
||||
}));
|
||||
|
||||
@@ -886,7 +898,7 @@ function initOrUpdateGranaryBar() {
|
||||
|
||||
const names = STATE.list.map(i => i.name.replace('号仓房', '#').replace('号油罐', 'T#'));
|
||||
const storageData = STATE.list.map(i => i.storageNum);
|
||||
const capacityData = STATE.list.map(i => i.capacity);
|
||||
const capacityData = STATE.list.map(i => i.capacityNum);
|
||||
|
||||
const option = {
|
||||
tooltip: {
|
||||
@@ -1139,6 +1151,7 @@ window.addEventListener('DOMContentLoaded', async () => {
|
||||
}, 60000);
|
||||
|
||||
setupAutoPlay();
|
||||
if (urlParams.get('view') === 'forecast') selectGranary(STATE.activeId, true);
|
||||
|
||||
const fsBtn = document.getElementById('btn-fullscreen');
|
||||
if (fsBtn) fsBtn.addEventListener('click', toggleFullscreen);
|
||||
@@ -1154,6 +1167,11 @@ window.addEventListener('DOMContentLoaded', async () => {
|
||||
});
|
||||
|
||||
window.addEventListener('keydown', (e) => {
|
||||
if (e.target?.closest?.('input, textarea, select, [contenteditable="true"]')) return;
|
||||
if (e.key === 'Escape' && STATE.isCenterChartOpen) {
|
||||
toggleCenterChartBoard(STATE.centerChartTab, false);
|
||||
return;
|
||||
}
|
||||
const curIdx = STATE.list.findIndex(w => w.id === STATE.activeId);
|
||||
if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') {
|
||||
const nextIdx = (curIdx - 1 + STATE.list.length) % STATE.list.length;
|
||||
|
||||
46
public/screen/js/site_data.js
普通文件
46
public/screen/js/site_data.js
普通文件
@@ -0,0 +1,46 @@
|
||||
export function validateSitePayload(payload, site) {
|
||||
const data = payload?.data;
|
||||
if (!data || data.site !== site || !Array.isArray(data.list)) throw new Error('库区数据不匹配');
|
||||
if (data.list.some(row => row.site !== site)) throw new Error('仓库归属不匹配');
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function fetchSiteData(site, fetcher = fetch) {
|
||||
const path = `/api/index/granaryList?site=${encodeURIComponent(site)}`;
|
||||
const endpoints = [path, `https://grain.gynhc.com${path}`];
|
||||
for (const url of endpoints) {
|
||||
try {
|
||||
const response = await fetcher(url, { cache: 'no-store', signal: AbortSignal.timeout(8000) });
|
||||
if (!response.ok) continue;
|
||||
return validateSitePayload(await response.json(), site);
|
||||
} catch (_) { /* Try the configured service if this origin is unavailable. */ }
|
||||
}
|
||||
throw new Error('暂时无法读取库区数据');
|
||||
}
|
||||
|
||||
export function showSiteDataState(site, state, count, hasDemo = false) {
|
||||
const wrapper = document.getElementById('screen-wrapper');
|
||||
if (!wrapper) return;
|
||||
let badge = document.getElementById('site-data-state');
|
||||
if (!badge) {
|
||||
badge = document.createElement('div');
|
||||
badge.id = 'site-data-state';
|
||||
badge.setAttribute('role', 'status');
|
||||
badge.style.cssText = 'position:absolute;top:83px;left:50%;transform:translateX(-50%);z-index:100;padding:5px 14px;border:1px solid #35536a;border-radius:4px;background:#0b1828;color:#bcd4e8;font-size:13px;pointer-events:none;white-space:nowrap';
|
||||
wrapper.appendChild(badge);
|
||||
}
|
||||
const name = site === 'xishui' ? '习水库' : '遵义中心库';
|
||||
badge.dataset.state = state;
|
||||
badge.hidden = state === 'live';
|
||||
badge.textContent = state === 'live' ? `${name} · 后台数据 · ${count} 座仓储设施${hasDemo ? ' · 含 DEMO 演示化验,非实测' : ''}`
|
||||
: state === 'empty' ? `${name} · 暂无仓库资料` : `${name} · 数据连接失败,请稍后重试`;
|
||||
let empty = document.getElementById('site-empty-state');
|
||||
if (!empty) {
|
||||
empty = document.createElement('div');
|
||||
empty.id = 'site-empty-state';
|
||||
empty.style.cssText = 'position:absolute;inset:120px 0 50px;z-index:99;display:none;align-items:center;justify-content:center;background:rgba(6,16,29,.97);color:#bcd4e8;font-size:24px';
|
||||
wrapper.appendChild(empty);
|
||||
}
|
||||
empty.style.display = state === 'live' ? 'none' : 'flex';
|
||||
empty.textContent = state === 'empty' ? '当前库区暂无仓库资料,请在后台录入' : '暂时无法读取库区数据,请检查网络后刷新';
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { fetchSiteData, showSiteDataState } from './site_data.js?v=20261028_demo3';
|
||||
import {
|
||||
calcScreenScale,
|
||||
normalizeGranaryList,
|
||||
@@ -17,7 +18,7 @@ import {
|
||||
getGranaryQualityReport,
|
||||
generateDepotAlerts,
|
||||
syncAlertMarqueeSpeed
|
||||
} from './grain_monitor_core.js?v=20261028_chart3';
|
||||
} from './grain_monitor_core.js?v=20261028_demo3';
|
||||
|
||||
// 全局状态
|
||||
const STATE = {
|
||||
@@ -86,37 +87,18 @@ function updateClock() {
|
||||
}
|
||||
|
||||
// 3. 加载习水子库标准数据集
|
||||
function loadGranaryData() {
|
||||
STATE.list = normalizeGranaryList(XISHUI_GRANARY_DATA);
|
||||
|
||||
// 尝试连接后台接口同步最新配置
|
||||
if (typeof fetch !== 'undefined') {
|
||||
const urls = [
|
||||
'/api/index/granaryList?site=xishui',
|
||||
'https://grain.gynhc.com/api/index/granaryList?site=xishui',
|
||||
'/api/granary/list?site=xishui'
|
||||
];
|
||||
(async () => {
|
||||
for (const u of urls) {
|
||||
try {
|
||||
const res = await fetch(u, { cache: 'no-cache', signal: AbortSignal.timeout(2000) });
|
||||
if (!res.ok) continue;
|
||||
const json = await res.json();
|
||||
if (json && json.data && Array.isArray(json.data.list) && json.data.list.length > 0) {
|
||||
STATE.list = normalizeGranaryList(json);
|
||||
if (json.data.coords) {
|
||||
STATE.customCoords = json.data.coords;
|
||||
}
|
||||
renderKPIs();
|
||||
renderHotspots();
|
||||
renderMiniGrid();
|
||||
renderDetailPanels();
|
||||
renderDepotAlerts();
|
||||
return;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
})();
|
||||
async function loadGranaryData() {
|
||||
try {
|
||||
const data = await fetchSiteData('xishui');
|
||||
STATE.list = normalizeGranaryList({ data });
|
||||
STATE.customCoords = data.coords || {};
|
||||
STATE.activeId = STATE.list.some(item => item.id === STATE.activeId) ? STATE.activeId : (STATE.list[0]?.id || null);
|
||||
showSiteDataState('xishui', STATE.list.length ? 'live' : 'empty', STATE.list.length, STATE.list.some(item => item.isDemo));
|
||||
} catch (_) {
|
||||
STATE.list = [];
|
||||
STATE.customCoords = {};
|
||||
STATE.activeId = null;
|
||||
showSiteDataState('xishui', 'unavailable', 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,8 +377,8 @@ function renderLeftPanel(item, params) {
|
||||
document.getElementById('param-granary-type').textContent = b.warehouseType;
|
||||
document.getElementById('param-granary-variety').textContent = b.varieties;
|
||||
document.getElementById('param-granary-nature').textContent = b.natureName;
|
||||
document.getElementById('param-granary-addr').textContent = b.addr || '河南/湖北';
|
||||
document.getElementById('param-granary-year').textContent = b.harvestYear || '2023';
|
||||
document.getElementById('param-granary-addr').textContent = item.isOilTank ? b.productArea : b.addr;
|
||||
document.getElementById('param-granary-year').textContent = item.isOilTank ? b.machiningYear : b.harvestYear;
|
||||
document.getElementById('param-granary-enter').textContent = b.enterTime || '2023-08';
|
||||
document.getElementById('param-granary-custodian').textContent = b.custodian || '张卫国';
|
||||
document.getElementById('param-granary-mgmt').textContent = b.managementForm || '直接管理';
|
||||
@@ -500,20 +482,26 @@ function renderRightPanel(item, params) {
|
||||
// 标题与总体状态指示徽章 (短小精悍,杜绝截断)
|
||||
if (qualityTitle) {
|
||||
let statusBadge = '';
|
||||
if (report.summary.dangerCount > 0) {
|
||||
if (report.empty) {
|
||||
statusBadge = '<span class="quality-badge status-unknown" style="margin-left: 5px;">暂无数据</span>';
|
||||
} else if (report.summary.dangerCount > 0) {
|
||||
statusBadge = `<span class="quality-badge status-danger" style="margin-left: 5px;">⚠️ ${report.summary.dangerCount}项超标</span>`;
|
||||
} else if (report.summary.warnCount > 0) {
|
||||
statusBadge = `<span class="quality-badge status-warn" style="margin-left: 5px;">⚠️ ${report.summary.warnCount}项预警</span>`;
|
||||
} else {
|
||||
} else if (!report.summary.unknownCount) {
|
||||
statusBadge = `<span class="quality-badge status-normal" style="margin-left: 5px;">✓ 健康达标</span>`;
|
||||
}
|
||||
if (report.summary.unknownCount > 0) {
|
||||
statusBadge += `<span class="quality-badge status-unknown" style="margin-left: 5px;">${report.summary.unknownCount}项待核实</span>`;
|
||||
}
|
||||
qualityTitle.innerHTML = `<span>${report.variety}品质全参数舱</span>${statusBadge}`;
|
||||
}
|
||||
|
||||
// 标题栏右侧显示批次阶段与检验日期 (精炼格式)
|
||||
if (qualityExtra) {
|
||||
const stageShort = (report.inspectStage || '').split('/')[0].trim();
|
||||
qualityExtra.innerHTML = `<span style="font-size: 9px; color: var(--text-sub); white-space: nowrap;">${stageShort} · ${report.inspectDate}</span>`;
|
||||
if (report.empty) qualityExtra.textContent = stageShort;
|
||||
if (!report.empty) qualityExtra.innerHTML = `<span style="font-size: 9px; color: var(--text-sub); white-space: nowrap;">${stageShort} · ${report.inspectDate}</span>`;
|
||||
}
|
||||
|
||||
// 渲染方案A专属品质全参数舱 (全量水平条形卡片 + 分类Tab)
|
||||
@@ -560,6 +548,27 @@ async function initOrUpdateForecastCharts(granaryItem) {
|
||||
STATE.charts.forecastCompare = echarts.init(compareDom);
|
||||
}
|
||||
|
||||
const currentReport = getGranaryQualityReport(grainName, currentItem.rawContent || currentItem.content || {}, currentItem.qualityTest, { requireRecordedData: true });
|
||||
for (const id of ['btn-forecast-recalc', 'btn-forecast-reset']) {
|
||||
const button = document.getElementById(id);
|
||||
if (button) {
|
||||
button.disabled = currentReport.empty;
|
||||
button.title = currentReport.empty ? '请先录入本仓化验数据' : '';
|
||||
}
|
||||
}
|
||||
if (currentReport.empty) {
|
||||
const emptyOption = {
|
||||
title: { text: '暂无化验数据\n录入本仓实测数据后可查看质量预测', left: 'center', top: '40%',
|
||||
textStyle: { color: '#94a3b8', fontSize: 13, lineHeight: 24 } }
|
||||
};
|
||||
STATE.charts.forecastTrend.setOption(emptyOption, true);
|
||||
STATE.charts.forecastCompare.setOption(emptyOption, true);
|
||||
if (trendTitleEl) trendTitleEl.textContent = `${currentItem.name} · 暂无实测数据`;
|
||||
if (compareTitleEl) compareTitleEl.textContent = '待录入化验记录';
|
||||
delete STATE.forecastCache[currentItem.id];
|
||||
return;
|
||||
}
|
||||
|
||||
if (!grainType) {
|
||||
const emptyOption = {
|
||||
title: {
|
||||
@@ -607,7 +616,7 @@ async function initOrUpdateForecastCharts(granaryItem) {
|
||||
|
||||
setupForecastEnvControls();
|
||||
|
||||
const currentReport = getGranaryQualityReport(grainName, currentItem.rawContent || currentItem.content || {}, currentItem.qualityTest);
|
||||
|
||||
|
||||
// 1. 0 毫秒即时秒出基础图表 (杜绝任何白屏与残亮点)
|
||||
const baselineList = [
|
||||
@@ -648,6 +657,9 @@ async function initOrUpdateForecastCharts(granaryItem) {
|
||||
key: m.key,
|
||||
name: m.name,
|
||||
unit: m.unit,
|
||||
warn: m.warn,
|
||||
alert: m.alert,
|
||||
direction: m.direction,
|
||||
predictedValue: m.values[3] !== undefined ? m.values[3] : m.values[m.values.length - 1]
|
||||
}));
|
||||
const initialCompareOption = buildForecastCompareChartOption(grainType, currentReport?.items || [], initialFuture30);
|
||||
@@ -684,6 +696,9 @@ async function initOrUpdateForecastCharts(granaryItem) {
|
||||
key: m.key,
|
||||
name: m.name,
|
||||
unit: m.unit,
|
||||
warn: m.warn,
|
||||
alert: m.alert,
|
||||
direction: m.direction,
|
||||
predictedValue: m.values[3] !== undefined ? m.values[3] : m.values[m.values.length - 1]
|
||||
}));
|
||||
|
||||
@@ -847,7 +862,7 @@ function initOrUpdateGranaryBar() {
|
||||
|
||||
const names = STATE.list.map(i => i.name.replace('号浅圆仓', '#圆').replace('号仓房', '#平'));
|
||||
const storageData = STATE.list.map(i => i.storageNum);
|
||||
const capacityData = STATE.list.map(i => i.capacity);
|
||||
const capacityData = STATE.list.map(i => i.capacityNum);
|
||||
|
||||
const option = {
|
||||
tooltip: {
|
||||
@@ -992,14 +1007,14 @@ function toggleFullscreen() {
|
||||
}
|
||||
|
||||
// 初始化入口
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
window.addEventListener('DOMContentLoaded', async () => {
|
||||
resizeScreen();
|
||||
window.addEventListener('resize', resizeScreen);
|
||||
|
||||
updateClock();
|
||||
setInterval(updateClock, 1000);
|
||||
|
||||
loadGranaryData();
|
||||
await loadGranaryData();
|
||||
loadEnvData();
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
@@ -1020,15 +1035,20 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||
renderDepotAlerts();
|
||||
|
||||
// 电视大屏 60 秒自动静默轮询同步最新台账与微气候
|
||||
setInterval(() => {
|
||||
setInterval(async () => {
|
||||
try {
|
||||
loadGranaryData();
|
||||
await loadGranaryData();
|
||||
loadEnvData();
|
||||
renderKPIs();
|
||||
renderHotspots();
|
||||
renderMiniGrid();
|
||||
renderDetailPanels();
|
||||
renderDepotAlerts();
|
||||
} catch (_) {}
|
||||
}, 60000);
|
||||
|
||||
setupAutoPlay();
|
||||
if (urlParams.get('view') === 'forecast') selectGranary(STATE.activeId, true);
|
||||
|
||||
const fsBtn = document.getElementById('btn-fullscreen');
|
||||
if (fsBtn) fsBtn.addEventListener('click', toggleFullscreen);
|
||||
@@ -1044,6 +1064,11 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||
});
|
||||
|
||||
window.addEventListener('keydown', (e) => {
|
||||
if (e.target?.closest?.('input, textarea, select, [contenteditable="true"]')) return;
|
||||
if (e.key === 'Escape' && STATE.isCenterChartOpen) {
|
||||
toggleCenterChartBoard(STATE.centerChartTab, false);
|
||||
return;
|
||||
}
|
||||
const curIdx = STATE.list.findIndex(w => w.id === STATE.activeId);
|
||||
if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') {
|
||||
const nextIdx = (curIdx - 1 + STATE.list.length) % STATE.list.length;
|
||||
|
||||
在新工单中引用
屏蔽一个用户