feat: docking log management, sim_time DB-only, modal helpers

- Add docking_log_list and docking_log_delete routes with dedicated page
- _append_docking_log: detect existing state interval before creating new entry
- _append_undocking_log: find entry by node title+at_time, accept docked_at param
- Fix _entry_state_label and _entry_location to return time-correct values
- Add api_set_sim_time POST endpoint; remove sim_time from all url_for() calls
- _resolve_simulation_time simplified to DB-only (no URL param)
- app.js: add openModal/closeModal/toggleTheme helpers
- base.html: add 对接日志管理 nav item, remove Today button

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 16:19:32 +08:00
co-authored by Claude Opus 4.7
parent dd5210c203
commit ac5141fd02
4 changed files with 196 additions and 23 deletions
+9
View File
@@ -79,6 +79,15 @@
<span class="ic"></span>燃料换算
</a>
<div class="nst" onclick="this.classList.toggle('on')">
<span class="ar"></span>控制台
</div>
<div class="niw">
<a class="ni su{% if active_page == 'docking_logs' %} act{% endif %}" href="{{ url_for('web.docking_log_list') }}">
<span class="ic"></span>对接日志管理
</a>
</div>
<a class="ni" href="{{ url_for('api.health') }}">
<span class="ic">📡</span>API 健康检查
</a>
+41
View File
@@ -0,0 +1,41 @@
{% extends "base.html" %}
{% block content %}
<div class="ph fi">
<div class="ey">Console</div>
<h1>对接日志管理</h1>
</div>
<table>
<thead><tr>
<th>对接时间</th><th>分离时间</th><th>母舰</th><th>子载具</th><th>备注</th><th>操作</th>
</tr></thead>
<tbody>
{% for e in events %}
<tr>
<td class="mt">{{ e.docked_at.strftime('%Y-%m-%d %H:%M') if e.docked_at else '-' }}</td>
<td class="mt">{{ e.undocked_at.strftime('%Y-%m-%d %H:%M') if e.undocked_at else '-' }}</td>
<td>
{% if e.parent_asset %}
<a href="{{ url_for('web.asset_detail', asset_id=e.parent_asset.id) }}" style="color:var(--accent)">{{ e.parent_asset.name }}</a>
{% else %}-{% endif %}
</td>
<td>
{% if e.child_asset %}
<a href="{{ url_for('web.asset_detail', asset_id=e.child_asset.id) }}" style="color:var(--accent)">{{ e.child_asset.name }}</a>
{% elif e.child_label %}{{ e.child_label }}
{% else %}-{% endif %}
</td>
<td class="mt" style="max-width:300px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">{{ e.dock_note or '-' }}</td>
<td>
<form method="post" action="{{ url_for('web.docking_log_delete', event_id=e.id) }}" style="display:inline" onsubmit="return confirm('确定删除这条对接记录?相关日志也会被清理。')">
<button class="danger-link" type="submit" style="font-size:.66rem;border:none;background:none;color:var(--red);cursor:pointer">Del</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<p class="mt" style="margin-top:12px">{{ events|length }} records</p>
{% endblock %}