From 253ebe7b0b56b55499318885ac534790b1d52539 Mon Sep 17 00:00:00 2001 From: bot_dev1 Date: Wed, 5 Aug 2026 10:50:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=20issue=20#157=20?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=8F=AA=E8=AF=BB=E9=A9=BE=E9=A9=B6?= =?UTF-8?q?=E8=88=B1=E8=A1=A5=E5=85=85=E6=89=8B=E5=8A=A8=E5=88=B7=E6=96=B0?= =?UTF-8?q?=EF=BC=88KPI=20=E6=97=B6=E9=97=B4=E6=A1=B6=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/mobile/index.html | 5 ++++- web/mobile/mobile.css | 4 +++- web/mobile/mobile.js | 22 ++++++++++++++-------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/web/mobile/index.html b/web/mobile/index.html index 554b2c5..d5fde78 100644 --- a/web/mobile/index.html +++ b/web/mobile/index.html @@ -13,7 +13,10 @@ 只读展示:工艺四状态 / KPI / 告警;交接班摘要按 handover_brief 章节渲染。 -->

iAOP 移动驾驶舱

- 只读 +
+ + 只读 +
diff --git a/web/mobile/mobile.css b/web/mobile/mobile.css index 93b05a7..a513478 100644 --- a/web/mobile/mobile.css +++ b/web/mobile/mobile.css @@ -18,7 +18,9 @@ body { margin: 0; font-family: "PingFang SC", "Microsoft YaHei", sans-serif; position: sticky; top: 0; z-index: 2; } #topbar h1 { font-size: 17px; margin: 0; color: var(--cockpit-accent); } #ro-badge { font-size: 11px; color: var(--cockpit-warn); border: 1px solid var(--cockpit-warn); - border-radius: 10px; padding: 2px 8px; } + border-radius: 10px; padding: 2px 8px; margin-left: 8px; } +.ghost-btn { background: none; border: 1px solid var(--cockpit-grid-line); border-radius: 8px; + color: var(--cockpit-accent); font-size: 12px; padding: 4px 10px; cursor: pointer; } .view { display: none; padding: 10px 12px; } .view.active { display: block; } diff --git a/web/mobile/mobile.js b/web/mobile/mobile.js index fda9176..dee01ac 100644 --- a/web/mobile/mobile.js +++ b/web/mobile/mobile.js @@ -71,7 +71,8 @@ function renderMobileCockpit(plan) { kpiBox.innerHTML = ""; plan.widgets.forEach(function (w) { if (w.type !== "kpi_card") return; - var rnd = seededRandom(w.props.metric || ""); + // 30s 时间桶入种子:刷新/定时重渲染时数值滚动(接真实总线后替换) + var rnd = seededRandom((w.props.metric || "") + "|" + Math.floor(Date.now() / 30000)); var card = el("div", "kpi"); card.appendChild(el("div", "v", (60 + rnd() * 40).toFixed(2))); card.appendChild(el("div", "l", w.props.label || w.props.metric)); @@ -231,11 +232,16 @@ function generateBrief() { fetch(ALARM_PLAN_URL).then(function (r) { return r.ok ? r.json() : null; }) .then(function (p) { if (p && p.severityStyles) severityStyles = p.severityStyles; }) .catch(function () {}); - fetch(PLAN_URL).then(function (r) { return r.json(); }) - .then(renderMobileCockpit) - .catch(function (e) { - document.getElementById("m-stages").innerHTML = ""; - document.getElementById("m-stages").appendChild( - el("div", "hint", "布局资产加载失败:" + e.message + "(请从 web/ 根目录起服务)")); - }); + // issue #157:只读数据手动刷新(重新加载布局资产并重渲染 KPI/告警) + function loadPlan() { + fetch(PLAN_URL).then(function (r) { return r.json(); }) + .then(renderMobileCockpit) + .catch(function (e) { + document.getElementById("m-stages").innerHTML = ""; + document.getElementById("m-stages").appendChild( + el("div", "hint", "布局资产加载失败:" + e.message + "(请从 web/ 根目录起服务)")); + }); + } + document.getElementById("btn-refresh").onclick = loadPlan; + loadPlan(); })();