commit
b3dc67de3c
@ -0,0 +1,22 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
var $editModal = $('.department-apply-edit-modal');
|
||||
if($editModal.length > 0){
|
||||
var $form = $editModal.find('form.department-apply-form');
|
||||
var $applyIdInput = $form.find('input[name="id"]');
|
||||
$editModal.on('show.bs.modal', function (event) {
|
||||
var $link = $(event.relatedTarget);
|
||||
var applyId = $link.data('id');
|
||||
$applyIdInput.val(applyId);
|
||||
});
|
||||
$editModal.on('click', '.submit-btn', function(){
|
||||
$.ajax({
|
||||
method: "PUT",
|
||||
dataType: 'script',
|
||||
url: "/admins/department_applies/"+ $applyIdInput.val(),
|
||||
data: $form.serialize(),
|
||||
}).done(function(){
|
||||
$editModal.modal('hide');
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,71 @@
|
||||
class Admins::DepartmentAppliesController < Admins::BaseController
|
||||
|
||||
before_action :get_apply,only:[:agree,:edit,:update,:destroy]
|
||||
def index
|
||||
params[:status] ||= 0
|
||||
params[:sort_by] = params[:sort_by].presence || 'created_at'
|
||||
params[:sort_direction] = params[:sort_direction].presence || 'desc'
|
||||
applies = Admins::DepartmentApplyQuery.call(params)
|
||||
@depart_applies = paginate applies.preload(:school,user: :user_extension)
|
||||
end
|
||||
|
||||
def agree
|
||||
ActiveRecord::Base.transaction do
|
||||
@depart_apply.update_attribute("status",1)
|
||||
@depart_apply&.applied_messages&.update_all(status:1)
|
||||
@depart_apply&.department&.update_attribute("is_auth",1)
|
||||
@depart_apply&.user&.user_extension&.update_attribute("department_id",@depart_apply.department_id)
|
||||
render_success_js
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
depart_name = params[:name]
|
||||
ActiveRecord::Base.transaction do
|
||||
@depart_apply.update_attribute("name",depart_name)
|
||||
@depart_apply&.department&.update_attribute("name",depart_name)
|
||||
extra = depart_name + "(#{@depart_apply&.department&.school&.try(:name)})"
|
||||
tiding_params = {
|
||||
user_id: @depart_apply.user_id,
|
||||
trigger_user_id: 0,
|
||||
container_id: @depart_apply.id,
|
||||
container_type: 'ApplyAddDepartment',
|
||||
belong_container_id: @depart_apply.department.school_id,
|
||||
belong_container_type: "School",
|
||||
tiding_type: "System",
|
||||
status: 3,
|
||||
extra: extra
|
||||
}
|
||||
Tiding.create(tiding_params)
|
||||
render_success_js
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
ActiveRecord::Base.transaction do
|
||||
@depart_apply.update_attribute("status",3)
|
||||
@depart_apply&.applied_messages&.update_all(status:3)
|
||||
@depart_apply&.department&.destroy
|
||||
@depart_apply&.user&.user_extension&.update_attribute("department_id", nil)
|
||||
tiding_params = {
|
||||
user_id: @depart_apply.user_id,
|
||||
trigger_user_id: 0,
|
||||
container_id: @depart_apply.id,
|
||||
container_type: 'ApplyAddDepartment',
|
||||
belong_container_id: @depart_apply.department.school_id,
|
||||
belong_container_type: "School",
|
||||
tiding_type: "System",
|
||||
status: 2,
|
||||
extra: params[:reason]
|
||||
}
|
||||
Tiding.create(tiding_params)
|
||||
render_success_js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def get_apply
|
||||
@depart_apply = ApplyAddDepartment.find_by(id:params[:id])
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
module Util::Redis
|
||||
class << self
|
||||
def online_user_count
|
||||
if Rails.cache.is_a?(ActiveSupport::Cache::RedisStore)
|
||||
Rails.cache.data.scan(0, match: 'cache:_session_id:*', count: 100000).last.uniq.size
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,25 @@
|
||||
class Admins::DepartmentApplyQuery < ApplicationQuery
|
||||
include CustomSortable
|
||||
|
||||
attr_reader :params
|
||||
|
||||
sort_columns :created_at, default_by: :created_at, default_direction: :desc
|
||||
|
||||
def initialize(params)
|
||||
@params = params
|
||||
end
|
||||
|
||||
def call
|
||||
status = params[:status]
|
||||
|
||||
applies = ApplyAddDepartment.where(status: status) if status.present?
|
||||
|
||||
# 关键字模糊查询
|
||||
keyword = params[:keyword].to_s.strip
|
||||
if keyword.present?
|
||||
applies = applies.where('name LIKE :keyword', keyword: "%#{keyword}%")
|
||||
end
|
||||
|
||||
custom_sort(applies, params[:sort_by], params[:sort_direction])
|
||||
end
|
||||
end
|
@ -0,0 +1,2 @@
|
||||
//$("#apply-id-<%= @depart_apply.id %>").remove()
|
||||
//pop_box_new("批准成功", 400, 248);
|
@ -0,0 +1,18 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('部门审批') %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container flex-column mb-0 pb-0 department-applies-list-form">
|
||||
<%= form_tag(admins_department_applies_path(unsafe_params), method: :get, class: 'form-inline search-form mt-3', remote: true) do %>
|
||||
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '部门名称检索') %>
|
||||
<%= submit_tag('搜索', class: 'btn btn-primary ml-3','data-disable-with':"搜索中...") %>
|
||||
<%= link_to "清除",admins_department_applies_path(keyword:nil),class:"btn btn-default",remote:true %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="box department-applies-list-container">
|
||||
<%= render(partial: 'admins/department_applies/shared/list', locals: { applies: @depart_applies }) %>
|
||||
</div>
|
||||
|
||||
<%= render(partial: 'admins/shared/admin_common_refuse_modal') %>
|
||||
<%= render partial: 'admins/department_applies/shared/edit_modal' %>
|
@ -0,0 +1 @@
|
||||
$(".department-applies-list-container").html("<%= j render partial: "admins/department_applies/shared/list",locals: {applies:@depart_applies} %>")
|
@ -0,0 +1,26 @@
|
||||
<div class="modal fade department-apply-edit-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">修改为</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="department-apply-form" data-remote="true">
|
||||
<%= hidden_field_tag(:id, nil) %>
|
||||
<div class="form-group">
|
||||
<label for="grade" class="col-form-label">名称:</label>
|
||||
<%= text_field_tag(:name,nil,class:"form-control",placeholder:"输入新的名称") %>
|
||||
</div>
|
||||
<div class="error text-danger"></div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary submit-btn">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,40 @@
|
||||
<table class="table table-hover text-center department_applies-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="9%">ID</th>
|
||||
<th width="25%" class="edu-txt-left">部门名称</th>
|
||||
<th width="20%" class="edu-txt-left">单位名称</th>
|
||||
<th width="15%">创建者</th>
|
||||
<th width="15%"><%= sort_tag('创建于', name: 'created_at', path: admins_department_applies_path) %></th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if applies.present? %>
|
||||
<% applies.each do |apply| %>
|
||||
<tr class="department-apply-<%= apply.id %>">
|
||||
<td><%= apply.id %></td>
|
||||
<td class="edu-txt-left"> <%= apply.name %></td>
|
||||
<td class="edu-txt-left"> <%= apply.school.try(:name) %></td>
|
||||
<td><%= apply.user.show_real_name %></td>
|
||||
<td><%= format_time apply.created_at %></td>
|
||||
<td class="action-container">
|
||||
<%= agree_link '批准', agree_admins_department_apply_path(apply, element: ".department-apply-#{apply.id}"), 'data-confirm': '确认批准通过?' %>
|
||||
<%= javascript_void_link('删除', class: 'action refuse-action',
|
||||
data: {
|
||||
toggle: 'modal', target: '.admin-common-refuse-modal', id: apply.id, title: "删除原因", type: "delete",
|
||||
url: admins_department_apply_path(apply, element: ".department-apply-#{apply.id}")
|
||||
}) %>
|
||||
|
||||
<%= javascript_void_link('修改', class: 'action department-apply-action', data: { toggle: 'modal', target: '.department-apply-edit-modal', id: apply.id }) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %>
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -0,0 +1,109 @@
|
||||
.color4CACFF{
|
||||
color: #4CACFF !important;
|
||||
}
|
||||
|
||||
.orderingbox{
|
||||
width:1200px;
|
||||
height:80px;
|
||||
background:rgba(255,255,255,1);
|
||||
box-shadow:3px 3px 3px rgba(237,237,237,1);
|
||||
opacity:1;
|
||||
border-radius:2px 2px 0px 0px;
|
||||
padding: 24px;
|
||||
box-sizing: border-box;
|
||||
line-height: 34px;
|
||||
}
|
||||
|
||||
.orderingbtnright{
|
||||
width: 90px;
|
||||
height: 38px;
|
||||
background: rgba(255,255,255,1);
|
||||
border: 1px solid rgba(228,228,228,1);
|
||||
box-shadow: 0px 1px 1px rgba(0,0,0,0.16);
|
||||
opacity: 1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.orderingbtnleft{
|
||||
width: 90px;
|
||||
height: 38px;
|
||||
background: rgba(76,172,255,1);
|
||||
box-shadow: 0px 1px 1px rgba(0,0,0,0.16);
|
||||
opacity: 1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.pd1323s{
|
||||
padding: 10px 6px 25px 40px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
.orderSection{
|
||||
height: 80px;
|
||||
padding-top: 16px;
|
||||
}
|
||||
|
||||
.ordermidbox{
|
||||
width: 960px;
|
||||
height: 120px;
|
||||
background: rgba(255,255,255,1);
|
||||
/* border: 1px solid rgba(205,205,205,1); */
|
||||
opacity: 1;
|
||||
margin-left:120px;
|
||||
}
|
||||
|
||||
.orderfonttop{
|
||||
font-size: 16px !important;
|
||||
font-family: Microsoft YaHei;
|
||||
font-weight: bold;
|
||||
line-height: 28px;
|
||||
color: rgba(5,16,26,1);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.orderfontbom{
|
||||
font-size:14px;
|
||||
font-family:Microsoft YaHei;
|
||||
font-weight:400;
|
||||
line-height:25px;
|
||||
color:rgba(153,153,153,1);
|
||||
opacity:1;
|
||||
}
|
||||
|
||||
.ordermidbox:hover {
|
||||
box-shadow: 0px 2px 6px rgba(51,51,51,0.09);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.mb200{
|
||||
margin-bottom: 200px;
|
||||
}
|
||||
|
||||
.maxwidth865s{
|
||||
max-width: 865px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.maxwidth795 {
|
||||
max-width:795px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.ordermidbox:active{
|
||||
background:rgba(248,247,255,1);
|
||||
border:1px solid rgba(76,172,255,1);
|
||||
}
|
||||
|
||||
.ordermidbox:focus{
|
||||
background:rgba(248,247,255,1);
|
||||
border:1px solid rgba(76,172,255,1);
|
||||
}
|
||||
|
||||
.ordermiddiv{
|
||||
min-height: 500px;
|
||||
}
|
Loading…
Reference in new issue