wb = xlsx_package.workbook
wb.add_worksheet(name: '报名列表') do |sheet|
  sheet.add_row %w(序号 战队ID 战队名称 创建者 指导老师 队员姓名 职业 手机号 邮箱 学号 实名认证 职业认证 队员学校 地区 报名时间 排名)

  @enroll_lists.each_with_index do |member, index|
    team = member.competition_team
    member_user = member.user
    rank = @competition_scores.length > 0 ? @competition_scores.index(member.competition_team_id).to_i + 1 : "--"
    data = [
      index + 1,
      member.competition_team_id,
      @personal ? "--" : team.name,
      team.user.real_name,
      @personal ? "--" : team.teachers_info,
      member_user.real_name,
      member_user.identity,
      member_user.phone.present? ? (member_user.phone.to_s + "\t") : "--",
      member_user.mail,
      member_user.student_id.present? ? (member_user.student_id.to_s + "\t") : "--",
      member_user.authentication ? "√" : "",
      member_user.professional_certification ? "√" : "",
      member_user.school_name,
      member_user.school_province,
      team.created_at&.strftime('%Y-%m-%d %H:%M'),
      rank
    ]
    sheet.add_row(data)
  end
end