urlxiugai
This commit is contained in:
commit
cf6aedda8f
|
@ -1,57 +1,108 @@
|
|||
{% load static %}
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
{% load static %}
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<!-- 上述meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="{% static 'groups/bower_components/bootstrap/dist/css/bootstrap.min.css' %}" rel="stylesheet"/>
|
||||
<link href="{% static 'groups/login/login.css' %}" rel="stylesheet"/>
|
||||
<title>登录</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>集团后台|登陆</title>
|
||||
<!-- Tell the browser to be responsive to screen width -->
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
<!-- Bootstrap 3.3.7 -->
|
||||
<link rel="stylesheet" href="{% static 'groups/bower_components/bootstrap/dist/css/bootstrap.min.css' %}">
|
||||
<!-- Font Awesome -->
|
||||
<link rel="stylesheet" href="{% static 'groups/bower_components/font-awesome/css/font-awesome.min.css' %}">
|
||||
<!-- Ionicons -->
|
||||
<link rel="stylesheet" href="{% static 'groups/bower_components/Ionicons/css/ionicons.min.css' %}">
|
||||
<!-- Theme style -->
|
||||
<link rel="stylesheet" href="{% static 'groups/dist/css/AdminLTE.min.css' %}">
|
||||
<!-- iCheck -->
|
||||
<link rel="stylesheet" href="{% static 'groups/plugins/iCheck/square/blue.css' %}">
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<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]-->
|
||||
|
||||
<!-- Google Font -->
|
||||
<link rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="col">
|
||||
<form class="form-login" action="/groups/login/" method="post">
|
||||
|
||||
<body class="hold-transition login-page">
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<a href="../../index2.html"><b>集团后台</b>登陆</a>
|
||||
</div>
|
||||
<!-- /.login-logo -->
|
||||
<div class="login-box-body">
|
||||
<p class="login-box-msg">企业安全生产管理系统</p>
|
||||
|
||||
<form action="{% url 'groups_login' %}" method="post">
|
||||
{% if groups_form.captcha.errors %}
|
||||
<div class="alert alert-warning">{{ groups_form.captcha.error_messages }}</div>
|
||||
<p style="color:red">{{ groups_form.captcha.error_messages }}</p>
|
||||
{% elif message %}
|
||||
<div class="alert alert-warning">{{ message }}</div>
|
||||
<p style="color:red">{{ message }}</p>
|
||||
{% endif %}
|
||||
{% csrf_token %}
|
||||
<h3 class="text-center">欢迎登录</h3>
|
||||
<div class="form-group">
|
||||
{{ groups_form.username.label_tag }}
|
||||
<div class="form-group has-feedback">
|
||||
{{groups_form.username}}
|
||||
<span class="glyphicon glyphicon-user form-control-feedback"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{{ groups_form.password.label_tag }}
|
||||
<div class="form-group has-feedback">
|
||||
{{groups_form.password}}
|
||||
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{{ groups_form.captcha.label_tag }}
|
||||
<div class="form-group has-feedback">
|
||||
{{ groups_form.captcha }}
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary float-right">登录</button>
|
||||
<div class="row">
|
||||
<!-- <div class="col-xs-8">
|
||||
<div class="checkbox icheck">
|
||||
<label>
|
||||
<input type="checkbox"> Remember Me
|
||||
</label>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- /.col -->
|
||||
<div class="col-xs-12">
|
||||
<button type="submit" class="btn btn-primary btn-block btn-flat ">登陆</button>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- <div class="social-auth-links text-center">
|
||||
<p>- OR -</p>
|
||||
<a href="#" class="btn btn-block btn-social btn-facebook btn-flat"><i class="fa fa-facebook"></i> Sign in using
|
||||
Facebook</a>
|
||||
<a href="#" class="btn btn-block btn-social btn-google btn-flat"><i class="fa fa-google-plus"></i> Sign in using
|
||||
Google+</a>
|
||||
</div> -->
|
||||
<!-- /.social-auth-links -->
|
||||
|
||||
<!-- <a href="#">I forgot my password</a><br>
|
||||
<a href="register.html" class="text-center">Register a new membership</a> -->
|
||||
|
||||
</div>
|
||||
</div> <!-- /container -->
|
||||
<!-- /.login-box-body -->
|
||||
</div>
|
||||
<!-- /.login-box -->
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="{% static 'groups/bower_components/jquery/dist/jquery.js' %}"></script>
|
||||
<script src="https://cdn.bootcss.com/popper.js/1.15.0/umd/popper.js"></script>
|
||||
<!-- 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>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<!-- iCheck -->
|
||||
<script src="{% static 'groups/plugins/iCheck/icheck.min.js' %}"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
$('#id_captcha_1').addClass('form-control');
|
||||
$('input').iCheck({
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
radioClass: 'iradio_square-blue',
|
||||
increaseArea: '20%' /* optional */
|
||||
});
|
||||
});
|
||||
$('.captcha').click(function () {
|
||||
$.getJSON("/groups/refresh_captcha/", function (result) {
|
||||
|
@ -60,3 +111,6 @@ $('.captcha').click(function () {
|
|||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,62 @@
|
|||
{% load static %}
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<!-- 上述meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="{% static 'groups/bower_components/bootstrap/dist/css/bootstrap.min.css' %}" rel="stylesheet"/>
|
||||
<link href="{% static 'groups/login/login.css' %}" rel="stylesheet"/>
|
||||
<title>登录</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="col">
|
||||
<form class="form-login" action="/groups/login/" method="post">
|
||||
{% if groups_form.captcha.errors %}
|
||||
<div class="alert alert-warning">{{ groups_form.captcha.error_messages.invalid }}</div>
|
||||
{% elif message %}
|
||||
<div class="alert alert-warning">{{ message }}</div>
|
||||
{% endif %}
|
||||
{% csrf_token %}
|
||||
<h3 class="text-center">欢迎登录</h3>
|
||||
<div class="form-group">
|
||||
{{ groups_form.username.label_tag }}
|
||||
{{ groups_form.username}}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{{ groups_form.password.label_tag }}
|
||||
{{ groups_form.password }}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{{ groups_form.captcha.label_tag }}
|
||||
{{ groups_form.captcha }}
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary float-right">登录</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div> <!-- /container -->
|
||||
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="{% static 'groups/bower_components/jquery/dist/jquery.js' %}"></script>
|
||||
<script src="https://cdn.bootcss.com/popper.js/1.15.0/umd/popper.js"></script>
|
||||
<script src="{% static 'groups/bower_components/bootstrap/dist/js/bootstrap.min.js' %}"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<script>
|
||||
$(function(){
|
||||
$('#id_captcha_1').addClass('form-control');
|
||||
});
|
||||
$('.captcha').click(function () {
|
||||
$.getJSON("/groups/refresh_captcha/", function (result) {
|
||||
$('.captcha').attr('src', result['image_url']);
|
||||
$('#id_captcha_0').val(result['key'])
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -34,7 +34,6 @@ def login(request):
|
|||
request.session['user_name'] = user.username
|
||||
return redirect('/groups/index/')
|
||||
else:
|
||||
message = '密码不正确!'
|
||||
return render(request, 'groups/login.html', locals())
|
||||
else:
|
||||
return render(request, 'groups/login.html', locals())
|
||||
|
|
|
@ -693,7 +693,7 @@ class Inspect(models.Model):#设备巡检记录
|
|||
|
||||
class RiskAct(models.Model):#风险点表
|
||||
id = models.AutoField(primary_key=True)
|
||||
area = models.ForeignKey(Area,on_delete=models.CASCADE,null=True,blank=True)
|
||||
area = models.ForeignKey(Area,on_delete=models.CASCADE,null=True,blank=True,related_name='riskactarea')
|
||||
place = models.CharField(max_length=50,null=True,blank=True)
|
||||
type = models.ForeignKey(Dickey,on_delete=models.CASCADE,null=True,blank=True)
|
||||
name = models.CharField(max_length=200,null=True,blank=True)
|
||||
|
|
|
@ -1,94 +1,27 @@
|
|||
<div style="width:100%;height:5%;">
|
||||
<div style="margin-left:10px;margin-top:5px">
|
||||
<form id="yhbztf">
|
||||
<label>起始时间</label><input id="sqssj" name="qssj" class="easyui-datebox" style="width:110px;height:22px" />
|
||||
<label>结束时间</label><input id="sjssj" name="jssj" class="easyui-datebox" style="width:110px;height:22px" />
|
||||
<label>发现部门</label><input id="sfxbm" name="fxbm" style="width:200px;height:22px" />
|
||||
<a onclick="yhbztsearch()" class='easyui-linkbutton' iconCls='fa-search' plain=true>查询</a></form>
|
||||
<form id="fxfxf">
|
||||
<label>责任部门</label><input id="szrbm" name="zrbm" style="width:200px;height:22px" />
|
||||
<a onclick="fxsearch()" class='easyui-linkbutton' iconCls='fa-search' plain=true>查询</a></form>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width:100%;height:500px;padding: 20px">
|
||||
<div style="width:33%;height:80%;float: left;margin-top:20px;" align=center>
|
||||
<div id="yhlbt" style="width:80%;height:100%;">
|
||||
<div align=center>
|
||||
<div id="fxdlxt" style="width:80%;height:600px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div style="width:33%;height:80%;float: left;margin-top:20px" align=center>
|
||||
<div id="yhpgt" style="width:80%;height:100%;">
|
||||
|
||||
<div id="fxdjbt" style="width:80%;height:600px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div style="width:33%;height:80%;float: left;margin-top:20px" align=center>
|
||||
<div id="yhztt" style="width:80%;height:100%;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="yhqst" style="width:100%;height:400px;padding: 20px">
|
||||
</div>
|
||||
<div style="width: 60%; margin: 0px auto; ">
|
||||
<table name="" id="fxrpmtable" class='easyui-datagrid' title="隐患发现人排名" data-options="
|
||||
rownumbers:true,
|
||||
singleSelect:true,
|
||||
striped: true,
|
||||
method:'get',
|
||||
url: 'fxhandle?a=yhfxpm',
|
||||
toolbar:'#fxrpmbar'" style="height:400px">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-options="field:'fxr__userid',hidden:true">用户ID</th>
|
||||
<th data-options="field:'fxr__name',align:'right'" width="30%">姓名</th>
|
||||
<th data-options="field:'fxbm__partname',align:'right'" width="40%">所属部门</th>
|
||||
<th data-options="field:'number',align:'right'" width="20%">填报隐患数</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div id='fxrpmbar'>
|
||||
<form id="fxrpms">
|
||||
<a onclick="fxrpmsearch()" class='easyui-linkbutton' iconCls='fa-search' plain=true>查询</a>
|
||||
<a onclick="fxrpmexport()" class='easyui-linkbutton' iconCls='fa-upload' plain=true>导出</a>
|
||||
<div>
|
||||
<label>发现部门</label><input id="sfxbm2" name="fxbm" style="width:180px;height:22px" />
|
||||
<label>起始时间</label><input id="sqssj" name="qssj" class="easyui-datebox" style="width:80px;height:22px" />
|
||||
<label>结束时间</label><input id="sjssj" name="jssj" class="easyui-datebox" style="width:80px;height:22px" />
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div style="height:20px"></div>
|
||||
<table name="" id="zgrpmtable" class='easyui-datagrid' title="隐患整改人排名" data-options="
|
||||
rownumbers:true,
|
||||
singleSelect:true,
|
||||
striped: true,
|
||||
method:'get',
|
||||
url: 'fxhandle?a=yhzgpm',
|
||||
toolbar:'#zgrpmbar'" style="height:400px">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-options="field:'zgr__userid',hidden:true">用户ID</th>
|
||||
<th data-options="field:'zgr__name',align:'right'" width="30%">姓名</th>
|
||||
<th data-options="field:'zgbm__partname',align:'right'" width="40%">所属部门</th>
|
||||
<th data-options="field:'number',align:'right'" width="20%">整改隐患数</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<div id='zgrpmbar'>
|
||||
<form id="zgrpms">
|
||||
<a onclick="zgrpmsearch()" class='easyui-linkbutton' iconCls='fa-search' plain=true>查询</a>
|
||||
<a onclick="zgrpmexport()" class='easyui-linkbutton' iconCls='fa-upload' plain=true>导出</a>
|
||||
<div>
|
||||
<label>整改人</label><input class="easyui-textbox" name="zgr" style="width:80px;height:22px" />
|
||||
<label>起始时间</label><input id="sqssj" name="qssj" class="easyui-datebox" style="width:80px;height:22px" />
|
||||
<label>结束时间</label><input id="sjssj" name="jssj" class="easyui-datebox" style="width:80px;height:22px" />
|
||||
</div>
|
||||
</form>
|
||||
<div id="fxjbt" style="width:80%;height:600px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="fxdqyt" style="width:100%;height:600px;padding: 20px">
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$("#sfxbm,#sfxbm2").combotree({
|
||||
$("#szrbm").combotree({
|
||||
url: 'parthandle?a=tree',
|
||||
editable: false,
|
||||
loadFilter: function (rows) {
|
||||
|
@ -102,85 +35,513 @@
|
|||
return s;
|
||||
},
|
||||
onSelect: function (node) {
|
||||
$('#sfxr').combobox({
|
||||
url: 'getuser?partid=' + node.id + '&a=combobox',
|
||||
editable: false,
|
||||
});
|
||||
// $('#sfxr').combobox({
|
||||
// url: 'getuser?partid=' + node.id + '&a=combobox',
|
||||
// editable: false,
|
||||
// });
|
||||
}
|
||||
});
|
||||
function fxrpmsearch() {
|
||||
var querydata = $('#fxrpms').serializeJSON();
|
||||
$('#fxrpmtable').datagrid('load', querydata);
|
||||
}
|
||||
function zgrpmsearch() {
|
||||
var querydata = $('#zgrpms').serializeJSON();
|
||||
$('#zgrpmtable').datagrid('load', querydata);
|
||||
}
|
||||
function yhbztsearch() {
|
||||
var querydata = $('#yhbztf').serializeJSON();
|
||||
bindmap3_o('yhlbt', querydata)
|
||||
bindmap4_o('yhpgt', querydata)
|
||||
bindmap8('yhztt', querydata)
|
||||
bindmap7('yhqst',querydata);
|
||||
// function fxrpmsearch() {
|
||||
// var querydata = $('#fxrpms').serializeJSON();
|
||||
// $('#fxrpmtable').datagrid('load', querydata);
|
||||
// }
|
||||
// function zgrpmsearch() {
|
||||
// var querydata = $('#zgrpms').serializeJSON();
|
||||
// $('#zgrpmtable').datagrid('load', querydata);
|
||||
// }
|
||||
function fxsearch() {
|
||||
var querydata = $('#fxfxf').serializeJSON();
|
||||
bindmap_fxdlxt('fxdlxt',querydata);
|
||||
bindmap_fxdjbt('fxdjbt',querydata);
|
||||
bindmap_fxjbt('fxjbt',querydata);
|
||||
bindmap_fxdqyt('fxdqyt',querydata);
|
||||
}
|
||||
var now = new Date();
|
||||
var year = now.getFullYear();
|
||||
var month = now.getMonth() + 1;
|
||||
bindmap3_o('yhlbt', { 'year': year, 'month': month });
|
||||
bindmap4_o('yhpgt', { 'year': year, 'month': month });
|
||||
bindmap7('yhqst');
|
||||
bindmap8('yhztt');
|
||||
function fxrpmexport() {
|
||||
var data = $('#fxrpmtable').datagrid('getData');
|
||||
var datalist = data.rows;
|
||||
//datalist.unshift({'fxr__userid':'用户ID','fxr__name':'姓名','fxbm__partname':'部门','number':'发现隐患数'})
|
||||
bindmap_fxdlxt('fxdlxt');
|
||||
bindmap_fxdjbt('fxdjbt');
|
||||
bindmap_fxjbt('fxjbt');
|
||||
bindmap_fxdqyt('fxdqyt');
|
||||
function bindmap_fxdjbt(x, querydata) {
|
||||
|
||||
var querydata = querydata || {}
|
||||
let myChart
|
||||
myChart = echarts.init(document.getElementById(x));
|
||||
myChart.setOption(option = {
|
||||
title: {
|
||||
text: '风险点级别分布图',
|
||||
},
|
||||
legend: {
|
||||
x: 'center',
|
||||
y: 'bottom',
|
||||
data: []
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: "{a} <br/>{b} : {c} ({d}%)"
|
||||
},
|
||||
toolbox: {
|
||||
show: true,
|
||||
feature: {
|
||||
mark: { show: true },
|
||||
restore: { show: true },
|
||||
saveAsImage: { show: true },
|
||||
dataView: { show: true, readOnly: false },
|
||||
//magicType: { show: true, type: ['line', 'bar'] },
|
||||
}
|
||||
},
|
||||
color:['blue', 'yellow','orange','red'],
|
||||
series: [
|
||||
{
|
||||
name: '风险点级别',
|
||||
type: 'pie',
|
||||
radius: '70%',
|
||||
center: ['50%', '50%'],
|
||||
data: [
|
||||
],
|
||||
label: {
|
||||
normal: {
|
||||
formatter: '{a|{a}}{abg|}\n{hr|}\n {b|{b}:}{c} {per|{d}%} ',
|
||||
backgroundColor: '#eee',
|
||||
borderColor: '#aaa',
|
||||
borderWidth: 1,
|
||||
borderRadius: 4,
|
||||
// shadowBlur:3,
|
||||
// shadowOffsetX: 2,
|
||||
// shadowOffsetY: 2,
|
||||
// shadowColor: '#999',
|
||||
// padding: [0, 7],
|
||||
rich: {
|
||||
a: {
|
||||
color: '#999',
|
||||
lineHeight: 22,
|
||||
align: 'center'
|
||||
},
|
||||
hr: {
|
||||
borderColor: '#aaa',
|
||||
width: '100%',
|
||||
borderWidth: 0.5,
|
||||
height: 0
|
||||
},
|
||||
b: {
|
||||
fontSize: 16,
|
||||
lineHeight: 33
|
||||
},
|
||||
per: {
|
||||
color: '#eee',
|
||||
backgroundColor: '#334455',
|
||||
padding: [2, 4],
|
||||
borderRadius: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
]
|
||||
});
|
||||
myChart.showLoading();
|
||||
|
||||
for (var j = 0, len = datalist.length; j < len; j++) {
|
||||
var dic = datalist[j]
|
||||
for (var key in dic) {
|
||||
dic["姓名"] = dic["fxr__name"]
|
||||
dic["部门"] = dic["fxbm__partname"]
|
||||
dic["发现隐患数"] = dic["number"]
|
||||
delete dic["fxr__userid"];
|
||||
delete dic["fxr__name"]
|
||||
delete dic["fxbm__partname"]
|
||||
delete dic["number"]
|
||||
$.ajax({
|
||||
type: "get",
|
||||
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
|
||||
url: "api/riskas?a=fxdjbt", //请求发送
|
||||
data: querydata,
|
||||
dataType: "json", //返回数据形式为json
|
||||
success: function (data) {
|
||||
//请求成功时执行该函数内容,data即为服务器返回的json对象
|
||||
if (data) {
|
||||
myChart.hideLoading(); //隐藏加载动画
|
||||
myChart.setOption(
|
||||
{
|
||||
legend: [{
|
||||
data: data.legendData,
|
||||
}],
|
||||
series: [
|
||||
{
|
||||
data: data.seriesData,
|
||||
}
|
||||
]
|
||||
}
|
||||
);
|
||||
//map4v=myChart.getDataURL();
|
||||
}
|
||||
},
|
||||
error: function (errorMsg) {
|
||||
//请求失败时执行该函数
|
||||
//alert("汗,没有数据吧!");
|
||||
myChart.hideLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
function bindmap_fxdlxt(x, querydata) {
|
||||
|
||||
var querydata = querydata || {}
|
||||
let myChart
|
||||
myChart = echarts.init(document.getElementById(x));
|
||||
myChart.setOption(option = {
|
||||
title: {
|
||||
text: '风险点类型分布图',
|
||||
},
|
||||
legend: {
|
||||
x: 'center',
|
||||
y: 'bottom',
|
||||
data: []
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: "{a} <br/>{b} : {c} ({d}%)"
|
||||
},
|
||||
toolbox: {
|
||||
show: true,
|
||||
feature: {
|
||||
mark: { show: true },
|
||||
restore: { show: true },
|
||||
saveAsImage: { show: true },
|
||||
dataView: { show: true, readOnly: false },
|
||||
//magicType: { show: true, type: ['line', 'bar'] },
|
||||
}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '风险点类型',
|
||||
type: 'pie',
|
||||
radius: '70%',
|
||||
center: ['50%', '50%'],
|
||||
data: [
|
||||
],
|
||||
label: {
|
||||
normal: {
|
||||
formatter: '{a|{a}}{abg|}\n{hr|}\n {b|{b}:}{c} {per|{d}%} ',
|
||||
backgroundColor: '#eee',
|
||||
borderColor: '#aaa',
|
||||
borderWidth: 1,
|
||||
borderRadius: 4,
|
||||
// shadowBlur:3,
|
||||
// shadowOffsetX: 2,
|
||||
// shadowOffsetY: 2,
|
||||
// shadowColor: '#999',
|
||||
// padding: [0, 7],
|
||||
rich: {
|
||||
a: {
|
||||
color: '#999',
|
||||
lineHeight: 22,
|
||||
align: 'center'
|
||||
},
|
||||
hr: {
|
||||
borderColor: '#aaa',
|
||||
width: '100%',
|
||||
borderWidth: 0.5,
|
||||
height: 0
|
||||
},
|
||||
b: {
|
||||
fontSize: 16,
|
||||
lineHeight: 33
|
||||
},
|
||||
per: {
|
||||
color: '#eee',
|
||||
backgroundColor: '#334455',
|
||||
padding: [2, 4],
|
||||
borderRadius: 2
|
||||
}
|
||||
}
|
||||
JSONToCSVConvertor(JSON.stringify(datalist), "发现排名", true);
|
||||
// var postdata = {
|
||||
// data:JSON.stringify(datalist)
|
||||
// }
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: "fxhandle?a=exportexcel",
|
||||
// data: postdata,
|
||||
// success: function (data) {
|
||||
// if (data.code==1) {
|
||||
// downloadurl = 'http://' + window.location.host + '/' + data.downloadurl
|
||||
// window.open(downloadurl);
|
||||
// } else{
|
||||
// $.messager.alert('提示', '导出失败!');
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
function zgrpmexport() {
|
||||
var data = $('#zgrpmtable').datagrid('getData');
|
||||
var datalist = data.rows;
|
||||
for (var j = 0, len = datalist.length; j < len; j++) {
|
||||
var dic = datalist[j]
|
||||
for (var key in dic) {
|
||||
dic["姓名"] = dic["zgr__name"]
|
||||
dic["部门"] = dic["zgbm__partname"]
|
||||
dic["整改隐患数"] = dic["number"]
|
||||
delete dic["zgr__userid"];
|
||||
delete dic["zgr__name"]
|
||||
delete dic["zgbm__partname"]
|
||||
delete dic["number"]
|
||||
},
|
||||
}
|
||||
]
|
||||
});
|
||||
myChart.showLoading();
|
||||
|
||||
$.ajax({
|
||||
type: "get",
|
||||
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
|
||||
url: "api/riskas?a=fxdlxt", //请求发送
|
||||
data: querydata,
|
||||
dataType: "json", //返回数据形式为json
|
||||
success: function (data) {
|
||||
//请求成功时执行该函数内容,data即为服务器返回的json对象
|
||||
if (data) {
|
||||
myChart.hideLoading(); //隐藏加载动画
|
||||
myChart.setOption(
|
||||
{
|
||||
legend: [{
|
||||
data: data.legendData,
|
||||
}],
|
||||
series: [
|
||||
{
|
||||
data: data.seriesData,
|
||||
}
|
||||
]
|
||||
}
|
||||
);
|
||||
//map4v=myChart.getDataURL();
|
||||
}
|
||||
},
|
||||
error: function (errorMsg) {
|
||||
//请求失败时执行该函数
|
||||
//alert("汗,没有数据吧!");
|
||||
myChart.hideLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
function bindmap_fxjbt(x, querydata) {
|
||||
|
||||
var querydata = querydata || {}
|
||||
let myChart
|
||||
myChart = echarts.init(document.getElementById(x));
|
||||
myChart.setOption(option = {
|
||||
title: {
|
||||
text: '风险级别分布图',
|
||||
},
|
||||
legend: {
|
||||
x: 'center',
|
||||
y: 'bottom',
|
||||
data: []
|
||||
},
|
||||
|
||||
color: ['blue', 'yellow', 'orange', 'red'],
|
||||
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: "{a} <br/>{b} : {c} ({d}%)"
|
||||
},
|
||||
toolbox: {
|
||||
show: true,
|
||||
feature: {
|
||||
mark: { show: true },
|
||||
restore: { show: true },
|
||||
saveAsImage: { show: true },
|
||||
dataView: { show: true, readOnly: false },
|
||||
//magicType: { show: true, type: ['line', 'bar'] },
|
||||
}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '风险级别',
|
||||
type: 'pie',
|
||||
radius: '70%',
|
||||
center: ['50%', '50%'],
|
||||
data: [
|
||||
],
|
||||
label: {
|
||||
normal: {
|
||||
formatter: '{a|{a}}{abg|}\n{hr|}\n {b|{b}:}{c} {per|{d}%} ',
|
||||
backgroundColor: '#eee',
|
||||
borderColor: '#aaa',
|
||||
borderWidth: 1,
|
||||
borderRadius: 4,
|
||||
// shadowBlur:3,
|
||||
// shadowOffsetX: 2,
|
||||
// shadowOffsetY: 2,
|
||||
// shadowColor: '#999',
|
||||
// padding: [0, 7],
|
||||
rich: {
|
||||
a: {
|
||||
color: '#999',
|
||||
lineHeight: 22,
|
||||
align: 'center'
|
||||
},
|
||||
hr: {
|
||||
borderColor: '#aaa',
|
||||
width: '100%',
|
||||
borderWidth: 0.5,
|
||||
height: 0
|
||||
},
|
||||
b: {
|
||||
fontSize: 16,
|
||||
lineHeight: 33
|
||||
},
|
||||
per: {
|
||||
color: '#eee',
|
||||
backgroundColor: '#334455',
|
||||
padding: [2, 4],
|
||||
borderRadius: 2
|
||||
}
|
||||
}
|
||||
JSONToCSVConvertor(JSON.stringify(datalist), "整改排名", true);
|
||||
}
|
||||
},
|
||||
}
|
||||
]
|
||||
});
|
||||
myChart.showLoading();
|
||||
|
||||
$.ajax({
|
||||
type: "get",
|
||||
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
|
||||
url: "api/riskas?a=fxjbt", //请求发送
|
||||
data: querydata,
|
||||
dataType: "json", //返回数据形式为json
|
||||
success: function (data) {
|
||||
//请求成功时执行该函数内容,data即为服务器返回的json对象
|
||||
if (data) {
|
||||
myChart.hideLoading(); //隐藏加载动画
|
||||
myChart.setOption(
|
||||
{
|
||||
legend: [{
|
||||
data: data.legendData,
|
||||
}],
|
||||
series: [
|
||||
{
|
||||
data: data.seriesData,
|
||||
}
|
||||
]
|
||||
}
|
||||
);
|
||||
//map4v=myChart.getDataURL();
|
||||
}
|
||||
},
|
||||
error: function (errorMsg) {
|
||||
//请求失败时执行该函数
|
||||
//alert("汗,没有数据吧!");
|
||||
myChart.hideLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
function bindmap_fxdqyt(x, querydata) {
|
||||
var querydata = querydata || {}
|
||||
let myChart
|
||||
myChart = echarts.init(document.getElementById(x));
|
||||
myChart.setOption(option = {
|
||||
title: {
|
||||
text: '区域风险分布图',
|
||||
},
|
||||
legend: {
|
||||
data: ['风险点','低风险点','一般风险点','较大风险点','重大风险点','风险','低风险','一般风险','较大风险','重大风险']
|
||||
},
|
||||
toolbox: {
|
||||
show: true,
|
||||
feature: {
|
||||
mark: { show: true },
|
||||
restore: { show: true },
|
||||
saveAsImage: { show: true },
|
||||
dataView: { show: true, readOnly: false },
|
||||
//magicType: { show: true, type: ['line', 'bar'] },
|
||||
}
|
||||
},
|
||||
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: [],
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
},
|
||||
series: [],
|
||||
dataZoom: [
|
||||
{
|
||||
type: 'slider',
|
||||
show: true,
|
||||
start: 0,
|
||||
end: 10,
|
||||
handleSize: 8
|
||||
},
|
||||
{
|
||||
type: 'inside',
|
||||
start: 94,
|
||||
end: 100
|
||||
},
|
||||
{
|
||||
type: 'slider',
|
||||
show: true,
|
||||
yAxisIndex: 0,
|
||||
filterMode: 'empty',
|
||||
width: 12,
|
||||
height: '70%',
|
||||
handleSize: 8,
|
||||
showDataShadow: false,
|
||||
left: '93%'
|
||||
}
|
||||
]
|
||||
});
|
||||
myChart.showLoading();
|
||||
$.ajax({
|
||||
type: "get",
|
||||
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
|
||||
url: "api/riskas?a=fxdqyt", //请求发送
|
||||
data: querydata,
|
||||
dataType: "json", //返回数据形式为json
|
||||
success: function (data) {
|
||||
//请求成功时执行该函数内容,data即为服务器返回的json对象
|
||||
if (data) {
|
||||
myChart.hideLoading(); //隐藏加载动画
|
||||
myChart.setOption({
|
||||
xAxis: {
|
||||
data: data.xAxisData
|
||||
},
|
||||
series: [{
|
||||
name: '风险点',
|
||||
type:'bar',
|
||||
|
||||
data: data.seriesData.datariskact
|
||||
},{
|
||||
name: '低风险点',
|
||||
type:'bar',
|
||||
stack: '风险点',
|
||||
color: 'blue',
|
||||
data: data.seriesData.datariskact1
|
||||
},
|
||||
{
|
||||
name: '一般风险点',
|
||||
type:'bar',
|
||||
stack: '风险点',
|
||||
color: 'yellow',
|
||||
data: data.seriesData.datariskact2
|
||||
},{
|
||||
name: '较大风险点',
|
||||
type:'bar',
|
||||
stack: '风险点',
|
||||
color: 'orange',
|
||||
data: data.seriesData.datariskact3
|
||||
},{
|
||||
name: '重大风险点',
|
||||
type:'bar',
|
||||
stack: '风险点',
|
||||
color: 'red',
|
||||
data: data.seriesData.datariskact4
|
||||
},{
|
||||
name: '风险',
|
||||
type:'bar',
|
||||
data: data.seriesData.datarisk
|
||||
},{
|
||||
name: '低风险',
|
||||
type:'bar',
|
||||
stack: '风险',
|
||||
color: 'blue',
|
||||
data: data.seriesData.datarisk1
|
||||
},{
|
||||
name: '一般风险',
|
||||
type:'bar',
|
||||
stack: '风险',
|
||||
color: 'yellow',
|
||||
data: data.seriesData.datarisk2
|
||||
},{
|
||||
name: '较大风险',
|
||||
type:'bar',
|
||||
stack: '风险',
|
||||
color: 'orange',
|
||||
data: data.seriesData.datarisk3
|
||||
},{
|
||||
name: '重大风险',
|
||||
type:'bar',
|
||||
stack: '风险',
|
||||
color: 'red',
|
||||
data: data.seriesData.datarisk4
|
||||
},]
|
||||
});
|
||||
//map4v=myChart.getDataURL();
|
||||
}
|
||||
},
|
||||
error: function (errorMsg) {
|
||||
//请求失败时执行该函数
|
||||
//alert("汗,没有数据吧!");
|
||||
myChart.hideLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -87,6 +87,7 @@ urlpatterns = [
|
|||
path('html/report/edit',views.reportedit),
|
||||
path('html/bhr',views.bhrhtml),
|
||||
path('riskas',views.riskas),
|
||||
path('html/examhistory/<int:id>/',views.examhistory),
|
||||
#html页面
|
||||
|
||||
|
||||
|
@ -150,8 +151,9 @@ urlpatterns = [
|
|||
#path('api/riskactcheck',views.apiriskactcheck),
|
||||
path('api/riskcheck2',views.apiriskcheck2),
|
||||
path('api/report',views.apireport),
|
||||
path('html/examhistory/<int:id>/',views.examhistory),
|
||||
path('api/obscount',views.observepic),
|
||||
path('api/riskas',views.apiriskas),
|
||||
|
||||
|
||||
#path('api/rights/group/<int:groupid>',views.rightsgroup),
|
||||
path('api/main',views.mainapi),
|
||||
|
|
|
@ -1647,7 +1647,7 @@ def charthandle(req):
|
|||
nowyjz = a.yjz
|
||||
nowycz = a.ycz
|
||||
return JsonResponse({'code':1,'yjz':nowyjz,'ycz':nowycz})
|
||||
elif req.GET.get('a')=='yhlbt':#隐患列表图
|
||||
elif req.GET.get('a')=='yhlbt':#隐患类别图
|
||||
if req.GET.get('year'):
|
||||
year = int(req.GET.get('year'))
|
||||
month = int(req.GET.get('month'))
|
||||
|
@ -1953,6 +1953,79 @@ def charthandle(req):
|
|||
value.append({'value':y,'name':x})
|
||||
return JsonResponse({'code':1,'key':key,'value':value})
|
||||
|
||||
def apiriskas(req):
|
||||
userid = req.session['userid']
|
||||
companyid = getcompany(userid)
|
||||
if req.GET.get('a') == 'fxdlxt':#风险点类型图
|
||||
objs = RiskAct.objects.filter(usecomp__partid=companyid)
|
||||
if req.GET.get('zrbm',None):
|
||||
partid = req.GET.get('zrbm')
|
||||
objs = objs.filter(zrbm__partid=partid)
|
||||
legendData = []
|
||||
seriesData = []
|
||||
for i in Dickey.objects.filter(dicparent__dicid=53):
|
||||
legendData.append(i.dickeyname)
|
||||
seriesData.append({'value':objs.filter(type=i).count(),'name':i.dickeyname})
|
||||
return JsonResponse({'code':1,'legendData':legendData,'seriesData':seriesData})
|
||||
elif req.GET.get('a') == 'fxdjbt':#风险点级别图
|
||||
objs = RiskAct.objects.filter(usecomp__partid=companyid)
|
||||
if req.GET.get('zrbm',None):
|
||||
partid = req.GET.get('zrbm')
|
||||
objs = objs.filter(zrbm__partid=partid)
|
||||
legendData = ['低风险','一般风险','较大风险','重大风险']
|
||||
seriesData = []
|
||||
for i in legendData:
|
||||
seriesData.append({'value':objs.filter(level=i).count(),'name':i})
|
||||
return JsonResponse({'code':1,'legendData':legendData,'seriesData':seriesData})
|
||||
elif req.GET.get('a') == 'fxjbt':#风险级别图
|
||||
objs = Risk.objects.filter(usecomp__partid=companyid)
|
||||
if req.GET.get('zrbm',None):
|
||||
partid = req.GET.get('zrbm')
|
||||
objs = objs.filter(riskact__zrbm__partid=partid)
|
||||
legendData = ['低风险','一般风险','较大风险','重大风险']
|
||||
seriesData = []
|
||||
for i in legendData:
|
||||
seriesData.append({'value':objs.filter(level=i).count(),'name':i})
|
||||
return JsonResponse({'code':1,'legendData':legendData,'seriesData':seriesData})
|
||||
elif req.GET.get('a') == 'fxdqyt':#风险点区域图
|
||||
objs = RiskAct.objects.filter(usecomp__partid=companyid)
|
||||
objs2 = Risk.objects.filter(usecomp__partid=companyid)
|
||||
if req.GET.get('zrbm',None):
|
||||
partid = req.GET.get('zrbm')
|
||||
objs = objs.filter(zrbm__partid=partid)
|
||||
objs2 = objs2.filter(riskact__zrbm__partid=partid)
|
||||
xAxisData = []
|
||||
series = []
|
||||
#areas = Area.objects.filter(usecomp__partid=companyid,deletemark=1)
|
||||
#riskactareas = Area.objects.filter(usecomp__partid=companyid,deletemark=1).annotate(num=Count('riskactarea')).filter(num__gt=0).order_by('-num')
|
||||
riskactareas = objs.values('area').annotate(num=Count('area')).order_by('-num')
|
||||
for i in riskactareas:
|
||||
xAxisData.append(Area.objects.get(id=i['area']).name)
|
||||
data = {}
|
||||
data['datariskact']=[] # 风险点总数
|
||||
data['datariskact1']=[] # 低风险点数
|
||||
data['datariskact2']=[] # 一般风险点数
|
||||
data['datariskact3']=[] # 较大风险点数
|
||||
data['datariskact4']=[] # 重大风险点数
|
||||
data['datarisk']=[] # 风险总数
|
||||
data['datarisk1']=[] # 低风险数
|
||||
data['datarisk2']=[] # 一般风险数
|
||||
data['datarisk3']=[] # 较大风险数
|
||||
data['datarisk4']=[] # 重大风险数
|
||||
for i in riskactareas:
|
||||
objsxx = objs.filter(area__id=i['area'])
|
||||
data['datariskact'].append(objsxx.count())
|
||||
data['datariskact1'].append(objsxx.filter(level="低风险").count())
|
||||
data['datariskact2'].append(objsxx.filter(level="一般风险").count())
|
||||
data['datariskact3'].append(objsxx.filter(level="较大风险").count())
|
||||
data['datariskact4'].append(objsxx.filter(level="重大风险").count())
|
||||
objsxx2 = objs2.filter(riskact__area__id=i['area'])
|
||||
data['datarisk'].append(objsxx2.count())
|
||||
data['datarisk1'].append(objsxx2.filter(level="低风险").count())
|
||||
data['datarisk2'].append(objsxx2.filter(level="一般风险").count())
|
||||
data['datarisk3'].append(objsxx2.filter(level="较大风险").count())
|
||||
data['datarisk4'].append(objsxx2.filter(level="重大风险").count())
|
||||
return JsonResponse({'code':1,'xAxisData':xAxisData,'seriesData':data})
|
||||
def fxhandle(req):
|
||||
a = req.GET.get('a')
|
||||
if a == 'exportyjdoc':
|
||||
|
|
Loading…
Reference in New Issue