| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- <!doctype html>
- <html lang="zh-CN">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>{% block title %}wind104 运维台{% endblock %}</title>
- <style>
- :root {
- --bg:#f1f5f9; --card:#fff; --line:#e3e9f2; --line2:#eff3f9;
- --ink:#0f172a; --ink2:#334155; --muted:#64748b;
- --brand:#2563eb; --brand-d:#1d4ed8; --brand-l:#eff5ff;
- --ok:#15803d; --warn:#b45309; --bad:#b91c1c; --off:#5b6b82;
- --r:10px; --shadow:0 1px 2px rgba(15,23,42,.05), 0 10px 24px -18px rgba(15,23,42,.35);
- }
- * { box-sizing:border-box; }
- body { margin:0; font:14px/1.55 "Microsoft YaHei","PingFang SC","Segoe UI",system-ui,sans-serif;
- color:var(--ink); background:var(--bg); -webkit-font-smoothing:antialiased; }
- a { color:var(--brand-d); text-decoration:none; }
- a:hover { text-decoration:underline; }
- /* ---- 顶栏 ---- */
- nav { position:sticky; top:0; z-index:30; display:flex; align-items:center; gap:4px;
- height:54px; padding:0 18px; flex-wrap:wrap;
- background:linear-gradient(180deg,#13203a,#0b1526); color:#cbd5e1;
- box-shadow:0 1px 0 rgba(255,255,255,.06), 0 8px 22px -14px rgba(2,6,23,.7); }
- .brand { display:flex; align-items:center; gap:9px; margin-right:14px; }
- .brand .logo { width:26px; height:26px; border-radius:7px; text-align:center;
- background:linear-gradient(135deg,#3b82f6,#1d4ed8); color:#fff;
- font:700 10.5px/26px "Segoe UI",sans-serif; letter-spacing:.6px;
- box-shadow:inset 0 0 0 1px rgba(255,255,255,.28); }
- .brand b { color:#fff; font-size:15px; font-weight:600; letter-spacing:.2px; white-space:nowrap; }
- nav a { color:#c7d2fe; padding:6px 11px; border-radius:7px; font-size:13.5px; white-space:nowrap; }
- nav a:hover { background:rgba(148,163,184,.16); color:#fff; text-decoration:none; }
- nav a.cur { color:#fff; background:rgba(59,130,246,.30); box-shadow:inset 0 0 0 1px rgba(147,197,253,.35); }
- nav .sp { flex:1; }
- nav a.util { color:#94a3b8; font-size:12.5px; }
- main { padding:18px 20px 48px; max-width:1560px; margin:0 auto; }
- /* ---- 标题区 ---- */
- .page-head { display:flex; align-items:flex-end; justify-content:space-between; gap:12px;
- flex-wrap:wrap; margin:2px 0 14px; }
- .page-head h1 { margin:0; font-size:21px; font-weight:600; letter-spacing:-.01em; }
- .page-head .sub { margin-top:3px; color:var(--muted); font-size:12.5px; }
- .page-head .sub b { color:var(--ink); font-variant-numeric:tabular-nums; }
- .acts { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
- h1 { font-size:21px; font-weight:600; margin:2px 0 14px; }
- h2 { font-size:15px; font-weight:600; margin:18px 0 8px; color:var(--ink2); }
- /* ---- 卡片 / 指标块 ---- */
- .card { background:var(--card); border:1px solid var(--line); border-radius:var(--r);
- padding:14px 16px; margin-bottom:14px; box-shadow:var(--shadow); }
- .tiles { display:grid; grid-template-columns:repeat(auto-fit,minmax(146px,1fr)); gap:10px; margin-bottom:14px; }
- .tile { position:relative; overflow:hidden; background:var(--card); border:1px solid var(--line);
- border-radius:var(--r); padding:11px 14px 10px; box-shadow:var(--shadow); }
- .tile::before { content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background:#94a3b8; }
- .tile.t-ok::before { background:#22c55e; } .tile.t-warn::before { background:#f59e0b; }
- .tile.t-bad::before { background:#ef4444; } .tile.t-off::before { background:#94a3b8; }
- .tile.t-brand::before { background:#3b82f6; }
- .tile .v { font-size:23px; font-weight:700; line-height:1.15; letter-spacing:-.02em;
- font-variant-numeric:tabular-nums; color:var(--ink); }
- .tile .v.sm { font-size:16px; font-weight:600; padding-top:6px; }
- .tile .k { margin-top:3px; font-size:12px; color:var(--muted); }
- .kv { display:flex; flex-wrap:wrap; gap:7px 26px; font-size:13px; color:var(--ink2); }
- .kv i { font-style:normal; color:var(--muted); margin-right:3px; }
- .kv b { font-weight:600; }
- /* ---- 按钮 ---- */
- button { cursor:pointer; font:inherit; font-size:13px; font-weight:600; padding:7px 14px;
- border:1px solid var(--brand-d); border-radius:7px; color:#fff;
- background:linear-gradient(180deg,#3b82f6,#2563eb);
- box-shadow:0 1px 2px rgba(37,99,235,.35); }
- button:hover { filter:brightness(1.06); }
- button:active { transform:translateY(1px); }
- button.gray { background:#fff; color:var(--ink2); border-color:#d7dfea; box-shadow:none; font-weight:500; }
- button.gray:hover { background:#f6f8fc; }
- button.mini { padding:2px 9px; font-size:12px; border-radius:6px; }
- button.red { background:#fff; color:var(--bad); border-color:#f2c4c1; box-shadow:none; font-weight:500; }
- button.red:hover { background:#fef2f2; }
- button:disabled { opacity:.55; cursor:default; }
- .acts a button { pointer-events:none; } /* 链接里套按钮:点击统一走外层 <a> */
- /* ---- 表单控件 ---- */
- input, select, textarea { font:inherit; font-size:13px; padding:6px 9px; color:var(--ink);
- background:#fff; border:1px solid #d7dfea; border-radius:7px; }
- input:focus, select:focus, textarea:focus { outline:none; border-color:#93b4f7;
- box-shadow:0 0 0 3px rgba(59,130,246,.15); }
- input[name=q] { width:260px; }
- input[readonly] { background:#f1f5f9; color:var(--muted); }
- label.f { display:inline-flex; align-items:center; gap:6px; color:var(--ink2); font-size:13px; }
- form.inline { display:inline; }
- .frow { display:flex; flex-wrap:wrap; align-items:center; gap:9px 14px; }
- .grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:14px 22px; }
- .field { display:flex; flex-direction:column; gap:4px; min-width:0; }
- .field label { color:var(--ink2); font-weight:600; font-size:13px; }
- .field input, .field select { width:100%; }
- .field .hint { line-height:1.35; min-height:17px; }
- /* 级联下拉(风场/机型/机组)摆一起,一眼看出这是一组 */
- .casc { display:inline-flex; align-items:center; gap:10px; padding:3px 10px;
- border:1px solid #cddcf7; border-radius:8px; background:var(--brand-l); }
- .casc label.f { color:#1e40af; }
- /* ---- 表格 ---- */
- .wrap { overflow:auto; max-height:calc(100vh - 210px); background:var(--card);
- border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow); }
- table { border-collapse:separate; border-spacing:0; width:100%; background:var(--card); font-size:13px; }
- th, td { padding:8px 10px; border-bottom:1px solid var(--line2); text-align:left; vertical-align:top; }
- thead th { position:sticky; top:0; z-index:2; background:#f7f9fc; color:#475569;
- font-size:12.5px; font-weight:600; white-space:nowrap; border-bottom:1px solid var(--line); }
- tbody tr:nth-child(even) { background:#fbfcfe; }
- tbody tr:hover { background:#f2f7ff; }
- tbody tr:last-child td { border-bottom:0; }
- td.n, th.n { text-align:right; font-variant-numeric:tabular-nums; }
- td.mono, .mono { font-family:Consolas,"SF Mono",Menlo,monospace; font-size:12.5px; }
- .tbl-wide { min-width:1100px; } /* 列多的表宁可在 .wrap 里横向滚,也别把风场名挤成一字一行 */
- .nw { white-space:nowrap; }
- td.ops, th.ops { white-space:nowrap; }
- td.ops form.inline { margin-left:4px; }
- .card.wrap, .card .wrap { max-height:none; }
- /* ---- 状态标签 ---- */
- .chip { display:inline-flex; align-items:center; gap:5px; padding:1px 9px 1px 8px; border-radius:999px;
- font-size:12px; font-weight:600; line-height:18px; white-space:nowrap; border:1px solid transparent; }
- .chip::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; opacity:.85; }
- .chip.ok { background:#e9f7ef; color:var(--ok); border-color:#c7ecd4; }
- .chip.warn { background:#fef4e6; color:var(--warn); border-color:#fbe1bb; }
- .chip.bad { background:#fdecea; color:var(--bad); border-color:#f7cdca; }
- .chip.off { background:#eef1f6; color:var(--off); border-color:#dfe5ee; }
- .legend { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:0 0 12px; }
- .t-warn { color:var(--warn); } .t-bad { color:var(--bad); } .t-ok { color:var(--ok); }
- /* ---- 提示条 ---- */
- .flash { background:#ecfdf5; border:1px solid #a7f3c9; border-left:3px solid #22c55e;
- color:#065f46; padding:8px 12px; border-radius:7px; margin-bottom:12px; }
- .err { background:#fef2f2; border:1px solid #f6c6c3; border-left:3px solid #ef4444;
- color:#991b1b; padding:8px 12px; border-radius:7px; margin-bottom:12px; }
- .hint { color:var(--muted); font-size:12px; }
- .blk { display:block; margin-top:6px; }
- /* ---- 分页 ---- */
- .pager { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between;
- gap:10px 16px; margin:12px 0; padding:8px 12px; background:var(--card);
- border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow); }
- .pinfo { font-size:13px; color:var(--ink2); white-space:nowrap; }
- .pinfo b { color:var(--ink); font-variant-numeric:tabular-nums; }
- .pnav { display:flex; align-items:center; gap:4px; flex-wrap:wrap; }
- .pg { min-width:31px; height:30px; display:inline-flex; align-items:center; justify-content:center;
- padding:0 9px; border:1px solid var(--line); border-radius:7px; background:#fff;
- color:var(--ink2); font-size:13px; font-variant-numeric:tabular-nums; }
- .pg:hover { background:#f1f5f9; text-decoration:none; }
- .pg.cur { background:var(--brand); border-color:var(--brand); color:#fff; font-weight:700; }
- .pg.dis { color:#a8b3c4; background:#f8fafc; border-color:#eef2f7; cursor:default; }
- .jump { display:flex; align-items:center; gap:6px; font-size:13px; color:var(--muted); }
- /* ---- 遮罩:测点页一次请求要现扫几百 MB 原始文件,不给反馈用户就会当成卡死反复提交 ---- */
- .ld { position:fixed; inset:0; background:rgba(15,23,42,.45); backdrop-filter:blur(1px);
- display:none; align-items:center; justify-content:center; z-index:50; }
- .ld.on { display:flex; }
- .ld .box { background:#fff; border-radius:12px; padding:22px 28px; max-width:560px;
- text-align:center; box-shadow:0 18px 50px rgba(2,6,23,.45); }
- .spin { width:32px; height:32px; margin:0 auto 14px; border:3px solid #dbeafe;
- border-top-color:var(--brand); border-radius:50%; animation:sp .9s linear infinite; }
- @keyframes sp { to { transform:rotate(360deg); } }
- .ld .t { font-size:15px; font-weight:600; color:var(--ink); }
- .ld .s { margin-top:6px; }
- @media (max-width:820px) {
- nav { height:auto; padding:8px 12px; }
- main { padding:12px 12px 32px; }
- .page-head { align-items:flex-start; }
- nav .sp { display:none; }
- }
- </style>
- </head>
- <body>
- <nav>
- <span class="brand"><span class="logo">104</span><b>wind104 运维台</b></span>
- <a href="/" class="{{ 'cur' if active == 'ports' else '' }}">端口联通总览</a>
- {% for t in tables %}
- <a href="/db/{{ t }}" class="{{ 'cur' if active == t else '' }}">{{ TABLES_CN[t] }}</a>
- {% endfor %}
- <span class="sp"></span>
- <a href="/reload" class="util">让采集重载点表</a>
- <a href="/api/ports" class="util">JSON</a>
- </nav>
- <main>
- {% block body %}{% endblock %}
- </main>
- <div class="ld" id="ld" aria-live="polite">
- <div class="box">
- <div class="spin"></div>
- <div class="t" id="ld_t">正在查询…</div>
- <div class="hint blk" id="ld_s"></div>
- <div style="margin-top:14px"><button type="button" id="ld_close" class="gray" style="display:none">关闭</button></div>
- </div>
- </div>
- <script>
- (function () {
- var ld = document.getElementById('ld'), t = document.getElementById('ld_t'), s = document.getElementById('ld_s'),
- closeBtn = document.getElementById('ld_close'), hideTimer = null;
- function show(msg, sub, isDownload) {
- t.textContent = msg || '正在查询…'; s.textContent = sub || ''; ld.classList.add('on');
- // 文件下载不会触发 pageshow,遮罩不会自动消失:给一个超时 + 手动关闭按钮
- if (isDownload) {
- closeBtn.style.display = 'inline-block';
- clearTimeout(hideTimer);
- hideTimer = setTimeout(function () { ld.classList.remove('on'); closeBtn.style.display = 'none'; }, 90000);
- } else {
- closeBtn.style.display = 'none';
- clearTimeout(hideTimer);
- }
- }
- function hide() { ld.classList.remove('on'); closeBtn.style.display = 'none'; clearTimeout(hideTimer); }
- // 整页跳转:浏览器一收到新文档就会跑 onload/pageshow,届时上面这段脚本已不存在,
- // 遮罩自然消失,不需要额外计时器兜底(计时器反而会在新页面慢的时候误关)。
- document.addEventListener('submit', function (e) {
- var f = e.target;
- if (!f.classList || !f.classList.contains('loadable')) return;
- show(f.getAttribute('data-ld'), f.getAttribute('data-ld-sub'), false);
- });
- document.addEventListener('click', function (e) {
- var a = e.target && e.target.closest ? e.target.closest('a.loadable') : null;
- if (!a || a.target === '_blank') return;
- // 导出 CSV / 导出带值 是文件下载,不会跳转页面,遮罩需要超时 + 手动关闭
- var isDownload = /\/export(\?|$)/.test(a.href || '');
- show(a.getAttribute('data-ld') || '正在打开…', a.getAttribute('data-ld-sub'), isDownload);
- });
- window.addEventListener('pageshow', hide);
- closeBtn.addEventListener('click', hide);
- })();
- </script>
- </body>
- </html>
|