feat: 完成 issue #157 移动端只读驾驶舱补充手动刷新(KPI 时间桶滚动)
This commit is contained in:
@@ -13,7 +13,10 @@
|
|||||||
只读展示:工艺四状态 / KPI / 告警;交接班摘要按 handover_brief 章节渲染。 -->
|
只读展示:工艺四状态 / KPI / 告警;交接班摘要按 handover_brief 章节渲染。 -->
|
||||||
<header id="topbar">
|
<header id="topbar">
|
||||||
<h1 id="page-title">iAOP 移动驾驶舱</h1>
|
<h1 id="page-title">iAOP 移动驾驶舱</h1>
|
||||||
<span id="ro-badge">只读</span>
|
<div>
|
||||||
|
<button id="btn-refresh" class="ghost-btn">刷新</button>
|
||||||
|
<span id="ro-badge">只读</span>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<!-- 只读驾驶舱视图 -->
|
<!-- 只读驾驶舱视图 -->
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ body { margin: 0; font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
|
|||||||
position: sticky; top: 0; z-index: 2; }
|
position: sticky; top: 0; z-index: 2; }
|
||||||
#topbar h1 { font-size: 17px; margin: 0; color: var(--cockpit-accent); }
|
#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);
|
#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 { display: none; padding: 10px 12px; }
|
||||||
.view.active { display: block; }
|
.view.active { display: block; }
|
||||||
|
|||||||
+14
-8
@@ -71,7 +71,8 @@ function renderMobileCockpit(plan) {
|
|||||||
kpiBox.innerHTML = "";
|
kpiBox.innerHTML = "";
|
||||||
plan.widgets.forEach(function (w) {
|
plan.widgets.forEach(function (w) {
|
||||||
if (w.type !== "kpi_card") return;
|
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");
|
var card = el("div", "kpi");
|
||||||
card.appendChild(el("div", "v", (60 + rnd() * 40).toFixed(2)));
|
card.appendChild(el("div", "v", (60 + rnd() * 40).toFixed(2)));
|
||||||
card.appendChild(el("div", "l", w.props.label || w.props.metric));
|
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; })
|
fetch(ALARM_PLAN_URL).then(function (r) { return r.ok ? r.json() : null; })
|
||||||
.then(function (p) { if (p && p.severityStyles) severityStyles = p.severityStyles; })
|
.then(function (p) { if (p && p.severityStyles) severityStyles = p.severityStyles; })
|
||||||
.catch(function () {});
|
.catch(function () {});
|
||||||
fetch(PLAN_URL).then(function (r) { return r.json(); })
|
// issue #157:只读数据手动刷新(重新加载布局资产并重渲染 KPI/告警)
|
||||||
.then(renderMobileCockpit)
|
function loadPlan() {
|
||||||
.catch(function (e) {
|
fetch(PLAN_URL).then(function (r) { return r.json(); })
|
||||||
document.getElementById("m-stages").innerHTML = "";
|
.then(renderMobileCockpit)
|
||||||
document.getElementById("m-stages").appendChild(
|
.catch(function (e) {
|
||||||
el("div", "hint", "布局资产加载失败:" + e.message + "(请从 web/ 根目录起服务)"));
|
document.getElementById("m-stages").innerHTML = "";
|
||||||
});
|
document.getElementById("m-stages").appendChild(
|
||||||
|
el("div", "hint", "布局资产加载失败:" + e.message + "(请从 web/ 根目录起服务)"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
document.getElementById("btn-refresh").onclick = loadPlan;
|
||||||
|
loadPlan();
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user