From aebad83d27dc65aecd859543b920568fbc3e4159 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sun, 17 Apr 2022 12:01:53 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E9=9A=90=E6=82=A3=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- safesite/templates/trouble.html | 20 +++++++++++++++++++- safesite/views.py | 8 ++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/safesite/templates/trouble.html b/safesite/templates/trouble.html index 86d15f3a..7550751a 100644 --- a/safesite/templates/trouble.html +++ b/safesite/templates/trouble.html @@ -34,6 +34,9 @@ {% if request|has_permission:'b_trouble_exportxls' %} 导出无图Excel {% endif %} + {% if request|has_permission:'b_trouble_exportxls' %} + 导出选中 + {% endif %}
@@ -98,7 +101,6 @@ $('#yhtable').datagrid({ rownumbers: true, - singleSelect: true, striped: true, method: 'get', url: '', @@ -109,6 +111,7 @@ border: false, columns: [[ { field: 'troubleid', hidden: true }, + { field: 'ck', checkbox: true , width: 20}, { field: 'yhnum', title: '编号', width: 100 }, { field: 'yhzt', title: '流程状态', width: 100, styler: function (value, row, index) { @@ -338,6 +341,21 @@ window.open(url); // $('
').appendTo('body').submit().remove(); } + function exportyhexcel3() { + var rows = $('#yhtable').datagrid('getSelections'); + if(rows.length>0){ + var data = {'ids':[]} + for(var i=0;i Date: Sun, 17 Apr 2022 12:03:46 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E9=9A=90=E6=82=A3=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- safesite/templates/trouble.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/safesite/templates/trouble.html b/safesite/templates/trouble.html index 7550751a..d6fd83d4 100644 --- a/safesite/templates/trouble.html +++ b/safesite/templates/trouble.html @@ -114,7 +114,7 @@ { field: 'ck', checkbox: true , width: 20}, { field: 'yhnum', title: '编号', width: 100 }, { - field: 'yhzt', title: '流程状态', width: 100, styler: function (value, row, index) { + field: 'yhzt', title: '流程状态', width: 60, styler: function (value, row, index) { switch (value) { case 0: return 'background-color:yellow;'; break; case 1: return 'background-color:yellow;'; break; @@ -150,7 +150,7 @@ { field: 'todouser__userid', hidden: true }, { field: 'sybzt', hidden: true }, { - field: 'shresult', title: '隐患状态', width: 100, styler: function (value, row, index) { + field: 'shresult', title: '隐患状态', width: 80, styler: function (value, row, index) { switch (value) { case 1: return ''; break; case 2: return 'color:red;font-weight:bold'; break; From 2e45c2a332eab93006824fb19044ef0a6e5341b5 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sun, 17 Apr 2022 22:12:07 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E8=B5=84=E6=96=99?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=A7=82=E7=9C=8B=E5=8E=86=E5=8F=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- safesite/edu/views.py | 20 ++++++++++++-------- safesite/templates/edulessondetail.html | 9 +++++---- safesite/templates/edulessonindex.html | 8 ++++---- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/safesite/edu/views.py b/safesite/edu/views.py index 506eb3ba..73f4c662 100644 --- a/safesite/edu/views.py +++ b/safesite/edu/views.py @@ -80,10 +80,10 @@ def api(req): startnum,endnum=fenye(req) a = a.order_by('-downnum','-modifytime')[startnum:endnum].values('id','num','title','user__name','user__ubelongpart__partname','desciption','submittime','type','cate__name','url','downnum','modifytime') return HttpResponse(transjson(total,a),content_type="application/json") - elif a == 'detail': - id = req.GET.get('id') - obj = Edulesson.objects.filter(id=id).values('id','num','title','user__name','user__ubelongpart__partname','desciption','submittime','type','cate__name','url','downnum','modifytime') - return JsonResponse(list(obj)[0]) + # elif a == 'detail': + # id = req.GET.get('eduid') + # obj = Edulesson.objects.filter(id=id).values('id','num','title','user__name','user__ubelongpart__partname','desciption','submittime','type','cate__name','url','downnum','modifytime') + # return JsonResponse(list(obj)[0]) #视频 elif a=='add': userid = req.session['userid']#用户ID @@ -168,7 +168,11 @@ def api(req): return JsonResponse({"code":1,"url": a.url}) #观看详情 elif a=='detail': - id=req.GET.get('zrid') - a = EdulessonWatch.objects.filter(edulesson=id).values('id','user__name','submittime') - total = a.count() - return HttpResponse(transjson(total,a),content_type="application/json") \ No newline at end of file + id=req.GET.get('eduid') + userid = req.session['userid'] + companyid = getcompany(userid)#公司ID + objs = EdulessonWatch.objects.filter(edulesson=id, user__usecomp=companyid) + total = objs.count() + startnum, endnum = fenye(req) + objs_data = objs.order_by('-submittime')[startnum:endnum].values('id','user__name','submittime') + return HttpResponse(transjson(total, objs_data), content_type="application/json") \ No newline at end of file diff --git a/safesite/templates/edulessondetail.html b/safesite/templates/edulessondetail.html index 9a2382d5..d6de5d5b 100644 --- a/safesite/templates/edulessondetail.html +++ b/safesite/templates/edulessondetail.html @@ -1,6 +1,6 @@ -
-
+
+
@@ -9,7 +9,7 @@ var eduid = {{ jyid }}; var html; - $('#zytable').datagrid({ + $('#eduwatchtable').datagrid({ url: 'edu/api?a=detail&eduid=' + eduid, rownumbers: true, singleSelect: true, @@ -17,7 +17,8 @@ fitColumns: true, method: 'get', pageSize: 20, - toolbar: '#zytablebar', + pagination: 'true', + toolbar: '#eduwatchtablebar', columns: [[ { field: 'id', title: 'ID', hidden: true }, { field: 'user__name', title: '观看人', width: 80 }, diff --git a/safesite/templates/edulessonindex.html b/safesite/templates/edulessonindex.html index ec8e37d7..d4a174a0 100644 --- a/safesite/templates/edulessonindex.html +++ b/safesite/templates/edulessonindex.html @@ -30,9 +30,9 @@ {% if request|has_permission:'b_edu_study' %} 下载/查看 {% endif %} - + {% if request|has_permission:'b_edu_addfile' %} + 观看历史 + {% endif %}
@@ -159,7 +159,7 @@ $.messager.alert('提示', '请选择一行数据!'); } } - function jydetail() { + function edudetail() { var row = $('#edutab').datagrid('getSelected'); if (row) { var url = 'edu/html/edulessondetail/detail/' + row.id From 5391c500de67572dc6907b62dc4220f0de72b631 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sun, 17 Apr 2022 22:26:41 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=83=A8=E5=88=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- safesite/views.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/safesite/views.py b/safesite/views.py index 7832ff95..46e1467e 100644 --- a/safesite/views.py +++ b/safesite/views.py @@ -1322,7 +1322,6 @@ def getyh(req): def accessyh(req): - logger.info(req.get_full_path()) userid = req.session['userid'] yhdata = json.loads(req.body.decode('utf-8')) troubleid = yhdata['troubleid'] @@ -1704,7 +1703,7 @@ def accessyh(req): postdict['touser'] = a.todouser.openid send_wechatmsg.delay(postdict) return JsonResponse({"code": 1}) - + logger.info(a.troubleid + '-' + str(yhdata)) def parttree2(req): userid = req.session['userid'] companyid = getcompany(userid) @@ -3547,8 +3546,11 @@ def gchandle(req): if 'lookers' in gcdata: ulist = gcdata['lookers'].split(',') for i in ulist: - x = User.objects.get(userid=i) - obj.lookers.add(x) + try: + x = User.objects.get(userid=i) + obj.lookers.add(x) + except: + pass if 'unsafe' in gcdata: olist = gcdata['unsafe'] for i in olist: