You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
3.8 KiB
81 lines
3.8 KiB
{% extends "base.html" %}
|
|
|
|
{% block title %}HappyWedding{% endblock %}
|
|
|
|
{% block content %}
|
|
<section class="mb-5 flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between">
|
|
<div class="flex items-center gap-2">
|
|
<h2 class="page-title">审计日志</h2>
|
|
<span class="status-badge status-badge-muted">{{ logs|length }} 条</span>
|
|
</div>
|
|
<div class="flex flex-wrap items-center gap-2">
|
|
{% if selected_action_type %}
|
|
<span class="summary-metric">动作 {{ selected_action_type }}</span>
|
|
{% endif %}
|
|
{% if from_date or to_date %}
|
|
<span class="summary-metric">{{ from_date or '开始' }} - {{ to_date or '今天' }}</span>
|
|
{% endif %}
|
|
</div>
|
|
</section>
|
|
|
|
<section class="mb-5 card shadow-soft">
|
|
<div class="card-body">
|
|
<form method="get" class="space-y-4">
|
|
<div class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-5">
|
|
<select name="actor_user_id" class="form-select">
|
|
<option value="">操作人:全部</option>
|
|
{% for account in accounts %}
|
|
<option value="{{ account.id }}" {% if selected_actor_user_id == account.id %}selected{% endif %}>{{ account.display_name or account.username }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<select name="action_type" class="form-select">
|
|
<option value="">动作:全部</option>
|
|
{% for action in action_types %}
|
|
<option value="{{ action }}" {% if selected_action_type == action %}selected{% endif %}>{{ action }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<input type="date" name="from_date" value="{{ from_date }}" class="form-input" placeholder="起始日期">
|
|
<input type="date" name="to_date" value="{{ to_date }}" class="form-input" placeholder="结束日期">
|
|
<button type="submit" class="btn btn-primary">筛选</button>
|
|
</div>
|
|
<div class="flex items-center justify-between border-t border-neutral-100 pt-3 text-xs text-neutral-500 dark:border-neutral-700 dark:text-neutral-400">
|
|
<span>按自然日筛选</span>
|
|
<a class="font-medium hover:text-neutral-700 dark:hover:text-neutral-200" href="{{ url_for('admin.audit_logs') }}">清空筛选</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="table-container shadow-soft">
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-left text-sm">
|
|
<thead class="table-header">
|
|
<tr>
|
|
<th class="px-4 py-3">时间</th>
|
|
<th class="px-4 py-3">操作人</th>
|
|
<th class="px-4 py-3">动作</th>
|
|
<th class="px-4 py-3">对象</th>
|
|
<th class="px-4 py-3">详情</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for log in logs %}
|
|
<tr class="table-row">
|
|
<td class="px-4 py-3 text-neutral-500 dark:text-neutral-400">{{ log.created_at.strftime('%Y-%m-%d %H:%M:%S') if log.created_at else '-' }}</td>
|
|
<td class="px-4 py-3 font-medium text-neutral-700 dark:text-neutral-200">{{ log.actor_display_name or log.actor_username }}</td>
|
|
<td class="px-4 py-3"><span class="status-badge status-badge-muted">{{ log.action_type }}</span></td>
|
|
<td class="px-4 py-3 text-neutral-500 dark:text-neutral-400">{{ log.target_type }}{% if log.target_id %}#{{ log.target_id }}{% endif %}</td>
|
|
<td class="px-4 py-3">
|
|
<a class="btn btn-secondary btn-sm" href="{{ url_for('admin.audit_log_detail', log_id=log.id) }}">查看</a>
|
|
</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr>
|
|
<td colspan="5" class="empty-state">暂无日志</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
{% endblock %}
|
|
|