mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-08 22:14:04 +08:00
init project
This commit is contained in:
18
app/views/admins/user_statistics/export.xlsx.axlsx
Normal file
18
app/views/admins/user_statistics/export.xlsx.axlsx
Normal file
@@ -0,0 +1,18 @@
|
||||
wb = xlsx_package.workbook
|
||||
wb.add_worksheet(name: '用户实训情况') do |sheet|
|
||||
sheet.add_row %w(姓名 单位部门 学习关卡数 完成关卡数 学习实训数 完成实训数 评测次数 实战时间)
|
||||
|
||||
@users.each do |user|
|
||||
data = [
|
||||
user.real_name,
|
||||
[user.school_name.presence, user.department_name.presence].compact.join(' - '),
|
||||
user.display_extra_data(:study_challenge_count),
|
||||
user.display_extra_data(:finish_challenge_count),
|
||||
user.display_extra_data(:study_shixun_count),
|
||||
user.display_extra_data(:finish_shixun_count),
|
||||
user.display_extra_data(:evaluate_count),
|
||||
Util.display_cost_time(user.display_extra_data(:cost_time)),
|
||||
]
|
||||
sheet.add_row(data)
|
||||
end
|
||||
end
|
||||
27
app/views/admins/user_statistics/index.html.erb
Normal file
27
app/views/admins/user_statistics/index.html.erb
Normal file
@@ -0,0 +1,27 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('用户实训情况') %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container user-statistic-list-form">
|
||||
<%= form_tag(admins_user_statistics_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
|
||||
<div class="form-group col-12 col-md-auto">
|
||||
<label for="status">时间范围:</label>
|
||||
<% data_arrs = [['不限', ''], ['最近一周', 'weekly'], ['最近一个月', 'monthly'], ['最近三个月', 'quarterly'], ['最近一年', 'yearly']] %>
|
||||
<%= select_tag(:date, options_for_select(data_arrs, params[:date]), class: 'form-control') %>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-12 col-md-3">
|
||||
<label for="school_name">所属单位:</label>
|
||||
<%= hidden_field_tag(:school_id, params[:school_id]) %>
|
||||
<%= select_tag :school_name, options_for_select([''], params[:school_id]), class: 'form-control school-select flex-1' %>
|
||||
</div>
|
||||
|
||||
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
|
||||
<input type="reset" class="btn btn-secondary clear-btn" value="清空"/>
|
||||
<% end %>
|
||||
<%= javascript_void_link '导出', class: 'btn btn-outline-primary export-action', 'data-url': export_admins_user_statistics_path(format: :xlsx) %>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container user-statistic-list-container">
|
||||
<%= render partial: 'admins/user_statistics/shared/list', locals: { users: @users } %>
|
||||
</div>
|
||||
1
app/views/admins/user_statistics/index.js.erb
Normal file
1
app/views/admins/user_statistics/index.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$('.user-statistic-list-container').html("<%= j( render partial: 'admins/user_statistics/shared/list', locals: { users: @users } ) %>");
|
||||
40
app/views/admins/user_statistics/shared/_list.html.erb
Normal file
40
app/views/admins/user_statistics/shared/_list.html.erb
Normal file
@@ -0,0 +1,40 @@
|
||||
<table class="table table-hover text-center user-statistic-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="4%">序号</th>
|
||||
<th width="14%" class="text-left">姓名</th>
|
||||
<th width="22%" class="text-left">单位部门</th>
|
||||
<th width="10%">学习关卡数<%#= sort_tag('学习关卡数', name: 'study_challenge_count', path: admins_user_statistics_path) %></th>
|
||||
<th width="9%">完成关卡数<%#= sort_tag('完成关卡数', name: 'finish_challenge_count', path: admins_user_statistics_path) %></th>
|
||||
<th width="9%"><%= sort_tag('学习实训数', name: 'study_shixun_count', path: admins_user_statistics_path) %></th>
|
||||
<th width="9%"><%= sort_tag('完成实训数', name: 'finish_shixun_count', path: admins_user_statistics_path) %></th>
|
||||
<th width="9%">评测次数</th>
|
||||
<th width="14%">实战时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if users.present? %>
|
||||
<% users.each_with_index do |user, index| %>
|
||||
<tr class="user-statistic-item-<%= user.id %>">
|
||||
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
|
||||
<td class="text-left">
|
||||
<%= link_to "/users/#{user.login}", target: '_blank' do %>
|
||||
<%= overflow_hidden_span user.real_name, width: 100 %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="text-left"><%= display_text [user.school_name.presence, user.department_name.presence].compact.join(' - ') %></td>
|
||||
<td><%= user.display_extra_data(:study_challenge_count) %></td>
|
||||
<td><%= user.display_extra_data(:finish_challenge_count) %></td>
|
||||
<td><%= user.display_extra_data(:study_shixun_count) %></td>
|
||||
<td><%= user.display_extra_data(:finish_shixun_count) %></td>
|
||||
<td><%= user.display_extra_data(:evaluate_count) %></td>
|
||||
<td><%= Util.display_cost_time(user.display_extra_data(:cost_time)) || '--' %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: users } %>
|
||||
Reference in New Issue
Block a user