xiugai
This commit is contained in:
commit
05047be1e5
|
@ -1,7 +1,28 @@
|
|||
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', "删除"),
|
||||
)
|
||||
|
||||
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'}))
|
||||
|
|
|
@ -36,7 +36,7 @@ scratch. This page gets rid of all links and provides the needed markup only.
|
|||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
{% block headother %}{% endblock %}
|
||||
<!-- Google Font -->
|
||||
<link rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
|
||||
|
@ -193,10 +193,9 @@ desired effect
|
|||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
|
||||
{% block pagehead %}
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
{% block pagehead %}{% endblock %}
|
||||
<!-- <h1>
|
||||
Page Header
|
||||
<small>Optional description</small>
|
||||
|
@ -206,16 +205,16 @@ desired effect
|
|||
<li class="active">Here</li>
|
||||
</ol> -->
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
{% block content %}{% endblock %}
|
||||
<!--------------------------
|
||||
| Your Page Content Here |
|
||||
-------------------------->
|
||||
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
{% endblock %}
|
||||
</div>
|
||||
<!-- /.content-wrapper -->
|
||||
|
||||
|
@ -310,7 +309,13 @@ desired effect
|
|||
|
||||
<!-- REQUIRED JS SCRIPTS -->
|
||||
|
||||
|
||||
<!-- jQuery 3 -->
|
||||
<script src="{% static 'groups/bower_components/jquery/dist/jquery.min.js' %}"></script>
|
||||
<!-- Bootstrap 3.3.7 -->
|
||||
<script src="{% static 'groups/bower_components/bootstrap/dist/js/bootstrap.min.js' %}"></script>
|
||||
<!-- AdminLTE App -->
|
||||
<script src="{% static 'groups/dist/js/adminlte.min.js' %}"></script>
|
||||
{% block endother %}{% endblock %}
|
||||
|
||||
<!-- Optionally, you can add Slimscroll and FastClick plugins.
|
||||
Both of these plugins are recommended to enhance the
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
{% extends "./base.html" %}
|
||||
|
||||
{% block title %}公司列表{% endblock %}
|
||||
|
||||
{% block pagehead %}
|
||||
<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>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<!-- /.box -->
|
||||
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">下属公司列表</h3>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body">
|
||||
<div id="example1_wrapper" class="dataTables_wrapper form-inline dt-bootstrap"><div class="row"><div class="col-sm-6">
|
||||
<div class="dataTables_length" id="example1_length">
|
||||
<label>Show <select name="example1_length" aria-controls="example1" class="form-control input-sm">
|
||||
<option value="10">10</option>
|
||||
<option value="25">25</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
</select> entries</label></div>
|
||||
</div><div class="col-sm-6">
|
||||
<div id="example1_filter" class="dataTables_filter">
|
||||
<label>Search:<input type="search" class="form-control input-sm" placeholder=""
|
||||
aria-controls="example1"></label></div></div></div>
|
||||
<div class="row"><div class="col-sm-12">
|
||||
<table id="example1" class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info">
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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 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>{{i.useradmin}}</td>
|
||||
<td>{{i.creattime}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table></div></div><div class="row"><div class="col-sm-5"><div class="dataTables_info" id="example1_info" role="status" aria-live="polite">Showing 1 to 10 of 57 entries</div></div><div class="col-sm-7"><div class="dataTables_paginate paging_simple_numbers" id="example1_paginate"><ul class="pagination"><li class="paginate_button previous disabled" id="example1_previous"><a href="#" aria-controls="example1" data-dt-idx="0" tabindex="0">Previous</a></li><li class="paginate_button active"><a href="#" aria-controls="example1" data-dt-idx="1" tabindex="0">1</a></li><li class="paginate_button "><a href="#" aria-controls="example1" data-dt-idx="2" tabindex="0">2</a></li><li class="paginate_button "><a href="#" aria-controls="example1" data-dt-idx="3" tabindex="0">3</a></li><li class="paginate_button "><a href="#" aria-controls="example1" data-dt-idx="4" tabindex="0">4</a></li><li class="paginate_button "><a href="#" aria-controls="example1" data-dt-idx="5" tabindex="0">5</a></li><li class="paginate_button "><a href="#" aria-controls="example1" data-dt-idx="6" tabindex="0">6</a></li><li class="paginate_button next" id="example1_next"><a href="#" aria-controls="example1" data-dt-idx="7" tabindex="0">Next</a></li></ul></div></div></div></div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
{% endblock %}
|
|
@ -1,74 +1,101 @@
|
|||
{% extends "./base.html" %}
|
||||
|
||||
{% block title %}公司列表{% endblock %}
|
||||
|
||||
{% block pagehead %}
|
||||
<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>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<!-- /.box -->
|
||||
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">下属公司列表</h3>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body">
|
||||
<div id="example1_wrapper" class="dataTables_wrapper form-inline dt-bootstrap"><div class="row"><div class="col-sm-6">
|
||||
<div class="dataTables_length" id="example1_length">
|
||||
<label>Show <select name="example1_length" aria-controls="example1" class="form-control input-sm">
|
||||
<option value="10">10</option>
|
||||
<option value="25">25</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
</select> entries</label></div>
|
||||
</div><div class="col-sm-6">
|
||||
<div id="example1_filter" class="dataTables_filter">
|
||||
<label>Search:<input type="search" class="form-control input-sm" placeholder=""
|
||||
aria-controls="example1"></label></div></div></div>
|
||||
<div class="row"><div class="col-sm-12">
|
||||
<table id="example1" class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info">
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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 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>{{i.useradmin}}</td>
|
||||
<td>{{i.creattime}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table></div></div><div class="row"><div class="col-sm-5"><div class="dataTables_info" id="example1_info" role="status" aria-live="polite">Showing 1 to 10 of 57 entries</div></div><div class="col-sm-7"><div class="dataTables_paginate paging_simple_numbers" id="example1_paginate"><ul class="pagination"><li class="paginate_button previous disabled" id="example1_previous"><a href="#" aria-controls="example1" data-dt-idx="0" tabindex="0">Previous</a></li><li class="paginate_button active"><a href="#" aria-controls="example1" data-dt-idx="1" tabindex="0">1</a></li><li class="paginate_button "><a href="#" aria-controls="example1" data-dt-idx="2" tabindex="0">2</a></li><li class="paginate_button "><a href="#" aria-controls="example1" data-dt-idx="3" tabindex="0">3</a></li><li class="paginate_button "><a href="#" aria-controls="example1" data-dt-idx="4" tabindex="0">4</a></li><li class="paginate_button "><a href="#" aria-controls="example1" data-dt-idx="5" tabindex="0">5</a></li><li class="paginate_button "><a href="#" aria-controls="example1" data-dt-idx="6" tabindex="0">6</a></li><li class="paginate_button next" id="example1_next"><a href="#" aria-controls="example1" data-dt-idx="7" tabindex="0">Next</a></li></ul></div></div></div></div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
{% endblock %}
|
||||
{% 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 i in companys %}
|
||||
<tr role="row" class="even">
|
||||
<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>
|
||||
<!-- /.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 %}
|
||||
|
||||
|
||||
|
|
|
@ -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></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 %}
|
||||
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
{% 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></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">
|
||||
<!-- right column -->
|
||||
<div class="col-md-12">
|
||||
<!-- Horizontal Form -->
|
||||
<div class="box box-info">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">员工信息</h3>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<!-- form start -->
|
||||
<form class="form-horizontal" method="post" action="{% url 'groups_userupdate' %}">
|
||||
{% csrf_token %}{{ user_form.userid }}
|
||||
{% if message %}
|
||||
<p style="color:red">{{ message }}</p>
|
||||
{% endif %}
|
||||
<div class="box-body">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ user_form.username.label_tag }}</label>
|
||||
<div class="col-sm-6">
|
||||
{{ user_form.username}} {{ user_form.username.errors }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ user_form.name.label_tag }}</label>
|
||||
<div class="col-sm-6">
|
||||
{{ user_form.name}}{{ user_form.name.errors }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ user_form.empid.label_tag }}</label>
|
||||
<div class="col-sm-6">
|
||||
{{ user_form.empid}}{{ user_form.empid.errors }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ user_form.ubelongpart.label_tag }}</label>
|
||||
<div class="col-sm-6">
|
||||
{{ user_form.ubelongpart}}{{ user_form.ubelongpart.errors }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ user_form.openid.label_tag }}</label>
|
||||
<div class="col-sm-6">
|
||||
{{ user_form.openid}}{{ user_form.openid.errors }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ user_form.nickname.label_tag }}</label>
|
||||
<div class="col-sm-6">
|
||||
{{ user_form.nickname}}{{ user_form.nickname.errors }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ user_form.headimgurl.label_tag }}</label>
|
||||
<div class="col-sm-6">
|
||||
{{ user_form.headimgurl}}{{ user_form.headimgurl.errors }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ user_form.deletemark.label_tag }}</label>
|
||||
<div class="col-sm-6">
|
||||
{{ user_form.deletemark}}{{ user_form.deletemark.errors }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ user_form.mpopenid.label_tag }}</label>
|
||||
<div class="col-sm-6">
|
||||
{{ user_form.mpopenid}}{{ user_form.mpopenid.errors }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ user_form.usecomp.label_tag }}</label>
|
||||
<div class="col-sm-6">
|
||||
{{ user_form.usecomp}}{{ user_form.usecomp.errors }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn btn-primary">提交</button>
|
||||
</div>
|
||||
<!-- /.box-footer -->
|
||||
</form>
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
</div>
|
||||
<!--/.col (right) -->
|
||||
</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 %}
|
||||
|
||||
|
|
@ -9,6 +9,10 @@ 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('company/userupdate/', views.groups_userupdate, name='groups_userupdate'),
|
||||
|
||||
path('trouble/', views.trouble, name='groups_trouble'),#隐患排查统计图
|
||||
path('observe/', views.observe, name='groups_observe'),#行为观察统计图
|
||||
path('miss/', views.miss, name='groups_miss'),#未遂事件统计图
|
||||
|
|
|
@ -2,9 +2,11 @@ from django.http import HttpResponse,JsonResponse
|
|||
from django.shortcuts import render
|
||||
from django.shortcuts import redirect
|
||||
from .models import Group,GroupUser
|
||||
from .forms import GroupUserForm
|
||||
from .forms import GroupUserForm, UserForm
|
||||
from safesite import models as s_models
|
||||
from safesite.tasks import gettime
|
||||
from django.forms.models import model_to_dict
|
||||
from django.http import Http404
|
||||
import requests
|
||||
import json
|
||||
import time
|
||||
|
@ -41,6 +43,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())
|
||||
|
@ -73,6 +76,47 @@ 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):
|
||||
try:
|
||||
user = s_models.User.objects.get(pk=uid)
|
||||
except s_models.User.DoesNotExist:
|
||||
raise Http404("User does not exist")
|
||||
user_form = UserForm(model_to_dict(user))
|
||||
# print(type(user))
|
||||
# print(user_form)
|
||||
# dump(user)
|
||||
return render(request, 'groups/company_userdetail.html', locals())
|
||||
|
||||
def groups_userupdate(request):
|
||||
if request.method == 'POST':
|
||||
user_form = UserForm(request.POST)
|
||||
if user_form.is_valid():
|
||||
model_user = s_models.User()
|
||||
model_user.userid = user_form.cleaned_data.get('userid')
|
||||
model_user.username = user_form.cleaned_data.get('username')
|
||||
model_user.name = user_form.cleaned_data.get('name')
|
||||
model_user.empid = user_form.cleaned_data.get('empid')
|
||||
model_user.ubelongpart = user_form.cleaned_data.get('ubelongpart')
|
||||
model_user.openid = user_form.cleaned_data.get('openid')
|
||||
model_user.nickname = user_form.cleaned_data.get('nickname')
|
||||
model_user.headimgurl = user_form.cleaned_data.get('headimgurl')
|
||||
model_user.deletemark = user_form.cleaned_data.get('deletemark')
|
||||
model_user.mpopenid = user_form.cleaned_data.get('mpopenid')
|
||||
model_user.usecomp = user_form.cleaned_data.get('usecomp')
|
||||
model_user.save()
|
||||
return render(request, 'groups/company_userdetail.html', locals())
|
||||
else:
|
||||
return redirect('/groups/company/')
|
||||
|
||||
def dump(obj):
|
||||
print('\n'.join(['%s:%s' % item for item in obj.__dict__.items()]))
|
||||
|
||||
@check_login
|
||||
def index(req):
|
||||
first_day,first_day_of_next_month=gettime()
|
||||
|
@ -144,6 +188,7 @@ def observeChart(request):#行为观察
|
|||
end = request.GET.get('end')
|
||||
if code=='obv':
|
||||
companys = GroupUser.objects.get(id = request.session['user_id']).group.members.all()
|
||||
|
||||
observelist = s_models.Observe.objects.filter(deletemark=1,usecomp__in=companys).values('usecomp__partid','usecomp__partname').annotate(number = Count('lookid'))
|
||||
if start:
|
||||
observelist = observelist.filter(looktime__gte=start)
|
||||
|
|
Loading…
Reference in New Issue