初始提交:5G 基站退服时长智能分析与故障闭环管控系统

Flask + SQLite 后端,免构建 React + ECharts 前端,含合成样例数据。
测试参考数据(FOR-TEST-ONLY)与运行时数据库不入库。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
treeandClaude Opus 5.5 committed 2026-11-18 14:01:48 +08:00
commit f8d1ccc526
39 files changed
+29010

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
/* 显示格式与颜色常量。颜色全部取自 Apple 系统色(浅色模式值),同一实体在所有图表中颜色固定。 */
export const num = v => (v == null || v === '' ? '' : Number(v).toLocaleString('zh-CN'));
/** 站名精简:去掉运营商前缀、行政区与 BBU 后缀,便于图表标签展示 */
export const shortSite = n =>
String(n).replace(/^[A-Z]+/, '').replace(/^南宁(市)?(邕宁区)?/, '').replace(/[-_]?BBU.*$/i, '').slice(0, 14) || n;
/** 固定小数位,让同一屏的百分比位数一致(例如 97.0712 → 97.07,90.6 → 90.60) */
export function fixed(value, digits = 2) {
if (value == null || value === '') {
return '';
}
return Number(value).toFixed(digits);
}
export const BLUE = '#007aff';
/**
* 柱状图数据:只把最大值标成强调色,其余柱子用主题里的中性灰。
* 这样每张图只有一个视觉焦点,读者一眼看到“最需要关注的是哪一项”。
*/
export function accentMax(values) {
const max = Math.max(...values);
const data = [];
for (const value of values) {
if (value === max && max > 0) {
data.push({value, itemStyle: {color: BLUE}});
} else {
data.push(value);
}
}
return data;
}
/** 热力图格子里的数字颜色:深色格子用白字,浅色格子用深色字(格子颜色深浅模式下相同,所以不跟随主题) */
export function heatLabelColor(value, max) {
if (value > max * 0.6) {
return '#ffffff';
}
return '#1d1d1f';
}
/** 图表系列色板:systemBlue / Orange / Green / Purple / Pink / Teal / Indigo / Red */
export const PALETTE = [BLUE, '#ff9500', '#34c759', '#af52de', '#ff2d55', '#30b0c7', '#5856d6', '#ff3b30'];
/** 根因颜色 */
export const CAUSE_COLOR = {
传输中断: BLUE, 电源故障: '#ff9500', 设备硬件: '#af52de', 天馈故障: '#34c759',
机房环境: '#ff2d55', 割接施工: '#30b0c7', 其他: '#8e8e93',
};
/** 热力图色阶:由浅到深的 systemBlue */
export const BLUE_SCALE = ['#e8f2ff', '#a9cfff', '#4da3ff', '#0062cc'];
/** 断站分级、闭环状态 -> 标签色调(见 app.css 中的 .tag[data-tone]) */
export const LEVEL_TONE = {重要: 'red', 主要: 'orange', 次要: 'gray'};
export const STATUS_TONE = {已闭环: 'green', 处理中: 'blue', 待处理: 'yellow'};
export const ROLE_NAME = {admin: '管理员', user: '普通用户'};