添加合作单位的调整

dev_local
cxt 6 years ago
parent 638a3ba1a3
commit c56a997403

@ -1202,7 +1202,7 @@ end
@schools = @schools.where("name like ?", "%#{@search}%") @schools = @schools.where("name like ?", "%#{@search}%")
end end
if params[:province] if params[:province] && params[:province] != '0'
@schools = @schools.where("province like ?", "%#{@province}%") @schools = @schools.where("province like ?", "%#{@province}%")
end end
@ -1276,7 +1276,7 @@ end
# 添加合作伙伴管理员- 弹框 # 添加合作伙伴管理员- 弹框
def add_partner_member_box def add_partner_member_box
@partner = Partner.first @partner = Partner.where(:id => params[:partner]).first
@members = @members =
if params[:search] if params[:search]
User.where("LOWER(concat(lastname, firstname, nickname, mail)) LIKE '%#{params[:search]}%'") User.where("LOWER(concat(lastname, firstname, nickname, mail)) LIKE '%#{params[:search]}%'")
@ -1284,6 +1284,9 @@ end
User.where(:certification => 1) User.where(:certification => 1)
end end
@members = paginateHelper @members, 8 @members = paginateHelper @members, 8
respond_to do |format|
format.js
end
end end
# 合作伙伴添加管理员 # 合作伙伴添加管理员

