add company user show

This commit is contained in:
wcharles 2019-10-23 16:18:24 +08:00
parent 84db934805
commit 016188aeb7
5 changed files with 137 additions and 8 deletions

View File

@ -36,27 +36,28 @@
<thead>
<tr role="row">
<th class="sorting_asc" tabindex="0" aria-controls="example1" rowspan="1" colspan="1" style="width: 164.933px;" aria-sort="ascending"
aria-label="Rendering engine: activate to sort column descending">公司名称</th>
aria-label="Rendering engine: activate to sort column descending">公司ID</th>
<th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1" style="width: 204.15px;"
aria-label="Browser: activate to sort column ascending">Browser</th>
aria-label="Browser: activate to sort column ascending">公司名称</th>
<th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1" style="width: 179.933px;"
aria-label="Platform(s): activate to sort column ascending">Platform(s)</th>
aria-label="Platform(s): activate to sort column ascending">超管账号</th>
<th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1" style="width: 140.467px;"
aria-label="Engine version: activate to sort column ascending">超管账号</th>
aria-label="Engine version: activate to sort column ascending">建立时间</th>
<th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1" style="width: 99.1833px;"
aria-label="CSS grade: activate to sort column ascending">建立时间</th>
aria-label="CSS grade: activate to sort column ascending">查看员工</th>
</tr>
</thead>
<tbody>
{% for i in companys %}
<tr role="row" class="even">
<td class="sorting_1">{{i.partname}}</td>
<td>Firefox 1.0</td>
<td>Win 98+ / OSX.2+</td>
<td class="sorting_1">{{i.partid}}</td>
<td>{{i.partname}}</td>
<td>{{i.useradmin}}</td>
<td>{{i.creattime}}</td>
<td><a href="{% url 'groups_cuser' i.partid %}">员工</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>

View File

@ -0,0 +1,101 @@
{% extends "./base.html" %}
{% load static %}
{% block headother%}
<!-- DataTables -->
<link rel="stylesheet" href="{% static 'groups/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css' %}">
{% endblock %}
{% block title %}公司员工列表{% endblock %}
{% block pagehead %}
<section class="content-header">
<h1>
公司列表
<small>companys list</small>
</h1>
<ol class="breadcrumb">
<li><a href="{% url 'groups_index' %}"><i class="fa fa-dashboard"></i> 主页</a></li>
<li class="active">公司员工列表</li>
</ol>
</section>
{% endblock %}
{% block content %}
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">公司员工列表</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr role="row">
<th class="sorting_asc" tabindex="0" aria-controls="example1" rowspan="1" colspan="1" style="width: 164.933px;" aria-sort="ascending"
aria-label="Rendering engine: activate to sort column descending">员工ID</th>
<th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1" style="width: 204.15px;"
aria-label="Browser: activate to sort column ascending">员工名称</th>
<th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1" style="width: 179.933px;"
aria-label="Platform(s): activate to sort column ascending">员工账号</th>
<th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1" style="width: 140.467px;"
aria-label="Engine version: activate to sort column ascending">员工工号</th>
<th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1" style="width: 99.1833px;"
aria-label="CSS grade: activate to sort column ascending">操作</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr role="row" class="even">
<td class="sorting_1">{{user.userid}}</td>
<td>{{user.name}}</td>
<td>{{user.username}}</td>
<td>{{user.empid}}</td>
<td><a href="{% url 'groups_userdetail' user.userid %}">修改</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
{% endblock %}
{% block endother%}
<!-- DataTables -->
<script src="{% static 'groups/bower_components/datatables.net/js/jquery.dataTables.min.js' %}"></script>
<script src="{% static 'groups/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js' %}"></script>
<!-- SlimScroll -->
<script src="{% static 'groups/bower_components/jquery-slimscroll/jquery.slimscroll.min.js' %}"></script>
<!-- FastClick -->
<script src="{% static 'groups/bower_components/fastclick/lib/fastclick.js' %}"></script>
<script>
$(function () {
$('#example1').DataTable()
$('#example2').DataTable({
'paging' : true,
'lengthChange': false,
'searching' : false,
'ordering' : true,
'info' : true,
'autoWidth' : false
})
})
</script>
{% endblock %}

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>uid={{ uid }}</h1>
</body>
</html>

View File

@ -9,6 +9,9 @@ urlpatterns = [
path('logout/', views.logout, name='groups_logout'),
path('captcha/', include('captcha.urls')),
path('company/', views.company, name='groups_company'),
path('company/user/<int:cid>/', views.company_user, name='groups_cuser'),
path('company/userdetail/<int:uid>/', views.company_userdetail, name='groups_userdetail'),
path('trouble/', views.job, name='groups_trouble'),
path('observe/', views.job, name='groups_observe'),
path('miss/', views.job, name='groups_miss'),

View File

@ -32,6 +32,7 @@ def login(request):
request.session['is_login'] = True
request.session['user_id'] = user.id
request.session['user_name'] = user.username
request.session['group_id'] = user.group
return redirect('/groups/index/')
else:
return render(request, 'groups/login.html', locals())
@ -63,3 +64,16 @@ def company(request):
def job(request):
return render(request, 'groups/job.html', locals())
def company_user(request, cid):
users = s_models.User.objects.filter(usecomp=cid)
# for user in users:
# dump(user)
return render(request, 'groups/company_user.html', locals())
def company_userdetail(request, uid):
return render(request, 'groups/company_userdetail.html', locals())
def dump(obj):
print('\n'.join(['%s:%s' % item for item in obj.__dict__.items()]))