diff --git a/doc/个人安全绩效等功能.txt b/doc/个人安全绩效等功能.txt new file mode 100644 index 00000000..d451bd29 --- /dev/null +++ b/doc/个人安全绩效等功能.txt @@ -0,0 +1,3 @@ +1.事故隐患界面增加无图片导出excel(支持一次性导出1000条) +2.增加应急预案的上传 +3.安全绩效下的个人安全绩效统计数字可点击链接查看 \ No newline at end of file diff --git a/safesite/export.py b/safesite/export.py index ea6fe65e..9784f896 100644 --- a/safesite/export.py +++ b/safesite/export.py @@ -256,7 +256,7 @@ def exportdoc(a,id): import re ILLEGAL_CHARACTERS_RE = re.compile(r'[\000-\010]|[\013-\014]|[\016-\037]') -def exportxlsx(a,objs): +def exportxlsx(a,objs,pic=1): if a =='yh': wb = load_workbook(dirname + 'safesite/exportemp/yhdc.xlsx') sheet = wb.active @@ -265,7 +265,11 @@ def exportxlsx(a,objs): row_height = 70 #查询数据 yhobjs = objs.order_by('-troubleid') - if yhobjs.count()>100: + if yhobjs.count()>1000: + res = HttpResponse() + res.write('数量超过1000,请查询后导出!') + return res + if pic==1 and yhobjs.count()>100: res = HttpResponse() res.write('数量超过100,请查询后导出!') return res @@ -308,22 +312,23 @@ def exportxlsx(a,objs): sheet['r'+str(i+4)] = ILLEGAL_CHARACTERS_RE.sub(r'', v['zgms']) sheet['s'+str(i+4)] = v['shr__name'] sheet['t'+str(i+4)] = v['fcr__name'] - if v['yhtp']: - try: - img = Image(dirname + v['yhtp'][0]) - if img.format!='mpo': - img.width, img.height = (90, 90) #这两个属性分别是对应添加图片的宽高 - sheet.add_image(img, 'u'+str(i+4)) - except: - pass - if v['zghtp']: - try: - img = Image(dirname + v['zghtp'][0]) - if img.format!='mpo': - img.width, img.height = (90, 90) #这两个属性分别是对应添加图片的宽高 - sheet.add_image(img, 'w'+str(i+4)) - except: - pass + if pic==1: + if v['yhtp']: + try: + img = Image(dirname + v['yhtp'][0]) + if img.format!='mpo': + img.width, img.height = (90, 90) #这两个属性分别是对应添加图片的宽高 + sheet.add_image(img, 'u'+str(i+4)) + except: + pass + if v['zghtp']: + try: + img = Image(dirname + v['zghtp'][0]) + if img.format!='mpo': + img.width, img.height = (90, 90) #这两个属性分别是对应添加图片的宽高 + sheet.add_image(img, 'w'+str(i+4)) + except: + pass nowtime = datetime.now().strftime('%Y%m%d%H%M%S') sheet['b1'] = nowtime filename = 'YHS' + nowtime diff --git a/safesite/templates/drill.html b/safesite/templates/drill.html index 6a8c00f5..05d57318 100644 --- a/safesite/templates/drill.html +++ b/safesite/templates/drill.html @@ -67,6 +67,7 @@ if(searchStr){ var lls = JSON.parse(searchStr) queryParams = Object.assign(queryParams, lls) + sessionStorage.removeItem("drill") } $('#yltable').datagrid({ url: 'ylhandle', queryParams: queryParams }); $("#searchylff").form('clear'); diff --git a/safesite/templates/examtest.html b/safesite/templates/examtest.html index aecda068..d13281e1 100644 --- a/safesite/templates/examtest.html +++ b/safesite/templates/examtest.html @@ -45,6 +45,8 @@ if(searchStr){ var lls = JSON.parse(searchStr) queryParams = Object.assign(queryParams, lls) + sessionStorage.removeItem("examtest") + } $('#kstable').datagrid({url:'api/examtest',queryParams:queryParams}); }) diff --git a/safesite/templates/index.html b/safesite/templates/index.html index 7383b881..30d35ed2 100644 --- a/safesite/templates/index.html +++ b/safesite/templates/index.html @@ -193,13 +193,18 @@ onSelect: function (title) { var allTabs = $('#tt').tabs('tabs'); var selectTab = $('#tt').tabs('getSelected'); + var ecludetitles = ['个人安全数据'] + var stitle = selectTab.panel('options').title + // if(ecludetitles.indexOf(stitle)!=-1){ + + // }else{ + // selectTab.panel('refresh') + // } for (var i = 0; i < allTabs.length; i++) { - if (allTabs[i]) { - var ecludetitles = ['个人安全数据'] - if(ecludetitles.indexOf(allTabs[i].panel('options').title)!=-1){ - return - } - if (allTabs[i].panel('options').title != selectTab.panel('options').title) { + if(ecludetitles.indexOf(allTabs[i].panel('options').title)!=-1){ + break + } + if (allTabs[i].panel('options').title != stitle) { $('#tt').tabs('update', { tab: allTabs[i], options: { @@ -207,7 +212,6 @@ } }); } - } } //selectTab.panel('refresh') diff --git a/safesite/templates/inspect.html b/safesite/templates/inspect.html index 78a43025..208dfb5c 100644 --- a/safesite/templates/inspect.html +++ b/safesite/templates/inspect.html @@ -71,6 +71,7 @@ if(searchStr){ var lls = JSON.parse(searchStr) queryParams = Object.assign(queryParams, lls) + sessionStorage.removeItem("inspect") } $('#xjtable').datagrid({ url: 'api/inspect', queryParams: queryParams }); $("#searchxjff").form('clear'); diff --git a/safesite/templates/inspectitem.html b/safesite/templates/inspectitem.html index 619b74de..3c2e4970 100644 --- a/safesite/templates/inspectitem.html +++ b/safesite/templates/inspectitem.html @@ -40,6 +40,7 @@ if(searchStr){ var lls = JSON.parse(searchStr) queryParams = Object.assign(queryParams, lls) + sessionStorage.removeItem("inspectitem") } $('#ycitemtable').datagrid({url:'api/inspectitem',queryParams:queryParams}); $("#searchxjff").form('clear'); diff --git a/safesite/templates/miss.html b/safesite/templates/miss.html index 4647b592..c0ab9f19 100644 --- a/safesite/templates/miss.html +++ b/safesite/templates/miss.html @@ -55,6 +55,7 @@ if(searchStr){ var lls = JSON.parse(searchStr) queryParams = Object.assign(queryParams, lls) + sessionStorage.removeItem("miss") } $('#wstable').datagrid({url:'api/miss',queryParams:queryParams}); $("#searchwsff").form('clear'); diff --git a/safesite/templates/operation.html b/safesite/templates/operation.html index dfddcb20..81c7fe97 100644 --- a/safesite/templates/operation.html +++ b/safesite/templates/operation.html @@ -53,6 +53,7 @@ if(searchStr){ var lls = JSON.parse(searchStr) queryParams = Object.assign(queryParams, lls) + sessionStorage.removeItem("operation") } $('#zytable').datagrid({url:'api/operation',queryParams:queryParams}); $.get('getdickey?dicclass=33&a=combobox',function(data){ diff --git a/safesite/templates/personalp.html b/safesite/templates/personalp.html index cef3dafb..2b6a9752 100644 --- a/safesite/templates/personalp.html +++ b/safesite/templates/personalp.html @@ -283,8 +283,8 @@ if ($('#tt').tabs('exists', title)) { sessionStorage.setItem(k1, JSON.stringify(myquerydata)) $('#tt').tabs('select', title); - var tab = $('#tt').tabs('getSelected'); - tab.panel('refresh'); + // var tab = $('#tt').tabs('getSelected'); + // tab.panel('refresh'); } else { $('#tt').tabs('add', { title: title, diff --git a/safesite/templates/safecert.html b/safesite/templates/safecert.html index af6d2730..6eb66b53 100644 --- a/safesite/templates/safecert.html +++ b/safesite/templates/safecert.html @@ -34,6 +34,7 @@ if(searchStr){ var lls = JSON.parse(searchStr) queryParams = Object.assign(queryParams, lls) + sessionStorage.removeItem("safecert") } $('#aqzstable').datagrid({url:'api/safecert',queryParams:queryParams}); }) diff --git a/safesite/templates/socert.html b/safesite/templates/socert.html index 7b24a23e..d89d260f 100644 --- a/safesite/templates/socert.html +++ b/safesite/templates/socert.html @@ -46,6 +46,7 @@ if(searchStr){ var lls = JSON.parse(searchStr) queryParams = Object.assign(queryParams, lls) + sessionStorage.removeItem("socert") } $('#tzzstable').datagrid({url:'api/socert',queryParams:queryParams}); }) diff --git a/safesite/templates/suggest.html b/safesite/templates/suggest.html index 6cb229ac..0f47ad5f 100644 --- a/safesite/templates/suggest.html +++ b/safesite/templates/suggest.html @@ -57,6 +57,7 @@ if(searchStr){ var lls = JSON.parse(searchStr) queryParams = Object.assign(queryParams, lls) + sessionStorage.removeItem("suggest") } $('#jytable').datagrid({url:'api/suggest',queryParams:queryParams}); $("#searchjyff").form('clear'); diff --git a/safesite/templates/train.html b/safesite/templates/train.html index bc80a8fe..d3ebf3fc 100644 --- a/safesite/templates/train.html +++ b/safesite/templates/train.html @@ -65,6 +65,7 @@ if(searchStr){ var lls = JSON.parse(searchStr) queryParams = Object.assign(queryParams, lls) + sessionStorage.removeItem("train") } $('#pxtable').datagrid({ url: 'pxhandle', queryParams: queryParams }); $("#searchpxff").form('clear'); diff --git a/safesite/templates/trouble.html b/safesite/templates/trouble.html index e3f7d43e..86d15f3a 100644 --- a/safesite/templates/trouble.html +++ b/safesite/templates/trouble.html @@ -31,6 +31,9 @@ {% if request|has_permission:'b_trouble_exportxls' %} 导出Excel {% endif %} + {% if request|has_permission:'b_trouble_exportxls' %} + 导出无图Excel + {% endif %}
@@ -83,11 +86,11 @@ $(function () { // var option = $('#main').attr('value') var searchStr = sessionStorage.getItem("trouble"); - var queryParams = {'a':'listall'} if(searchStr){ var lls = JSON.parse(searchStr) queryParams = Object.assign(queryParams, lls) + sessionStorage.removeItem("trouble") } $('#yhtable').datagrid({ url: 'troublehandle', queryParams: queryParams }); $("#searchyhff").form('clear'); @@ -329,6 +332,12 @@ window.open(url); // $('
').appendTo('body').submit().remove(); } + function exportyhexcel2() { + var querydata = $('#searchyhff').serializeJSON(); + let url = 'troublehandle?a=exportexcel&nopic=1&' + parseParams(querydata) + window.open(url); + // $('
').appendTo('body').submit().remove(); + } function delyh() { var row = $('#yhtable').datagrid('getSelected'); if (row) { diff --git a/safesite/views.py b/safesite/views.py index 789d654d..863a38cd 100644 --- a/safesite/views.py +++ b/safesite/views.py @@ -2057,7 +2057,10 @@ def troublehandle(req): a = a.filter(Q(zgbm__in=parts) | Q(fxbm__in=parts, zgbm=None)) if fxrname: a = a.filter(fxr__name=fxrname) - res = exportxlsx('yh', a) + if req.GET.get('nopic', None): + res = exportxlsx('yh', a, 0) + else: + res = exportxlsx('yh', a) return res elif a == 'del': userid = req.session['userid']