超级管理员的导出调整

dev_partners
cxt 6 years ago
parent 22b549cf77
commit 52af31be38

@ -3345,7 +3345,7 @@ end
end end
@users = User.where(:id => user_id).where("#{sql}").includes(:apply_actions, user_extensions: [:department, :school]).order("last_login_on desc") @users = User.where(:id => user_id).where("#{sql}").includes(:apply_actions, user_extensions: [:department, :school]).order("last_login_on desc")
@xls_users = @users.reorder("created_on desc").limit(1000) #导出excel用户 @xls_users = @users.reorder("created_on desc").limit(3000) #导出excel用户
@page = (params['page'] || 1).to_i @page = (params['page'] || 1).to_i
@users_count = @users.count @users_count = @users.count
@limit = 20 @limit = 20
@ -4176,7 +4176,7 @@ end
sheet1 = book.create_worksheet :name => "course" sheet1 = book.create_worksheet :name => "course"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue sheet1.row(0).default_format = blue
sheet1.row(0).concat(["ID","课堂名称","成员","资源","普通作业"," 实训作业","试卷","私有","状态","创建者单位","创建者","动态时间"]) sheet1.row(0).concat(["ID","课堂名称","成员","资源","普通作业"," 实训作业","试卷","私有","状态","创建者单位","创建者","动态时间","创建时间"])
count_row = 1 count_row = 1
courses.each do |course| courses.each do |course|
school = course.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : course.teacher.school_name school = course.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : course.teacher.school_name
@ -4193,6 +4193,7 @@ end
sheet1[count_row,9] = school sheet1[count_row,9] = school
sheet1[count_row,10] = teacher_name sheet1[count_row,10] = teacher_name
sheet1[count_row,11] = format_time(course.updatetime) sheet1[count_row,11] = format_time(course.updatetime)
sheet1[count_row,12] = format_time(course.created_at)
count_row += 1 count_row += 1
end end
book.write xls_report book.write xls_report

Loading…
Cancel
Save