XH_Digital_Management/templates/view_list.html

118 lines
8.1 KiB
HTML

{% extends 'base.html' %}
{% load static tags %}
{% block content %}
<section class="pcoded-main-container">
<div class="pcoded-wrapper">
<div class="pcoded-content">
<div class="pcoded-inner-content">
<div class="main-body">
<div class="page-wrapper">
{% include 'breadcrumb.html' %}
<div class="row mb-3">
<div class="col-md-12">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-md-8">
<!-- 筛选表单 开始 -->
<form action="{% url form_action_url %}" method="get">
{% csrf_token %}
<div class="row">
{% for filter in filters %}
{% if filter.type == 'text' %}
<div class="col">
<label for="{{ filter.id }}" class="form-label">{{ filter.label }}</label>
<input type="text" class="form-control" id="{{ filter.id }}" name="{{ filter.name }}" placeholder="{{ filter.placeholder }}">
</div>
{% elif filter.type == 'select' %}
<div class="col">
<label class="form-label" for="{{ filter.id }}">{{ filter.label }}</label>
<select class="form-control" id="{{ filter.id }}" name="{{ filter.name }}">
<option value="">请选择</option>
{% for option in filter.options %}
<option value="{{ option.value }}"
{% if request.GET|get_value:filter.name == option.value %}selected{% endif %}>{{ option.display }}
</option>
{% endfor %}
</select>
</div>
{% elif filter.type == 'date' %}
<div class="col">
<label for="{{ filter.id }}" class="form-label">{{ filter.label }}</label>
<input type="date" class="form-control" id="{{ filter.id }}" name="{{ filter.name }}" value="{{ request.GET|get_value:filter.name }}">
</div>
{% elif filter.type == 'month' %}
<div class="col">
<label for="{{ filter.id }}" class="form-label">{{ filter.label }}</label>
<input type="month" class="form-control" id="{{ filter.id }}" name="{{ filter.name }}" value="{{ request.GET|get_value:filter.name }}">
</div>
{% endif %}
{% endfor %}
<div class="col mt-4 d-flex align-items-center">
<button type="submit" class="btn btn-primary">查询</button>
</div>
</div>
</form>
<!-- 筛选表单 结束 -->
</div>
<div class="col-md-4 mt-4 text-end">
<button class="btn btn-outline-primary">切换</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-sm-12">
<div class="card">
<div class="card-body table-border-style">
<div class="table-responsive">
<!-- 表格 开始 -->
<table class="table">
{% get_verbose_field_names_from_model model_config table_exclude_field_name as columns %}
<thead>
<tr>
{% for column in columns %}
<th class="text-center">{{ column }}</th>
{% endfor %}
</tr>
</thead>
<tbody id="result" style="color: white;">
{% for item in items %}
<tr>
{% for field in item|get_fields:table_exclude_field_name %}
{% if '(元)' in field.verbose_name %}
<td class="text-center">{{ field.value|default_if_none:'-'|thousands_separator }}</td>
{% else %}
<td class="text-center">{{ field.value|default_if_none:'-' }}</td>
{% endif %}
{% endfor %}
</tr>
{% empty %}
<tr>
<td class="text-center" colspan="{{ table_columns|length }}">暂无数据</td>
</tr>
{% endfor %}
</tbody>
</table>
<!-- 表格 结束 -->
</div>
</div>
</div>
</div>
</div>
{% include 'pagination_ps.html' with page_obj=items query_params=query_params %}
</div>
</div>
</div>
</div>
</div>
</section>
<script>
</script>
{% endblock %}