From 497f92692efe804a6ecf1dad75109a330f6e70bf Mon Sep 17 00:00:00 2001 From: wcharles Date: Fri, 18 Oct 2019 14:00:38 +0800 Subject: [PATCH 1/4] table page --- groups/templates/groups/base.html | 13 +- groups/templates/groups/company.bak.html | 74 ++++++++++ groups/templates/groups/company.html | 174 +++++++++++++---------- 3 files changed, 180 insertions(+), 81 deletions(-) create mode 100644 groups/templates/groups/company.bak.html diff --git a/groups/templates/groups/base.html b/groups/templates/groups/base.html index c6be3ac5..67e70ed3 100644 --- a/groups/templates/groups/base.html +++ b/groups/templates/groups/base.html @@ -30,7 +30,7 @@ scratch. This page gets rid of all links and provides the needed markup only. - + {% block headother %}{% endblock %} @@ -190,10 +190,9 @@ desired effect
- + {% block pagehead %}
- {% block pagehead %}{% endblock %}
- + {% endblock %} + {% block content %}
- {% block content %}{% endblock %} -
+ {% endblock %}
@@ -313,7 +312,7 @@ desired effect - + {% block endother %}{% endblock %} diff --git a/groups/templates/groups/company.bak.html b/groups/templates/groups/company.bak.html new file mode 100644 index 00000000..44a60959 --- /dev/null +++ b/groups/templates/groups/company.bak.html @@ -0,0 +1,74 @@ +{% extends "./base.html" %} + +{% block title %}公司列表{% endblock %} + +{% block pagehead %} +

+ 公司列表 + companys list +

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

下属公司列表

+
+ +
+
+
+
+
+
+
+
+ + + + + + + + + + + + {% for i in companys %} + + + + + + + + {% endfor %} + +
公司名称BrowserPlatform(s)超管账号建立时间
{{i.partname}}Firefox 1.0Win 98+ / OSX.2+{{i.useradmin}}{{i.creattime}}
Showing 1 to 10 of 57 entries
+
+ +
+ +
+ +
+ +{% endblock %} \ No newline at end of file diff --git a/groups/templates/groups/company.html b/groups/templates/groups/company.html index 44a60959..5b00fca2 100644 --- a/groups/templates/groups/company.html +++ b/groups/templates/groups/company.html @@ -1,74 +1,100 @@ -{% extends "./base.html" %} - -{% block title %}公司列表{% endblock %} - -{% block pagehead %} -

- 公司列表 - companys list -

- -{% endblock %} -{% block content %} -
-
- - -
-
-

下属公司列表

-
- -
-
-
-
-
-
-
-
- - - - - - - - - - - - {% for i in companys %} - - - - - - - - {% endfor %} - -
公司名称BrowserPlatform(s)超管账号建立时间
{{i.partname}}Firefox 1.0Win 98+ / OSX.2+{{i.useradmin}}{{i.creattime}}
Showing 1 to 10 of 57 entries
-
- -
- -
- -
- -{% endblock %} \ No newline at end of file +{% extends "./base.html" %} +{% load static %} +{% block headother%} + + + +{% endblock %} + + +{% block title %}公司列表{% endblock %} + +{% block pagehead %} +
+

+ 公司列表 + companys list +

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

下属公司列表

