diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index c92ae34d..75ee3edf 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1202,7 +1202,7 @@ end @schools = @schools.where("name like ?", "%#{@search}%") end - if params[:province] + if params[:province] && params[:province] != '0' @schools = @schools.where("province like ?", "%#{@province}%") end @@ -1276,7 +1276,7 @@ end # 添加合作伙伴管理员- 弹框 def add_partner_member_box - @partner = Partner.first + @partner = Partner.where(:id => params[:partner]).first @members = if params[:search] User.where("LOWER(concat(lastname, firstname, nickname, mail)) LIKE '%#{params[:search]}%'") @@ -1284,6 +1284,9 @@ end User.where(:certification => 1) end @members = paginateHelper @members, 8 + respond_to do |format| + format.js + end end # 合作伙伴添加管理员 diff --git a/app/views/managements/_partner_addManage.html.erb b/app/views/managements/_partner_addManage.html.erb index e6de3cec..9c8769ae 100644 --- a/app/views/managements/_partner_addManage.html.erb +++ b/app/views/managements/_partner_addManage.html.erb @@ -2,7 +2,7 @@
添加管理员
- + 搜索
@@ -12,25 +12,12 @@ 单位 手机号

-
- - <%= form_for @partner, :url => add_partner_member_managements_path,:html => {:id => 'add_partner_member_form', :remote => true, :method => :post} do |f| %> - - <% @members.each do |member| %> -

- - - - - <%= member.identity %> - <%= member.school_name %> - <%= member.phone %> -

- <% end %> - <% end %> - - -
+ <%= form_for @partner, :url => add_partner_member_managements_path,:html => {:id => 'add_partner_member_form', :remote => true, :method => :post} do |f| %> + +
+ <%= render :partial => "partner_member_search_list" %> +
+ <% end %>

请至少选择一个用户

  • @@ -40,6 +27,53 @@
  • \ No newline at end of file diff --git a/app/views/managements/_partner_addUnit.html.erb b/app/views/managements/_partner_addUnit.html.erb index 820cb75d..0d80e5a7 100644 --- a/app/views/managements/_partner_addUnit.html.erb +++ b/app/views/managements/_partner_addUnit.html.erb @@ -28,24 +28,22 @@ var i = 1; //设置当前页数 var msg_list_loading = false; $(function() { - $(function() { - var totalpage = <%= @total_pages.to_i %>; //总页数,防止超过总页数继续滚动 - var winH = $(window).height(); //页面可视区域高度 + var totalpage = <%= @total_pages.to_i %>; //总页数,防止超过总页数继续滚动 + var winH = $(window).height(); //页面可视区域高度 - $("#search_user_list").scroll(function() { - if (i < totalpage) { // 当滚动的页数小于总页数的时候,继续加载 - var pageH = $(document.body).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) - } + 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) } } - }); + } }); }); @@ -53,7 +51,7 @@ var msg_list = $('#search_user_list'); if (msg_list.height() + msg_list[0].scrollTop >= msg_list[0].scrollHeight - 60) { 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) { msg_list_loading = false; var s_html = ""; diff --git a/app/views/managements/_partner_member_search_list.html.erb b/app/views/managements/_partner_member_search_list.html.erb new file mode 100644 index 00000000..ed697064 --- /dev/null +++ b/app/views/managements/_partner_member_search_list.html.erb @@ -0,0 +1,11 @@ +<% @members.each do |member| %> +

    + + + + + <%= member.identity %> + <%= member.school_name %> + <%= member.phone %> +

    +<% end %> \ No newline at end of file diff --git a/app/views/managements/_partner_search_form.html.erb b/app/views/managements/_partner_search_form.html.erb index 35e3e8c9..cf6d9450 100644 --- a/app/views/managements/_partner_search_form.html.erb +++ b/app/views/managements/_partner_search_form.html.erb @@ -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| %>
    地区: - +
    单位: - +
    <% end %> @@ -13,7 +13,7 @@ \ No newline at end of file diff --git a/app/views/managements/add_partner_member_box.js.erb b/app/views/managements/add_partner_member_box.js.erb index 72197cd0..c5ba340b 100644 --- a/app/views/managements/add_partner_member_box.js.erb +++ b/app/views/managements/add_partner_member_box.js.erb @@ -1,6 +1,5 @@ - -<% if params[:search] || params[:page] %> -$("#depart_member_search_list").html("<%= j(render :partial => "depart_member_search_list") %>") +<% if params[:search] %> +$("#serch_user_list").html("<%= j(render :partial => "partner_member_search_list") %>") <% else %> var html="<%= escape_javascript(render :partial => "managements/partner_addManage") %>"; pop_box_new(html,572,500);