From e34c90934c2243097d00110fd685ee41849fce1b Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 17 Oct 2019 19:53:44 +0800 Subject: [PATCH 1/3] groups login --- groups/templates/groups/login.html | 168 ++++++++++++++++++--------- groups/templates/groups/login33.html | 62 ++++++++++ groups/views.py | 1 - 3 files changed, 173 insertions(+), 58 deletions(-) create mode 100644 groups/templates/groups/login33.html diff --git a/groups/templates/groups/login.html b/groups/templates/groups/login.html index 6b9a44a9..6d12ef52 100644 --- a/groups/templates/groups/login.html +++ b/groups/templates/groups/login.html @@ -1,62 +1,116 @@ -{% load static %} - - - - - - - - - - - 登录 - - -
-
- -
-
+ + - - - - - + + {% load static %} + + + 集团后台|登陆 + + + + + + + + + + + + - - - + + + + + \ No newline at end of file + + + + \ No newline at end of file diff --git a/groups/templates/groups/login33.html b/groups/templates/groups/login33.html new file mode 100644 index 00000000..8ea32f37 --- /dev/null +++ b/groups/templates/groups/login33.html @@ -0,0 +1,62 @@ +{% load static %} + + + + + + + + + + + 登录 + + +
+
+ +
+
+ + + + + + + + + + \ No newline at end of file diff --git a/groups/views.py b/groups/views.py index 6b3f0323..b354a695 100644 --- a/groups/views.py +++ b/groups/views.py @@ -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()) From 1f70f6e47f78ee49f47e101e089c8dcba4ef8145 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 18 Oct 2019 16:36:15 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=A3=8E=E9=99=A9=E5=88=86=E6=9E=90?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- safesite/models.py | 2 +- safesite/templates/riskas.html | 655 +++++++++++++++++++++++++-------- safesite/urls.py | 3 +- safesite/views.py | 74 +++- 4 files changed, 584 insertions(+), 150 deletions(-) diff --git a/safesite/models.py b/safesite/models.py index bf09e322..76efbbe4 100644 --- a/safesite/models.py +++ b/safesite/models.py @@ -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) diff --git a/safesite/templates/riskas.html b/safesite/templates/riskas.html index 09f0f186..763fe778 100644 --- a/safesite/templates/riskas.html +++ b/safesite/templates/riskas.html @@ -1,94 +1,27 @@
-
- - - - 查询
+
+ + 查询
-
-
-
+
+
-
-
-
-
+
+
-
-
-
+ +
-
+
-
- - - - - - - - - -
用户ID姓名所属部门填报隐患数
-
-
- 查询 - 导出 -
- - - -
- -
-
-
- - - - - - - - - -
用户ID姓名所属部门整改隐患数
- -
-
- 查询 - 导出 -
- - - -
-
-
-
- - \ No newline at end of file diff --git a/safesite/urls.py b/safesite/urls.py index 4ecde179..263be6e7 100644 --- a/safesite/urls.py +++ b/safesite/urls.py @@ -86,6 +86,7 @@ urlpatterns = [ path('html/risk/edit//',views.riskedit), path('html/report/edit',views.reportedit), path('riskas',views.riskas), + path('html/examhistory//',views.examhistory), #html页面 @@ -149,7 +150,7 @@ urlpatterns = [ #path('api/riskactcheck',views.apiriskactcheck), path('api/riskcheck2',views.apiriskcheck2), path('api/report',views.apireport), - path('html/examhistory//',views.examhistory), + path('api/riskas',views.apiriskas), #path('api/rights/group/',views.rightsgroup), diff --git a/safesite/views.py b/safesite/views.py index 6badac57..220685a4 100644 --- a/safesite/views.py +++ b/safesite/views.py @@ -1646,7 +1646,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')) @@ -1952,6 +1952,78 @@ 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(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': From 56788e689fd4903980ec83565b62d6d7f4e6d760 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 18 Oct 2019 16:44:35 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=A3=8E=E9=99=A9=E5=88=86=E6=9E=90?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- safesite/templates/riskas.html | 8 ++++---- safesite/views.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/safesite/templates/riskas.html b/safesite/templates/riskas.html index 763fe778..38893243 100644 --- a/safesite/templates/riskas.html +++ b/safesite/templates/riskas.html @@ -51,10 +51,10 @@ // } function fxsearch() { var querydata = $('#fxfxf').serializeJSON(); - bindmap_fxdlxt('fxdlxt'); - bindmap_fxdjbt('fxdjbt'); - bindmap_fxjbt('fxjbt'); - bindmap_fxdqyt('fxdqyt'); + bindmap_fxdlxt('fxdlxt',querydata); + bindmap_fxdjbt('fxdjbt',querydata); + bindmap_fxjbt('fxjbt',querydata); + bindmap_fxdqyt('fxdqyt',querydata); } var now = new Date(); var year = now.getFullYear(); diff --git a/safesite/views.py b/safesite/views.py index 220685a4..b72b1b10 100644 --- a/safesite/views.py +++ b/safesite/views.py @@ -1991,7 +1991,8 @@ def apiriskas(req): objs2 = Risk.objects.filter(usecomp__partid=companyid) if req.GET.get('zrbm',None): partid = req.GET.get('zrbm') - objs = objs.filter(riskact__zrbm__partid=partid) + objs = objs.filter(zrbm__partid=partid) + objs2 = objs2.filter(riskact__zrbm__partid=partid) xAxisData = [] series = [] #areas = Area.objects.filter(usecomp__partid=companyid,deletemark=1)