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: '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} = data; return html`