mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-11 07:15:55 +08:00
init project
This commit is contained in:
1
app/views/admins/school_statistics/contrast.js.erb
Normal file
1
app/views/admins/school_statistics/contrast.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$(".school-statistic-list-container").html("<%= j(render partial: 'admins/school_statistics/shared/contrast_list', locals: { statistics: @statistics, select_options: @select_options }) %>")
|
||||
49
app/views/admins/school_statistics/index.html.erb
Normal file
49
app/views/admins/school_statistics/index.html.erb
Normal file
@@ -0,0 +1,49 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('数据变化报表', admins_school_statistics_path) %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container school-statistic-list-form">
|
||||
<form class="form-inline search-form d-flex" data-grow-form-url="<%= admins_school_statistics_path %>" data-contrast-form-url="<%= contrast_admins_school_statistics_path %>">
|
||||
<div class="time-select">
|
||||
<!-- 数据对比 -->
|
||||
<%= hidden_field_tag :contrast_column, params[:contrast_column] %>
|
||||
|
||||
<div class="form-group grow-date-container" style="<%= params[:data_type] == 'grow' ? '' : 'display: none' %>">
|
||||
<div class="input-group input-daterange grow-date-input-daterange">
|
||||
<%= text_field_tag :grow_begin_date, params[:grow_begin_date], class: 'form-control start-date mx-0', placeholder: '开始时间' %>
|
||||
<div class="input-group-prepend"><span class="input-group-text">到</span></div>
|
||||
<%= text_field_tag :grow_end_date, params[:grow_end_date], class: 'form-control end-date mx-0', placeholder: '结束时间' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="contrast-date-container" style="<%= params[:data_type] == 'contrast' ? '' : 'display: none' %>">
|
||||
<div class="input-group input-daterange date-input-daterange">
|
||||
<%= text_field_tag :begin_date, params[:begin_date], class: 'form-control start-date mx-0', placeholder: '开始时间' %>
|
||||
<div class="input-group-prepend"><span class="input-group-text">到</span></div>
|
||||
<%= text_field_tag :end_date, params[:end_date], class: 'form-control end-date mx-0', placeholder: '结束时间' %>
|
||||
</div>
|
||||
<div class="mx-2 align-middle">VS</div>
|
||||
<div class="input-group input-daterange other-date-input-daterange">
|
||||
<%= text_field_tag :other_begin_date, params[:other_begin_date], class: 'form-control start-date mx-0', placeholder: '开始时间' %>
|
||||
<div class="input-group-prepend"><span class="input-group-text">到</span></div>
|
||||
<%= text_field_tag :other_end_date, params[:other_end_date], class: 'form-control end-date mx-0', placeholder: '结束时间' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="type-box ml-3">
|
||||
<%= hidden_field_tag :data_type, params[:data_type] || 'grow' %>
|
||||
<%= javascript_void_link '时段对比', class: "btn btn-outline-info btn-sm contrast-btn #{params[:data_type] == 'contrast' ? 'active' : ''}",
|
||||
data: { toggle: 'tooltip', trigger: 'hover', title: '请在左侧分别选择需进行对比的两个时段,具体从当日5:00开始计算,下表显示两时段选定指标两时段变化情况对比' } %>
|
||||
<%= javascript_void_link '数据变化', class: "btn btn-outline-info btn-sm grow-btn #{params[:data_type] == 'contrast' ? '' : 'active'}",
|
||||
data: { toggle: 'tooltip', trigger: 'hover', title: '请在左侧选择时间段,具体从当日5:00开始计算,下表显示选定时间段内各项指标数据变化情况' } %>
|
||||
</div>
|
||||
|
||||
<%= text_field_tag :keyword, params[:keyword], placeholder: 'ID/单位名称检索', class: 'form-control mx-3 search-input' %>
|
||||
|
||||
<%= javascript_void_link '搜索', class: 'btn btn-primary search-btn' %>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container school-statistic-list-container">
|
||||
<%= render partial: 'admins/school_statistics/shared/list', locals: { statistics: @statistics } %>
|
||||
</div>
|
||||
1
app/views/admins/school_statistics/index.js.erb
Normal file
1
app/views/admins/school_statistics/index.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$(".school-statistic-list-container").html("<%= j(render partial: 'admins/school_statistics/shared/list', locals: { statistics: @statistics }) %>")
|
||||
@@ -0,0 +1,72 @@
|
||||
<div style="position: relative;">
|
||||
<div style="padding: 15px 0; text-align: center; font-size: 18px; font-weight: bold; border: 1px solid #eee; border-bottom: unset;">
|
||||
学校数据统计(<%= I18n.t("school_daily_report.#{params[:contrast_column]}") %>变化统计情况)
|
||||
</div>
|
||||
<%= select_tag :contrast_column,
|
||||
options_for_select(select_options, params[:contrast_column]),
|
||||
class: 'form-control contrast-column-select' %>
|
||||
|
||||
<% if statistics.present? %>
|
||||
<div style="position: absolute; left: 20px; bottom: 0; font-size: 12px;">
|
||||
说明:新增数=时段二-时段一;新增百分比=(新增数/时段一)*100%(保留小数点后五位)
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if statistics.present? %>
|
||||
<table class="table table-hover text-center daily-school-statistic-list-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="36%" class="text-left">单位名称</th>
|
||||
<th width="22%">时段一<br><%= "(#{params[:begin_date]} 05:00至#{(Time.zone.parse(params[:end_date]) + 1.days).strftime('%Y-%m-%d')} 05:00)" %></th>
|
||||
<th width="22%">时段二<br><%= "(#{params[:other_begin_date]} 05:00至#{(Time.zone.parse(params[:other_end_date]) + 1.days).strftime('%Y-%m-%d')} 05:00)" %></th>
|
||||
<th width="20%" colspan="2">
|
||||
<%= sort_tag('变化情况', name: 'percentage', path: contrast_admins_school_statistics_path) %>
|
||||
<br>( 新 增 数 | 新增百分比)
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% statistics.each do |statistic| %>
|
||||
<tr>
|
||||
<td class="text-left">
|
||||
<%= link_to statistic.school_name, "/colleges/#{statistic.school_id}/statistics",
|
||||
target: '_blank', data: { toggle: 'tooltip', title: '点击查看学校统计概况' } %>
|
||||
</td>
|
||||
<td><%= statistic['total'] %></td>
|
||||
<td><%= statistic['other_total'] %></td>
|
||||
<%
|
||||
increase = statistic['other_total'] - statistic['total']
|
||||
percentage = statistic['total'].zero? ? increase.to_f * 100 : (increase / statistic['total'].to_f) * 100
|
||||
%>
|
||||
<% if increase > 0 %>
|
||||
<td class="text-right pr-2 text-danger relative right-border">
|
||||
+<%= increase %>
|
||||
</td>
|
||||
<% if statistic['total'].zero? %>
|
||||
<td class="text-left pl-2">-</td>
|
||||
<% else %>
|
||||
<td class="text-left pl-2 text-danger">+<%= percentage.round(5) %>%</td>
|
||||
<% end %>
|
||||
<% elsif increase.zero? %>
|
||||
<td class="text-right pr-2 right-border relative" style="position: relative;">
|
||||
<%= increase %>
|
||||
</td>
|
||||
<td class="text-left pl-2"><%= percentage.round(5) %>%</td>
|
||||
<% else %>
|
||||
<td class="text-right pr-2 right-border relative text-success">
|
||||
<%= increase %>
|
||||
</td>
|
||||
<td class="text-left pl-2 text-success"><%= percentage.round(5) %>%</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: statistics } %>
|
||||
<% else %>
|
||||
<div style="padding-top: 150px; height: 250px; text-align: center; color: grey; font-size: 14px;">
|
||||
暂无数据,请选择时间段对比
|
||||
</div>
|
||||
<% end %>
|
||||
58
app/views/admins/school_statistics/shared/_list.html.erb
Normal file
58
app/views/admins/school_statistics/shared/_list.html.erb
Normal file
@@ -0,0 +1,58 @@
|
||||
<div class="box pb-4 pt-0 pl-0">
|
||||
统计总计:
|
||||
<% if params[:grow_begin_date].present? %>
|
||||
<%= params[:grow_begin_date] %> 05:00至<%= (Time.zone.parse(params[:grow_end_date]) + 1.days).strftime('%Y-%m-%d') %> 05:00
|
||||
<% else %>
|
||||
<%= (Time.current - 5.hour).beginning_of_day.ago(1.days).strftime('%Y-%m-%d') %> 05:00至
|
||||
<%= (Time.current - 5.hour).beginning_of_day.strftime('%Y-%m-%d') %> 05:00,
|
||||
<% end %>
|
||||
新增教师<span class="text-danger"><%= @grow_summary.teacher_increase_count || 0 %></span>人,
|
||||
新增学生<span class="text-danger"><%= @grow_summary.student_increase_count || 0 %></span>人,
|
||||
新增课堂<span class="text-danger"><%= @grow_summary.course_increase_count || 0 %></span>个,
|
||||
新增实训<span class="text-danger"><%= @grow_summary.shixun_increase_count || 0 %></span>个,
|
||||
新增实训作业<span class="text-danger"><%= @grow_summary.shixun_homework_count || 0 %></span>个,
|
||||
新增实训评测<span class="text-danger"><%= @grow_summary.shixun_evaluate_count || 0 %></span>个,
|
||||
活跃用户<span class="text-danger">
|
||||
<%= @grow_summary.uniq_active_user_count.to_i.zero? ? @grow_summary.active_user_count.to_i : @grow_summary.uniq_active_user_count.to_i %>
|
||||
</span>个
|
||||
</div>
|
||||
|
||||
<table class="table table-hover text-center daily-school-statistic-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="4%">序号</th>
|
||||
<th width="20%" class="text-left">单位名称</th>
|
||||
<th width="12%"><%= sort_tag('新增教师', name: 'teacher_increase_count', path: admins_school_statistics_path) %></th>
|
||||
<th width="12%"><%= sort_tag('新增学生', name: 'student_increase_count', path: admins_school_statistics_path) %></th>
|
||||
<th width="12%"><%= sort_tag('新增课堂', name: 'course_increase_count', path: admins_school_statistics_path) %></th>
|
||||
<th width="12%"><%= sort_tag('新增实训', name: 'shixun_increase_count', path: admins_school_statistics_path) %></th>
|
||||
<th width="12%"><%= sort_tag('新增实训作业', name: 'shixun_homework_count', path: admins_school_statistics_path) %></th>
|
||||
<th width="12%"><%= sort_tag('新增实训评测', name: 'shixun_evaluate_count', path: admins_school_statistics_path) %></th>
|
||||
<th width="12%"><%= sort_tag('活跃用户', name: 'uniq_active_user_count', path: admins_school_statistics_path) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if statistics.present? %>
|
||||
<% statistics.each_with_index do |statistic, index| %>
|
||||
<tr>
|
||||
<td><%= list_index_no(@params_page.to_i, index) %></td>
|
||||
<td class="text-left">
|
||||
<%= link_to statistic.school_name, "/colleges/#{statistic.school_id}/statistics",
|
||||
target: '_blank', data: { toggle: 'tooltip', title: '点击查看学校统计概况' } %>
|
||||
</td>
|
||||
<td><%= statistic.teacher_increase_count.to_i %></td>
|
||||
<td><%= statistic.student_increase_count.to_i %></td>
|
||||
<td><%= statistic.course_increase_count.to_i %></td>
|
||||
<td><%= statistic.shixun_increase_count.to_i %></td>
|
||||
<td><%= statistic.shixun_homework_count.to_i %></td>
|
||||
<td><%= statistic.shixun_evaluate_count.to_i %></td>
|
||||
<td><%= statistic.uniq_active_user_count.to_i.zero? ? statistic.active_user_count.to_i : statistic.uniq_active_user_count.to_i %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: statistics } %>
|
||||
Reference in New Issue
Block a user