超级管理员的试用授权审批-已审批列表、以及用户列表增加筛选条件

dev_haigong
cxt 6 years ago
parent 1675c4e1c0
commit 999aba69f4

@ -2104,25 +2104,36 @@ end
condition = (params[:research_condition].nil? || params[:research_condition] == "name") ? "concat(lastname, firstname)" : params[:research_condition]
if 0 == status
if params[:research_condition] == "phone" && params[:research_contents].blank?
@users = User.order("#{@order_key} #{@us_order}")
@users = User.where(nil)
else
@users = User.where("#{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}")
@users = User.where("#{condition} like '%#{params[:research_contents]}%'")
end
else
if params[:research_condition] == "phone" && params[:research_contents].blank?
@users = User.where(:status => status).order("#{@order_key} #{@us_order}")
@users = User.where(:status => status)
else
@users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}")
@users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'")
end
end
if params[:identity] && params[:identity].to_i != -1
@users = @users.includes(:user_extensions).where("user_extensions.identity = ?", params[:identity].to_i)
end
if params[:auto_school] && params[:auto_school].to_i != 0
@users = @users.includes(:user_extensions => [:school]).where("schools.auto_users_trial = ?", params[:auto_school].to_i == 1 ? 1 : 0)
end
if params[:school] && params[:school] != ''
school_name = params[:school]
school = School.where("name like '%#{school_name}%'")
school_id = school.map(&:id)
user_id = UserExtensions.where(:school_id => school_id).map(&:user_id)
@users = @users.where(:id => user_id).order("#{@order_key} #{@us_order}")
@users = @users.where(:id => user_id)
end
@users = @users.order("#{@order_key} #{@us_order}")
@page = (params['page'] || 1).to_i
@users_count = @users.count
@limit = 20
@ -3186,25 +3197,44 @@ end
search = params[:search]
@status = trial_authorization_status(params[:status])
# @status = (params[:status].blank? || params[:status] == "0") ? 0 : [1,2]
if search.blank?
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status).includes(:user)
else
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'")
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status, :user_id => user_id).includes(:user)
user_id = []
search = false
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status)
unless search.blank?
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'").map(&:id)
end
if params[:sname] && params[:sname] != ''
if params[:sname] && params[:sname].strip != ''
school_id = School.where("name like '%#{params[:sname]}%'")
user_id = UserExtensions.where(:school_id => school_id).map(&:user_id)
@authorizations = @authorizations.where(:user_id => user_id).order("updated_at desc")
new_user_id = UserExtensions.where(:school_id => school_id).map(&:user_id)
user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id
search = true
end
if params[:identity] && params[:identity].to_i != -1
new_user_id = UserExtensions.where(:identity => params[:identity].to_i).map(&:user_id)
user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id
search = true
end
if params[:auto_school] && params[:auto_school].to_i != 0
school_id = School.where(auto_users_trial: params[:auto_school].to_i == 1 ? 1 : 0)
new_user_id = UserExtensions.where(:school_id => school_id).map(&:user_id)
user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id
search = true
end
@authorizations = user_id.size == 0 && !search ? @authorizations.order("updated_at desc") : @authorizations.where(:user_id => user_id.uniq).order("updated_at desc")
@autu_count = @authorizations.count
@limit = 15
@is_remote = true
@autu_pages = Paginator.new @autu_count, @limit, params['page'] || 1
@offset ||= @autu_pages.offset
@authorizations = paginateHelper @authorizations, @limit
@authorizations = @authorizations.includes(:user)
respond_to do |format|
format.js
format.html

