tongjitu
This commit is contained in:
commit
9f1e130dd5
|
@ -10,4 +10,11 @@ class GroupAdmin(admin.ModelAdmin):
|
|||
def formfield_for_manytomany(self, db_field, request, **kwargs):
|
||||
if db_field.name == "members":
|
||||
kwargs["queryset"] = s_models.Partment.objects.filter(iscompany=1,deletemark=1)
|
||||
return super().formfield_for_manytomany(db_field, request, **kwargs)
|
||||
return super().formfield_for_manytomany(db_field, request, **kwargs)
|
||||
|
||||
@admin.register(models.Groupmember)
|
||||
class GroupmemberAdmin(admin.ModelAdmin):
|
||||
def formfield_for_foreignkey(self, db_field, request, **kwargs):
|
||||
if db_field.name == "member":
|
||||
kwargs["queryset"] = s_models.Partment.objects.filter(iscompany=1,deletemark=1)
|
||||
return super().formfield_for_foreignkey(db_field, request, **kwargs)
|
|
@ -0,0 +1,31 @@
|
|||
# Generated by Django 2.1.5 on 2019-10-24 10:56
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0281_remove_companyinfo_liaison_fax'),
|
||||
('groups', '0002_auto_20191017_0929'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Groupmember',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='groupmember',
|
||||
name='group',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='groups.Group'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='groupmember',
|
||||
name='member',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='safesite.Partment'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.1.5 on 2019-10-24 11:09
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('groups', '0003_auto_20191024_1056'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='group',
|
||||
old_name='members',
|
||||
new_name='member',
|
||||
),
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 2.1.5 on 2019-10-24 11:11
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('groups', '0004_auto_20191024_1109'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='group',
|
||||
name='member',
|
||||
),
|
||||
]
|
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 2.1.5 on 2019-10-24 11:20
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0285_remove_companyinfo_liaison_fax'),
|
||||
('groups', '0005_remove_group_member'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='group',
|
||||
name='members',
|
||||
field=models.ManyToManyField(through='groups.Groupmember', to='safesite.Partment'),
|
||||
),
|
||||
]
|
|
@ -11,8 +11,7 @@ class Group(models.Model):
|
|||
groupname = models.CharField(max_length=128, unique=True)
|
||||
type = models.CharField(max_length=32, choices=grouptype, default="集团")
|
||||
createtime = models.DateTimeField(auto_now_add=True)
|
||||
members = models.ManyToManyField(s_models.Partment)
|
||||
|
||||
members = models.ManyToManyField(s_models.Partment,through='Groupmember')
|
||||
def __str__(self):
|
||||
return self.groupname
|
||||
|
||||
|
@ -21,6 +20,10 @@ class Group(models.Model):
|
|||
verbose_name="集团"
|
||||
verbose_name_plural="集团"
|
||||
|
||||
class Groupmember(models.Model):
|
||||
group = models.ForeignKey(Group,on_delete=models.CASCADE)
|
||||
member = models.ForeignKey(s_models.Partment,on_delete=models.CASCADE)
|
||||
|
||||
class GroupUser(models.Model):
|
||||
username = models.CharField(max_length=128, unique=True)
|
||||
password = models.CharField(max_length=256)
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||
<!--
|
||||
2013-9-30: Created.
|
||||
-->
|
||||
<svg>
|
||||
<metadata>
|
||||
Created by iconfont
|
||||
</metadata>
|
||||
<defs>
|
||||
|
||||
<font id="laydate-icon" horiz-adv-x="1024" >
|
||||
<font-face
|
||||
font-family="laydate-icon"
|
||||
font-weight="500"
|
||||
font-stretch="normal"
|
||||
units-per-em="1024"
|
||||
ascent="896"
|
||||
descent="-128"
|
||||
/>
|
||||
<missing-glyph />
|
||||
|
||||
<glyph glyph-name="x" unicode="x" horiz-adv-x="1001"
|
||||
d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5
|
||||
t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5
|
||||
t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" />
|
||||
|
||||
|
||||
|
||||
<glyph glyph-name="youyou" unicode="" d="M283.648 721.918976 340.873216 780.926976 740.352 383.997952 340.876288-12.925952 283.648 46.077952 619.52 383.997952Z" horiz-adv-x="1024" />
|
||||
|
||||
|
||||
<glyph glyph-name="zuozuo" unicode="" d="M740.352 721.918976 683.126784 780.926976 283.648 383.997952 683.123712-12.925952 740.352 46.077952 404.48 383.997952Z" horiz-adv-x="1024" />
|
||||
|
||||
|
||||
<glyph glyph-name="xiayiye" unicode="" d="M62.573 384.103l423.401 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.751-18.976-68.727 0l-39.753 39.753 0.269 0.246-385.655 385.661zM451.365 384.103l423.407 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.757-18.977-68.727 0l-39.762 39.754 0.273 0.249-385.662 385.661zM451.365 384.103z" horiz-adv-x="1024" />
|
||||
|
||||
|
||||
<glyph glyph-name="xiayiye1" unicode="" d="M948.066926 382.958838l-411.990051-412.24426c-18.47333-18.47333-48.417689-18.47333-66.875207 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L814.691135 383.088983 467.512212 730.269123c-18.466032 18.458735-18.466032 48.405526 0 66.873991 18.468465 18.464816 48.410391 18.464816 66.872774 0l38.682336-38.682336-0.261507-0.239614 375.259894-375.265975v0.003649m-378.312834 0L157.756743-29.285422c-18.47333-18.47333-48.415256-18.47333-66.872775 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L436.369787 383.088983 89.19208 730.269123c-18.4636 18.458735-18.4636 48.405526 0 66.873991 18.470898 18.464816 48.415256 18.464816 66.872774 0l38.692067-38.682336-0.266372-0.239614 375.267191-375.265975-0.004865 0.003649m0 0z" horiz-adv-x="1024" />
|
||||
|
||||
|
||||
|
||||
|
||||
</font>
|
||||
</defs></svg>
|
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,134 @@
|
|||
{% extends "./base.html" %}
|
||||
|
||||
{% block title %}隐患统计{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% load static %}
|
||||
<div class="callout callout-warning">
|
||||
<h3>未遂事件统计</h3>
|
||||
</div>
|
||||
<div style="height:600px;width:100%;background-color:aquamarine">
|
||||
<div style="width:100%;height:100px;">
|
||||
开始日期:<input type="text" id="test">
|
||||
结束日期:<input type="text" id="test2">
|
||||
|
||||
<button class="btn btn-info" onclick="funTypeChange()"> 查询</button>
|
||||
</div>
|
||||
|
||||
<div id="examchart" style="width:60%;height:400px;margin:auto"></div>
|
||||
</div>
|
||||
<!-- 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>
|
||||
|
||||
<script src="{% static 'groups/time/laydate/laydate.js' %}"></script>
|
||||
<link rel="stylesheet" href="{% static 'groups/time/laydate/theme/default/laydate.css' %}">
|
||||
<!-- iCheck -->
|
||||
<script src="{% static 'groups/plugins/iCheck/icheck.min.js' %}"></script>
|
||||
<script src="{% static 'groups/bower_components/echarts.min.js' %}"></script>
|
||||
<script type="text/javascript">
|
||||
//隐患数量趋势图
|
||||
|
||||
|
||||
$(function () {
|
||||
|
||||
laydate.render({
|
||||
elem: '#test'
|
||||
, format: 'yyyy-MM-dd' //可任意组合
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#test2'
|
||||
, format: 'yyyy-MM-dd' //可任意组合
|
||||
});
|
||||
exam();
|
||||
|
||||
});
|
||||
function funTypeChange() {
|
||||
exam();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function exam() {
|
||||
|
||||
var start = $("#test").val();
|
||||
var end = $("#test2").val();
|
||||
|
||||
$.ajax({
|
||||
type: "get",
|
||||
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
|
||||
url: "/groups/api/examChart?code=exam&start=" + start + "&end=" + end, //请求发送
|
||||
dataType: "json", //返回数据形式为json
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
//请求成功时执行该函数内容,data即为服务器返回的json对象
|
||||
var examChart = echarts.init(document.getElementById("examchart"));
|
||||
var examnum = [];
|
||||
var companyName = [];
|
||||
if (data.data.examlist != null) {
|
||||
$.each(data.data.examlist, function (i, item) {
|
||||
|
||||
|
||||
examnum.push(item.number);
|
||||
|
||||
companyName.push(item.usecomp__partname);
|
||||
|
||||
})
|
||||
|
||||
examChart.setOption(
|
||||
|
||||
option = {
|
||||
color: ['#FFA500'],
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||
}
|
||||
},
|
||||
|
||||
title: {
|
||||
text: '本集团各公司未遂事件统计图'
|
||||
},
|
||||
tooltip: {},
|
||||
legend: {
|
||||
data: ['公司未遂事件总数']
|
||||
},
|
||||
grid: {
|
||||
y2: 140
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: companyName,
|
||||
boundaryGap: [0, 0.01],
|
||||
axisLabel: {
|
||||
interval: 0,//横轴信息全部显示
|
||||
rotate: -30,//-30度角倾斜显示
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
yAxis: {},
|
||||
series: [{
|
||||
name: '公司未遂事件总数',
|
||||
data: examnum,
|
||||
type: 'bar'
|
||||
}]
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
},
|
||||
error: function (errorMsg) {
|
||||
examChart.hideLoading();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -0,0 +1,135 @@
|
|||
{% extends "./base.html" %}
|
||||
|
||||
{% block title %}隐患统计{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% load static %}
|
||||
<div class="callout callout-warning">
|
||||
<h3>未遂事件统计</h3>
|
||||
</div>
|
||||
<div style="height:600px;width:100%;background-color:aquamarine">
|
||||
<div style="width:100%;height:100px;">
|
||||
开始日期:<input type="text" id="test">
|
||||
结束日期:<input type="text" id="test2">
|
||||
|
||||
<button class="btn btn-info" onclick="funTypeChange()"> 查询</button>
|
||||
</div>
|
||||
|
||||
<div id="misschart" style="width:60%;height:400px;margin:auto"></div>
|
||||
</div>
|
||||
<!-- 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>
|
||||
|
||||
<script src="{% static 'groups/time/laydate/laydate.js' %}"></script>
|
||||
<link rel="stylesheet" href="{% static 'groups/time/laydate/theme/default/laydate.css' %}">
|
||||
<!-- iCheck -->
|
||||
|
||||
<script src="{% static 'groups/plugins/iCheck/icheck.min.js' %}"></script>
|
||||
<script src="{% static 'groups/bower_components/echarts.min.js' %}"></script>
|
||||
<script type="text/javascript">
|
||||
//隐患数量趋势图
|
||||
|
||||
|
||||
$(function () {
|
||||
|
||||
laydate.render({
|
||||
elem: '#test'
|
||||
, format: 'yyyy-MM-dd' //可任意组合
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#test2'
|
||||
, format: 'yyyy-MM-dd' //可任意组合
|
||||
});
|
||||
miss();
|
||||
|
||||
});
|
||||
function funTypeChange() {
|
||||
miss();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function miss() {
|
||||
|
||||
var start = $("#test").val();
|
||||
var end = $("#test2").val();
|
||||
|
||||
$.ajax({
|
||||
type: "get",
|
||||
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
|
||||
url: "/groups/api/missChart?code=miss&start=" + start + "&end=" + end, //请求发送
|
||||
dataType: "json", //返回数据形式为json
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
//请求成功时执行该函数内容,data即为服务器返回的json对象
|
||||
var missChart = echarts.init(document.getElementById("misschart"));
|
||||
var missnum = [];
|
||||
var companyName = [];
|
||||
if (data.data.misslist != null) {
|
||||
$.each(data.data.misslist, function (i, item) {
|
||||
|
||||
|
||||
missnum.push(item.number);
|
||||
|
||||
companyName.push(item.usecomp__partname);
|
||||
|
||||
})
|
||||
|
||||
missChart.setOption(
|
||||
|
||||
option = {
|
||||
color: ['#dd4b39'],
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||
}
|
||||
},
|
||||
|
||||
title: {
|
||||
text: '本集团各公司未遂事件统计图'
|
||||
},
|
||||
tooltip: {},
|
||||
legend: {
|
||||
data: ['公司未遂事件总数']
|
||||
},
|
||||
grid: {
|
||||
y2: 140
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: companyName,
|
||||
boundaryGap: [0, 0.01],
|
||||
axisLabel: {
|
||||
interval: 0,//横轴信息全部显示
|
||||
rotate: -30,//-30度角倾斜显示
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
yAxis: {},
|
||||
series: [{
|
||||
name: '公司未遂事件总数',
|
||||
data: missnum,
|
||||
type: 'bar'
|
||||
}]
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
},
|
||||
error: function (errorMsg) {
|
||||
missChart.hideLoading();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -9,33 +9,21 @@
|
|||
</div>
|
||||
<div style="height:600px;width:100%;background-color:aquamarine">
|
||||
<div style="width:100%;height:100px;">
|
||||
<select id="YearNum" style="margin-left:5px;height:30px;width:70px;font-size:large"> </select> <span style="font-size:large">年</span>
|
||||
|
||||
<select id="banqType" style="height:30px;width:70px;font-size:large">
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
<option value="5">5</option>
|
||||
<option value="6">6</option>
|
||||
<option value="7">7</option>
|
||||
<option value="8">8</option>
|
||||
<option value="9">9</option>
|
||||
<option value="10">10</option>
|
||||
<option value="11">11</option>
|
||||
<option value="12">12</option>
|
||||
</select>
|
||||
<span style="font-size:large">月</span>
|
||||
开始日期:<input type="text" id="test">
|
||||
结束日期:<input type="text" id="test2">
|
||||
|
||||
<button class="btn btn-info" onclick="funTypeChange()"> 查询</button>
|
||||
</div>
|
||||
|
||||
<div id="troubchart" style="width:60%;height:400px;margin:auto"></div>
|
||||
<div id="obvchart" style="width:60%;height:400px;margin:auto"></div>
|
||||
</div>
|
||||
<!-- 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>
|
||||
|
||||
<script src="{% static 'groups/time/laydate/laydate.js' %}"></script>
|
||||
<link rel="stylesheet" href="{% static 'groups/time/laydate/theme/default/laydate.css' %}">
|
||||
<!-- iCheck -->
|
||||
<script src="{% static 'groups/plugins/iCheck/icheck.min.js' %}"></script>
|
||||
<script src="{% static 'groups/bower_components/echarts.min.js' %}"></script>
|
||||
|
@ -45,131 +33,100 @@
|
|||
|
||||
$(function () {
|
||||
|
||||
var currentYear = new Date().getFullYear();
|
||||
var select = document.getElementById("YearNum");
|
||||
for (var i = 0; i <= 3; i++) {
|
||||
var theOption = document.createElement("option");
|
||||
theOption.innerHTML = currentYear - i;
|
||||
theOption.value = currentYear - i;
|
||||
select.appendChild(theOption);
|
||||
}
|
||||
var date = new Date();
|
||||
var year = date.getFullYear();
|
||||
var month = date.getMonth() + 1;
|
||||
$("#YearNum").val(year);
|
||||
$("#banqType").val(month);
|
||||
gczxt()
|
||||
laydate.render({
|
||||
elem: '#test'
|
||||
, format: 'yyyy-MM-dd' //可任意组合
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#test2'
|
||||
, format: 'yyyy-MM-dd' //可任意组合
|
||||
});
|
||||
observe();
|
||||
|
||||
});
|
||||
function funTypeChange() {
|
||||
gczxt()
|
||||
observe();
|
||||
}
|
||||
|
||||
|
||||
function gczxt() {//行为观察折线图
|
||||
var y = $("#YearNum").val();
|
||||
var m = $("#banqType").val();
|
||||
//行为观察折线图
|
||||
|
||||
|
||||
function observe() {
|
||||
|
||||
var start = $("#test").val();
|
||||
var end = $("#test2").val();
|
||||
|
||||
$.ajax({
|
||||
type: "get",
|
||||
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
|
||||
url: "/groups/api/observeChart?code=tbpic&year=" + y + "&month=" + m, //请求发送
|
||||
url: "/groups/api/observeChart?code=obv&start=" + start + "&end=" + end, //请求发送
|
||||
dataType: "json", //返回数据形式为json
|
||||
success: function (data) {
|
||||
//请求成功时执行该函数内容,data即为服务器返回的json对象
|
||||
console.log(data);
|
||||
var gcChart2 = echarts.init(document.getElementById("troubchart"));
|
||||
//请求成功时执行该函数内容,data即为服务器返回的json对象
|
||||
var obvChart = echarts.init(document.getElementById("obvchart"));
|
||||
var obvnum = [];
|
||||
var companyName = [];
|
||||
if (data.list != null) {
|
||||
$.each(data.list, function (i, item) {
|
||||
if (data.data.observelist != null) {
|
||||
$.each(data.data.observelist, function (i, item) {
|
||||
|
||||
|
||||
obvnum.push(item.number);
|
||||
|
||||
companyName.push(item.usecomp__partname);
|
||||
|
||||
})
|
||||
gcChart2.setOption(option = {
|
||||
title: {
|
||||
text: '行为观察折线图'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: ['人员的反映', '员工的位置', '个人防护装备', '工具和设备', '程序和标准', '人体工程学', '环境整洁']
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
saveAsImage: {}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: companyName
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '人员的反映',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: data.userfy
|
||||
|
||||
obvChart.setOption(
|
||||
|
||||
option = {
|
||||
color: ['#00a65a'],
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '员工的位置',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: data.userwz
|
||||
|
||||
title: {
|
||||
text: '本集团各公司行为观察统计图'
|
||||
},
|
||||
{
|
||||
name: '个人防护装备',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: data.grfh
|
||||
tooltip: {},
|
||||
legend: {
|
||||
data: ['公司行为观察总数']
|
||||
},
|
||||
{
|
||||
name: '工具和设备',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: data.gjhsb
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: companyName,
|
||||
boundaryGap: [0, 0.01],
|
||||
axisLabel: {
|
||||
interval: 0,//横轴信息全部显示
|
||||
rotate: -30,//-30度角倾斜显示
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '程序和标准',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: data.cxhbz
|
||||
}
|
||||
,
|
||||
{
|
||||
name: '人体工程学',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: data.rtgcx
|
||||
grid: {
|
||||
y2: 140
|
||||
},
|
||||
{
|
||||
name: '环境整洁',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: data.hjzj
|
||||
}
|
||||
]
|
||||
});
|
||||
}},
|
||||
yAxis: {},
|
||||
series: [{
|
||||
name: '公司行为观察总数',
|
||||
data: obvnum,
|
||||
type: 'bar'
|
||||
}]
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
},
|
||||
error: function (errorMsg) {
|
||||
gcChart2.hideLoading();
|
||||
obvChart.hideLoading();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
{% extends "./base.html" %}
|
||||
|
||||
{% block title %}风险管控{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% load static %}
|
||||
<div class="callout callout-warning">
|
||||
<h3>风险管控统计</h3>
|
||||
</div>
|
||||
<div style="height:600px;width:100%;background-color:aquamarine">
|
||||
<div style="width:100%;height:100px;">
|
||||
开始日期:<input type="text" id="test">
|
||||
结束日期:<input type="text" id="test2">
|
||||
|
||||
<button class="btn btn-info" onclick="funTypeChange()"> 查询</button>
|
||||
</div>
|
||||
|
||||
<div id="riskchart" style="width:60%;height:400px;margin:auto"></div>
|
||||
</div>
|
||||
<!-- 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>
|
||||
|
||||
<script src="{% static 'groups/time/laydate/laydate.js' %}"></script>
|
||||
<link rel="stylesheet" href="{% static 'groups/time/laydate/theme/default/laydate.css' %}">
|
||||
<!-- iCheck -->
|
||||
<script src="{% static 'groups/plugins/iCheck/icheck.min.js' %}"></script>
|
||||
<script src="{% static 'groups/bower_components/echarts.min.js' %}"></script>
|
||||
<script type="text/javascript">
|
||||
//隐患数量趋势图
|
||||
|
||||
|
||||
$(function () {
|
||||
|
||||
laydate.render({
|
||||
elem: '#test'
|
||||
, format: 'yyyy-MM-dd' //可任意组合
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#test2'
|
||||
, format: 'yyyy-MM-dd' //可任意组合
|
||||
});
|
||||
risk();
|
||||
|
||||
});
|
||||
function funTypeChange() {
|
||||
risk();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function risk() {
|
||||
|
||||
var start = $("#test").val();
|
||||
var end = $("#test2").val();
|
||||
|
||||
$.ajax({
|
||||
type: "get",
|
||||
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
|
||||
url: "/groups/api/riskChart?code=risk&start=" + start + "&end=" + end, //请求发送
|
||||
dataType: "json", //返回数据形式为json
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
//请求成功时执行该函数内容,data即为服务器返回的json对象
|
||||
var riskChart = echarts.init(document.getElementById("riskchart"));
|
||||
var risknum = [];
|
||||
var companyName = [];
|
||||
if (data.data.risklist != null) {
|
||||
$.each(data.data.risklist, function (i, item) {
|
||||
|
||||
|
||||
risknum.push(item.number);
|
||||
|
||||
companyName.push(item.usecomp__partname);
|
||||
|
||||
})
|
||||
|
||||
riskChart.setOption(
|
||||
|
||||
option = {
|
||||
color: ['#FFA500'],
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||
}
|
||||
},
|
||||
|
||||
title: {
|
||||
text: '本集团各公司风险管控统计图'
|
||||
},
|
||||
tooltip: {},
|
||||
legend: {
|
||||
data: ['公司风险管控总数']
|
||||
},
|
||||
grid: {
|
||||
y2: 140
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: companyName,
|
||||
boundaryGap: [0, 0.01],
|
||||
axisLabel: {
|
||||
interval: 0,//横轴信息全部显示
|
||||
rotate: -30,//-30度角倾斜显示
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
yAxis: {},
|
||||
series: [{
|
||||
name: '公司风险管控总数',
|
||||
data: risknum,
|
||||
type: 'bar'
|
||||
}]
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
},
|
||||
error: function (errorMsg) {
|
||||
riskChart.hideLoading();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -0,0 +1,136 @@
|
|||
{% extends "./base.html" %}
|
||||
|
||||
{% block title %}教育培训统计{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% load static %}
|
||||
<div class="callout callout-warning">
|
||||
<h3>教育培训统计</h3>
|
||||
</div>
|
||||
<div style="height:600px;width:100%;background-color:aquamarine">
|
||||
<div style="width:100%;height:100px;">
|
||||
开始日期:<input type="text" id="test">
|
||||
结束日期:<input type="text" id="test2">
|
||||
|
||||
<button class="btn btn-info" onclick="funTypeChange()"> 查询</button>
|
||||
|
||||
|
||||
|
||||
<div id="trainchart" style="width:60%;height:400px;margin:auto"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 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>
|
||||
<script src="{% static 'groups/time/laydate/laydate.js' %}"></script>
|
||||
<link rel="stylesheet" href="{% static 'groups/time/laydate/theme/default/laydate.css' %}">
|
||||
<!-- iCheck -->
|
||||
<script src="{% static 'groups/plugins/iCheck/icheck.min.js' %}"></script>
|
||||
<script src="{% static 'groups/bower_components/echarts.min.js' %}"></script>
|
||||
<script type="text/javascript">
|
||||
//隐患数量趋势图
|
||||
|
||||
|
||||
$(function () {
|
||||
laydate.render({
|
||||
elem: '#test'
|
||||
, format: 'yyyy-MM-dd' //可任意组合
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#test2'
|
||||
, format: 'yyyy-MM-dd' //可任意组合
|
||||
});
|
||||
train();
|
||||
|
||||
|
||||
});
|
||||
function funTypeChange() {
|
||||
|
||||
train();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function train() {
|
||||
|
||||
var start = $("#test").val();
|
||||
var end = $("#test2").val();
|
||||
$.ajax({
|
||||
type: "get",
|
||||
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
|
||||
url: "/groups/api/trainChart?code=train&start=" + start + "&end=" + end, //请求发送
|
||||
dataType: "json", //返回数据形式为json
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
//请求成功时执行该函数内容,data即为服务器返回的json对象
|
||||
var trainChart = echarts.init(document.getElementById("trainchart"));
|
||||
|
||||
var trainnum = [];
|
||||
var companyName = [];
|
||||
if (data.data.trainlist != null) {
|
||||
$.each(data.data.trainlist, function (i, item) {
|
||||
|
||||
|
||||
trainnum.push(item.number);
|
||||
|
||||
companyName.push(item.usecomp__partname);
|
||||
|
||||
})
|
||||
|
||||
trainChart.setOption(
|
||||
|
||||
option = {
|
||||
color: ['#00c0ef'],
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||
}
|
||||
},
|
||||
|
||||
title: {
|
||||
text: '本集团各公司教育培训统计图'
|
||||
},
|
||||
tooltip: {},
|
||||
legend: {
|
||||
data: ['公司教育培训总数']
|
||||
},
|
||||
grid: {
|
||||
y2: 140
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: companyName,
|
||||
boundaryGap: [0, 0.01],
|
||||
axisLabel: {
|
||||
interval: 0,//横轴信息全部显示
|
||||
rotate: -30,//-30度角倾斜显示
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
yAxis: {},
|
||||
series: [{
|
||||
name: '公司教育培训总数',
|
||||
data: trainnum,
|
||||
type: 'bar'
|
||||
}]
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
},
|
||||
error: function (errorMsg) {
|
||||
trainChart.hideLoading();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -7,15 +7,13 @@
|
|||
<div class="callout callout-warning">
|
||||
<h3>隐患统计</h3>
|
||||
</div>
|
||||
<div style="height:600px;width:100%;background-color:aquamarine">
|
||||
<div class="input-group date" data-provide="datepicker">
|
||||
<input type="text" class="form-control" id="time">
|
||||
<div class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-th"></span>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-info" onclick="funTypeChange()"> 查询</button>
|
||||
<div style="height:600px;width:100%;background-color:#dac2a3">
|
||||
<div style="width:100%;height:100px;">
|
||||
开始日期:<input type="text" id="test">
|
||||
结束日期:<input type="text" id="test2">
|
||||
|
||||
<button class="btn btn-info" onclick="funTypeChange()"> 查询</button>
|
||||
</div>
|
||||
|
||||
<div id="troubchart" style="width:60%;height:400px;margin:auto"></div>
|
||||
</div>
|
||||
|
@ -24,9 +22,8 @@
|
|||
<!-- Bootstrap 3.3.7 -->
|
||||
<script src="{% static 'groups/bower_components/bootstrap/dist/js/bootstrap.min.js' %}"></script>
|
||||
|
||||
<script src="{% static 'groups/bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js' %}"></script>
|
||||
<script src="{% static 'groups/bower_components/bootstrap-datepicker/dist/locales/bootstrap-datepicker.zh-CN.min.js' %}"></script>
|
||||
<link rel="stylesheet" href="{% static 'groups/bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css' %}">
|
||||
<script src="{% static 'groups/time/laydate/laydate.js' %}"></script>
|
||||
<link rel="stylesheet" href="{% static 'groups/time/laydate/theme/default/laydate.css' %}">
|
||||
<!-- iCheck -->
|
||||
<script src="{% static 'groups/plugins/iCheck/icheck.min.js' %}"></script>
|
||||
<script src="{% static 'groups/bower_components/echarts.min.js' %}"></script>
|
||||
|
@ -35,37 +32,30 @@
|
|||
|
||||
|
||||
$(function () {
|
||||
|
||||
$('.datepicker').datepicker({
|
||||
language: 'zh-CN',
|
||||
format: 'yyyy-mm-dd hh:00:00',//日期格式。可以将日期格式,定成年月日时,分秒为0。
|
||||
weekStart: 1,
|
||||
todayBtn: 1,
|
||||
autoclose: 1,
|
||||
todayHighlight: 1,
|
||||
startView: 2,
|
||||
forceParse: 0,
|
||||
showMeridian: 1
|
||||
});
|
||||
var times = $('#time').value;
|
||||
alert(times)
|
||||
|
||||
laydate.render({
|
||||
elem: '#test'
|
||||
, format: 'yyyy-MM-dd' //可任意组合
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#test2'
|
||||
, format: 'yyyy-MM-dd' //可任意组合
|
||||
});
|
||||
troub();
|
||||
|
||||
});
|
||||
|
||||
|
||||
function funTypeChange() {
|
||||
var times = $('#time').value;
|
||||
alert(times)
|
||||
troub();
|
||||
}
|
||||
function troub() {
|
||||
|
||||
var start = $("#test").val();
|
||||
var end = $("#test2").val();
|
||||
|
||||
$.ajax({
|
||||
type: "get",
|
||||
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
|
||||
url: "/groups/api/troubleChart?code=tbpic&starttime=" + starttime + "&endtime=" + endtime, //请求发送
|
||||
url: "/groups/api/troubleChart?code=tbpic&start=" + start + "&end=" + end, //请求发送
|
||||
dataType: "json", //返回数据形式为json
|
||||
success: function (data) {
|
||||
console.log(data.data.troublelist);
|
||||
|
@ -87,7 +77,7 @@
|
|||
yhChart.setOption(
|
||||
|
||||
option = {
|
||||
color: ['#3398DB'],
|
||||
color: ['#f39c12'],
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
|
@ -96,15 +86,23 @@
|
|||
},
|
||||
|
||||
title: {
|
||||
text: '本集团' + y + '年' + m + '月各公司隐患统计图'
|
||||
text: '本集团各公司隐患统计图'
|
||||
},
|
||||
tooltip: {},
|
||||
legend: {
|
||||
data: ['公司隐患总数']
|
||||
},
|
||||
grid: {
|
||||
y2: 140
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: companyName
|
||||
data: companyName,
|
||||
boundaryGap: [0, 0.01],
|
||||
axisLabel: {
|
||||
interval: 0,//横轴信息全部显示
|
||||
rotate: -30,//-30度角倾斜显示
|
||||
}
|
||||
},
|
||||
yAxis: {},
|
||||
series: [{
|
||||
|
|
|
@ -11,13 +11,18 @@ urlpatterns = [
|
|||
path('company/', views.company, name='groups_company'),
|
||||
path('trouble/', views.trouble, name='groups_trouble'),#隐患排查统计图
|
||||
path('observe/', views.observe, name='groups_observe'),#行为观察统计图
|
||||
path('miss/', views.job, name='groups_miss'),#未遂事件统计图
|
||||
path('risk/', views.job, name='groups_risk'),#风险管控统计图
|
||||
path('tain/', views.job, name='groups_train'),#教育培训统计图
|
||||
path('test/', views.job, name='groups_test'),#在线考试统计图
|
||||
path('miss/', views.miss, name='groups_miss'),#未遂事件统计图
|
||||
path('risk/', views.risk, name='groups_risk'),#风险管控统计图
|
||||
path('tain/', views.train, name='groups_train'),#教育培训统计图
|
||||
path('test/', views.exam, name='groups_test'),#在线考试统计图
|
||||
path('refresh_captcha/', views.refresh_captcha),
|
||||
path('updateposition/',views.updateposition),
|
||||
path('api/positions',views.apipositions),
|
||||
path('api/troubleChart',views.troubleChart),
|
||||
path('api/observeChart',views.observeChart)
|
||||
path('api/observeChart',views.observeChart),
|
||||
path('api/missChart',views.missChart),
|
||||
path('api/riskChart',views.riskChart),
|
||||
path('api/trainChart',views.trainChart),
|
||||
path('api/examChart',views.examChart)
|
||||
|
||||
]
|
||||
|
|
107
groups/views.py
107
groups/views.py
|
@ -118,34 +118,93 @@ def trouble(request):#隐患排查
|
|||
return render(request, 'groups/troublepic.html', locals())
|
||||
def observe(request):#行为观察
|
||||
return render(request, 'groups/observe.html', locals())
|
||||
def miss(request):#未遂事件
|
||||
return render(request, 'groups/miss.html', locals())
|
||||
def risk(request):#风险管控
|
||||
return render(request, 'groups/risk.html', locals())
|
||||
def train(request):#教育培训
|
||||
return render(request, 'groups/train.html', locals())
|
||||
def exam(request):#在线考试
|
||||
return render(request, 'groups/exam.html', locals())
|
||||
def troubleChart(request):#隐患统计图
|
||||
code = request.GET.get('code')
|
||||
|
||||
start = request.GET.get('start')
|
||||
end = request.GET.get('end')
|
||||
if code=='tbpic':
|
||||
yhcompanys=[]
|
||||
yhcompanyscount=[]
|
||||
|
||||
companys = GroupUser.objects.get(id = request.session['user_id']).group.members.all()
|
||||
troublelist = s_models.Trouble.objects.filter(deletemark=1,usecomp__in=companys).values('usecomp__partid','usecomp__partname').annotate(number = Count('troubleid'))
|
||||
if request.GET.get('starttime'):#开始时间
|
||||
a = troublelist.filter(fxsj__gte=request.GET.get('qssj'))
|
||||
if request.GET.get('endtime'):#结束时间
|
||||
a = troublelist.filter(fxsj__lte=request.GET.get('jssj'))
|
||||
return HttpResponse(json.dumps({'code':1,'data':{'troublelist':list(a)}}), content_type='application/json')
|
||||
if start:
|
||||
troublelist = troublelist.filter(fxsj__gte=start)
|
||||
if end:
|
||||
troublelist = troublelist.filter(fxsj__lte=end)
|
||||
return HttpResponse(json.dumps({'code':1,'data':{'troublelist':list(troublelist)}}), content_type='application/json')
|
||||
def observeChart(request):#行为观察
|
||||
code = request.GET.get('code')
|
||||
year = int(request.GET.get('year'))
|
||||
month =int( request.GET.get('month'))
|
||||
if code=='tbpic':
|
||||
userfy=[]#人员反映
|
||||
userwz=[]#员工的位置
|
||||
grfh=[]#个人防护装备
|
||||
gjhsb=[]#工具和设备
|
||||
cxhbz=[]#程序和标准
|
||||
rtgcx=[]#人体工程学
|
||||
hjzj=[]#环境整洁
|
||||
first_day,first_day_of_next_month = gettime(datetime(year,month,1))
|
||||
companys = GroupUser.objects.get(id = request.session['user_id']).group.members.all().values('partname')
|
||||
|
||||
return HttpResponse(json.dumps({'code':1,'data':{'list':list(Observe)},'userfy':userfy,'userwz':userwz,'grfh':grfh,'gjhsb':gjhsb,'cxhbz':cxhbz,'rtgcx':rtgcx,'hjzj':hjzj,}), content_type='application/json')
|
||||
|
||||
start = request.GET.get('start')
|
||||
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)
|
||||
if end:
|
||||
observelist = observelist.filter(looktime__lte=end)
|
||||
return HttpResponse(json.dumps({'code':1,'data':{'observelist':list(observelist)}}), content_type='application/json')
|
||||
|
||||
def missChart(request):#未遂事件
|
||||
code = request.GET.get('code')
|
||||
start = request.GET.get('start')
|
||||
end = request.GET.get('end')
|
||||
if code=='miss':
|
||||
|
||||
companys = GroupUser.objects.get(id = request.session['user_id']).group.members.all()
|
||||
misslist = s_models.Miss.objects.filter(deletemark=1,usecomp__in=companys).values('usecomp__partid','usecomp__partname').annotate(number = Count('missid'))
|
||||
if start:
|
||||
misslist = misslist.filter(misstime__gte=start)
|
||||
if end:
|
||||
misslist = misslist.filter(misstime__lte=end)
|
||||
return HttpResponse(json.dumps({'code':1,'data':{'misslist':list(misslist)}}), content_type='application/json')
|
||||
|
||||
def riskChart(request):#风险管控
|
||||
code = request.GET.get('code')
|
||||
start = request.GET.get('start')
|
||||
end = request.GET.get('end')
|
||||
if code=='risk':
|
||||
|
||||
companys = GroupUser.objects.get(id = request.session['user_id']).group.members.all()
|
||||
risklist = s_models.Risk.objects.filter(usecomp__in=companys).values('usecomp__partid','usecomp__partname').annotate(number = Count('id'))
|
||||
if start:
|
||||
risklist = risklist.filter(createtime__gte=start)
|
||||
if end:
|
||||
risklist = risklist.filter(createtime__lte=end)
|
||||
return HttpResponse(json.dumps({'code':1,'data':{'risklist':list(risklist)}}), content_type='application/json')
|
||||
def trainChart(request):#教育培训
|
||||
code = request.GET.get('code')
|
||||
start = request.GET.get('start')
|
||||
end = request.GET.get('end')
|
||||
if code=='train':
|
||||
companys = GroupUser.objects.get(id = request.session['user_id']).group.members.all()
|
||||
trainlist = s_models.Train.objects.filter(usecomp__in=companys).values('usecomp__partid','usecomp__partname').annotate(number = Count('trainid'))
|
||||
if start:
|
||||
trainlist = trainlist.filter(starttime__gte=start)
|
||||
if end:
|
||||
trainlist = trainlist.filter(starttime__lte=end)
|
||||
return HttpResponse(json.dumps({'code':1,'data':{'trainlist':list(trainlist)}}), content_type='application/json')
|
||||
|
||||
def examChart(request):#在线考试
|
||||
code = request.GET.get('code')
|
||||
start = request.GET.get('start')
|
||||
end = request.GET.get('end')
|
||||
examjson = []
|
||||
if code=='exam':
|
||||
companys = GroupUser.objects.get(id = request.session['user_id']).group.members.all()
|
||||
|
||||
for i in companys:
|
||||
examlist = s_models.ExamTest.objects.filter(usecomps__contains=','+i+',').annotate(number = Count('id'))
|
||||
if start:
|
||||
examlist = examlist.filter(starttime__gte=start)
|
||||
if end:
|
||||
examlist = examlist.filter(starttime__lte=end)
|
||||
examjson.append({'companyName':i,'number':examlist.number})
|
||||
return HttpResponse(json.dumps({'code':1,'data':examjson}), content_type='application/json')
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 2.1.5 on 2019-10-24 10:56
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0280_auto_20191023_1711'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 2.1.5 on 2019-10-24 11:09
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0281_remove_companyinfo_liaison_fax'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 2.1.5 on 2019-10-24 11:11
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0282_remove_companyinfo_liaison_fax'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 2.1.5 on 2019-10-24 11:13
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0283_remove_companyinfo_liaison_fax'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 2.1.5 on 2019-10-24 11:20
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0284_remove_companyinfo_liaison_fax'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
]
|
Loading…
Reference in New Issue