You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

240 lines
8.2 KiB

{% extends "base.html" %}
{% load staticfiles %}
{% block title %}任务列表{% endblock %}
{% block staticcss %}
{% endblock %}
{% block staticjs %}
<script>
$(function () {
$('input[name="start_date"]').daterangepicker({
singleDatePicker: true,
showDropdowns: true,
minYear: 1901,
locale: {
format: 'YYYY-MM-DD'
}
});
});
$(function () {
$('input[name="end_date"]').daterangepicker({
singleDatePicker: true,
showDropdowns: true,
minYear: 1901,
locale: {
format: 'YYYY-MM-DD'
}
});
});
</script>
<script>
$(document).ready(function () {
$('#dataTable').DataTable({
responsive: true,
"language": {
"sProcessing": "处理中...",
"sLengthMenu": "显示 _MENU_ 项结果",
"sZeroRecords": "没有匹配结果",
"sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
"sInfoPostFix": "",
"sSearch": "搜索:",
"sUrl": "",
"sEmptyTable": "表中数据为空",
"sLoadingRecords": "载入中...",
"sInfoThousands": ",",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "上页",
"sNext": "下页",
"sLast": "末页"
},
"oAria": {
"sSortAscending": ": 以升序排列此列",
"sSortDescending": ": 以降序排列此列"
}
}
});
});
</script>
{% endblock %}
{% block content %}
<!-- Page Content -->
<div id="page-wrapper">
<div class="container-fluid">
<div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-gray-800">搜索结果</h1>
</div>
</div>
<!-- /.container-fluid -->
<!-- /.row -->
{% if not search_results %}
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">搜索任务</h6>
</div>
<div class="card-body">
<p>搜索文案</p>
<form class="user" action='' onsubmit="return dosubmit()" method="POST">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
{% for field in form.visible_fields %}
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="btn btn-primary" id="basic-addon1">{{field.label}}</span>
</div>
{{field}}
</div>
{% endfor %}
{% if messages %}
{% for message in messages %}
<div {% if message.tags %} class="alert alert-{{ message.tags }}" role="alert" {% endif %}>
{{ message }}
</div>
{% endfor %}
{% endif %}
<input type="submit" class="btn btn-success btn-block" value="查询">
</form>
</div>
</div>
{% endif %}
{% if search_results %}
<div class="card shadow mb-4">
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">任务列表</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
</div>
</div>
<div class="card-body">
<!--表单报错显示-->
{% if form.errors %}
{% for field, error in form.errors.items %}
<div class="alert alert-error">
{{ field }} <code>{{ error }}</code>
</div>
{% endfor %}
{% endif %}
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>ID</th>
<th>任务名称</th>
<th>任务类型</th>
<th>权重</th>
<th>创建人</th>
<th>创建日期</th>
<th>截止日期</th>
<th>分配给</th>
<th>状态</th>
<th>评论</th>
<th>绩效值</th>
<th>绩效锁定</th>
<th>操作</th>
</tr>
</thead>
<tfoot>
<tr>
<th>ID</th>
<th>任务名称</th>
<th>任务类型</th>
<th>权重</th>
<th>创建人</th>
<th>创建日期</th>
<th>截止日期</th>
<th>分配给</th>
<th>状态</th>
<th>次数</th>
<th>绩效值</th>
<th>绩效锁定</th>
<th>操作</th>
</tr>
</tfoot>
<tbody>
{% for list in search_results %}
<tr class="odd gradeX">
<td>{{ forloop.counter }}
</td>
<td>{{ list.title|slice:'15' }}</td>
<td>{{ list.type }}</td>
<td>{{ list.get_priority_display }}</td>
<td>{{ list.created_by }}</td>
<td>{{ list.created_date }}</td>
<td>{{ list.due_date }}</td>
<td>{{ list.assigned_to }}</td>
<td>{{ list.get_status_display }}</td>
<td>{{ list.itemcomment_set.all.count }}</td>
<td>{{ list.per_value }}</td>
<td>
{% if list.lock %}
<i class="fa fa-lock"></i>
{% else %}
<i class="fa fa-unlock"></i>
{% endif %}
</td>
<td>
<a class="btn btn-outline btn-primary" href="{% url 'taskview' list.id %}">查看</a>
{% if not list.lock %}
<a class="btn btn-outline btn-info" href="{% url 'edittaskitem' list.id %}">编辑</a>
<a class="btn btn-outline btn-danger" href="#"
data-href="{% url 'delitem'%}?type=task&id={{ list.id }}" data-toggle="modal"
data-target="#confirm-delete">删除</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
</div>
<!--表单报错显示-->
{% if form.errors %}
{% for field, error in form.errors.items %}
<div class="alert alert-error">
{{ field }} <code>{{ error }}</code>
</div>
{% endfor %}
{% endif %}
{% endblock %}