超级管理员评测时间页面增加按时间搜索并增加最大执行时间列

dev_ec
daiao 6 years ago
parent 2862d530f7
commit 2374e6f31c

@ -863,19 +863,19 @@ class ManagementsController < ApplicationController
# 评测时间列表
def evaluate_records
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
uri = "#{shixun_tomcat}/bridge/monitor/getPodsInfo"
res = uri_exec uri, params
if res['code'] == 0
@pod_num = res['sum']
@pod_dis = JSON.parse(res['distr']) if res['distr'].present?
end
#uri = "#{shixun_tomcat}/bridge/monitor/getPodsInfo"
#res = uri_exec uri, params
#if res['code'] == 0
@pod_num = 1 # res['sum']
@pod_dis = [{ip: 1, num: 1}] #JSON.parse(res['distr']) if res['distr'].present?
#end
page = (params['page'] || 1).to_i
search = params[:search]
keyword = params[:keyword]
limit = 20
if search
if search.present?
if "u_name" == keyword
@evaluate_recods = EvaluateRecord.joins("join users u on evaluate_records.user_id = u.id").where("concat(u.lastname, u.firstname) like '%#{search}%'")
# @evaluate_recods = EvaluateRecord.where(user_id: User.where("concat(lastname, firstname) like '%#{search}%'").pluck(:id))
@ -884,7 +884,12 @@ class ManagementsController < ApplicationController
# @evaluate_recods = EvaluateRecord.where(user_id: UserExtensions.where(school_id: School.where("name like '%#{search}%'").pluck(:id)).pluck(:user_id))
end
else
@evaluate_recods = EvaluateRecord.where("0=0")
@evaluate_recods = EvaluateRecord.where(nil)
end
if params[:beginTime].present?
endTime = params[:endTime].present? ? params[:endTime] : Time.now
@evaluate_recods = @evaluate_recods.where("created_at >= ? and created_at <= ?", params[:beginTime], endTime)
end
@evaluate_recods_count = @evaluate_recods.count

@ -16,13 +16,14 @@
<th width="12%">开始时间<i class="fa fa-long-arrow-down color-light-green ml5" ></i></th>
<th width="12%">结束时间</th>
<th width="8%">耗时</th>
<th width="10%">评测者</th>
<th width="8%">最大执行时间</th>
<th width="8%">评测者</th>
<th width="10%">评测者单位</th>
<th width="5%">耗时详细</th>
</tr>
</thead>
<tbody>
<% @evaluate_recods.each do |record| %>
<% @evaluate_recods.includes(:shixun).each do |record| %>
<tr>
<td><%= record.id %></td>
<td><a href="/tasks/<%= record.game.try(:identifier) %>" target="_blank"><%= record.game.try(:identifier) %></a></td>
@ -33,6 +34,7 @@
<td><%= record.created_at.strftime('%Y-%m-%d %H:%M:%S') %></td>
<td><%= record.updated_at.strftime('%Y-%m-%d %H:%M:%S') %></td>
<td><%= record.try(:consume_time) %></td>
<td><%= record.shixun.exec_time %></td>
<td class="task-hide" title="<%= record.user.show_real_name %>">
<%= link_to record.user.show_real_name, user_path(record.user), :target => "_blank" %>
</td>

@ -1,14 +1,21 @@
<div class="edu-class-container">
<%= form_tag(url_for(evaluate_records_managements_path),:id=>"evaluate_records",:method => "post",:remote=>true) do %>
<div class="edu-con-top clearfix xmt10">
<div class="edu-con-top clearfix mb20 bor-grey-e mt10">
<select class="fl task-form-15 task-height-30" style="margin:20px 0px 10px 25px;width: 11%" name="keyword" id="condition">
<option value="u_name">评测者姓名搜索</option>
<option value="s_name">评测者单位搜索</option>
</select>
<input class="fl task-form-20 task-height-30 mt20 ml20" name="search" maxlength="40" placeholder="输入关键字进行搜索" type="text" id="Look_name">
<li class="fl mt20">
<span class="mr10 ml10 font-14">开始时间</span>
<input type="text" name="beginTime" placeholder="请选择开始时间" class="winput-150-30 mr10"/>
<input type="text" name="endTime" placeholder="请选择结束时间" class="winput-150-30"/>
</li>
<a href="javascript:void(0);" class="fl task-btn task-btn-orange ml5 mt20" onclick="$('#evaluate_records').submit();">搜索</a>
<a href="javascript:clearSearchCondition()" class="fl task-btn ml5 mt2 mt20" id="clear_contents">清除</a>
</div>
<% end %>
</div>
<div class="edu-con-bg01 mt15" id="evaluate_records_list">
<%= render :partial => "evaluate_records_list" %>
</div>
@ -19,4 +26,17 @@
$("#Look_name").val("");
$.get('<%= evaluate_records_managements_path() %>');
}
$("input[name='beginTime']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
$("input[name='endTime']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
</script>

Loading…
Cancel
Save