feat(ui): 交付第8个子页面【设备数据库管理】UI重构与全链路功能联动

- 页面交付清单 (已累计完成 8/11 个页面):
  1. 语言设置 (已完工)
  2. 版型切换 (已完工)
  3. 心率区间设置 (已完工)
  4. 自动连接配置 (已完工)
  5. 手环配置 (已完工)
  6. DFU固件升级 (已完工)
  7. 用户管理 (已完工)
  8. 设备数据库管理 (本次交付·已完工)
- 核心重构亮点:
  1. 采纳 Master-Detail Inset Station 经典双栏比例 (360px 1fr);
  2. 全量遵循 #2563EB 核心主色蓝体系与柔和调和语义色规范;
  3. 严格对齐原版文字:【📡 设备数据库 (统一充电与状态管理)】、【默认同步天数】与【批量解绑全部】;
  4. 完备支持任意手环设备单选/多选/全选联动,动态响应同步台数;
  5. 支持自由配置 1天/3天/7天/14天/30天 同步时间范围;
  6. 集齐 6 件套交付物 (baseline_ui.html, image.png, DESIGN_SPEC.md, implementation_plan.md, CARD 任务卡, README 更新)。
This commit is contained in:
zhy200308
2026-08-17 18:33:28 +08:00
parent 393f1a97f4
commit 75a642f4e9
23 changed files with 1807 additions and 98 deletions
@@ -0,0 +1,214 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>方案 2:Master-Detail Inset Station 经典双栏 (360px 1fr + 任意勾选与自由时间)</title>
<style>
:root {
--color-primary: #2563EB;
--color-primary-dark: #1D4ED8;
--color-primary-light: #EFF6FF;
--color-primary-border: #DBEAFE;
--color-primary-glow: rgba(37, 99, 235, 0.22);
--color-primary-gradient: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
--bg: #EEF2F6;
--surface: #FFFFFF;
--text-main: #0F172A;
--text-sub: #64748B;
--divider: #E2E8F0;
--color-warning: #D97706;
--color-warning-bg: #FFFBEB;
--color-warning-border: #FDE68A;
--color-danger: #E11D48;
--color-danger-bg: #FFF1F2;
--color-danger-border: #FFE4E6;
--content-max-width: 1160px;
--content-gutter: clamp(16px, 2.5vw, 32px);
--appbar-height: 60px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Segoe UI", Roboto, sans-serif;
background: var(--bg); color: var(--text-main); min-height: 100vh;
padding: var(--content-gutter); display: flex; flex-direction: column;
}
.device-wrapper {
width: 100%; max-width: var(--content-max-width); margin: 0 auto; background: var(--surface);
border-radius: 20px; border: 1px solid var(--divider); box-shadow: 0 16px 40px -10px rgba(15, 23, 42, 0.08);
overflow: hidden; position: relative; min-height: 660px; display: flex; flex-direction: column;
}
.appbar {
height: var(--appbar-height); display: flex; align-items: center; justify-content: space-between;
padding: 0 20px; border-bottom: 1px solid var(--divider); background: var(--surface);
}
.appbar-left { display: flex; align-items: center; }
.appbar-nav, .appbar-more {
width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
cursor: pointer; background: transparent; border: none;
}
.appbar-nav svg, .appbar-more svg { width: 22px; height: 22px; fill: var(--text-main); }
.appbar-title { font-size: 19px; font-weight: 700; margin-left: 10px; }
/* 360px 1fr 经典双栏 */
.split-body {
padding: clamp(20px, 2.5vw, 30px); background: #F8FAFC; flex: 1; overflow-y: auto;
display: grid; grid-template-columns: 360px 1fr; gap: 20px; max-height: calc(100vh - 120px);
}
.station-side-panel {
background: white; border: 1.5px solid var(--divider); border-radius: 16px; padding: 22px;
display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
}
.devices-main-panel {
background: white; border: 1.5px solid var(--divider); border-radius: 16px; padding: 20px;
display: flex; flex-direction: column; gap: 12px; overflow-y: auto;
}
.stat-box {
background: #F8FAFC; border: 1px solid var(--divider); border-radius: 10px; padding: 12px 14px;
display: flex; justify-content: space-between; align-items: center;
}
.time-box-label { font-size: 13px; font-weight: 700; color: var(--text-main); margin-bottom: 6px; }
.time-select-full {
width: 100%; height: 38px; background: white; border: 1.5px solid #CBD5E1; border-radius: 8px;
padding: 0 12px; font-size: 13.5px; font-weight: 700; outline: none; cursor: pointer;
}
.btn-dynamic-full {
width: 100%; height: 44px; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer;
display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.15s ease;
}
.btn-primary-full {
background: var(--color-primary-gradient); color: white; border: none;
box-shadow: 0 4px 12px var(--color-primary-glow);
}
.btn-primary-full:hover { transform: translateY(-1px); box-shadow: 0 6px 16px var(--color-primary-glow); }
.btn-danger-full {
background: var(--color-danger-bg); color: var(--color-danger); border: 1.5px solid var(--color-danger-border);
}
.dev-inset-row {
border: 1.5px solid var(--divider); border-radius: 12px; padding: 14px 18px;
display: flex; align-items: center; justify-content: space-between; transition: all 0.15s ease; cursor: pointer;
}
.dev-inset-row:hover { border-color: var(--color-primary); background: #F8FAFC; }
.dev-inset-row.selected { border-color: var(--color-primary); background: var(--color-primary-light); }
</style>
</head>
<body>
<div class="device-wrapper">
<header class="appbar">
<div class="appbar-left">
<button class="appbar-nav"><svg viewBox="0 0 24 24"><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/></svg></button>
<h1 class="appbar-title">设备数据库管理</h1>
</div>
<button class="appbar-more"><svg viewBox="0 0 24 24"><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/></svg></button>
</header>
<main class="split-body">
<!-- 左侧 360px 控制中心 -->
<div class="station-side-panel">
<div style="display: flex; flex-direction: column; gap: 14px;">
<div>
<h2 style="font-size: 17.5px; font-weight: 700; color: var(--color-primary);">📡 充电机柜遥测大盘</h2>
<p style="font-size: 12.5px; color: var(--text-sub); margin-top: 4px;">统一供电、固件巡检与广播遥测</p>
</div>
<div class="stat-box">
<span style="font-size: 13px; color: var(--text-sub);">已登记手环</span>
<span style="font-size: 16px; font-weight: 700; color: var(--color-primary);">7 台</span>
</div>
<div>
<div class="time-box-label">默认同步时间范围</div>
<select class="time-select-full" id="opt2DaysSelect">
<option value="1">1 天 (今日数据)</option>
<option value="3">3 天 (近期数据)</option>
<option value="7" selected>7 天 (近一周数据)</option>
<option value="14">14 天 (近两周数据)</option>
<option value="30">30 天 (近一月数据)</option>
</select>
</div>
</div>
<div style="display: flex; flex-direction: column; gap: 10px;">
<button class="btn-dynamic-full btn-primary-full" id="opt2SyncBtn" onclick="alert('执行批量同步')">
<svg style="width: 16px; height: 16px; fill: currentColor;" viewBox="0 0 24 24"><path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"/></svg>
<span id="opt2SyncBtnText">开始同步已选手环 (2 台)</span>
</button>
<button class="btn-dynamic-full btn-danger-full" onclick="confirm('确认解绑全部设备?')">
<span>批量解绑全部</span>
</button>
</div>
</div>
<!-- 右侧 1fr 设备勾选矩阵 -->
<div class="devices-main-panel">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px;">
<span style="font-size: 14px; font-weight: 700;">手环设备清单 (支持任意单选与多选)</span>
<div style="display: flex; gap: 10px;">
<button style="background: transparent; border: none; font-size: 13px; font-weight: 700; color: var(--color-primary); cursor: pointer;" onclick="opt2SelectAll(true)">全选</button>
<button style="background: transparent; border: none; font-size: 13px; font-weight: 700; color: var(--text-sub); cursor: pointer;" onclick="opt2SelectAll(false)">清除</button>
</div>
</div>
<div class="dev-inset-row selected" onclick="opt2Toggle(this)">
<div style="display: flex; align-items: center; gap: 14px;">
<input type="checkbox" class="opt2-chk" checked onclick="event.stopPropagation(); opt2UpdateCount();" style="width: 18px; height: 18px; accent-color: var(--color-primary);">
<div>
<b style="font-family: monospace; font-size: 15px;">33X_BLE_62200024</b>
<div style="font-size: 12px; color: var(--text-sub); margin-top: 2px;">电量: 未知 · 固件: 未知 · 同步: 2026-08-12 14:32:25</div>
</div>
</div>
<span style="background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid var(--color-warning-border); padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 700;">未绑定</span>
</div>
<div class="dev-inset-row selected" onclick="opt2Toggle(this)">
<div style="display: flex; align-items: center; gap: 14px;">
<input type="checkbox" class="opt2-chk" checked onclick="event.stopPropagation(); opt2UpdateCount();" style="width: 18px; height: 18px; accent-color: var(--color-primary);">
<div>
<b style="font-family: monospace; font-size: 15px;">33X_BLE_2200002</b>
<div style="font-size: 12px; color: var(--text-sub); margin-top: 2px;">电量: 未知 · 固件: 未知 · 同步: 2026-08-12 14:32:25</div>
</div>
</div>
<span style="background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid var(--color-warning-border); padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 700;">未绑定</span>
</div>
<div class="dev-inset-row" onclick="opt2Toggle(this)">
<div style="display: flex; align-items: center; gap: 14px;">
<input type="checkbox" class="opt2-chk" onclick="event.stopPropagation(); opt2UpdateCount();" style="width: 18px; height: 18px; accent-color: var(--color-primary);">
<div>
<b style="font-family: monospace; font-size: 15px;">33X_BLE_62200025</b>
<div style="font-size: 12px; color: var(--text-sub); margin-top: 2px;">电量: 未知 · 固件: 未知 · 同步: 2026-08-12 14:32:25</div>
</div>
</div>
<span style="background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid var(--color-warning-border); padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 700;">未绑定</span>
</div>
</div>
</main>
</div>
<script>
function opt2Toggle(row) {
const chk = row.querySelector('.opt2-chk');
chk.checked = !chk.checked;
if (chk.checked) row.classList.add('selected');
else row.classList.remove('selected');
opt2UpdateCount();
}
function opt2SelectAll(sel) {
document.querySelectorAll('.dev-inset-row').forEach(r => {
r.querySelector('.opt2-chk').checked = sel;
if (sel) r.classList.add('selected');
else r.classList.remove('selected');
});
opt2UpdateCount();
}
function opt2UpdateCount() {
const count = document.querySelectorAll('.opt2-chk:checked').length;
document.getElementById('opt2SyncBtnText').innerText = count > 0 ? `开始同步已选手环 (${count} 台)` : `请勾选要同步的手环`;
document.getElementById('opt2SyncBtn').disabled = (count === 0);
}
</script>
</body>
</html>