XH_Digital_Management/templates/table.html

53 lines
2.5 KiB
HTML
Raw Normal View History

2024-05-30 17:06:23 +08:00
{% load tags %}
<div class="card-body table-border-style">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
{% for column in table_columns %}
2024-06-06 15:08:38 +08:00
{% if column.is_show %}
<th class="text-center">{{ column.label }}</th>
{% endif %}
2024-05-30 17:06:23 +08:00
{% endfor %}
</tr>
</thead>
<tbody id="result" style="color: white;">
{% for item in items %}
2024-06-06 15:08:38 +08:00
<tr data-id="{{ item|getattr_filter:id_name }}">
2024-05-30 17:06:23 +08:00
{% for column in table_columns %}
{% if column.field == 'actions' %}
2024-06-04 16:50:30 +08:00
<td class="text-center">
2024-06-06 15:08:38 +08:00
<a href="#" class="edit-btn" data-target_id="{{ item|getattr_filter:id_name }}"
{% for column in table_columns %}
{% if column.is_add %}
data-{{ column.field }}="{{ item | getattr_filter:column.field }}"
{% endif %}
{% endfor %}
2024-06-04 16:50:30 +08:00
data-bs-toggle="modal" style="color: deepskyblue;" data-bs-target="#addModifyModal">编辑</a>
2024-06-06 15:08:38 +08:00
<a href="#" class="delete-btn" style="color: red;"
data-target_id="{{ item|getattr_filter:id_name }}"
2024-06-04 16:50:30 +08:00
data-bs-toggle="modal" data-bs-target="#deleteModal">删除</a>
</td>
2024-06-04 18:45:11 +08:00
{% elif column.field == 'authority' %}
2024-06-05 10:11:00 +08:00
<td class="text-center">
2024-06-06 15:08:38 +08:00
<button id="permission-btn-{{ item|getattr_filter:list_key }}"
class="btn btn-outline-primary" data-bs-toggle="modal"
data-bs-target="#userPermissionModal">权限设置
</button>
2024-06-04 18:45:11 +08:00
</td>
2024-05-30 17:06:23 +08:00
{% else %}
2024-06-04 16:50:30 +08:00
<td class="text-center">{{ item|getattr_filter:column.field }}</td>
2024-05-30 17:06:23 +08:00
{% endif %}
{% endfor %}
</tr>
{% empty %}
2024-05-30 17:12:34 +08:00
<tr>
2024-05-31 20:17:40 +08:00
<td class="text-center" colspan="{{ table_columns|length }}">暂无数据</td>
2024-05-30 17:12:34 +08:00
</tr>
{% endfor %}
2024-05-30 17:06:23 +08:00
</tbody>
</table>
</div>
2024-06-04 16:50:30 +08:00
</div>