+
+ +
+ + + + + + + + + + + + {% for i in companys %} + + + + + + + + {% endfor %} + +
公司名称BrowserPlatform(s)超管账号建立时间
{{i.partname}}Firefox 1.0Win 98+ / OSX.2+{{i.useradmin}}{{i.creattime}}
+
+ +
+ +
+ +
+ +
+ +{% endblock %} + + +{% block endother%} + + + + + + + + + + +{% endblock %} + + From 016188aeb73cc6977d4f82ca2c5d14ba3b0f8ae2 Mon Sep 17 00:00:00 2001 From: wcharles Date: Wed, 23 Oct 2019 16:18:24 +0800 Subject: [PATCH 2/4] 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 From 4c5cacd916f91a3b90253af01e340eb2a73c5b03 Mon Sep 17 00:00:00 2001 From: wcharles Date: Thu, 24 Oct 2019 15:23:20 +0800 Subject: [PATCH 3/4] add form --- groups/forms.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/groups/forms.py b/groups/forms.py index 116bc045..cd6aabf3 100644 --- a/groups/forms.py +++ b/groups/forms.py @@ -1,7 +1,26 @@ from django import forms from captcha.fields import CaptchaField +from safesite import models as s_models class GroupUserForm(forms.Form): username = forms.CharField(label="用户名", max_length=128, widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': "账户",'autofocus': ''})) password = forms.CharField(label="密码", max_length=256, widget=forms.PasswordInput(attrs={'class': 'form-control','placeholder': "密码"})) captcha = CaptchaField(label='验证码', error_messages={"invalid":"验证码错误"}) + + +class UserForm(forms.Form): + mark = ( + ('1', "未删除"), + ('0', "删除"), + ) + username = forms.CharField(label="账号",max_length=30, widget=forms.TextInput()) + name = forms.CharField(label="姓名", max_length=20, widget=forms.TextInput()) + empid = forms.CharField(label="工号", max_length=20, widget=forms.TextInput()) + password = forms.CharField(label="密码", max_length=256, widget=forms.PasswordInput()) + ubelongpart = forms.ModelChoiceField(queryset=s_models.Partment.objects.all()) + openid = forms.CharField(label="公众号openid", max_length=200, widget=forms.TextInput()) + nickname = forms.CharField(label="昵称", max_length=200, widget=forms.TextInput()) + mpopenid = forms.CharField(label="小程序openid", max_length=200, widget=forms.TextInput()) + deletemark = forms.ChoiceField(label='删除标记', choices=mark) + headimgurl = forms.CharField(label="头像", max_length=200, required=False, widget=forms.TextInput()) + usecomp = forms.ModelChoiceField(queryset=s_models.Partment.objects.all())#所属公司 From 9c48a9c7183b2b59d9b5285de9dde9edc742738c Mon Sep 17 00:00:00 2001 From: wcharles Date: Fri, 25 Oct 2019 17:41:14 +0800 Subject: [PATCH 4/4] update user detail --- groups/forms.py | 24 +-- groups/templates/groups/company_user.html | 4 +- .../templates/groups/company_userdetail.html | 156 ++++++++++++++++-- groups/urls.py | 1 + groups/views.py | 33 +++- 5 files changed, 194 insertions(+), 24 deletions(-) diff --git a/groups/forms.py b/groups/forms.py index cd6aabf3..36a7b857 100644 --- a/groups/forms.py +++ b/groups/forms.py @@ -13,14 +13,16 @@ class UserForm(forms.Form): ('1', "未删除"), ('0', "删除"), ) - username = forms.CharField(label="账号",max_length=30, widget=forms.TextInput()) - name = forms.CharField(label="姓名", max_length=20, widget=forms.TextInput()) - empid = forms.CharField(label="工号", max_length=20, widget=forms.TextInput()) - password = forms.CharField(label="密码", max_length=256, widget=forms.PasswordInput()) - ubelongpart = forms.ModelChoiceField(queryset=s_models.Partment.objects.all()) - openid = forms.CharField(label="公众号openid", max_length=200, widget=forms.TextInput()) - nickname = forms.CharField(label="昵称", max_length=200, widget=forms.TextInput()) - mpopenid = forms.CharField(label="小程序openid", max_length=200, widget=forms.TextInput()) - deletemark = forms.ChoiceField(label='删除标记', choices=mark) - headimgurl = forms.CharField(label="头像", max_length=200, required=False, widget=forms.TextInput()) - usecomp = forms.ModelChoiceField(queryset=s_models.Partment.objects.all())#所属公司 + + userid = forms.CharField(widget=forms.HiddenInput()) + username = forms.CharField(label="账号",max_length=30, widget=forms.TextInput(attrs={'class': 'form-control'})) + name = forms.CharField(label="姓名", max_length=20, widget=forms.TextInput(attrs={'class': 'form-control'})) + empid = forms.CharField(label="工号", max_length=20, widget=forms.TextInput(attrs={'class': 'form-control'})) + #password = forms.CharField(label="密码", max_length=256, widget=forms.PasswordInput()) + ubelongpart = forms.ModelChoiceField(label="ubelongpart", queryset=s_models.Partment.objects.all(), widget=forms.Select(attrs={'class': 'form-control'})) + openid = forms.CharField(label="公众号openid", max_length=200, widget=forms.TextInput(attrs={'class': 'form-control'})) + nickname = forms.CharField(label="昵称", max_length=200, widget=forms.TextInput(attrs={'class': 'form-control'})) + mpopenid = forms.CharField(label="小程序openid", max_length=200, widget=forms.TextInput(attrs={'class': 'form-control'})) + deletemark = forms.ChoiceField(label='删除标记', choices=mark, widget=forms.Select(attrs={'class': 'form-control'})) + #headimgurl = forms.CharField(label="头像", max_length=200, required=False, widget=forms.TextInput(attrs={'class': 'form-control'})) + usecomp = forms.ModelChoiceField(label="所属公司", queryset=s_models.Partment.objects.all(), widget=forms.Select(attrs={'class': 'form-control'})) diff --git a/groups/templates/groups/company_user.html b/groups/templates/groups/company_user.html index b75a7cc0..1a9324be 100644 --- a/groups/templates/groups/company_user.html +++ b/groups/templates/groups/company_user.html @@ -12,8 +12,8 @@ {% block pagehead %}

- 公司列表 - companys list + 公司员工列表 +