初始提交:5G 基站退服时长智能分析与故障闭环管控系统
Flask + SQLite 后端,免构建 React + ECharts 前端,含合成样例数据。 测试参考数据(FOR-TEST-ONLY)与运行时数据库不入库。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
f8d1ccc526
39 files changed
+29010
No files matched your search
@@ -0,0 +1,66 @@
|
||||
/* 内容层组件。只放有实际逻辑的组件;纯布局直接写 className(.grid / .row / .grow / .note / .chips,见 app.css)。 */
|
||||
import {Card, Fragment, html, Picker, useState} from 'vendor';
|
||||
import {CAUSE_COLOR, LEVEL_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 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}>`;
|
||||
}
|
||||
Reference in new issue
Block a user