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

110 lines
6.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<div class="edu-class-top mt15 clearfix bor-grey-e">
<%= form_tag(url_for(users_managements_path), :id => "managements_users_search", :method => "post", :remote => true) do %>
<div class=" edu-position edu-admin-select fl mr10" style="width:140px;" >
<p>全部状态<i class="fa fa-caret-down ml10" ></i></p>
<input type="hidden" name="user_status" value="0">
<ul class="edu-admin-option">
<li data-val="0">全部状态</li>
<li data-val="1">活动的(<%= query_user_status_num 1 %></li>
<li data-val="2">未激活(<%= query_user_status_num 2 %></li>
<li data-val="3">已锁定(<%= query_user_status_num 3 %></li>
</ul>
</div>
<div class="edu-position edu-admin-select fl mr10" style="width:150px;">
<p>真实姓名搜索<i class="fa fa-caret-down ml10"></i></p>
<input type="hidden" name="research_condition" value="name">
<ul class="edu-admin-option">
<li data-val="name">真实姓名搜索</li>
<li data-val="login">用户id搜索</li>
<li data-val="mail">邮箱地址搜索</li>
<li data-val="phone">手机号码搜索</li>
</ul>
</div>
<div class="fl with20">
<input type="text" class="fl task-form-100 task-height-40 panel-box-sizing" name="research_contents" placeholder="输入关键字进行搜索">
</div>
<li class="fl task-height-30 ml10" style="display: inline-block">
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请输入单位名称关键字进行搜索" style="width: 240px" />
<input nhname="tag" nh_tag_5="true" class="fl" id="school_id" name="school_id" style="display:none;" type="text"/> <!-- 单位名称的test框选中下拉列表框的id -->
<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>
<a href="javascript:void(0);" class="fl task-btn task-btn-orange ml5 mt5" onclick="$('#managements_users_search').submit();">搜索</a>
<!--<a href="javascript:void(0);" class="fl task-btn ml5 mt5" id="clear_contents">清除</a>-->
<a href="javascript:void(0);" onclick="import_student_accounts();" class="fl ml20 task-btn task-btn-orange mt5">账号生成</a>
<a href="javascript:void(0);" onclick="import_course_members();" class="fl ml10 task-btn task-btn-orange mt5">课堂添加成员</a>
<% end %>
</div>
<div class="edu-con-bg01 mt15" id="managements_user_list">
<%= render :partial => "managements/user_list" %>
</div>
<script>
function import_student_accounts(){
var htmlvalue = '<%= escape_javascript(render :partial => 'student_work/import_excel_score') %>';
pop_box_new(htmlvalue, 452, 163);
$("#submit_url").val('<%= import_student_accounts_managements_path() %>');
}
function import_course_members(){
var htmlvalue = '<%= escape_javascript(render :partial => 'student_work/import_excel_score') %>';
pop_box_new(htmlvalue, 452, 163);
$("#submit_url").val('<%= import_course_members_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>