@ -1,7 +1,7 @@
<div class="task-popup" style="width: 572px;">
<div class="task-popup-title clearfix">添加合作伙伴</div>
<div class="task_popup_con">
<div class="clearfix mb20 df">
<div class="clearfix mb5 df">
<div class="flex1">
<div class="df">
<span class="fl lineh-35">地区:</span>
@ -14,42 +14,26 @@
</div>
<a href="javascript:void(0);" onclick="submit_search_user()" class="white-btn mt6 edu-blueback-btn fl ml15 mt55">搜索</a>
</div>
<div class="mb20 clearfix">
<div class="mb4 clearfix">
<p class="pl10 color-grey-6 clearfix">
<span class="fl ml25">单位</span>
<span class="fr with30">地区</span>
</p>
<div class="edu-back-skyblue clearfix pl10 over280" id="serch_user_list">
<p class="clearfix mt5">
<span class="fl with70">
<span>
<input type="checkbox" name="user_id[]" value="1" id="user_1" class="magic-checkbox">
<label for="user_1">国防科技大学</label>
</span>
</span>
<span class="fl with30">湖南</span>
</p>
<p class="clearfix mt5">
<span class="fl with70">
<span>
<input type="checkbox" name="user_id[]" value="12" id="user_12" class="magic-checkbox">
<label for="user_12">国防科技大学</label>
</span>
</span>
<span class="fl with30">湖南</span>
</p>
<p class="clearfix mt5">
<span class="fl with70">
<span>
<input type="checkbox" name="user_id[]" value="125" id="user_125" class="magic-checkbox">
<label for="user_125">国防科技大学</label>
</span>
</span>
<span class="fl with30">湖南</span>
</p>
</div>
<p class="clearfix" style="height: 20px;"><span class="fl lineh-20 none color-red" id="checkNotice"></span></p>
<div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @schools_pages, @schools_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
</div>
<li class="clearfix mt10 edu-txt-center">
<a href="javascript:void(0);" class="task-btn mr10" onclick="hideModal()">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20" onclick="submit_add_partner()">确定</a>
@ -60,12 +44,46 @@
$(function() {
unitDownOption();
showprovince("province");
})
get_schools()
});
function get_schools() {
$.getJSON("/managements/all_partners",function(schools){
let 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>"
})
$("#serch_user_list").html(s_html)
})
}
function submit_add_partner(){
if($("input[name='user_id[]']:checked").length==0){
if($("input[name='school[id ]']:checked").length==0){
$("#checkNotice").html("请选择需要添加的内容").removeClass("none");
return;
}else{
let checked_array = [];
$("input[name='school[id]']:checked").each(function () {
checked_array.push($(this).val())
});
let check_ids = {ids:checked_array};
$.ajax({
url: "/managements/add_partner",
type: 'POST',
data: check_ids,
success: function (e) {
if(e.status === 1){}
$("#popupAll").remove()
}
})
}
}
</script>