@ -2,7 +2,7 @@
<div class="task-popup-title clearfix">添加管理员</div> <div class="task-popup-title clearfix">添加管理员</div>
<div class="task_popup_con"> <div class="task_popup_con">
<div class="df mb20" id="add_major_manager"> <div class="df mb20" id="add_major_manager">
<input type="text" class="input-flex-35 color-grey-3" placeholder="输入用户的姓名、单位、职位尽情搜索"/> <input type="text" class="input-flex-35 color-grey-3" name="search" id="partner_member_search" placeholder="输入用户的姓名、昵称、邮箱进行搜索"/>
<a href="javascript:void(0);" onclick="submit_search_user()" class="white-btn mt6 edu-blueback-btn ml15">搜索</a> <a href="javascript:void(0);" onclick="submit_search_user()" class="white-btn mt6 edu-blueback-btn ml15">搜索</a>
</div> </div>
<div class="mb20 clearfix"> <div class="mb20 clearfix">
@ -12,25 +12,12 @@
<span class="fl edu-txt-w200 edu-txt-left">单位</span> <span class="fl edu-txt-w200 edu-txt-left">单位</span>
<span class="fl edu-txt-w100 edu-txt-center">手机号</span> <span class="fl edu-txt-w100 edu-txt-center">手机号</span>
</p> </p>
<div class="edu-back-skyblue clearfix pl10 over280" id="serch_user_list">
<%= form_for @partner, :url => add_partner_member_managements_path,:html => {:id => 'add_partner_member_form', :remote => true, :method => :post} do |f| %> <%= form_for @partner, :url => add_partner_member_managements_path,:html => {:id => 'add_partner_member_form', :remote => true, :method => :post} do |f| %>
<input type="hidden" value="<%= @partner.id %>" name="partner"> <input type="hidden" value="<%= @partner.id %>" name="partner">
<% @members.each do |member| %> <div id="serch_user_list">
<p class="clearfix"> <%= render :partial => "partner_member_search_list" %>
<span class="fl edu-txt-w90">
<input type="checkbox" name="partner_member[]" value="<%= member.id %>" id="user_<%= member.id %>" class="magic-checkbox">
<label for="user_<%= member.id %>"><%= member.show_real_name %></label>
</span>
<span class="fl edu-txt-w90 mt5 edu-txt-center color-grey-6 pointer"><%= member.identity %></span>
<span class="fl task-hide edu-txt-w200 mt5 edu-txt-left color-grey-9"><%= member.school_name %> </span>
<span class="fl edu-txt-w100 mt5 edu-txt-center color-grey-9"><%= member.phone %></span>
</p>
<% end %>
<% end %>
</div> </div>
<% end %>
</div> </div>
<p class="clearfix none color-red edu-txt-left" id="form_notice">请至少选择一个用户</p> <p class="clearfix none color-red edu-txt-left" id="form_notice">请至少选择一个用户</p>
<li class="clearfix mt10 edu-txt-center"> <li class="clearfix mt10 edu-txt-center">
@ -40,6 +27,53 @@
</div> </div>
</div> </div>
<script> <script>
var i = 1; //设置当前页数
var msg_list_loading = false;
$(function() {
var totalpage = <%= @total_pages.to_i %>; //总页数,防止超过总页数继续滚动
var winH = $(window).height(); //页面可视区域高度
$("#search_user_list").scroll(function() {
if (i < totalpage) { // 当滚动的页数小于总页数的时候,继续加载
var pageH = $(document.body).height();
var scrollT = $(window).scrollTop(); //滚动条top
var aa = (pageH - winH - scrollT) / winH;
console.log(aa);
if ( !msg_list_loading ){
if (aa < 0.01 ) {
get_schools(i+1)
}
}
}
});
});
function get_schools(page) {
var msg_list = $('#search_user_list');
if (msg_list.height() + msg_list[0].scrollTop >= msg_list[0].scrollHeight - 60) {
msg_list_loading = true;
$.getJSON("/managements/add_partner_member_box?partner=<%= @partner.id %>&search="+$("#partner_member_search").val()+"&page="+page, function(schools) {
if (schools) {
msg_list_loading = false;
var s_html = "";
$.each(schools,function (index,array) {
s_html = s_html+ "<p class='clearfix mt5'>" +
" <span class='fl with70'>" +
" <span>" +
" <input type='checkbox' name='school[id]' value='"+array["school"]["id"]+"' id='school_'"+array["school"]["id"]+"'class='magic-checkbox'>" +
" <label for='school_'"+array["school"]["id"]+">"+array["school"]["name"]+"</label>" +
" </span>\n" +
" </span>\n" +
" <span class='fl with30'>"+array["school"]["province"]+"</span>" +
" </p>"
});
$("#search_user_list").append(s_html);
i ++;
}
});
}
}
function submit_add_manager(){ function submit_add_manager(){
if($("input[name='partner_member[]']:checked").length == 0){ if($("input[name='partner_member[]']:checked").length == 0){
@ -54,7 +88,7 @@
$(function() { $(function() {
unitDownOption(); unitDownOption();
$("#add_major_manager").on("keydown", "input[name='name'],input[name='school']", function(e){ $("#add_major_manager").on("keydown", "input[name='search']", function(e){
// 兼容FF和IE和Opera // 兼容FF和IE和Opera
var theEvent = e || window.event; var theEvent = e || window.event;
var code = theEvent.keyCode || theEvent.which || theEvent.charCode; var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
@ -63,15 +97,10 @@
submit_search_user(); submit_search_user();
} }
}); });
})
function submit_search_user(){ function submit_search_user(){
if($("input[name='name']").val()==""){ $.get("/managements/add_partner_member_box?partner=<%= @partner.id %>&search="+$("#partner_member_search").val());
$("input[name='name']").addClass("bor-red");
return;
} }
}
})
</script> </script>

@ -27,7 +27,6 @@
<script> <script>
var i = 1; //设置当前页数 var i = 1; //设置当前页数
var msg_list_loading = false; var msg_list_loading = false;
$(function() {
$(function() { $(function() {
var totalpage = <%= @total_pages.to_i %>; //总页数,防止超过总页数继续滚动 var totalpage = <%= @total_pages.to_i %>; //总页数,防止超过总页数继续滚动
var winH = $(window).height(); //页面可视区域高度 var winH = $(window).height(); //页面可视区域高度
@ -47,13 +46,12 @@
} }
}); });
}); });
});
function get_schools(page) { function get_schools(page) {
var msg_list = $('#search_user_list'); var msg_list = $('#search_user_list');
if (msg_list.height() + msg_list[0].scrollTop >= msg_list[0].scrollHeight - 60) { if (msg_list.height() + msg_list[0].scrollTop >= msg_list[0].scrollHeight - 60) {
msg_list_loading = true; msg_list_loading = true;
$.getJSON("<%= all_path %>?page="+page, function(schools) { $.getJSON("<%= all_path %>?page="+page+"&search="+$("#partner_name_search").val()+"&province="+$("#partner_province").val(), function(schools) {
if (schools) { if (schools) {
msg_list_loading = false; msg_list_loading = false;
var s_html = ""; var s_html = "";

@ -0,0 +1,11 @@
<% @members.each do |member| %>
<p class="clearfix">
<span class="fl edu-txt-w90">
<input type="checkbox" name="partner_member[]" value="<%= member.id %>" id="user_<%= member.id %>" class="magic-checkbox">
<label for="user_<%= member.id %>"><%= member.show_real_name %></label>
</span>
<span class="fl edu-txt-w90 mt5 edu-txt-center color-grey-6 pointer"><%= member.identity %></span>
<span class="fl task-hide edu-txt-w200 mt5 edu-txt-left color-grey-9"><%= member.school_name %> </span>
<span class="fl edu-txt-w100 mt5 edu-txt-center color-grey-9"><%= member.phone %></span>
</p>
<% end %>

@ -1,11 +1,11 @@
<%= form_for "", :url => {:controller=> 'managements', :action => 'all_partners', :type => @type}, :html => {:id => 'partners_search_form'}, :method => "get", :remote => true do |f| %> <%= form_for "", :url => {:controller=> 'managements', :action => 'all_partners', :type => @type}, :html => {:id => 'partners_search_form'}, :method => "get", :remote => true do |f| %>
<div class="df"> <div class="df">
<span class="fl lineh-35">地区:</span> <span class="fl lineh-35">地区:</span>
<select placeholder="请选择地区" name="province" id="province" class="flex1"></select> <select placeholder="请选择地区" name="province" id="partner_province" class="flex1"></select>
</div> </div>
<div class="df mt15"> <div class="df mt15">
<span class="fl lineh-35">单位:</span> <span class="fl lineh-35">单位:</span>
<input type="text" class="input-flex-35" name="search" placeholder="请输入单位关键字" value="<%= @search %>" id="partner_name_search"/> <input type="text" class="input-flex-35" name="search" placeholder="请输入单位关键字" id="partner_name_search"/>
</div> </div>
<% end %> <% end %>
@ -13,7 +13,7 @@
<script> <script>
$(function () { $(function () {
unitDownOption(); unitDownOption();
showprovince("province"); showprovince("partner_province");
}) })
</script> </script>

@ -1,6 +1,5 @@
<% if params[:search] %>
<% if params[:search] || params[:page] %> $("#serch_user_list").html("<%= j(render :partial => "partner_member_search_list") %>")
$("#depart_member_search_list").html("<%= j(render :partial => "depart_member_search_list") %>")
<% else %> <% else %>
var html="<%= escape_javascript(render :partial => "managements/partner_addManage") %>"; var html="<%= escape_javascript(render :partial => "managements/partner_addManage") %>";
pop_box_new(html,572,500); pop_box_new(html,572,500);

Loading…
Cancel
Save