Publish top10 KA FFR report
This commit is contained in:
+19
-1
@@ -33,6 +33,8 @@ tr.link{cursor:pointer}tr.link:hover{background:#f8fafc}
|
||||
.bar>b{position:relative;display:block;text-align:right;padding-right:4px;font-size:11px;line-height:16px}
|
||||
.bar.over>i{background:var(--blue)}.bar.low>i{background:var(--pink)}
|
||||
.notes{font-size:11px;color:#94a3b8;margin-top:8px;line-height:1.8}
|
||||
.alert{margin-top:14px;padding:13px 16px;border-radius:12px;border:1px solid #fecaca;background:#fef2f2;color:#b42318;font-size:12px;line-height:1.8}
|
||||
.alert b{color:#991b1b}
|
||||
.error{margin:40px auto;max-width:700px;text-align:center;padding:44px;color:#b42318}
|
||||
.footer{text-align:center;color:#94a3b8;font-size:11px;margin:18px}
|
||||
@media(max-width:1100px){.grid{grid-template-columns:repeat(3,1fr)}}
|
||||
@@ -40,6 +42,7 @@ tr.link{cursor:pointer}tr.link:hover{background:#f8fafc}
|
||||
</style></head><body><main class="shell">
|
||||
<header class="hero"><div><h1>Top10 KA · FFR 与 GP</h1><p id="period">正在加载数据…</p></div><div class="updated" id="updated">数据加载中</div></header>
|
||||
<div class="tabs" id="tabs"></div>
|
||||
<div id="alert"></div>
|
||||
<div id="view"></div>
|
||||
<div class="footer">Revenue 来自各 KA 日报表客户口径消耗 · Cost 来自 Sands · GP = Revenue − Cost</div>
|
||||
</main>
|
||||
@@ -254,6 +257,21 @@ function renderView(){
|
||||
drawChart(item);
|
||||
}
|
||||
|
||||
/* Cost 抓取时间晚于数据周期时提示,避免误用滞后的 GP */
|
||||
function renderAlert(){
|
||||
const sands=report.sands||{},p=report.period||{},box=$('alert');
|
||||
const messages=[];
|
||||
if(!sands.by_pkg&&!ok(sands.total_cost))
|
||||
messages.push('<b>Cost 数据缺失</b>:尚未抓取 Sands,GP 与 GP rate 无法计算。');
|
||||
else if(sands.stale)
|
||||
messages.push(`<b>Cost 数据滞后</b>:Sands 抓取于 ${esc(sands.fetched_date||String(sands.fetched_at||'').slice(0,10))},`
|
||||
+`数据周期到 ${esc(p.end||'—')},滞后约 ${num(sands.lag_days)} 天。`
|
||||
+'GP 与完成率会偏高,请重新抓取后再用于汇报。');
|
||||
if(sands.carried_over)
|
||||
messages.push('<b>Cost 沿用上次抓取值</b>:本次更新未包含新的 Sands 数据。');
|
||||
box.innerHTML=messages.length?`<div class="alert">${messages.join('<br>')}</div>`:'';
|
||||
}
|
||||
|
||||
function render(){
|
||||
const p=report.period||{},sands=report.sands||{};
|
||||
$('period').textContent=`${p.start||'—'} 至 ${p.end||'—'} · ${num(p.days)}/${num(p.month_days)} 天 · 时间进度 ${pct(p.time_progress_percent)}`;
|
||||
@@ -261,7 +279,7 @@ function render(){
|
||||
if(sands.fetched_at)parts.push(`Sands Cost 抓取于 ${esc(String(sands.fetched_at).replace('T',' '))}`);
|
||||
if(sands.carried_over)parts.push('Cost 沿用上次抓取值');
|
||||
$('updated').innerHTML=parts.join('<br>');
|
||||
renderTabs();renderView();
|
||||
renderAlert();renderTabs();renderView();
|
||||
}
|
||||
|
||||
window.addEventListener('resize',()=>{if(report&¤t!=='overview')drawChart(findAccount(current))});
|
||||
|
||||
Reference in New Issue
Block a user