Files
treeandClaude Opus 5.5 0e070a64fe P1:闭环时限管控、治理成效评估、站型阈值系数与接口测试
- 闭环状态流转自动记录接单/闭环时间,状态值校验;按断站分级判定响应时限
  (及时/超时/超时未响应/未到期/无记录),新增及时响应率、平均闭环时长、超时未闭环指标与筛选
- 新增治理成效评估 /api/effect:分界日期前后指标对比与问题站点逐站改善判定
- 新增站型阈值系数(实际阈值 = 场景阈值 × 站型系数)及配置接口与页面
- 样例数据新增接单/闭环时间(独立随机数,原字段不变),导入支持并校验
- 新增 tests/test_api.py(权限、导入模板、闭环流程、站型系数、成效评估、无数据边界)
- 修复:新流水无告警匹配时根因分析报错;空筛选时超长站点清单返回 500

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

63 lines
2.5 KiB
JavaScript
Raw Permalink 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.
/* 显示格式与颜色常量。颜色全部取自 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 SLA_TONE = {及时: 'green', 超时: 'orange', 超时未响应: 'red', 未到期: 'blue', 无记录: 'gray'};
export const ROLE_NAME = {admin: '管理员', user: '普通用户'};