导出excel进行数量限制,可能是导致系统崩溃的原因

This commit is contained in:
caoqianming 2020-11-03 16:04:08 +08:00
parent 08cfffa8c0
commit dc204a95f3
9 changed files with 22 additions and 6 deletions

View File

@ -439,6 +439,10 @@ def exportxlsx(a,objs):
wb.save(filepath)
return url
elif a=='ws':
if objs.count()>100:
res = HttpResponse()
res.write('数量超过100,请查询后导出!')
return res
#查询数据
wslist = objs.values('missnum','missplace','misstime','misser__name','description','prevent','misspart__partname','submittime','missimg','lesson')
#写入数据
@ -517,6 +521,10 @@ def exportxlsx(a,objs):
res.write(output.getvalue())
return res
elif a=='jy':
if objs.count()>100:
res = HttpResponse()
res.write('数量超过100,请查询后导出!')
return res
#查询数据
jylist = objs.values('jynum','jylb__dickeyname','jyr__name','jybm__partname','dqxz','jynr','qwxg','submittime','jyimg','jyimg2','pgr__name','clr__name','jyfk','clcs','clms')
#写入数据
@ -568,6 +576,10 @@ def exportxlsx(a,objs):
res.write(output.getvalue())
return res
elif a=='gc':
if objs.count()>100:
res = HttpResponse()
res.write('数量超过100,请查询后导出!')
return res
#查询数据
gclist = objs.values('looknum','lookplace','actname','looktime','looktime2','looker__name','lookeder','otherunsafe','safecontent','lookpart__partname','submittime','lookimg')
#写入数据
@ -612,6 +624,10 @@ def exportxlsx(a,objs):
res.write(output.getvalue())
return res
elif a=='zy':
if objs.count()>100:
res = HttpResponse()
res.write('数量超过100,请查询后导出!')
return res
#查询数据
zylist = objs.values('zyid','zylx__dickeyname','zynum','zybm__partname','zyfzr__name','zynr','zyzt','submittime','kssj','jssj','zyimg','zyimg2')
wb = load_workbook(dirname + 'safesite/exportemp/zy.xlsx')

View File

@ -153,8 +153,7 @@
}
function exportwsexcel() {
var querydata = $('#searchwsff').serializeJSON();
console.log(querydata)
let url = 'api/miss?a=exportexcel&'+parseParams(querydata)
$('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
window.open(url);
}
</script>

View File

@ -168,6 +168,6 @@
function exportgcexcel() {
var querydata = $('#searchgcff').serializeJSON();
let url = 'gchandle?a=exportexcel&'+parseParams(querydata)
$('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
window.open(url);
}
</script>

View File

@ -165,8 +165,9 @@
else { $.messager.alert('提示', '请选择一行数据!'); }
}
function exportzyexcel() {
let url = 'api/operation?a=exportexcel'
$('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
var querydata = $('#searchzyff').serializeJSON();
let url = 'api/operation?a=exportexcel'+parseParams(querydata)
window.open(url);
}
function gbzy(){
var row = $('#zytable').datagrid('getSelected');

View File

@ -174,7 +174,7 @@
function exportjyexcel() {
var querydata = $('#searchjyff').serializeJSON();
let url = 'api/suggest?a=exportexcel&'+parseParams(querydata)
$('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
window.open(url);
}
function updatejy(){

Binary file not shown.

Binary file not shown.

Binary file not shown.