Files
Gset/static/js/pages/Impact.js
T
treeandClaude Opus 5.5 e9616af34d 修复 P0:根因判定、退服率口径、影响评估与告警关联量化
- 根因判定改为三级(衍生关系/时间窗/疑似)并带置信度;小区退服告警 ±2 分钟匹配;
  衍生告警按父告警归类;优先选随业务恢复清除的告警;时间窗按历史流水 95% 分位数标定
- 退服率按日历统计周期计算;站点数分母支持站名关键字;重复退服率除以全部站点;
  月均按统计周期自然月数;导出与看板同一口径
- 影响评估新增受影响用户·小时与 500 米邻站覆盖补偿
- 新增告警—退服关联量化(支持度/置信度/提升度)及 /api/association,根因页展示
- 新增 tests/(扰动数据集留出检验、指标口径检验)与 bench.py;旧库启动时自动迁移

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 14:43:34 +08:00

62 lines
3.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import {html} from 'vendor';
import {useApp, useFetch} from '../api.js';
import {accentMax, fixed, num} from '../format.js';
import {EChart} from '../components/EChart.js';
import {DataTable} from '../components/DataTable.js';
import {Kpi, Loading, Section} from '../components/ui.js';
const BENCH_COLUMNS = [
{key: 'scene', title: '场景'}, {key: 'sites', title: '站点数'}, {key: 'count', title: '退服次数'},
{key: 'total_h', title: '累计时长(h)'}, {key: 'avg_min', title: '平均时长(min)'}, {key: 'outage_rate', title: '退服率(%)'},
{key: 'availability', title: '可用率(%)'}, {key: 'long_ratio', title: '超长占比(%)'}, {key: 'repeat_rate', title: '重复退服率(%)'},
{key: 'users', title: '受影响用户', render: num}, {key: 'user_h', title: '用户·小时', render: num},
{key: 'loss_gb', title: '业务损失(GB)', render: num},
];
/** 场景柱状图配置:最大的场景用强调色标出 */
const sceneBar = (bench, values) => ({
tooltip: {trigger: 'axis', axisPointer: {type: 'shadow'}},
xAxis: {type: 'category', data: bench.map(x => x.scene)},
yAxis: {type: 'value'},
series: [{type: 'bar', barMaxWidth: 34, label: {show: true, position: 'top'}, data: accentMax(values)}],
});
export default function Impact() {
const {filters} = useApp();
const {data} = useFetch('/api/dashboard', filters);
if (!data) return html`<${Loading}/>`;
const {kpi: k, bench, period} = data;
return html`
<div className="grid">
<${Section} title="影响评估" hint=${`统计周期 ${period.days} 天(${period.months} 个月)· ${num(k.sites)} 个站`}>
<div className="kpis">
<${Kpi} title="受影响用户" value=${num(k.users)} unit="人次" sub="小区数 × 单小区在线用户 × 忙闲时 × 覆盖补偿"/>
<${Kpi} title="受影响用户·小时" value=${num(k.user_h)} unit="人·h" sub="受影响用户 × 退服时长"/>
<${Kpi} title="业务损失" value=${num(k.loss_gb)} unit="GB" sub="小区话务 × 忙闲时 × 覆盖补偿 × 退服时长"/>
<${Kpi} title="退服率" value=${fixed(k.outage_rate)} unit="%"/>
<${Kpi} title="网络可用率" value=${fixed(k.availability)} unit="%"/>
<${Kpi} title="平均退服时长" value=${k.avg_min} unit="min"/>
<${Kpi} title="超长退服占比" value=${fixed(k.long_ratio)} unit="%"/>
<${Kpi} title="重复退服率" value=${fixed(k.repeat_rate)} unit="%"/>
</div>
</${Section}>
<${Section} span=${6} title="分场景退服率" hint="单位:%">
<${EChart} option=${sceneBar(bench, bench.map(x => x.outage_rate))}/>
</${Section}>
<${Section} span=${6} title="分场景受影响用户·小时" hint="单位:万人·h">
<${EChart} option=${sceneBar(bench, bench.map(x => +(x.user_h / 1e4).toFixed(1)))}/>
</${Section}>
<${Section} title="口径说明">
<div className="note">
退服率 = 总退服时长 ÷(站点数 × 统计周期);统计周期取顶栏的月份 / 日期范围,未筛选时为全部流水首日至末日。
重复退服率 = 高频重复站点数 ÷ 站点数。“月均”按统计周期的自然月数计算。
覆盖补偿:站点 500 米内每有一个邻站,受影响用户与话务损失下降 10%(室分站 5%),最低保留 40%。
</div>
</${Section}>
<${Section} title="通信场景运维考核指标横向对标">
<${DataTable} rowKey="scene" columns=${BENCH_COLUMNS} rows=${bench}/>
</${Section}>
</div>`;
}