XH_Digital_Management/templates/table.html

53 lines
2.5 KiB
HTML

{% load tags %}
<div class="card-body table-border-style">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
{% for column in table_columns %}
{% if column.is_show %}
<th class="text-center">{{ column.label }}</th>
{% endif %}
{% endfor %}
</tr>
</thead>
<tbody id="result" style="color: white;">
{% for item in items %}
<tr data-id="{{ item|getattr_filter:id_name }}">
{% for column in table_columns %}
{% if column.field == 'actions' %}
<td class="text-center">
<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 %}
data-bs-toggle="modal" style="color: deepskyblue;" data-bs-target="#addModifyModal">编辑</a>
<a href="#" class="delete-btn" style="color: red;"
data-target_id="{{ item|getattr_filter:id_name }}"
data-bs-toggle="modal" data-bs-target="#deleteModal">删除</a>
</td>
{% elif column.field == 'authority' %}
<td class="text-center">
<button id="permission-btn-{{ item|getattr_filter:list_key }}"
class="btn btn-outline-primary" data-bs-toggle="modal"
data-bs-target="#userPermissionModal">权限设置
</button>
</td>
{% else %}
<td class="text-center">{{ item|getattr_filter:column.field }}</td>
{% endif %}
{% endfor %}
</tr>
{% empty %}
<tr>
<td class="text-center" colspan="{{ table_columns|length }}">暂无数据</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>