75a642f4e9
- 页面交付清单 (已累计完成 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 更新)。
426 lines
21 KiB
HTML
426 lines
21 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>方案 1:Fluid Telemetry Pro 现代工控流 (条目流式 + 精准时间与设备勾选)</title>
|
||
<style>
|
||
/* =========================================================================
|
||
全局统一色彩与 Design Tokens (严格遵循 #2563EB 体系)
|
||
========================================================================= */
|
||
:root {
|
||
--color-primary: #2563EB;
|
||
--color-primary-dark: #1D4ED8;
|
||
--color-on-primary-container: #1E40AF;
|
||
--color-primary-light: #EFF6FF;
|
||
--color-primary-container: #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;
|
||
--surface-sub: #F8FAFC;
|
||
--text-main: #0F172A;
|
||
--text-sub: #64748B;
|
||
--text-dim: #94A3B8;
|
||
--divider: #E2E8F0;
|
||
--border-card: #E2E8F0;
|
||
|
||
--color-warning: #D97706;
|
||
--color-warning-bg: #FFFBEB;
|
||
--color-warning-border: #FDE68A;
|
||
|
||
--color-danger: #E11D48;
|
||
--color-danger-bg: #FFF1F2;
|
||
--color-danger-border: #FFE4E6;
|
||
|
||
--corner-card: 16px;
|
||
--corner-item: 10px;
|
||
--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; -webkit-font-smoothing: antialiased;
|
||
}
|
||
|
||
.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;
|
||
}
|
||
|
||
/* 视图状态机容器 */
|
||
.view-panel { display: none; flex-direction: column; flex: 1; }
|
||
.view-panel.active { display: flex; }
|
||
|
||
/* 1. AppBar */
|
||
.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); flex-shrink: 0;
|
||
}
|
||
.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; transition: all 0.15s ease;
|
||
}
|
||
.appbar-nav:hover, .appbar-more:hover { background: rgba(15, 23, 42, 0.06); transform: scale(0.96); }
|
||
.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; }
|
||
|
||
/* =========================================================================
|
||
VIEW 1: 设备数据库管理主界面
|
||
========================================================================= */
|
||
.control-top-bar {
|
||
padding: 12px 24px; background: #F8FAFC; border-bottom: 1px solid var(--divider);
|
||
display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
|
||
}
|
||
.banner-title-area { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 700; color: var(--text-main); }
|
||
.banner-badge {
|
||
background: var(--color-primary-light); color: var(--color-primary); border: 1.5px solid var(--color-primary-border);
|
||
padding: 3px 10px; border-radius: 100px; font-size: 12px; font-weight: 700;
|
||
}
|
||
|
||
.top-actions-group { display: flex; align-items: center; gap: 10px; }
|
||
|
||
.btn-ctrl-action {
|
||
height: 38px; padding: 0 16px; border-radius: 8px; font-size: 13.5px; font-weight: 700;
|
||
cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all 0.15s ease;
|
||
border: 1.5px solid transparent;
|
||
}
|
||
.btn-primary-sync {
|
||
background: var(--color-primary-gradient); color: white;
|
||
box-shadow: 0 2px 8px var(--color-primary-glow);
|
||
}
|
||
.btn-primary-sync:hover { transform: translateY(-1px); box-shadow: 0 4px 14px var(--color-primary-glow); }
|
||
|
||
.btn-danger-ghost {
|
||
background: #FFFFFF; color: var(--color-danger); border-color: var(--color-danger-border);
|
||
}
|
||
.btn-danger-ghost:hover { background: var(--color-danger-bg); border-color: var(--color-danger); }
|
||
|
||
/* 主列表流式卡片容器 */
|
||
.devices-stream-body {
|
||
padding: clamp(18px, 2.5vw, 26px); background: #F8FAFC; flex: 1; overflow-y: auto;
|
||
display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 180px);
|
||
}
|
||
|
||
.device-row-card {
|
||
background: var(--surface); border: 1.5px solid var(--border-card); border-radius: 14px;
|
||
padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px;
|
||
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03); transition: all 0.2s ease;
|
||
}
|
||
.device-row-card:hover {
|
||
border-color: #CBD5E1; box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06); transform: translateY(-1px);
|
||
}
|
||
|
||
.dev-left-zone { display: flex; align-items: center; gap: 16px; }
|
||
.ble-avatar-box {
|
||
width: 48px; height: 48px; border-radius: 12px; background: var(--color-primary-light);
|
||
border: 1.5px solid var(--color-primary-border); display: flex; align-items: center; justify-content: center;
|
||
flex-shrink: 0; box-shadow: 0 2px 6px rgba(37, 99, 235, 0.08);
|
||
}
|
||
.ble-avatar-box svg { width: 24px; height: 24px; fill: var(--color-primary); }
|
||
|
||
.dev-info-stack { display: flex; flex-direction: column; gap: 4px; }
|
||
.dev-name-title { font-size: 16px; font-weight: 700; font-family: ui-monospace, monospace; color: var(--text-main); }
|
||
.dev-meta-line { font-size: 13px; color: var(--text-sub); display: flex; gap: 14px; flex-wrap: wrap; }
|
||
.dev-meta-line span b { color: var(--text-main); font-weight: 600; font-family: ui-monospace, monospace; }
|
||
|
||
.status-badge-soft {
|
||
font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 6px;
|
||
background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid var(--color-warning-border);
|
||
}
|
||
|
||
/* =========================================================================
|
||
VIEW 2: 批量历史数据同步子页面 (支持任意勾选与自由时间选择)
|
||
========================================================================= */
|
||
.sync-header-controls {
|
||
padding: 14px 24px; background: #F8FAFC; border-bottom: 1px solid var(--divider);
|
||
display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
|
||
}
|
||
|
||
.sync-time-selector {
|
||
display: flex; align-items: center; gap: 10px;
|
||
}
|
||
.time-label { font-size: 14px; font-weight: 700; color: var(--text-main); }
|
||
.time-select-dropdown {
|
||
height: 38px; min-width: 140px; background: #FFFFFF; border: 1.5px solid #CBD5E1; border-radius: 8px;
|
||
padding: 0 12px; font-size: 13.5px; font-weight: 700; color: var(--text-main); outline: none;
|
||
cursor: pointer; transition: all 0.15s ease;
|
||
}
|
||
.time-select-dropdown:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }
|
||
|
||
.sync-select-tools { display: flex; align-items: center; gap: 12px; }
|
||
.btn-text-tool {
|
||
background: transparent; border: none; font-size: 14px; font-weight: 700;
|
||
color: var(--color-primary); cursor: pointer; padding: 6px 10px; border-radius: 6px;
|
||
transition: all 0.15s ease;
|
||
}
|
||
.btn-text-tool:hover { background: var(--color-primary-light); }
|
||
.btn-text-tool.dim { color: var(--text-sub); }
|
||
.btn-text-tool.dim:hover { background: #F1F5F9; color: var(--text-main); }
|
||
|
||
.sync-list-container {
|
||
padding: clamp(18px, 2.5vw, 26px); background: #FFFFFF; flex: 1; overflow-y: auto;
|
||
display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 240px);
|
||
}
|
||
|
||
.sync-item-card {
|
||
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; user-select: none;
|
||
}
|
||
.sync-item-card:hover { border-color: var(--color-primary); background: #F8FAFC; }
|
||
.sync-item-card.selected {
|
||
border-color: var(--color-primary); background: var(--color-primary-light);
|
||
}
|
||
|
||
.sync-item-left { display: flex; align-items: center; gap: 14px; }
|
||
.sync-chk-box {
|
||
width: 20px; height: 20px; accent-color: var(--color-primary); cursor: pointer;
|
||
}
|
||
|
||
.sync-bottom-action-bar {
|
||
padding: 16px 24px; background: #FFFFFF; border-top: 1px solid var(--divider);
|
||
}
|
||
.btn-execute-sync-full {
|
||
width: 100%; height: 48px; background: var(--color-primary-gradient); color: white;
|
||
border: none; border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer;
|
||
display: flex; align-items: center; justify-content: center; gap: 8px;
|
||
box-shadow: 0 4px 14px var(--color-primary-glow); transition: all 0.15s ease;
|
||
}
|
||
.btn-execute-sync-full:hover { transform: translateY(-1px); box-shadow: 0 6px 18px var(--color-primary-glow); }
|
||
.btn-execute-sync-full:disabled { background: #CBD5E1; cursor: not-allowed; box-shadow: none; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="device-wrapper">
|
||
<!-- ========================================== -->
|
||
<!-- VIEW 1: 设备数据库管理主界面 -->
|
||
<!-- ========================================== -->
|
||
<div class="view-panel active" id="viewMain">
|
||
<header class="appbar">
|
||
<div class="appbar-left">
|
||
<button class="appbar-nav" title="返回"><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>
|
||
|
||
<div class="control-top-bar">
|
||
<div class="banner-title-area">
|
||
<span>📡 设备数据库 (统一充电与状态管理)</span>
|
||
<span class="banner-badge" id="mainTotalCountBadge">已登记 7 台设备</span>
|
||
</div>
|
||
<div class="top-actions-group">
|
||
<button class="btn-ctrl-action btn-primary-sync" onclick="openBatchSyncView()">
|
||
<svg style="width: 15px; height: 15px; 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>批量同步</span>
|
||
</button>
|
||
<button class="btn-ctrl-action btn-danger-ghost" onclick="triggerUnbindAll()">
|
||
<svg style="width: 15px; height: 15px; fill: currentColor;" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
|
||
<span>批量解绑全部</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<main class="devices-stream-body" id="mainDeviceList">
|
||
<!-- 33X_BLE_62200024 -->
|
||
<div class="device-row-card">
|
||
<div class="dev-left-zone">
|
||
<div class="ble-avatar-box"><svg viewBox="0 0 24 24"><path d="M14.24 12.01l2.32-2.32c.28-.28.28-.75 0-1.03l-4.24-4.24c-.33-.33-.89-.1-.89.37V10.1l-3.3-3.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l3.86 3.86-3.86 3.86a.754.754 0 0 0 0 1.06c.29.29.77.29 1.06 0l3.3-3.3v5.39c0 .47.56.7.89.37l4.24-4.24c.28-.28.28-.75 0-1.03l-2.32-2.32zm-1.31-4.73l1.88 1.88-1.88 1.88V7.28zm0 9.44v-3.76l1.88 1.88-1.88 1.88z"/></svg></div>
|
||
<div class="dev-info-stack">
|
||
<div class="dev-name-title">33X_BLE_62200024</div>
|
||
<div class="dev-meta-line">
|
||
<span>电量: <b>未知</b></span>
|
||
<span>固件: <b>未知</b></span>
|
||
<span>最后同步: <b>2026-08-12 14:32:25</b></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<span class="status-badge-soft">未绑定</span>
|
||
</div>
|
||
|
||
<!-- 33X_BLE_2200002 -->
|
||
<div class="device-row-card">
|
||
<div class="dev-left-zone">
|
||
<div class="ble-avatar-box"><svg viewBox="0 0 24 24"><path d="M14.24 12.01l2.32-2.32c.28-.28.28-.75 0-1.03l-4.24-4.24c-.33-.33-.89-.1-.89.37V10.1l-3.3-3.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l3.86 3.86-3.86 3.86a.754.754 0 0 0 0 1.06c.29.29.77.29 1.06 0l3.3-3.3v5.39c0 .47.56.7.89.37l4.24-4.24c.28-.28.28-.75 0-1.03l-2.32-2.32zm-1.31-4.73l1.88 1.88-1.88 1.88V7.28zm0 9.44v-3.76l1.88 1.88-1.88 1.88z"/></svg></div>
|
||
<div class="dev-info-stack">
|
||
<div class="dev-name-title">33X_BLE_2200002</div>
|
||
<div class="dev-meta-line">
|
||
<span>电量: <b>未知</b></span>
|
||
<span>固件: <b>未知</b></span>
|
||
<span>最后同步: <b>2026-08-12 14:32:25</b></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<span class="status-badge-soft">未绑定</span>
|
||
</div>
|
||
|
||
<!-- 33X_BLE_62200025 -->
|
||
<div class="device-row-card">
|
||
<div class="dev-left-zone">
|
||
<div class="ble-avatar-box"><svg viewBox="0 0 24 24"><path d="M14.24 12.01l2.32-2.32c.28-.28.28-.75 0-1.03l-4.24-4.24c-.33-.33-.89-.1-.89.37V10.1l-3.3-3.3a.754.754 0 0 0-1.06 0c-.29.29-.29.77 0 1.06l3.86 3.86-3.86 3.86a.754.754 0 0 0 0 1.06c.29.29.77.29 1.06 0l3.3-3.3v5.39c0 .47.56.7.89.37l4.24-4.24c.28-.28.28-.75 0-1.03l-2.32-2.32zm-1.31-4.73l1.88 1.88-1.88 1.88V7.28zm0 9.44v-3.76l1.88 1.88-1.88 1.88z"/></svg></div>
|
||
<div class="dev-info-stack">
|
||
<div class="dev-name-title">33X_BLE_62200025</div>
|
||
<div class="dev-meta-line">
|
||
<span>电量: <b>未知</b></span>
|
||
<span>固件: <b>未知</b></span>
|
||
<span>最后同步: <b>2026-08-12 14:32:25</b></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<span class="status-badge-soft">未绑定</span>
|
||
</div>
|
||
</main>
|
||
</div>
|
||
|
||
<!-- ========================================== -->
|
||
<!-- VIEW 2: 批量历史数据同步子页面 -->
|
||
<!-- ========================================== -->
|
||
<div class="view-panel" id="viewBatchSync">
|
||
<header class="appbar">
|
||
<div class="appbar-left">
|
||
<button class="appbar-nav" onclick="showMainView()" title="返回设备数据库"><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>
|
||
</header>
|
||
|
||
<div class="sync-header-controls">
|
||
<div class="sync-time-selector">
|
||
<span class="time-label">默认同步天数:</span>
|
||
<select class="time-select-dropdown" id="syncDaysSelect" onchange="handleTimeRangeChange(this.value)">
|
||
<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 class="sync-select-tools">
|
||
<button class="btn-text-tool" onclick="selectAllSync(true)">全选</button>
|
||
<button class="btn-text-tool dim" onclick="selectAllSync(false)">清除</button>
|
||
</div>
|
||
</div>
|
||
|
||
<main class="sync-list-container" id="syncItemList">
|
||
<div class="sync-item-card selected" onclick="toggleCardSelection(this)">
|
||
<div class="sync-item-left">
|
||
<input type="checkbox" class="sync-chk-box" checked onclick="event.stopPropagation(); updateSyncBtnState();">
|
||
<div>
|
||
<b style="font-family: monospace; font-size: 14.5px;">33X_BLE_62200024</b>
|
||
<div style="font-size: 12px; color: var(--text-sub); margin-top: 2px;">最后同步: 2026-08-12 14:32:25 · 待回传 <span class="sync-day-badge">7</span> 天心率数据</div>
|
||
</div>
|
||
</div>
|
||
<span style="font-size: 13px; font-weight: 700; color: var(--color-primary);">已就绪</span>
|
||
</div>
|
||
|
||
<div class="sync-item-card selected" onclick="toggleCardSelection(this)">
|
||
<div class="sync-item-left">
|
||
<input type="checkbox" class="sync-chk-box" checked onclick="event.stopPropagation(); updateSyncBtnState();">
|
||
<div>
|
||
<b style="font-family: monospace; font-size: 14.5px;">33X_BLE_2200002</b>
|
||
<div style="font-size: 12px; color: var(--text-sub); margin-top: 2px;">最后同步: 2026-08-12 14:32:25 · 待回传 <span class="sync-day-badge">7</span> 天心率数据</div>
|
||
</div>
|
||
</div>
|
||
<span style="font-size: 13px; font-weight: 700; color: var(--color-primary);">已就绪</span>
|
||
</div>
|
||
|
||
<div class="sync-item-card selected" onclick="toggleCardSelection(this)">
|
||
<div class="sync-item-left">
|
||
<input type="checkbox" class="sync-chk-box" checked onclick="event.stopPropagation(); updateSyncBtnState();">
|
||
<div>
|
||
<b style="font-family: monospace; font-size: 14.5px;">33X_BLE_62200025</b>
|
||
<div style="font-size: 12px; color: var(--text-sub); margin-top: 2px;">最后同步: 2026-08-12 14:32:25 · 待回传 <span class="sync-day-badge">7</span> 天心率数据</div>
|
||
</div>
|
||
</div>
|
||
<span style="font-size: 13px; font-weight: 700; color: var(--color-primary);">已就绪</span>
|
||
</div>
|
||
</main>
|
||
|
||
<footer class="sync-bottom-action-bar">
|
||
<button class="btn-execute-sync-full" id="btnExecuteSync" onclick="executeBatchSync()">
|
||
<svg style="width: 18px; height: 18px; 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="btnSyncTitleText">开始同步 (已选 3 台设备)</span>
|
||
</button>
|
||
</footer>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
function showMainView() {
|
||
document.querySelectorAll('.view-panel').forEach(p => p.classList.remove('active'));
|
||
document.getElementById('viewMain').classList.add('active');
|
||
}
|
||
|
||
function openBatchSyncView() {
|
||
document.querySelectorAll('.view-panel').forEach(p => p.classList.remove('active'));
|
||
document.getElementById('viewBatchSync').classList.add('active');
|
||
updateSyncBtnState();
|
||
}
|
||
|
||
function toggleCardSelection(card) {
|
||
const chk = card.querySelector('.sync-chk-box');
|
||
chk.checked = !chk.checked;
|
||
if (chk.checked) {
|
||
card.classList.add('selected');
|
||
} else {
|
||
card.classList.remove('selected');
|
||
}
|
||
updateSyncBtnState();
|
||
}
|
||
|
||
function selectAllSync(select) {
|
||
document.querySelectorAll('.sync-item-card').forEach(c => {
|
||
c.querySelector('.sync-chk-box').checked = select;
|
||
if (select) c.classList.add('selected');
|
||
else c.classList.remove('selected');
|
||
});
|
||
updateSyncBtnState();
|
||
}
|
||
|
||
function handleTimeRangeChange(days) {
|
||
document.querySelectorAll('.sync-day-badge').forEach(b => b.innerText = days);
|
||
}
|
||
|
||
function updateSyncBtnState() {
|
||
const checkedBoxes = document.querySelectorAll('.sync-chk-box:checked');
|
||
const count = checkedBoxes.length;
|
||
const btn = document.getElementById('btnExecuteSync');
|
||
const title = document.getElementById('btnSyncTitleText');
|
||
if (count === 0) {
|
||
btn.disabled = true;
|
||
title.innerText = '请选择要同步的设备';
|
||
} else {
|
||
btn.disabled = false;
|
||
title.innerText = `开始同步 (已选 ${count} 台设备)`;
|
||
}
|
||
}
|
||
|
||
function executeBatchSync() {
|
||
const count = document.querySelectorAll('.sync-chk-box:checked').length;
|
||
const days = document.getElementById('syncDaysSelect').value;
|
||
const title = document.getElementById('btnSyncTitleText');
|
||
title.innerText = `正在回传 ${count} 台手环过去 ${days} 天历史数据...`;
|
||
setTimeout(() => {
|
||
alert(`已成功同步 ${count} 台手环过去 ${days} 天的历史数据!`);
|
||
showMainView();
|
||
}, 1200);
|
||
}
|
||
|
||
function triggerUnbindAll() {
|
||
if (confirm('确认要解绑全部已登记设备吗?解绑后设备数据库将清空。')) {
|
||
alert('已成功解绑全部设备!');
|
||
}
|
||
}
|
||
</script>
|
||
</body>
|
||
</html>
|