You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.8 KiB
44 lines
1.8 KiB
graduation_requirements = @graduation_requirements
|
|
training_subitems = @training_subitems
|
|
subitem_size = training_subitems.size
|
|
support_map = @requirement_support_objectives.group_by do |support|
|
|
[support.ec_training_objective_id, support.ec_graduation_requirememt_id]
|
|
end
|
|
ec_year = @_current_year
|
|
major = ec_year.ec_major_school.ec_major
|
|
|
|
wb = xlsx_package.workbook
|
|
wb.styles do |style|
|
|
title_style = style.add_style(sz: 18, height: 22, b: true)
|
|
ec_year_style = style.add_style(sz: 10, height: 14)
|
|
note_style = style.add_style(sz: 11, height: 14, color: 'FF5500')
|
|
label_style = style.add_style(sz: 11, b: true, bg_color: '90EE90', alignment: { horizontal: :center })
|
|
content_style = style.add_style(sz: 11, height: 16, border: { style: :thin, color: '000000' })
|
|
|
|
wb.add_worksheet(:name => '毕业要求对培养目标的支撑') do |sheet|
|
|
sheet.add_row '毕业要求 vs 培养目标矩阵', style: title_style
|
|
|
|
sheet.merge_cells wb.rows.first.cells[(1..subitem_size)]
|
|
|
|
sheet.add_row []
|
|
|
|
sheet.add_row ['专业代码', major.code], style: ec_year_style
|
|
sheet.add_row ['专业名称', major.name], style: ec_year_style
|
|
sheet.add_row ['学年', "#{ec_year.year}学年"], style: ec_year_style
|
|
|
|
sheet.add_row ['注:“√” 表示有对应关系'], style: note_style
|
|
|
|
objectives = subitem_size.times.map { |index| "目标#{index + 1}" }
|
|
sheet.add_row objectives.unshift('毕业要求指标点\培养目标'), style: label_style
|
|
|
|
graduation_requirements.each do |requirement|
|
|
data =
|
|
training_subitems.map do |item|
|
|
support_map[[item.id, requirement.id]].present? ? '√' : ''
|
|
end
|
|
|
|
data.unshift("指导点#{requirement.position.to_s}")
|
|
sheet.add_row data, style: ([content_style] * subitem_size).unshift(label_style)
|
|
end
|
|
end
|
|
end |