@ -28,11 +28,22 @@
<div id="edu-tab-con-2" class="undis">
<div class="mt10">
<p class="fl task-form-40 mt8 ml15 clearfix">
<p class="fl task-form-20 mt8 ml15 clearfix">
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5 fl font-12 active" id="audit_all_authentication">全部</a>
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5 fl font-12" id="audit_agree_authentication">同意</a>
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5 fl font-12" id="audit_reject_authentication" >拒绝</a>
</p>
<select id="user_identity" name="identity" class="fl winput-120-40 ml15 mt5">
<option value="-1">请选择职业</option>
<option value="0">教师</option>
<option value="1">学生</option>
<option value="2">专业人士</option>
</select>
<select id="auto_school" name="auto_school" class="fl winput-120-40 ml15 mt5">
<option value="0">全部</option>
<option value="1">自动授权</option>
<option value="2">非自动授权</option>
</select>
<div class="edu-position fr task-form-30 mb10 fr mr15">
<input class="task-form-100 panel-box-sizing " placeholder="输入真实姓名进行检索" type="text" id="audit_search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt10" id="audit_search"><i class="fa fa-search"></i></a>
@ -91,45 +102,38 @@
});
/* ----------------------- 已审批(全部) ------------------------- */
$("#audit_all_authentication").on("click", function(){
var iName = $("#audit_search_name").val();
var sName = $("#school_search_name").val();
$.ajax({
url: "<%= trial_authorization_managements_path %>" + ".js",
data: { name: iName, status: [1, 2], sname: sName }
});
});
$("#audit_all_authentication").on("click", function(){search_func([1, 2]);});
/* ----------------------- 已审批(同意) ------------------------- */
$("#audit_agree_authentication").live("click", function(){
var iName = $("#audit_search_name").val();
var sName = $("#school_search_name").val();
$.ajax({
url: "<%= trial_authorization_managements_path %>" +".js",
data: { name: iName, status: 1, sname: sName}
});
});
$("#audit_agree_authentication").live("click", function(){search_func(1);});
/* ----------------------- 已审批(拒绝) ------------------------- */
$("#audit_reject_authentication").live("click", function(){
var iName = $("#audit_search_name").val();
var sName = $("#school_search_name").val();
$("#audit_reject_authentication").live("click", function(){search_func(2);});
$.ajax({
url: "<%= trial_authorization_managements_path %>" +".js",
data: { name: iName, status: 2, sname: sName }
});
/* ------------------- 按名字进行搜索(已审批)-------------------- */
$("#audit_search").live("click", function(){search_func(0);});
$("#user_identity").on("change", function(){search_func(0);});
$("#auto_school").on("change", function(){search_func(0);});
$("#audit_search_name, #school_search_name").on("keydown", function(e){
// 兼容FF和IE和Opera
var theEvent = e || window.event;
var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
if (code == 13) {
//回车执行查询
search_func(0);
}
});
/* ------------------- 按名字进行搜索(已审批)-------------------- */
$("#audit_search").live("click", function(){
function search_func(status){
var iName = $("#audit_search_name").val();
var sName = $("#school_search_name").val();
var identity = $("#user_identity").val();
var auto_school = $("#auto_school").val();
var type = status;
if(type == 0){
var id = $("#audit_all_authentication").parent().find(".active").attr("id");
var type = 0;
if(id == "audit_all_authentication"){
type = [1, 2];
@ -138,12 +142,15 @@
}else{
type = 2;
}
// alert(type);
}
$.ajax({
url: "<%= trial_authorization_managements_path %>" +".js",
data: { search: iName, status: type, sname: sName}
});
data: { search: iName, status: type, sname: sName, identity: identity, auto_school: auto_school}
});
}
// $(document).keyup(function(event){
// if(event.keyCode == 13){

@ -1,7 +1,7 @@
<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>
<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>
@ -10,7 +10,7 @@
<li data-val="3">已锁定(<%= query_user_status_num 3 %></li>
</ul>
</div>
<div class="edu-position edu-admin-select fl mr10" style="width:150px;">
<div class="edu-position edu-admin-select fl mr10" style="width:120px;">
<p>真实姓名搜索<i class="fa fa-caret-down ml10"></i></p>
<input type="hidden" name="research_condition" value="name">
<ul class="edu-admin-option">
@ -20,11 +20,24 @@
<li data-val="phone">手机号码搜索</li>
</ul>
</div>
<div class="fl with20">
<select id="user_identity" name="identity" class="fl winput-100-40 ml10">
<option value="-1">请选择职业</option>
<option value="0">教师</option>
<option value="1">学生</option>
<option value="2">专业人士</option>
</select>
<select id="auto_school" name="auto_school" class="fl winput-100-40 ml10">
<option value="0">全部</option>
<option value="1">自动授权</option>
<option value="2">非自动授权</option>
</select>
<div class="fl with15 ml10">
<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" id="province" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请输入单位名称关键字进行搜索" style="width: 260px" />
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请输入单位名称关键字进行搜索" style="width: 200px"/>
<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>
@ -42,7 +55,7 @@
<%= render :partial => "managements/user_list" %>
</div>
<script>
function import_course_members(){
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() %>');
@ -56,7 +69,7 @@
var d_count = 0; //查询结果的总量
var d_maxPage = 0;//最大页面值
function department_search_fn(e) {
if($(e.target).val().trim() == ''){
if ($(e.target).val().trim() == '') {
$("#search_school_result_list").hide();
$("input[name='school_id']").val("");
return;
@ -94,9 +107,10 @@
}
});
}
//修改部门
function changeSchoolValue(value, data) {
console.log(value+","+data)
console.log(value + "," + data)
$("input[name='school']").val(value);
$("input[name='school_id']").val(data);
$("#search_school_result_list").hide();

@ -284,6 +284,7 @@ a.color-red-dd:hover{color: #C61616!important;}
.winput-120-35{width: 120px;height: 35px;padding: 5px;box-sizing: border-box;}
.winput-120-30{width: 120px;height: 30px;padding: 5px;box-sizing: border-box;}
.winput-115-40{width: 115px;height: 40px;padding: 5px;box-sizing: border-box;}
.winput-100-40{width: 100px;height: 40px;padding: 5px;box-sizing: border-box;}
.winput-90-40{width: 90px;height: 40px;padding: 5px;box-sizing: border-box;}
.winput-90-35{width: 90px;height: 35px;padding: 5px;box-sizing: border-box;}
.winput-240-100{width: 240px;height: 100px;padding: 5px;box-sizing: border-box;}

Loading…
Cancel
Save