From a288c876cf0d048b77fb534201d8822bcabc7b5d Mon Sep 17 00:00:00 2001 From: shilixia <2309368887@qq.com> Date: Wed, 6 Nov 2019 10:04:11 +0800 Subject: [PATCH 1/2] peixun --- safesite.lnk | Bin 704 -> 0 bytes safesite/templates/behavior.html | 49 +++++---- safesite/templates/trainfigure.html | 156 ++++++++++++++++++---------- safesite/views.py | 31 +++--- 4 files changed, 145 insertions(+), 91 deletions(-) delete mode 100644 safesite.lnk diff --git a/safesite.lnk b/safesite.lnk deleted file mode 100644 index 129596d1d5934f116bab435e433f8931d5537ad3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 704 zcmeZaU|?VrVFHp23oYK=Yw4VDDTGeXqE$xa3l z2Kj&o{udNpS!D_=y1~JqZD250l0o0aDh93y!H8lo1ao5iyLb(Sf$i!*Xa=+1aw{?vGbA#kF{A?NOokF5&A=c5#CAX|1H>S0 zAR1y51A{G)EegcUKpb+ttPAAL&1WurVgNc3;Q~emJ%$8`ss#~18U#{Oi?d7e3v|u0 z(~9#8%OHYCB=^C9Klk3g6r5ec5D<0%7=ma3UEUe!G)@MF1*SlChQR^BZw>a|a%Sjs zU;g8Q@RH&*B}t%o3djt3AZ7t#7X~W^STME#`5;XOA62)%cb5`a`jIK2XWr{Isz7lr zAO>p!nvNxOApYkEDRKZ2x&7cc23ZHP1#Vq?>Nh{jNQi1akc0ye3zr3}7x!KTM}{kq z4|2n@tYi(_sh0$|USl}me^cUuCQw`sh`}cD0BMNBG2;oO#uA7@hHMneby?e6;IZ7p mL2rp|MUN~{JOiY_1BjD?v$@i^7J6({`1rqRU5P$O90mYbafE;X diff --git a/safesite/templates/behavior.html b/safesite/templates/behavior.html index 1fe2d098..8e007297 100644 --- a/safesite/templates/behavior.html +++ b/safesite/templates/behavior.html @@ -76,8 +76,8 @@ }, legend: { orient: 'vertical', - x: 'left', - y: 'bottom', + x: 'right', + y:'bottom', data: [] }, toolbox: { @@ -187,8 +187,12 @@ containLabel: true }, toolbox: { + show: true, feature: { - saveAsImage: {} + mark: { show: true }, + dataView: { show: true, readOnly: false }, + restore: { show: true }, + saveAsImage: { show: true } } }, xAxis: { @@ -260,33 +264,34 @@ -
+
-
- - - + + + +
+
-
+
diff --git a/safesite/templates/trainfigure.html b/safesite/templates/trainfigure.html index 68ec9739..4f601349 100644 --- a/safesite/templates/trainfigure.html +++ b/safesite/templates/trainfigure.html @@ -1,5 +1,25 @@ @@ -266,15 +299,24 @@
- - + +
姓名姓名用户名 培训次数
+
+
- -
+
+ + 查询 + 导出 +
+ + +
+
diff --git a/safesite/views.py b/safesite/views.py index c96422cb..6e593125 100644 --- a/safesite/views.py +++ b/safesite/views.py @@ -6079,20 +6079,27 @@ def trainfg(req): teamlevel.append(a.filter(trainlevel__dicid=7).count()) departmentlevel.append(a.filter(trainlevel__dicid=42).count()) return JsonResponse({'code':1,'companylevel':companylevel,'workshoplevel':workshoplevel,'teamlevel':teamlevel,'departmentlevel':departmentlevel}) + elif a=='trainuser': + a = Trainuser.objects.filter(participant__usecomp__partid=companyid) + + if req.GET.get('fxbm'): + fxbm = req.GET.get('fxbm') + parts = Partment.objects.filter(partlink__contains=',' + fxbm + ',')|Partment.objects.filter(partid=fxbm) + a = a.filter(participant__ubelongpart__in=parts) + total = a.count() + objs = a.values('participant__name','participant__username').annotate(count=Count('participant__userid')) + return HttpResponse(transjson(total,objs),content_type="application/json") elif a=='traintype': year = int(req.GET.get('year')) month = int(req.GET.get('month')) - daily=[]#日常培训 - related=[]#相关方培训 - jobuser=[]#在岗人员培训 + traintypelist=[] + first_day,first_day_of_next_month = gettime(datetime(year,month,1)) a = Train.objects.filter(usecomp__partid=companyid,deletemark=1,starttime__range=(first_day, first_day_of_next_month)) - daily.append(a.filter(traintype__dickeyid=1).count()) - related.append(a.filter(traintype__dickeyid=108).count()) - jobuser.append(a.filter(traintype__dickeyid=107).count()) - return JsonResponse({'code':1,'daily':daily,'related':related,'jobuser':jobuser}) - elif a=='trainuser': - a = Trainuser.objects.filter(participant__userid=userid) - total = a.count() - objs = a.annotate(count=Count('participant')).values('participant__username','count') - return HttpResponse(transjson(total,objs),content_type="application/json") + for i in Dickey.objects.filter(dicparent_id=8): + count=a.filter(traintype__dickeyid=i.dickeyid).count() + dickeyname=i.dickeyname + traintypelist.append({'value':count,'name':dickeyname}) + return HttpResponse(json.dumps({'code':1,'data':{'traintypelist':list(traintypelist)}}), content_type='application/json') + + From 9fe3fda052d2c287a7a5c8fc07b3ab7c35100df0 Mon Sep 17 00:00:00 2001 From: shilixia <2309368887@qq.com> Date: Wed, 6 Nov 2019 15:32:19 +0800 Subject: [PATCH 2/2] peixun2 --- safesite/urls.py | 1 + safesite/views.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/safesite/urls.py b/safesite/urls.py index 24d3ac00..2f49d38a 100644 --- a/safesite/urls.py +++ b/safesite/urls.py @@ -156,6 +156,7 @@ urlpatterns = [ path('api/obscount',views.observepic), path('api/riskas',views.apiriskas), path('api/trainfg',views.trainfg), + path('api/examtj',views.examtj), path('api/check_session',views.check_session), #path('api/rights/group/',views.rightsgroup), diff --git a/safesite/views.py b/safesite/views.py index 6e593125..0de1a060 100644 --- a/safesite/views.py +++ b/safesite/views.py @@ -6057,7 +6057,7 @@ def refresh_captcha(request): def dump(obj): print('\n'.join(['%s:%s' % item for item in obj.__dict__.items()])) - +#教育培训统计图 def trainfg(req): a = req.GET.get('a') userid = req.session['userid']