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`
<${Section} title="影响评估" hint=${`统计周期 ${period.days} 天(${period.months} 个月)· ${num(k.sites)} 个站`}>
<${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="%"/>
<${Section} span=${6} title="分场景退服率" hint="单位:%"> <${EChart} option=${sceneBar(bench, bench.map(x => x.outage_rate))}/> <${Section} span=${6} title="分场景受影响用户·小时" hint="单位:万人·h"> <${EChart} option=${sceneBar(bench, bench.map(x => +(x.user_h / 1e4).toFixed(1)))}/> <${Section} title="口径说明">
退服率 = 总退服时长 ÷(站点数 × 统计周期);统计周期取顶栏的月份 / 日期范围,未筛选时为全部流水首日至末日。 重复退服率 = 高频重复站点数 ÷ 站点数。“月均”按统计周期的自然月数计算。 覆盖补偿:站点 500 米内每有一个邻站,受影响用户与话务损失下降 10%(室分站 5%),最低保留 40%。
<${Section} title="通信场景运维考核指标横向对标"> <${DataTable} rowKey="scene" columns=${BENCH_COLUMNS} rows=${bench}/>
`; }