Files
treeandClaude Opus 5.5 f8d1ccc526 初始提交:5G 基站退服时长智能分析与故障闭环管控系统
Flask + SQLite 后端,免构建 React + ECharts 前端,含合成样例数据。
测试参考数据(FOR-TEST-ONLY)与运行时数据库不入库。

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

37 lines
1.7 KiB
JavaScript

import {GlassButton, html} from 'vendor';
import {download, useApp, useFetch} from '../api.js';
import {DataTable} from '../components/DataTable.js';
import {Loading, Section} from '../components/ui.js';
const REPORTS = [
{kind: 'stats', title: '退服统计表', desc: '考核指标汇总 + 站点维度累计/平均退服时长、次数、超长次数、受影响用户'},
{kind: 'long', title: '超长退服站点清单', desc: '超长与高频重复退服站点、阈值、主要根因与处置建议'},
{kind: 'advice', title: '根因处置建议清单', desc: '全部超长退服记录的判定根因、关联告警证据、分级与处置建议'},
];
const LOG_COLUMNS = [
{key: 'ts', title: '时间'}, {key: 'username', title: '用户'}, {key: 'action', title: '操作'},
{key: 'detail', title: '详情', wrap: true},
];
export default function Reports() {
const {filters, isAdmin} = useApp();
const {data: logs} = useFetch(isAdmin ? '/api/logs' : null); // 操作日志仅管理员可见
let logContent = html`<${Loading}/>`;
if (!isAdmin) {
logContent = html`<p className="hint">仅管理员可查看操作日志</p>`;
} else if (logs) {
logContent = html`<${DataTable} rows=${logs.rows} columns=${LOG_COLUMNS}/>`;
}
return html`
<div className="grid">
${REPORTS.map(r => html`
<${Section} key=${r.kind} span=${4} title=${r.title}>
<p className="hint report-desc">${r.desc}</p>
<${GlassButton} variant="tinted" onClick=${() => download(`/api/export/${r.kind}`, filters)}>导出 Excel</${GlassButton}>
</${Section}>`)}
<${Section} title="操作日志">${logContent}</${Section}>
</div>`;
}