This commit is contained in:
caoqianming 2022-04-09 22:11:39 +08:00
commit 62888f8b4c
5 changed files with 48 additions and 6 deletions

View File

@ -22,7 +22,7 @@ from django.core.serializers.json import DjangoJSONEncoder
from io import StringIO
import operator
import jwt
from ..views import getcompany,fenye,transjson,upfile
from ..views import apicheck_login, getcompany,fenye,transjson,upfile
def index(req):
return render(req,'edulessonindex.html')
@ -63,6 +63,8 @@ def selectDate(req):
startnum,endnum=fenye(req)
a = a.order_by('-submittime')[startnum:endnum].values('id','num','title','user__name','desciption','submittime','type','cate__name','url','downnum')
return HttpResponse(transjson(total,a),content_type="application/json")
@apicheck_login
def api(req):
a = req.GET.get('a')
#首页列表

View File

@ -57,8 +57,15 @@
</div>
<script>
$(function () {
var searchStr = sessionStorage.getItem("observe");
var option = $('#main').attr('value')
$('#gctable').datagrid({ url: 'gchandle', queryParams: { a: option } });
var queryParams = {'a': option}
if(searchStr){
var lls = JSON.parse(searchStr)
queryParams = Object.assign(queryParams, lls)
sessionStorage.removeItem("observe")
}
$('#gctable').datagrid({ url: 'gchandle', queryParams: queryParams });
$("#searchgcff").form('clear');
})
$("#sgcbm").combotree({

View File

@ -42,6 +42,12 @@
<a href="javascript:void(0);" onclick="goDetail('trouble', 'zgr', 'qssj', 'jssj')" id="troublediv2">0</a>
</th>
</tr>
<tr>
<th>上报观察</th>
<th>
<a href="javascript:void(0);" onclick="goDetail('observe', 'gcr', 'qssj', 'jssj')" id="observediv1">0</a>
</th>
</tr>
<tr>
<th>参加培训</th>
<th>
@ -163,7 +169,7 @@
</div>
<script type="text/javascript">
var arrs = new Array("trouble", "train", "operation", "miss", "suggest", "test", "drill", "inspect", "cert")
var arrs = new Array("trouble", "train", "operation", "miss", "suggest", "test", "drill", "inspect", "cert", "observe")
var useridx = '{{ user.userid }}';
var namex = '{{user.name}}'
$('#pname').html(namex)
@ -247,6 +253,9 @@
$('#certdiv1').html(res.aq_count)
$('#certdiv2').html(res.tz_count)
}
else if (data.type == 'observe') {
$('#observediv1').html(res.ob_count)
}
}
@ -269,7 +278,8 @@
'inspect': ['巡检记录', '/html/inspect'],
'inspectitem': ['异常处理', '/html/inspectitem'],
'safecert':['安全资格证书', '/html/safecert'],
'socert':['特种作业证书', '/socerthtml']
'socert':['特种作业证书', '/socerthtml'],
'observe':['行为观察', '/observehtml']
}
var myquerydata={}
if(querydatax.startdate){

View File

@ -3303,7 +3303,7 @@ def pxhandle(req):
str1 = []
for i in a.values('trainpart__partname'):
str1.append(i['trainpart__partname'])
x['trainpart'] = ','.join(str1)
x['trainpart'] = ','.join(str1) if str1 else ''
str2 = []
objs = Trainuser.objects.filter(train=a[0])
detailobjs = objs.order_by('checked').values(
@ -3541,9 +3541,20 @@ def gchandle(req):
yjjs_gc.delay(companyid)
return JsonResponse({"code": 1})
elif a == 'listall':
startnum, endnum = fenye(req)
a = Observe.objects.filter(usecomp=Partment.objects.get(
partid=companyid), deletemark=1).order_by('-looktime')
if req.GET.get('gcr'):
a = a.filter(looker__userid=req.GET.get('gcr'))
if req.GET.get('gcbm'):
parts = Partment.objects.filter(partlink__contains=','+req.GET.get(
'gcbm')+',') | Partment.objects.filter(partid=req.GET.get('gcbm'))
a = a.filter(lookpart__in=parts)
if req.GET.get('qssj'):
a = a.filter(looktime__gte=req.GET.get('qssj'))
if req.GET.get('jssj'):
a = a.filter(looktime__lte=req.GET.get('jssj'))
total = a.count()
startnum, endnum = fenye(req)
total = a.count()
a = a[startnum:endnum].values('lookid', 'looknum', 'lookplace',
'actname', 'looktime', 'looker__name', 'lookeder', 'otherunsafe')
@ -8826,6 +8837,7 @@ def getprodata(req):
total = a.count()
return HttpResponse(transjson(total,a),content_type="application/json")
@apicheck_login
def checkprojects(req):
a = req.GET.get('a')
userid = req.session['userid']

View File

@ -123,4 +123,15 @@ def apicountsafe(req):
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)
elif type == 'observe':
objs = Observe.objects.all()
if startdate:
objs = objs.filter(looktime__gte=startdate)
if enddate:
objs = objs.filter(looktime__lte=enddate)
if dept:
pass
else:
ret['ob_count'] = objs.filter(looker__userid=userid).count()
return JsonResponse(ret)