issue列表 新查询的导出excel功能

This commit is contained in:
huang 2016-09-22 17:40:58 +08:00
parent 0976f084f0
commit f8fd3d79a0
2 changed files with 3 additions and 7 deletions

View File

@ -701,7 +701,7 @@ class ApplicationController < ActionController::Base
sheet1[count_row,2] = issue.subject
sheet1[count_row,3] = issue.description
sheet1[count_row,4] = issue_status_change(issue.status_id)
sheet1[count_row,5] = issue.assigned_to.show_name
sheet1[count_row,5] = issue.assigned_to.try(:show_name)
sheet1[count_row,6] = issue_priority_change(issue.priority_id)
sheet1[count_row,7] = issue.author.show_name
sheet1[count_row,8] = issue.created_on

View File

@ -86,11 +86,7 @@ class IssuesController < ApplicationController
# @issue_pages = Paginator.new @issue_count, @limit, params['page']
# params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1
# @offset ||= @issue_pages.offset
@issues_filter = @query.issues
# (:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
# :order => 'issues.updated_on desc',
# :offset => @offset,
# :limit => @limit)
@issues_filter = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], :order => 'issues.updated_on desc')
@limit = 10
@is_remote = true
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
@ -109,7 +105,7 @@ class IssuesController < ApplicationController
format.csv { send_data(query_to_csv(@issues, @query, params), :type => 'text/csv; header=present', :filename => 'issues.csv') }
format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'issues.pdf') }
format.xls {filename = "#{@project.name.to_s}_#{l(:label_issue_list_xls)}.xls"
send_data(issue_list_xls(@issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
send_data(issue_list_xls(@issues_filter), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
end
else