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/schooladd.html.erb

131 lines
6.8 KiB

<link rel="stylesheet" href="/javascripts/layDate-v5.0.9/laydate/theme/default/laydate.css" />
<%= 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;"} %>
<input class="fl task-form-20 task-height-30 mt10 ml20 width200" placeholder="请选择时间段一" type="text" id="starttime">
<div class="fl mt10 ml5 mr5">VS</div>
<input class="fl task-form-20 task-height-30 mt10 width200 mr20" placeholder="请选择时间段一" type="text" id="endtime">
<a href="javascript:void(0);" class="fl task-btn task-btn-orange ml5 mt10 mr20" onclick="$('#classroom').submit();">时间对比</a>
<a href="javascript:clearSearchCondition()" class="fl task-btn ml5 mt2 mt10 mr10" id="clear_contents">日新增</a>
<input class="fl task-form-20 task-height-30 mt10 width350mr20" placeholder="请输入单位名称或者ID关键字进行搜索" name="search" maxlength="" type="text" id="Look_name">
<a href="javascript:void(0);" class="fl task-btn task-btn-orange ml5 mt10 mr20" onclick="$('#classroom').submit();">搜索</a>
<a href="javascript:clearSearchCondition()" class="fl task-btn ml5 mt2 mt10 mr10" id="clear_contents">清除</a>
<input name="sx_order" type="hidden">
</div>
<% end %>
<div class="edu-con-bg01 mt15" id="classroom_list">
<%= render :partial => "managements/schooladd_list" %>
</div>
<script src="/javascripts/layDate-v5.0.9/laydate/laydate.js" type="text/javascript"></script>
<script>
let starttime; //开始时间
let endtime; //结束时间
//日期时间范围
laydate.render({
elem: '#starttime'
,range: true,change: function(value, date, endDate){
// console.log(value); //得到日期生成的值2017-08-18
starttime=value;
// console.log(date); //得到日期时间对象:{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
// console.log(endDate); //得结束的日期时间对象开启范围选择range: true才会返回。对象成员同上。
getdata()
}
});
laydate.render({
elem: '#endtime'
,range: true,change: function(value, date, endDate){
// console.log(value); //得到日期生成的值2017-08-18
endtime=value;
// console.log(date); //得到日期时间对象:{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
// console.log(endDate); //得结束的日期时间对象开启范围选择range: true才会返回。对象成员同上。
getdata()
}
});
function getdata(){
console.log(starttime);
console.log(endtime);
}
//支持实训检索
$("#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>