|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
# encoding: utf-8
|
|
|
|
|
# Redmine - project management software
|
|
|
|
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
|
|
|
|
#
|
|
|
|
@ -685,6 +686,90 @@ class ApplicationController < ActionController::Base
|
|
|
|
|
:content_type => 'application/atom+xml'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 项目列表导出Excel功能
|
|
|
|
|
def issue_list_xls issues
|
|
|
|
|
xls_report = StringIO.new
|
|
|
|
|
book = Spreadsheet::Workbook.new
|
|
|
|
|
sheet1 = book.create_worksheet :name => "issues"
|
|
|
|
|
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
|
|
|
|
|
sheet1.row(0).default_format = blue
|
|
|
|
|
sheet1.row(0).concat([l(:issue_xls_id),l(:issue_xls_tracker_id),l(:issue_xls_title),l(:issue_xls_description),l(:issue_xls_status),l(:issue_xls_assign),l(:issue_xls_priority),l(:issue_xls_author),l(:issue_xls_created_at),l(:issue_xls_version),l(:issue_xls_start),l(:issue_xls_due),l(:issue_xls_ratio)])
|
|
|
|
|
count_row = 1
|
|
|
|
|
issues.each do |issue|
|
|
|
|
|
sheet1[count_row,0] = issue.id
|
|
|
|
|
sheet1[count_row,1] = issue_tracker_change(issue.tracker_id)
|
|
|
|
|
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,6] = issue_priority_change(issue.priority_id)
|
|
|
|
|
sheet1[count_row,7] = issue.author.show_name
|
|
|
|
|
sheet1[count_row,8] = issue.created_on
|
|
|
|
|
sheet1[count_row,9] = issue.fixed_version.try(:name)
|
|
|
|
|
sheet1[count_row,10] = issue.start_date
|
|
|
|
|
sheet1[count_row,11] = issue.due_date
|
|
|
|
|
sheet1[count_row,12] = issue_ratio_change(issue.done_ratio, issue.status_id)
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
book.write xls_report
|
|
|
|
|
xls_report.string
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def issue_ratio_change done_ratio, status_id
|
|
|
|
|
if done_ratio == 100 || status_id == 3
|
|
|
|
|
"已完成"
|
|
|
|
|
else
|
|
|
|
|
done_ratio.to_s + "%"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def issue_priority_change priority_id
|
|
|
|
|
case priority_id
|
|
|
|
|
when 1
|
|
|
|
|
"低"
|
|
|
|
|
when 2
|
|
|
|
|
"正常"
|
|
|
|
|
when 3
|
|
|
|
|
"高"
|
|
|
|
|
when 4
|
|
|
|
|
"紧急"
|
|
|
|
|
when 5
|
|
|
|
|
"立即"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def issue_status_change status_id
|
|
|
|
|
case status_id
|
|
|
|
|
when 1
|
|
|
|
|
"新增"
|
|
|
|
|
when 2
|
|
|
|
|
"正在解决"
|
|
|
|
|
when 3
|
|
|
|
|
"已解决"
|
|
|
|
|
when 4
|
|
|
|
|
"反馈"
|
|
|
|
|
when 5
|
|
|
|
|
"关闭"
|
|
|
|
|
when 6
|
|
|
|
|
"拒绝"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def issue_tracker_change tracker_id
|
|
|
|
|
case tracker_id
|
|
|
|
|
when 1
|
|
|
|
|
"缺陷"
|
|
|
|
|
when 2
|
|
|
|
|
"功能"
|
|
|
|
|
when 3
|
|
|
|
|
"支持"
|
|
|
|
|
when 4
|
|
|
|
|
"任务"
|
|
|
|
|
when 5
|
|
|
|
|
"周报"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def self.accept_rss_auth(*actions)
|
|
|
|
|
if actions.any?
|
|
|
|
|
self.accept_rss_auth_actions = actions
|
|
|
|
|