隐患增加选中导出

This commit is contained in:
caoqianming 2022-04-17 12:01:53 +08:00
parent a3dc2bf923
commit aebad83d27
2 changed files with 27 additions and 1 deletions

View File

@ -34,6 +34,9 @@
{% if request|has_permission:'b_trouble_exportxls' %}
<a id="exportexcel" onclick="exportyhexcel2()" class='easyui-linkbutton' data-options="iconCls: 'fa-download',plain:true">导出无图Excel</a>
{% endif %}
{% if request|has_permission:'b_trouble_exportxls' %}
<a id="exportexcel" onclick="exportyhexcel3()" class='easyui-linkbutton' data-options="iconCls: 'fa-download',plain:true">导出选中</a>
{% endif %}
</div>
<div id="sdg_yh" class="easyui-dialog" title="筛选条件" style="width:400px;height:420px;"
data-options="iconCls:'fa-search',resizable:true,modal:true,closed:true,border:false">
@ -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);
// $('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
}
function exportyhexcel3() {
var rows = $('#yhtable').datagrid('getSelections');
if(rows.length>0){
var data = {'ids':[]}
for(var i=0;i<rows.length;i++){
data.ids.push(rows[i].troubleid)
}
let url = 'troublehandle?a=exportexcel2&' + parseParams(data)
window.open(url);
}
else {
$.messager.alert('提示', '未选择数据!');
}
}
function delyh() {
var row = $('#yhtable').datagrid('getSelected');
if (row) {

View File

@ -2097,6 +2097,14 @@ def troublehandle(req):
else:
res = exportxlsx('yh', a)
return res
elif a == 'exportexcel2':
userid = req.session['userid']
companyid = getcompany(userid)
ids_l = req.GET.get('ids').split(',')
objs = Trouble.objects.filter(
usecomp=Partment.objects.get(partid=companyid), deletemark=1, troubleid__in=ids_l)
res = exportxlsx('yh', objs)
return res
elif a == 'del':
userid = req.session['userid']
if User.objects.get(userid=userid).issuper == 1: