fix: 修复导入ID重复覆盖逻辑、Excel列顺序对齐及UI优化

This commit is contained in:
cnbugs
2026-04-29 13:48:29 +08:00
parent cb057b431e
commit 2eac2d867e
6 changed files with 107 additions and 65 deletions
+1 -1
View File
@@ -61,7 +61,7 @@
<tr><td class="text-muted">卡数</td><td>{{ asset.gpu_count|default:"-" }}</td></tr>
<tr><td class="text-muted">负责人</td><td>{{ asset.responsible_person|default:"-" }}</td></tr>
<tr><td class="text-muted">使用部门</td><td>{{ asset.department|default:"-" }}</td></tr>
<tr><td class="text-muted">使用</td><td>{{ asset.user|default:"-" }}</td></tr>
<tr><td class="text-muted">维护</td><td>{{ asset.user|default:"-" }}</td></tr>
<tr><td class="text-muted">业务类型</td><td>{{ asset.business_type|default:"-" }}</td></tr>
<tr><td class="text-muted">状态</td>
<td><span class="badge
+21 -12
View File
@@ -22,10 +22,10 @@
<div class="card card-dark mb-3">
<div class="card-body">
<form method="get" class="row g-2 align-items-end">
<div class="col-md-4">
<div class="col-md-3">
<label class="form-label text-muted small">搜索</label>
<input type="text" name="search" class="form-control form-control-sm"
placeholder="编号/名称/序列号/IP/品牌/型号/位置/负责人/部门/使用人" value="{{ search }}">
placeholder="编号/名称/序列号/IP/BMC/品牌/型号/机柜/负责人/部门/维护人/业务类型..." value="{{ search }}">
</div>
<div class="col-md-2">
<label class="form-label text-muted small">分类</label>
@@ -46,16 +46,25 @@
</select>
</div>
<div class="col-md-2">
<label class="form-label text-muted small">位置</label>
<select name="location" class="form-select form-select-sm">
<option value="">全部位置</option>
{% for loc in locations %}
<option value="{{ loc }}" {% if current_location == loc %}selected{% endif %}>{{ loc }}</option>
<label class="form-label text-muted small">机柜</label>
<select name="cabinet" class="form-select form-select-sm">
<option value="">全部机柜</option>
{% for cab in cabinets %}
<option value="{{ cab }}" {% if current_cabinet == cab %}selected{% endif %}>{{ cab }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-primary btn-sm me-1"><i class="bi bi-search"></i> 搜索</button>
<label class="form-label text-muted small">业务类型</label>
<select name="business_type" class="form-select form-select-sm">
<option value="">全部业务</option>
{% for bt in business_types %}
<option value="{{ bt }}" {% if current_business_type == bt %}selected{% endif %}>{{ bt }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-1">
<button type="submit" class="btn btn-primary btn-sm me-1"><i class="bi bi-search"></i></button>
<a href="{% url 'asset_list' %}" class="btn btn-outline-secondary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></a>
</div>
</form>
@@ -84,7 +93,7 @@
<th>卡数</th>
<th style="width:60px">负责人</th>
<th>使用部门</th>
<th style="width:60px">使用</th>
<th style="width:60px">维护</th>
<th>业务类型</th>
<th>状态</th>
<th>操作</th>
@@ -145,19 +154,19 @@
<nav class="mt-3">
<ul class="pagination pagination-sm justify-content-center">
{% if page_obj.has_previous %}
<li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}{% if search %}&search={{ search }}{% endif %}{% if current_category %}&category={{ current_category }}{% endif %}{% if current_status %}&status={{ current_status }}{% endif %}{% if current_location %}&location={{ current_location }}{% endif %}"><i class="bi bi-chevron-left"></i></a></li>
<li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}{% if search %}&search={{ search }}{% endif %}{% if current_category %}&category={{ current_category }}{% endif %}{% if current_status %}&status={{ current_status }}{% endif %}{% if current_cabinet %}&cabinet={{ current_cabinet }}{% endif %}{% if current_business_type %}&business_type={{ current_business_type }}{% endif %}"><i class="bi bi-chevron-left"></i></a></li>
{% endif %}
{% for num in page_obj.paginator.page_range %}
{% if page_obj.number == num %}
<li class="page-item active"><span class="page-link">{{ num }}</span></li>
{% elif num > page_obj.number|add:'-3' and num < page_obj.number|add:'3' %}
<li class="page-item"><a class="page-link" href="?page={{ num }}{% if search %}&search={{ search }}{% endif %}{% if current_category %}&category={{ current_category }}{% endif %}{% if current_status %}&status={{ current_status }}{% endif %}{% if current_location %}&location={{ current_location }}{% endif %}">{{ num }}</a></li>
<li class="page-item"><a class="page-link" href="?page={{ num }}{% if search %}&search={{ search }}{% endif %}{% if current_category %}&category={{ current_category }}{% endif %}{% if current_status %}&status={{ current_status }}{% endif %}{% if current_cabinet %}&cabinet={{ current_cabinet }}{% endif %}{% if current_business_type %}&business_type={{ current_business_type }}{% endif %}">{{ num }}</a></li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}{% if search %}&search={{ search }}{% endif %}{% if current_category %}&category={{ current_category }}{% endif %}{% if current_status %}&status={{ current_status }}{% endif %}{% if current_location %}&location={{ current_location }}{% endif %}"><i class="bi bi-chevron-right"></i></a></li>
<li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}{% if search %}&search={{ search }}{% endif %}{% if current_category %}&category={{ current_category }}{% endif %}{% if current_status %}&status={{ current_status }}{% endif %}{% if current_cabinet %}&cabinet={{ current_cabinet }}{% endif %}{% if current_business_type %}&business_type={{ current_business_type }}{% endif %}"><i class="bi bi-chevron-right"></i></a></li>
{% endif %}
</ul>
</nav>