Files
DEMO-AGENT/templates/attachment_manager.html

140 lines
6.0 KiB
HTML

{% extends "base.html" %}
{% load static %}
{% block title %}附件管理 - DEMO-AGENT V2{% endblock %}
{% block body_class %}app-body{% endblock %}
{% block content %}
<main class="app-shell">
<header class="topbar">
<div class="topbar-left">
<div class="tabbar" role="tablist" aria-label="页面切换">
<a class="tab" href="/" role="tab" aria-selected="false">首页</a>
<a class="tab" href="/" role="tab" aria-selected="false">审核智能体</a>
<a class="tab" href="{% url 'knowledge_base_manager' %}" role="tab" aria-selected="false">知识库管理</a>
<a class="tab active" href="{% url 'attachment_manager' %}" role="tab" aria-selected="true">附件管理</a>
</div>
</div>
<div class="topbar-right">
<div class="user-menu">
<button class="user-menu-trigger" type="button">
<span class="avatar large">{{ request.user.username|slice:":1"|upper }}</span>
<div class="user-copy">
<strong>{{ request.user.username }}</strong>
<span>当前登录用户</span>
</div>
</button>
</div>
</div>
</header>
<section
class="attachment-manager-page"
data-selected-conversation="{% if selected_conversation %}{{ selected_conversation.pk }}{% endif %}"
>
<header class="attachment-manager-hero attachment-manager-toolbar">
<div>
<p class="eyebrow">附件管理</p>
<h1>附件管理</h1>
<p>管理各对话下上传的审核资料、版本、状态和下载。</p>
</div>
<div class="attachment-manager-selectbar">
<label for="attachmentConversationSelect">对话</label>
<select class="attachment-manager-select-control" id="attachmentConversationSelect">
<option value="">请选择对话</option>
{% for conversation in conversations %}
<option
value="{{ conversation.pk }}"
{% if selected_conversation and selected_conversation.pk == conversation.pk %}selected{% endif %}
>
{{ conversation.title|default:"新对话" }} · {{ conversation.updated_at|date:"m月d日 H:i" }} · {{ conversation.attachment_count }} 个附件
</option>
{% endfor %}
</select>
{% if selected_conversation %}
<a class="return-chat-link" href="{% url 'home' %}?conversation={{ selected_conversation.pk }}">返回对话</a>
{% endif %}
</div>
</header>
{% if selected_conversation %}
<div class="attachment-manager-content attachment-manager-split">
<section class="attachment-manager-panel upload-manager-panel">
<div class="summary-subheading">
<h3>上传附件</h3>
<span>{{ selected_conversation.title|default:"新对话" }}</span>
</div>
<div
class="upload-dropzone manager-upload-dropzone"
id="managerUploadDropzone"
data-upload-url="{% url 'file_summary_attachment_upload' selected_conversation.pk %}"
tabindex="0"
role="button"
>
<input id="managerAttachmentInput" type="file" multiple hidden>
<strong>拖拽文件到这里</strong>
<span>支持 doc、docx、xls、xlsx、ppt、pptx、pdf、zip、7z、rar</span>
</div>
<p class="upload-status" id="managerUploadStatus">上传后会归属到当前选择的对话。</p>
</section>
<section class="attachment-manager-panel">
<div class="summary-subheading">
<h3>附件列表</h3>
<input class="attachment-search" id="attachmentSearch" type="search" placeholder="搜索文件名">
</div>
<div class="attachment-table-wrap">
<table class="attachment-table" id="attachmentManagerTable">
<thead>
<tr>
<th>状态</th>
<th>文件名</th>
<th>版本</th>
<th>大小</th>
<th>上传时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{% for attachment in attachments %}
<tr
data-attachment-id="{{ attachment.pk }}"
data-update-url="{% url 'file_summary_attachment_detail' selected_conversation.pk attachment.pk %}"
data-download-url="{% url 'file_summary_attachment_download' selected_conversation.pk attachment.pk %}"
>
<td>{% if attachment.is_active %}启用{% else %}禁用{% endif %}</td>
<td class="attachment-name">{{ attachment.original_name }}</td>
<td>v{{ attachment.version_no }}</td>
<td>{{ attachment.file_size }} bytes</td>
<td>{{ attachment.created_at|date:"Y-m-d H:i" }}</td>
<td class="attachment-actions">
<a href="{% url 'file_summary_attachment_download' selected_conversation.pk attachment.pk %}">下载</a>
<button type="button" data-attachment-action="edit">编辑</button>
<button type="button" data-attachment-action="toggle">{% if attachment.is_active %}禁用{% else %}启用{% endif %}</button>
<button type="button" data-attachment-action="delete">删除</button>
</td>
</tr>
{% empty %}
<tr>
<td colspan="6" class="table-empty">当前对话暂无附件</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</section>
</div>
{% else %}
<section class="attachment-manager-panel attachment-manager-empty attachment-manager-content">
<h2>请选择一个对话查看附件</h2>
<p>通过上方下拉框选择对话后,可上传、下载、编辑、启用禁用或删除附件。</p>
</section>
{% endif %}
</section>
</main>
{% endblock %}
{% block scripts %}
<script src="{% static 'js/attachment_manager.js' %}"></script>
{% endblock %}