You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pgfqe6ch8/app/views/managements/classroom.html.erb

102 lines
6.2 KiB

6 years ago
<%= form_tag(url_for(classroom_managements_path),:id=>"classroom",:method => "post",:remote=>true) do %>
<div class="edu-con-top clearfix xmt10 bor-grey-e mt10">
<%#= select_tag :major_level,options_for_select(major_level_option, 0), {:id=>"major_level", :class=>"fl task-form-15 task-height-30", :style => "margin:0px 10px 0px 25px;"} %>
<%#= select_tag :discipline_category_id,options_for_select(discipline_category_option, nil), {:id=>"discipline_category_id", :class=>"fl task-form-15 task-height-30", :style => "margin:0px 30px 0px 50px;"} %>
<%#= select_tag :first_level_discipline_id,options_for_select(first_level_discipline_option, nil), {:id=>"first_level_discipline_id", :class=>"fl task-form-20 task-height-30", :style => "margin:0px 30px 0px 25px;"} %>
<%#= select_tag :major_id,options_for_select(syllabus_major_option, nil), {:id=>"major_id", :class=>"fl task-form-20 task-height-30", :style => "margin:0px 30px 0px 25px;"} %>
<!--<li class="clearfix mb10 ml35 mt15 fl" style="display: inline-block">-->
<!--<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请选择学校" style="width: 330px" />-->
<!--<input nhname="tag" nh_tag_5="true" class="fl" id="school_id" name="school_id" style="display:none;" type="text"/> &lt;!&ndash; 单位名称的test框选中下拉列表框的id &ndash;&gt;-->
<!--<div class="cl"></div>-->
<!--</li>-->
<!--<div id="search_school_result_list" style="width: 330px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display:none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">-->
<!--</div>-->
<!--</select>-->
<select class="fl task-form-15 task-height-30" style="margin:10px 0px 10px 25px;width: 11%" name="keyword" id="condition">
<option value="u_name">创建者姓名搜索</option>
<option value="cla_name">课程名称搜索</option>
</select>
<input class="fl task-form-20 task-height-30 mt10" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" id="Look_name">
<a href="javascript:void(0);" class="fl task-btn task-btn-orange ml5 mt10" onclick="$('#classroom').submit();">搜索</a>
<a href="javascript:clearSearchCondition()" class="fl task-btn ml5 mt2 mt10" id="clear_contents">清除</a>
<span class="fr shixun_webssh mt10">
<input type="checkbox" class="mr5 magic-checkbox" name="support_shixuns_search_title" value="1" id="join_course_role_0">
<label style="top:2px;padding-left:23px;" for="join_course_role_0"><span class="only_view">支持实训检索</span></label>
</span>
<input name="sx_order" type="hidden">
</div>
<% end %>
<div class="edu-con-bg01 mt15" id="classroom_list">
<%= render :partial => "managements/classroom_list" %>
</div>
<script>
//支持实训检索
$("#join_course_role_0").on("click",function(){
$('#classroom').submit();
});
function clearSearchCondition(){
// $("#part").val("");
$("#condition").val("u_name");
$("#Look_name").val("");
// $("#major_level").val("");
// $("#discipline_category_id").val("");
// $("#major_id").val("0");
// $("#first_level_discipline_id").val("");
$.get('<%= classroom_managements_path() %>');
}
$("input[name='school']").on('input', function (e) {
throttle(department_search_fn, window, e);
});
var d_lastSearchCondition = '';
var d_page = 1; //唯一控制页码 变量
var d_count = 0; //查询结果的总量
var d_maxPage = 0;//最大页面值
function department_search_fn(e) {
if($(e.target).val().trim() == ''){
$("#search_school_result_list").hide();
$("input[name='school_id']").val("");
return;
}
if ($(e.target).val().trim() == d_lastSearchCondition && $(e.target).val().trim() != '') {//如果输入框没有改变或者输入框为空就返回
return;
}
d_lastSearchCondition = $(e.target).val().trim();
page = 1; //有新的搜索页面重置为1
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value + '&school_id=' + $("input[name='occupation']").val() + '&page=' + d_page,
type: 'post',
success: function (data) {
d_schoolsResult = data.schools;
count = data.count;
maxPage = Math.ceil(count / 100); //最大页码值
if (d_schoolsResult.length != undefined && d_schoolsResult.length != 0) {
var i = 0;
$("#search_school_result_list").html('');
for (; i < d_schoolsResult.length; i++) {
link = '<a onclick="window.changeSchoolValue(\'' + d_schoolsResult[i].school.name.replace(/\s/g, " ") + '\',\'' + d_schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + d_schoolsResult[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link);
}
$("#search_school_result_list").css('left', $(e.target).offset().left);
$("#search_school_result_list").css('top', $(e.target).offset().top + 40);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").show();
} else {
$("#search_school_result_list").css('left', $(e.target).offset().left);
$("#search_school_result_list").css('top', $(e.target).offset().top + 40);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").html('你的学校不在列表中?请确认后输入');
$("#search_school_result_list").show();
}
}
});
}
//修改部门
function changeSchoolValue(value, data) {
console.log(value+","+data)
$("input[name='school']").val(value);
$("input[name='school_id']").val(data);
$("#search_school_result_list").hide();
}
</script>