Merge branch 'develop' into educoder

dev_haigong
daiao 6 years ago
commit 1780153ba2

@ -826,7 +826,7 @@ class ManagementsController < ApplicationController
format.xls{ format.xls{
shixun_ids = @all_discusses.pluck(:dis_id).uniq shixun_ids = @all_discusses.pluck(:dis_id).uniq
filename = "#{Time.now.strftime("%Y%m%d")}-实训反馈.xls" filename = "#{Time.now.strftime("%Y%m%d")}-实训反馈.xls"
send_data(shixun_feedback_xls(shixun_ids), :type => "text/excel;charset=utf-8; header=present", :filename => filename_for_content_disposition(filename)) send_data(shixun_feedback_xls(shixun_ids, @beginTime, @endTime), :type => "text/excel;charset=utf-8; header=present", :filename => filename_for_content_disposition(filename))
} }
end end
end end
@ -4250,7 +4250,7 @@ end
return sheet.rows return sheet.rows
end end
def shixun_feedback_xls shixun_ids def shixun_feedback_xls shixun_ids, beginTime, endTime
xls_report = StringIO.new xls_report = StringIO.new
book = Spreadsheet::Workbook.new book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "实训反馈" sheet1 = book.create_worksheet :name => "实训反馈"
@ -4262,6 +4262,12 @@ end
"评论者单位", "评论时间", "社区导师是否已回复"]) "评论者单位", "评论时间", "社区导师是否已回复"])
shixuns.each_with_index do |shixun, i| shixuns.each_with_index do |shixun, i|
discusses = shixun.discusses.where("user_id != ?", 1) discusses = shixun.discusses.where("user_id != ?", 1)
if beginTime.present?
discusses = discusses.where("created_at >= '#{beginTime}'")
end
if endTime.present?
discusses = discusses.where("created_at <= '#{endTime}'")
end
sheet1[count_row, 0] = i + 1 sheet1[count_row, 0] = i + 1
sheet1[count_row, 1] = shixun.identifier sheet1[count_row, 1] = shixun.identifier
sheet1[count_row, 2] = shixun.name sheet1[count_row, 2] = shixun.name

@ -1,12 +1,12 @@
<div class="edu-class-container"> <div class="edu-class-container">
<%= form_tag(url_for(shixun_feedback_message_managements_path), :id => "managements_shixuns_search", :method => "post", :remote => true ) do %> <%= form_tag(url_for(shixun_feedback_message_managements_path), :id => "managements_shixuns_search", :method => "post", :remote => true ) do %>
<div class="edu-con-top clearfix mb20"> <div class="edu-con-top clearfix mb20">
<input class="fl task-form-20 task-height-30 ml25" id="shixun_Look_name" name="search" maxlength="" placeholder="输入实训名称关键字进行搜索" type="text" style="height: 21px;"> <input class="fl task-form-20 task-height-30 ml25" id="shixun_Look_name" name="search" maxlength="" placeholder="输入实训名称关键字进行搜索" value="<%= @search %>" type="text" style="height: 21px;">
<li class="fl"> <li class="fl">
<span class="mr10 ml10 font-14">发布时间</span> <span class="mr10 ml10 font-14">发布时间</span>
<input type="text" name="beginTime" readonly placeholder="请选择开始时间" class="winput-150-30 mr10"/> <input type="text" name="beginTime" readonly placeholder="请选择开始时间" value="<%= @beginTime %>" class="winput-150-30 mr10"/>
<input type="text" name="endTime" readonly placeholder="请选择结束时间" class="winput-150-30"/> <input type="text" name="endTime" readonly placeholder="请选择结束时间" value="<%= @endTime %>" class="winput-150-30"/>
</li> </li>
<li class="fl ml10"> <li class="fl ml10">
<a href="javascript:void(0)" class="task-btn task-btn-orange" onclick="$('#managements_shixuns_search').submit();">搜索</a> <a href="javascript:void(0)" class="task-btn task-btn-orange" onclick="$('#managements_shixuns_search').submit();">搜索</a>
@ -22,6 +22,8 @@
<script> <script>
function clearSearchCondition(){ function clearSearchCondition(){
$("#shixun_Look_name").val('') $("#shixun_Look_name").val('')
$("input[name='beginTime']").val('');
$("input[name='endTime']").val('');
} }
$("input[name='beginTime']").datetimepicker({ $("input[name='beginTime']").datetimepicker({
allowBlank:true, allowBlank:true,

@ -568,7 +568,4 @@
}); });
script_Codemirror.setSize("auto","600px"); script_Codemirror.setSize("auto","600px");
// 非管理员只能查看 // 非管理员只能查看
<% if !@power %>
script_Codemirror.setOption("readOnly", "nocursor");
<% end %>
</script> </script>
Loading…
Cancel
Save