From 016188aeb73cc6977d4f82ca2c5d14ba3b0f8ae2 Mon Sep 17 00:00:00 2001 From: wcharles Date: Wed, 23 Oct 2019 16:18:24 +0800 Subject: [PATCH] add company user show --- groups/templates/groups/company.html | 17 +-- groups/templates/groups/company_user.html | 101 ++++++++++++++++++ .../templates/groups/company_userdetail.html | 10 ++ groups/urls.py | 3 + groups/views.py | 14 +++ 5 files changed, 137 insertions(+), 8 deletions(-) create mode 100644 groups/templates/groups/company_user.html create mode 100644 groups/templates/groups/company_userdetail.html diff --git a/groups/templates/groups/company.html b/groups/templates/groups/company.html index 5b00fca2..0d7cbefd 100644 --- a/groups/templates/groups/company.html +++ b/groups/templates/groups/company.html @@ -36,27 +36,28 @@ 公司名称 + aria-label="Rendering engine: activate to sort column descending">公司ID Browser + aria-label="Browser: activate to sort column ascending">公司名称 Platform(s) + aria-label="Platform(s): activate to sort column ascending">超管账号 超管账号 + aria-label="Engine version: activate to sort column ascending">建立时间 建立时间 + aria-label="CSS grade: activate to sort column ascending">查看员工 {% for i in companys %} - {{i.partname}} - Firefox 1.0 - Win 98+ / OSX.2+ + {{i.partid}} + {{i.partname}} {{i.useradmin}} {{i.creattime}} + 员工 {% endfor %} + diff --git a/groups/templates/groups/company_user.html b/groups/templates/groups/company_user.html new file mode 100644 index 00000000..b75a7cc0 --- /dev/null +++ b/groups/templates/groups/company_user.html @@ -0,0 +1,101 @@ +{% extends "./base.html" %} +{% load static %} +{% block headother%} + + + +{% endblock %} + + +{% block title %}公司员工列表{% endblock %} + +{% block pagehead %} +
+

+ 公司列表 + companys list +

+ +
+{% endblock %} +{% block content %} + +
+
+
+
+
+

公司员工列表

+
+ +
+ + + + + + + + + + + + {% for user in users %} + + + + + + + + {% endfor %} + + +
员工ID员工名称员工账号员工工号操作
{{user.userid}}{{user.name}}{{user.username}}{{user.empid}}修改
+
+ +
+ +
+ +
+ +
+ +{% endblock %} + + +{% block endother%} + + + + + + + + + + +{% endblock %} + + diff --git a/groups/templates/groups/company_userdetail.html b/groups/templates/groups/company_userdetail.html new file mode 100644 index 00000000..01f9bca6 --- /dev/null +++ b/groups/templates/groups/company_userdetail.html @@ -0,0 +1,10 @@ + + + + + Title + + +

uid={{ uid }}

+ + \ No newline at end of file diff --git a/groups/urls.py b/groups/urls.py index 7e8087f1..17e63f00 100644 --- a/groups/urls.py +++ b/groups/urls.py @@ -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//', views.company_user, name='groups_cuser'), + path('company/userdetail//', 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'), diff --git a/groups/views.py b/groups/views.py index b354a695..f03398d8 100644 --- a/groups/views.py +++ b/groups/views.py @@ -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()])) \ No newline at end of file