diff --git a/safesite/static/safesite/easyui/themes/icon.css b/safesite/static/safesite/easyui/themes/icon.css
index ec677c31..b3d93cc6 100644
--- a/safesite/static/safesite/easyui/themes/icon.css
+++ b/safesite/static/safesite/easyui/themes/icon.css
@@ -166,7 +166,9 @@
.icon-taskdo{
background:url('icons/taskdo.png') no-repeat center center;
}
-
+.icon-bhr {
+ background: url('icons/behv.png') no-repeat center center;
+}
diff --git a/safesite/static/safesite/easyui/themes/icons/behv.png b/safesite/static/safesite/easyui/themes/icons/behv.png
new file mode 100644
index 00000000..8ce20513
Binary files /dev/null and b/safesite/static/safesite/easyui/themes/icons/behv.png differ
diff --git a/safesite/templates/behavior.html b/safesite/templates/behavior.html
new file mode 100644
index 00000000..88bf8b64
--- /dev/null
+++ b/safesite/templates/behavior.html
@@ -0,0 +1,312 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 用户ID |
+ 观察人姓名 |
+ 观察部门 |
+ 行为观察数 |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/safesite/urls.py b/safesite/urls.py
index cb895384..358858c4 100644
--- a/safesite/urls.py
+++ b/safesite/urls.py
@@ -85,6 +85,8 @@ urlpatterns = [
path('html/riskcheck',views.riskcheck),
path('html/risk/edit//',views.riskedit),
path('html/report/edit',views.reportedit),
+ path('html/bhr',views.bhrhtml),
+
#html页面
@@ -149,7 +151,7 @@ urlpatterns = [
path('api/riskcheck2',views.apiriskcheck2),
path('api/report',views.apireport),
path('html/examhistory//',views.examhistory),
-
+ path('api/obscount',views.observepic),
#path('api/rights/group/',views.rightsgroup),
path('api/main',views.mainapi),
diff --git a/safesite/views.py b/safesite/views.py
index 5cbc6980..623f1da6 100644
--- a/safesite/views.py
+++ b/safesite/views.py
@@ -234,7 +234,8 @@ def troubleashtml(req):
return render(req,'troubleashtml.html')
def userhtml(req):
return render(req,'userhtml.html')
-
+def bhrhtml(req):
+ return render(req,'behavior.html')
def check_login(func):
def warpper(request,*args,**kwargs):
is_login = request.session.get('userid', None)
@@ -2714,10 +2715,85 @@ def gchandle(req):
url = exportdoc2('gc',data)
return JsonResponse({"code":1,"downloadurl":url})
+def observepic(req):
+ userid = req.session['userid']
+ companyid = getcompany(userid)
+ if req.GET.get('a')=='gclxt':#观察类型饼图
+ year = int(req.GET.get('year'))
+ month = int(req.GET.get('month'))
+ first_day,first_day_of_next_month = gettime(datetime(year,month,1))
+ if req.GET.get('part'):
+ partid = req.GET.get('part')
+ else:
+ partid = companyid
+ parts = Partment.objects.filter(Q(partid=partid) | Q(partlink__contains=',' + str(partid) + ','))
+ a = Observe.objects.filter(lookpart__in=parts,deletemark=1,looktime__range=(first_day, first_day_of_next_month))
+ value=[]
+ key=[]
+ for i in Dicclass.objects.filter(parentid__dicid=23):
+ x = i.dicname
+ y = Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count()
+ key.append(x)
+ value.append({'value':y,'name':x})
+ return JsonResponse({'code':1,'key':key,'value':value})
+ elif req.GET.get('a')=='gclzx':#观察类型折线图
+ year = int(req.GET.get('year'))
+ months = [1,2,3,4,5,6,7,8,9,10,11,12]
+ userfy=[]#人员反映
+ userwz=[]#员工的位置
+ grfh=[]#个人防护装备
+ gjhsb=[]#工具和设备
+ cxhbz=[]#程序和标准
+ rtgcx=[]#人体工程学
+ hjzj=[]#环境整洁
+ for month in months:
+ first_day,first_day_of_next_month = gettime(datetime(year,month,1))
+ if req.GET.get('part'):
+ partid = req.GET.get('part')
+ else:
+ partid = companyid
+ parts = Partment.objects.filter(Q(partid=partid) | Q(partlink__contains=',' + str(partid) + ','))
+ a = Observe.objects.filter(lookpart__in=parts,deletemark=1,looktime__range=(first_day, first_day_of_next_month))
+ for i in Dicclass.objects.filter(parentid__dicid=23):
+ if i.dicid==24:
+ userfy.append(Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count())
+ elif i.dicid==25:
+ userwz.append(Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count())
+ elif i.dicid==26:
+ grfh.append(Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count())
+ elif i.dicid==27:
+ gjhsb.append(Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count())
+ elif i.dicid==28:
+ cxhbz.append(Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count())
+ elif i.dicid==29:
+ rtgcx.append(Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count())
+ elif i.dicid==30:
+ hjzj.append(Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count())
+
-
+ return JsonResponse({'code':1,'months':months,'userfy':userfy,'userwz':userwz,'grfh':grfh,'gjhsb':gjhsb,'cxhbz':cxhbz,'rtgcx':rtgcx,'hjzj':hjzj,})
+ elif req.GET.get('a')=='gclxbg':
+ userid = req.session['userid']
+ companyid = getcompany(userid)
+ a = Observe.objects.filter(usecomp=Partment.objects.get(partid=companyid),deletemark=1)
+
+ 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'))
+ if req.GET.get('fxbm'):
+ gcbm = req.GET.get('fxbm')
+ parts = Partment.objects.filter(partlink__contains=',' + gcbm + ',')|Partment.objects.filter(partid=gcbm)
+ a = a.filter(lookpart__in=parts)
+
+ total = a.count()
+ objs = a.values('looker__userid','looker__name','lookpart__partname').annotate(number = Count('looker')).order_by('-number')
+ return HttpResponse(transjson(total,objs),content_type="application/json")
+
+
+
def dicchandle(req):
a = req.GET.get('a')
if a == 'tree':
diff --git a/static/safesite/easyui/themes/icons/behv.png b/static/safesite/easyui/themes/icons/behv.png
new file mode 100644
index 00000000..8ce20513
Binary files /dev/null and b/static/safesite/easyui/themes/icons/behv.png differ