|
|
|
@ -32,6 +32,14 @@ class ManagementsController < ApplicationController
|
|
|
|
|
# 实训课程等级体系
|
|
|
|
|
def subject_level_system
|
|
|
|
|
@levels = SubjectLevelSystem.all
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.html
|
|
|
|
|
format.xls{
|
|
|
|
|
time = Time.now.strftime("%Y%m%d")
|
|
|
|
|
filename = "实训课程体系#{time}.xls"
|
|
|
|
|
send_data(export_subject_level_system(), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 创建课程等级体系
|
|
|
|
@ -4286,6 +4294,33 @@ end
|
|
|
|
|
return sheet.rows
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def export_subject_level_system
|
|
|
|
|
xls_report = StringIO.new
|
|
|
|
|
book = Spreadsheet::Workbook.new
|
|
|
|
|
sheet1 = book.create_worksheet :name => "实训课程等级体系"
|
|
|
|
|
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
|
|
|
|
|
sheet1.row(0).default_format = blue
|
|
|
|
|
count_row = 1
|
|
|
|
|
sheet1.row(0).concat(["序号", "等级", "实训课程名称", "实训课程url", "实训名称"])
|
|
|
|
|
levels = SubjectLevelSystem.includes(subjects: [stage_shixuns: :shixun]).where(nil)
|
|
|
|
|
levels.each_with_index do |level, i|
|
|
|
|
|
sheet1[count_row, 0] = i + 1
|
|
|
|
|
sheet1[count_row, 1] = level.level
|
|
|
|
|
level.subjects.each do |subject|
|
|
|
|
|
sheet1[count_row, 2] = subject.name
|
|
|
|
|
sheet1[count_row, 3] = "#{subject_path(subject)}"
|
|
|
|
|
count_row += 1
|
|
|
|
|
subject.shixuns.each do |shixun|
|
|
|
|
|
sheet1[count_row, 4] = shixun.name
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
book.write xls_report
|
|
|
|
|
xls_report.string
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def shixun_feedback_xls shixun_ids, beginTime, endTime
|
|
|
|
|
xls_report = StringIO.new
|
|
|
|
|
book = Spreadsheet::Workbook.new
|
|
|
|
|