个人安全数据 未完成

This commit is contained in:
caoqianming 2021-03-24 22:24:25 +08:00
parent b9428dcd96
commit 53297aff42
2 changed files with 69 additions and 14 deletions

View File

@ -43,13 +43,13 @@
<div id="testdiv"> <div id="testdiv">
</div> </div>
<div id="yldiv"> <div id="drilldiv">
</div> </div>
<div id="xjdiv"> <div id="inspectdiv">
</div> </div>
<div id="zsdiv"> <div id="certdiv">
</div> </div>
</div> </div>
@ -58,12 +58,12 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var arrs = new Array("trouble","train","operation", "miss", "suggest", "test", "drill", "inspect", "cert")
$(function () { $(function () {
beginsearch({type:'trouble'}); for(var i=0;i<arrs.length;i++){
beginsearch({type:'train'}); var querydata = {type:arrs[i]}
beginsearch({type:'operation'}); beginsearch(querydata)
beginsearch({type:'miss'}); }
beginsearch({type:'suggest'});
}) })
function aaa(x) { function aaa(x) {
if (x == "user") { if (x == "user") {
@ -71,6 +71,14 @@
$('#username').textbox('setValue', top.$('#in').attr('show')); $('#username').textbox('setValue', top.$('#in').attr('show'));
} }
} }
function startSearch(){
var querydata = $('#ff').serializeJSON()
for(var i=0;i<arrs.length;i++){
querydata.type = arrs[i];
beginsearch(querydata)
}
}
function ExportWord(e) { function ExportWord(e) {
$("#exportdiv").wordExport(); $("#exportdiv").wordExport();
} }
@ -85,21 +93,32 @@
//请求成功时执行该函数内容data即为服务器返回的json对象 //请求成功时执行该函数内容data即为服务器返回的json对象
if(res){ if(res){
if(data.type == 'trouble'){ if(data.type == 'trouble'){
$('#troublediv').html('<p>上报隐患<span style="color:red;font-weight:bold">' + res.fx_count + '</span>条, 整改隐患<span style="color:red;font-weight:bold">' + res.zg_count + '</span>条.</p>') $('#troublediv').html('<p>上报隐患<span style="color:red;font-weight:bold">' + res.fx_count + '</span>条, 整改隐患<span style="color:red;font-weight:bold">' + res.zg_count + '</span>条.</p>')
} }
else if(data.type == 'train'){ else if(data.type == 'train'){
$('#traindiv').html('<p>需参加培训<span style="color:red;font-weight:bold">' + res.px_count + '</span>场, 参加并签到<span style="color:red;font-weight:bold">' + res.qd_count + '</span>场.</p>') $('#traindiv').html('<p>需参加培训<span style="color:red;font-weight:bold">' + res.px_count + '</span>场, 参加并签到<span style="color:red;font-weight:bold">' + res.qd_count + '</span>场.</p>')
} }
else if(data.type == 'operation'){ else if(data.type == 'operation'){
$('#operationdiv').html('<p>参与作业<span style="color:red;font-weight:bold">' + res.zy_count + '</span>场, 其中身为作业负责人<span style="color:red;font-weight:bold">' + res.zyfzr_count + '</span>场.</p>') $('#operationdiv').html('<p>参与作业<span style="color:red;font-weight:bold">' + res.zy_count + '</span>场, 其中身为作业负责人<span style="color:red;font-weight:bold">' + res.zyfzr_count + '</span>场.</p>')
} }
else if(data.type == 'miss'){ else if(data.type == 'miss'){
$('#missdiv').html('<p>上报未遂事件<span style="color:red;font-weight:bold">' + res.ws_count + '</span>件.</p>') $('#missdiv').html('<p>上报未遂事件<span style="color:red;font-weight:bold">' + res.ws_count + '</span>件.</p>')
} }
else if(data.type == 'suggest'){ else if(data.type == 'suggest'){
$('#suggestdiv').html('<p>共提出并被采纳的建议<span style="color:red;font-weight:bold">' + res.jy_count + '</span>条, 本人处理了<span style="color:red;font-weight:bold">' + res.jycl_count + '</span>条.</p>') $('#suggestdiv').html('<p>提出并被采纳的建议共<span style="color:red;font-weight:bold">' + res.jy_count + '</span>条, 本人处理了<span style="color:red;font-weight:bold">' + res.jycl_count + '</span>条.</p>')
}
else if(data.type == 'test'){
$('#testdiv').html('<p>共参加考试<span style="color:red;font-weight:bold">' + res.ks_count + '</span>场, 其中<span style="color:red;font-weight:bold">' + res.kstg_count + '</span>场通过.</p>')
}
else if(data.type == 'drill'){
$('#drilldiv').html('<p>共参加应急演练<span style="color:red;font-weight:bold">' + res.yl_count + '</span>场.')
}
else if(data.type == 'inspect'){
$('#inspectdiv').html('<p>共巡检设备<span style="color:red;font-weight:bold">' + res.xj_count + '</span>次, 其中<span style="color:red;font-weight:bold">' + res.xjyc_count + '</span>次发现异常.本人处理了<span style="color:red;font-weight:bold">'+ res.clyc_count+'</span>个异常</p>')
}
else if(data.type == 'cert'){
$('#certdiv').html('<p>拥有特种作业证书<span style="color:red;font-weight:bold">' + res.tz_count + '</span>张, 其中<span style="color:red;font-weight:bold">' + res.tzcq_count + '</span>张超期.</p><p>拥有安全证书<span style="color:red;font-weight:bold">'+ res.aq_count+'</span>张,其中<span style="color:red;font-weight:bold">' + res.aqcq_count + '</span>张超期.</p>')
} }
} }

