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

75 lines
3.4 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.
/* 内容层组件。只放有实际逻辑的组件;纯布局直接写 className(.grid / .row / .grow / .note / .chips,见 app.css)。 */
import {Card, Fragment, html, Picker, useState} from 'vendor';
import {CAUSE_COLOR, LEVEL_TONE, SLA_TONE, STATUS_TONE} from '../format.js';
/** 内容卡片:不透明,可带标题栏。span 为 12 栅格中占的列数 */
export function Section({title, hint, extra, span = 12, children}) {
return html`
<${Card} radius=${18} padding=${20} className=${`section span-${span}`}>
${(title || extra) && html`
<header className="section-head">
<h3>${title}</h3>
${hint && html`<span className="hint">${hint}</span>`}
<span className="grow"></span>
${extra}
</header>`}
${children}
</${Card}>`;
}
/** 指标卡 */
export function Kpi({title, value, unit, sub}) {
return html`
<div className="kpi">
<div className="kpi-title">${title}</div>
<div className="kpi-value">${value}<small>${unit}</small></div>
${sub && html`<div className="kpi-sub">${sub}</div>`}
</div>`;
}
/** 彩色文字标签(颜色之外始终带文字,不单靠颜色传达状态) */
export const LevelTag = ({value}) => value && html`<span className="tag" data-tone=${LEVEL_TONE[value]}>${value}</span>`;
/** 闭环状态标签:未闭环(待处理 / 处理中)前面加一个圆点,和侧边栏“未闭环”数量的圆点是同一个记号 */
export function StatusTag({value}) {
if (!value) return null;
let dot = null;
if (value !== '已闭环') {
dot = html`<i className="dot" aria-hidden="true"></i>`;
}
return html`<span className="tag" data-tone=${STATUS_TONE[value]}>${dot}${value}</span>`;
}
/** 响应时限判定标签(及时 / 超时 / 超时未响应 / 未到期 / 无记录) */
export const SlaTag = ({value}) => value && html`<span className="tag" data-tone=${SLA_TONE[value]}>${value}</span>`;
/** 变化判定:改善绿、恶化红、持平灰 */
export const VerdictTag = ({value}) => value && value !== '—'
? html`<span className="tag" data-tone=${{改善: 'green', 恶化: 'red', 持平: 'gray'}[value]}>${value}</span>`
: '—';
/** 根因:色点 + 名称 */
export const Cause = ({value}) => value && html`
<span className="cause"><i style=${{background: CAUSE_COLOR[value] || '#8e8e93'}}></i>${value}</span>`;
export const Loading = () => html`<div className="loading"><span></span>加载中…</div>`;
/**
* 下拉选择(组件库 Picker)。options 可以是字符串数组或 {value, label} 数组。
* - 传 onChange:受控用法,用于筛选条件。
* - 传 name:表单用法,value 为初始值;Picker 本身不参与表单提交,所以用隐藏 input 带上选中值。
* - 传 all:最前面加一个值为 '' 的“全部”选项。
*/
export function Select({label, options, all, value, onChange, name, showLabel = false}) {
const items = options.map(o => (typeof o === 'string' ? {value: o, label: o} : o));
if (all) items.unshift({value: '', label: all});
const [own, setOwn] = useState(value ?? items[0]?.value ?? '');
const current = onChange ? value ?? '' : own;
return html`
<${Fragment}>
<${Picker} label=${label} labelHidden=${!showLabel} options=${items} presentation="menu"
value=${current} onValueChange=${onChange || setOwn}/>
${name && html`<input type="hidden" name=${name} value=${current}/>`}
</${Fragment}>`;
}