base.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <!doctype html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>{% block title %}wind104 运维台{% endblock %}</title>
  7. <style>
  8. :root {
  9. --bg:#f1f5f9; --card:#fff; --line:#e3e9f2; --line2:#eff3f9;
  10. --ink:#0f172a; --ink2:#334155; --muted:#64748b;
  11. --brand:#2563eb; --brand-d:#1d4ed8; --brand-l:#eff5ff;
  12. --ok:#15803d; --warn:#b45309; --bad:#b91c1c; --off:#5b6b82;
  13. --r:10px; --shadow:0 1px 2px rgba(15,23,42,.05), 0 10px 24px -18px rgba(15,23,42,.35);
  14. }
  15. * { box-sizing:border-box; }
  16. body { margin:0; font:14px/1.55 "Microsoft YaHei","PingFang SC","Segoe UI",system-ui,sans-serif;
  17. color:var(--ink); background:var(--bg); -webkit-font-smoothing:antialiased; }
  18. a { color:var(--brand-d); text-decoration:none; }
  19. a:hover { text-decoration:underline; }
  20. /* ---- 顶栏 ---- */
  21. nav { position:sticky; top:0; z-index:30; display:flex; align-items:center; gap:4px;
  22. height:54px; padding:0 18px; flex-wrap:wrap;
  23. background:linear-gradient(180deg,#13203a,#0b1526); color:#cbd5e1;
  24. box-shadow:0 1px 0 rgba(255,255,255,.06), 0 8px 22px -14px rgba(2,6,23,.7); }
  25. .brand { display:flex; align-items:center; gap:9px; margin-right:14px; }
  26. .brand .logo { width:26px; height:26px; border-radius:7px; text-align:center;
  27. background:linear-gradient(135deg,#3b82f6,#1d4ed8); color:#fff;
  28. font:700 10.5px/26px "Segoe UI",sans-serif; letter-spacing:.6px;
  29. box-shadow:inset 0 0 0 1px rgba(255,255,255,.28); }
  30. .brand b { color:#fff; font-size:15px; font-weight:600; letter-spacing:.2px; white-space:nowrap; }
  31. nav a { color:#c7d2fe; padding:6px 11px; border-radius:7px; font-size:13.5px; white-space:nowrap; }
  32. nav a:hover { background:rgba(148,163,184,.16); color:#fff; text-decoration:none; }
  33. nav a.cur { color:#fff; background:rgba(59,130,246,.30); box-shadow:inset 0 0 0 1px rgba(147,197,253,.35); }
  34. nav .sp { flex:1; }
  35. nav a.util { color:#94a3b8; font-size:12.5px; }
  36. main { padding:18px 20px 48px; max-width:1560px; margin:0 auto; }
  37. /* ---- 标题区 ---- */
  38. .page-head { display:flex; align-items:flex-end; justify-content:space-between; gap:12px;
  39. flex-wrap:wrap; margin:2px 0 14px; }
  40. .page-head h1 { margin:0; font-size:21px; font-weight:600; letter-spacing:-.01em; }
  41. .page-head .sub { margin-top:3px; color:var(--muted); font-size:12.5px; }
  42. .page-head .sub b { color:var(--ink); font-variant-numeric:tabular-nums; }
  43. .acts { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
  44. h1 { font-size:21px; font-weight:600; margin:2px 0 14px; }
  45. h2 { font-size:15px; font-weight:600; margin:18px 0 8px; color:var(--ink2); }
  46. /* ---- 卡片 / 指标块 ---- */
  47. .card { background:var(--card); border:1px solid var(--line); border-radius:var(--r);
  48. padding:14px 16px; margin-bottom:14px; box-shadow:var(--shadow); }
  49. .tiles { display:grid; grid-template-columns:repeat(auto-fit,minmax(146px,1fr)); gap:10px; margin-bottom:14px; }
  50. .tile { position:relative; overflow:hidden; background:var(--card); border:1px solid var(--line);
  51. border-radius:var(--r); padding:11px 14px 10px; box-shadow:var(--shadow); }
  52. .tile::before { content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background:#94a3b8; }
  53. .tile.t-ok::before { background:#22c55e; } .tile.t-warn::before { background:#f59e0b; }
  54. .tile.t-bad::before { background:#ef4444; } .tile.t-off::before { background:#94a3b8; }
  55. .tile.t-brand::before { background:#3b82f6; }
  56. .tile .v { font-size:23px; font-weight:700; line-height:1.15; letter-spacing:-.02em;
  57. font-variant-numeric:tabular-nums; color:var(--ink); }
  58. .tile .v.sm { font-size:16px; font-weight:600; padding-top:6px; }
  59. .tile .k { margin-top:3px; font-size:12px; color:var(--muted); }
  60. .kv { display:flex; flex-wrap:wrap; gap:7px 26px; font-size:13px; color:var(--ink2); }
  61. .kv i { font-style:normal; color:var(--muted); margin-right:3px; }
  62. .kv b { font-weight:600; }
  63. /* ---- 按钮 ---- */
  64. button { cursor:pointer; font:inherit; font-size:13px; font-weight:600; padding:7px 14px;
  65. border:1px solid var(--brand-d); border-radius:7px; color:#fff;
  66. background:linear-gradient(180deg,#3b82f6,#2563eb);
  67. box-shadow:0 1px 2px rgba(37,99,235,.35); }
  68. button:hover { filter:brightness(1.06); }
  69. button:active { transform:translateY(1px); }
  70. button.gray { background:#fff; color:var(--ink2); border-color:#d7dfea; box-shadow:none; font-weight:500; }
  71. button.gray:hover { background:#f6f8fc; }
  72. button.mini { padding:2px 9px; font-size:12px; border-radius:6px; }
  73. button.red { background:#fff; color:var(--bad); border-color:#f2c4c1; box-shadow:none; font-weight:500; }
  74. button.red:hover { background:#fef2f2; }
  75. button:disabled { opacity:.55; cursor:default; }
  76. .acts a button { pointer-events:none; } /* 链接里套按钮:点击统一走外层 <a> */
  77. /* ---- 表单控件 ---- */
  78. input, select, textarea { font:inherit; font-size:13px; padding:6px 9px; color:var(--ink);
  79. background:#fff; border:1px solid #d7dfea; border-radius:7px; }
  80. input:focus, select:focus, textarea:focus { outline:none; border-color:#93b4f7;
  81. box-shadow:0 0 0 3px rgba(59,130,246,.15); }
  82. input[name=q] { width:260px; }
  83. input[readonly] { background:#f1f5f9; color:var(--muted); }
  84. label.f { display:inline-flex; align-items:center; gap:6px; color:var(--ink2); font-size:13px; }
  85. form.inline { display:inline; }
  86. .frow { display:flex; flex-wrap:wrap; align-items:center; gap:9px 14px; }
  87. .grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:14px 22px; }
  88. .field { display:flex; flex-direction:column; gap:4px; min-width:0; }
  89. .field label { color:var(--ink2); font-weight:600; font-size:13px; }
  90. .field input, .field select { width:100%; }
  91. .field .hint { line-height:1.35; min-height:17px; }
  92. /* 级联下拉(风场/机型/机组)摆一起,一眼看出这是一组 */
  93. .casc { display:inline-flex; align-items:center; gap:10px; padding:3px 10px;
  94. border:1px solid #cddcf7; border-radius:8px; background:var(--brand-l); }
  95. .casc label.f { color:#1e40af; }
  96. /* ---- 表格 ---- */
  97. .wrap { overflow:auto; max-height:calc(100vh - 210px); background:var(--card);
  98. border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow); }
  99. table { border-collapse:separate; border-spacing:0; width:100%; background:var(--card); font-size:13px; }
  100. th, td { padding:8px 10px; border-bottom:1px solid var(--line2); text-align:left; vertical-align:top; }
  101. thead th { position:sticky; top:0; z-index:2; background:#f7f9fc; color:#475569;
  102. font-size:12.5px; font-weight:600; white-space:nowrap; border-bottom:1px solid var(--line); }
  103. tbody tr:nth-child(even) { background:#fbfcfe; }
  104. tbody tr:hover { background:#f2f7ff; }
  105. tbody tr:last-child td { border-bottom:0; }
  106. td.n, th.n { text-align:right; font-variant-numeric:tabular-nums; }
  107. td.mono, .mono { font-family:Consolas,"SF Mono",Menlo,monospace; font-size:12.5px; }
  108. .tbl-wide { min-width:1100px; } /* 列多的表宁可在 .wrap 里横向滚,也别把风场名挤成一字一行 */
  109. .nw { white-space:nowrap; }
  110. td.ops, th.ops { white-space:nowrap; }
  111. td.ops form.inline { margin-left:4px; }
  112. .card.wrap, .card .wrap { max-height:none; }
  113. /* ---- 状态标签 ---- */
  114. .chip { display:inline-flex; align-items:center; gap:5px; padding:1px 9px 1px 8px; border-radius:999px;
  115. font-size:12px; font-weight:600; line-height:18px; white-space:nowrap; border:1px solid transparent; }
  116. .chip::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; opacity:.85; }
  117. .chip.ok { background:#e9f7ef; color:var(--ok); border-color:#c7ecd4; }
  118. .chip.warn { background:#fef4e6; color:var(--warn); border-color:#fbe1bb; }
  119. .chip.bad { background:#fdecea; color:var(--bad); border-color:#f7cdca; }
  120. .chip.off { background:#eef1f6; color:var(--off); border-color:#dfe5ee; }
  121. .legend { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:0 0 12px; }
  122. .t-warn { color:var(--warn); } .t-bad { color:var(--bad); } .t-ok { color:var(--ok); }
  123. /* ---- 提示条 ---- */
  124. .flash { background:#ecfdf5; border:1px solid #a7f3c9; border-left:3px solid #22c55e;
  125. color:#065f46; padding:8px 12px; border-radius:7px; margin-bottom:12px; }
  126. .err { background:#fef2f2; border:1px solid #f6c6c3; border-left:3px solid #ef4444;
  127. color:#991b1b; padding:8px 12px; border-radius:7px; margin-bottom:12px; }
  128. .hint { color:var(--muted); font-size:12px; }
  129. .blk { display:block; margin-top:6px; }
  130. /* ---- 分页 ---- */
  131. .pager { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between;
  132. gap:10px 16px; margin:12px 0; padding:8px 12px; background:var(--card);
  133. border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow); }
  134. .pinfo { font-size:13px; color:var(--ink2); white-space:nowrap; }
  135. .pinfo b { color:var(--ink); font-variant-numeric:tabular-nums; }
  136. .pnav { display:flex; align-items:center; gap:4px; flex-wrap:wrap; }
  137. .pg { min-width:31px; height:30px; display:inline-flex; align-items:center; justify-content:center;
  138. padding:0 9px; border:1px solid var(--line); border-radius:7px; background:#fff;
  139. color:var(--ink2); font-size:13px; font-variant-numeric:tabular-nums; }
  140. .pg:hover { background:#f1f5f9; text-decoration:none; }
  141. .pg.cur { background:var(--brand); border-color:var(--brand); color:#fff; font-weight:700; }
  142. .pg.dis { color:#a8b3c4; background:#f8fafc; border-color:#eef2f7; cursor:default; }
  143. .jump { display:flex; align-items:center; gap:6px; font-size:13px; color:var(--muted); }
  144. /* ---- 遮罩:测点页一次请求要现扫几百 MB 原始文件,不给反馈用户就会当成卡死反复提交 ---- */
  145. .ld { position:fixed; inset:0; background:rgba(15,23,42,.45); backdrop-filter:blur(1px);
  146. display:none; align-items:center; justify-content:center; z-index:50; }
  147. .ld.on { display:flex; }
  148. .ld .box { background:#fff; border-radius:12px; padding:22px 28px; max-width:560px;
  149. text-align:center; box-shadow:0 18px 50px rgba(2,6,23,.45); }
  150. .spin { width:32px; height:32px; margin:0 auto 14px; border:3px solid #dbeafe;
  151. border-top-color:var(--brand); border-radius:50%; animation:sp .9s linear infinite; }
  152. @keyframes sp { to { transform:rotate(360deg); } }
  153. .ld .t { font-size:15px; font-weight:600; color:var(--ink); }
  154. .ld .s { margin-top:6px; }
  155. @media (max-width:820px) {
  156. nav { height:auto; padding:8px 12px; }
  157. main { padding:12px 12px 32px; }
  158. .page-head { align-items:flex-start; }
  159. nav .sp { display:none; }
  160. }
  161. </style>
  162. </head>
  163. <body>
  164. <nav>
  165. <span class="brand"><span class="logo">104</span><b>wind104 运维台</b></span>
  166. <a href="/" class="{{ 'cur' if active == 'ports' else '' }}">端口联通总览</a>
  167. {% for t in tables %}
  168. <a href="/db/{{ t }}" class="{{ 'cur' if active == t else '' }}">{{ TABLES_CN[t] }}</a>
  169. {% endfor %}
  170. <span class="sp"></span>
  171. <a href="/reload" class="util">让采集重载点表</a>
  172. <a href="/api/ports" class="util">JSON</a>
  173. </nav>
  174. <main>
  175. {% block body %}{% endblock %}
  176. </main>
  177. <div class="ld" id="ld" aria-live="polite">
  178. <div class="box">
  179. <div class="spin"></div>
  180. <div class="t" id="ld_t">正在查询…</div>
  181. <div class="hint blk" id="ld_s"></div>
  182. <div style="margin-top:14px"><button type="button" id="ld_close" class="gray" style="display:none">关闭</button></div>
  183. </div>
  184. </div>
  185. <script>
  186. (function () {
  187. var ld = document.getElementById('ld'), t = document.getElementById('ld_t'), s = document.getElementById('ld_s'),
  188. closeBtn = document.getElementById('ld_close'), hideTimer = null;
  189. function show(msg, sub, isDownload) {
  190. t.textContent = msg || '正在查询…'; s.textContent = sub || ''; ld.classList.add('on');
  191. // 文件下载不会触发 pageshow,遮罩不会自动消失:给一个超时 + 手动关闭按钮
  192. if (isDownload) {
  193. closeBtn.style.display = 'inline-block';
  194. clearTimeout(hideTimer);
  195. hideTimer = setTimeout(function () { ld.classList.remove('on'); closeBtn.style.display = 'none'; }, 90000);
  196. } else {
  197. closeBtn.style.display = 'none';
  198. clearTimeout(hideTimer);
  199. }
  200. }
  201. function hide() { ld.classList.remove('on'); closeBtn.style.display = 'none'; clearTimeout(hideTimer); }
  202. // 整页跳转:浏览器一收到新文档就会跑 onload/pageshow,届时上面这段脚本已不存在,
  203. // 遮罩自然消失,不需要额外计时器兜底(计时器反而会在新页面慢的时候误关)。
  204. document.addEventListener('submit', function (e) {
  205. var f = e.target;
  206. if (!f.classList || !f.classList.contains('loadable')) return;
  207. show(f.getAttribute('data-ld'), f.getAttribute('data-ld-sub'), false);
  208. });
  209. document.addEventListener('click', function (e) {
  210. var a = e.target && e.target.closest ? e.target.closest('a.loadable') : null;
  211. if (!a || a.target === '_blank') return;
  212. // 导出 CSV / 导出带值 是文件下载,不会跳转页面,遮罩需要超时 + 手动关闭
  213. var isDownload = /\/export(\?|$)/.test(a.href || '');
  214. show(a.getAttribute('data-ld') || '正在打开…', a.getAttribute('data-ld-sub'), isDownload);
  215. });
  216. window.addEventListener('pageshow', hide);
  217. closeBtn.addEventListener('click', hide);
  218. })();
  219. </script>
  220. </body>
  221. </html>