View File

@ -1,11 +1,12 @@
from .models import * from .models import *
from .views import apicheck_login from .views import apicheck_login, getcompany
from django.http import JsonResponse from django.http import JsonResponse
from django.db.models import Q from django.db.models import Q
@apicheck_login @apicheck_login
def apicountsafe(req): def apicountsafe(req):
type = req.GET.get('type') type = req.GET.get('type')
userid = req.session['userid'] userid = req.session['userid']
companyid = getcompany(userid)
ret = {} ret = {}
if req.GET.get('userid', None): if req.GET.get('userid', None):
userid = req.GET.get('userid') userid = req.GET.get('userid')
@ -48,3 +49,38 @@ def apicountsafe(req):
ret['jy_count'] = objs.filter(jyr__userid=userid, accept=1).count() ret['jy_count'] = objs.filter(jyr__userid=userid, accept=1).count()
ret['jycl_count'] = objs.filter(clr__userid=userid, accept=1).count() ret['jycl_count'] = objs.filter(clr__userid=userid, accept=1).count()
return JsonResponse(ret) return JsonResponse(ret)
elif type == 'test':
objs = ExamTestDetail.objects.exclude(examtest__nousecomps__contains=','+companyid+',')
if req.GET.get('dept', None):
pass
else:
ret['ks_count'] = objs.filter(user__userid=userid).count()
ret['kstg_count'] = objs.filter(user__userid=userid, passcode=1).count()
return JsonResponse(ret)
elif type == 'drill':
objs = Drill.objects.filter(deletemark=1)
if req.GET.get('dept', None):
pass
else:
ret['yl_count'] = objs.filter(participant__userid=userid).count()
return JsonResponse(ret)
elif type == 'inspect':
objs = Inspect.objects.all()
if req.GET.get('dept', None):
pass
else:
ret['xj_count'] = objs.filter(user__userid=userid).count()
ret['xjyc_count'] = objs.filter(user__userid=userid, state=0).count()
ret['clyc_count'] = InspectItem.objects.filter(todouser__userid=userid, state='异常已处理').count()
return JsonResponse(ret)
elif type == 'cert':
objs1 = Socertificate.objects.all()
objs2 = Safecert.objects.all()
if req.GET.get('dept', None):
pass
else:
ret['tz_count'] = objs1.filter(user__userid=userid).count()
ret['tzcq_count'] = objs1.filter(user__userid=userid, zszt=3).count()
ret['aq_count'] = objs2.filter(user__userid=userid).count()
ret['aqcq_count'] = objs2.filter(user__userid=userid, zszt=3).count()
return JsonResponse(ret)