超级管理员页面部门删除
This commit is contained in:
parent
f5ed3d7da8
commit
f4808de686
|
|
@ -832,6 +832,35 @@ class AdminController < ApplicationController
|
|||
format.js
|
||||
end
|
||||
end
|
||||
# 单位审核:删除
|
||||
def delete_applied_schools
|
||||
applied_school = ApplyAddSchools.find(params[:id])
|
||||
applied_message_id = applied_school.school_id
|
||||
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddSchools")
|
||||
applied_message.update_all(:status => 3)
|
||||
applied_school.update_attribute(:status, 3)
|
||||
# 单位对应的部门审核也应做删除处理
|
||||
applied_departments = ApplyAddDepartment.where(:school_id => applied_school.school_id)
|
||||
applied_departments.update_all(:status => 3)
|
||||
AppliedMessage.where(:applied_id => applied_departments.map(&:id), :applied_type => "ApplyAddDepartment").update_all(:status => 3)
|
||||
# 未审批删除
|
||||
if params[:tip] == "unapplied"
|
||||
AppliedMessage.create(:user_id => applied_school.user_id, :status => 3, :viewed => 0, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
|
||||
if applied_departments.first
|
||||
AppliedMessage.create(:user_id => applied_departments.first.user_id, :status => 3, :viewed => 0, :applied_id => applied_departments.first.id, :applied_type => "ApplyAddDepartment", :name => applied_departments.first.name )
|
||||
end
|
||||
# 删除学校的用户
|
||||
users = UserExtensions.where("school_id = #{applied_school.school_id}")
|
||||
users.update_all(:school_id => nil, :department_id => nil)
|
||||
applied_school.school.destroy
|
||||
applied_school.school.departments.destroy_all
|
||||
redirect_to unit_managements_path
|
||||
# 已审批删除
|
||||
elsif params[:tip] == "applied"
|
||||
applied_school.destroy
|
||||
redirect_to unit_managements_path
|
||||
end
|
||||
end
|
||||
|
||||
# 部门审核
|
||||
# 未审批tab页
|
||||
|
|
|
|||
|
|
@ -272,6 +272,36 @@ end
|
|||
redirect_to unit_managements_path
|
||||
end
|
||||
|
||||
# 删除
|
||||
def delete_applied_schools
|
||||
applied_school = ApplyAddSchools.find(params[:id])
|
||||
applied_message_id = applied_school.school_id
|
||||
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddSchools")
|
||||
applied_message.update_all(:status => 3)
|
||||
applied_school.update_attribute(:status, 3)
|
||||
# 单位对应的部门审核也应做删除处理
|
||||
applied_departments = ApplyAddDepartment.where(:school_id => applied_school.school_id)
|
||||
applied_departments.update_all(:status => 3)
|
||||
AppliedMessage.where(:applied_id => applied_departments.map(&:id), :applied_type => "ApplyAddDepartment").update_all(:status => 3)
|
||||
# 未审批删除
|
||||
if params[:tip] == "unapplied"
|
||||
AppliedMessage.create(:user_id => applied_school.user_id, :status => 3, :viewed => 0, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
|
||||
if applied_departments.first
|
||||
AppliedMessage.create(:user_id => applied_departments.first.user_id, :status => 3, :viewed => 0, :applied_id => applied_departments.first.id, :applied_type => "ApplyAddDepartment", :name => applied_departments.first.name )
|
||||
end
|
||||
# 删除学校的用户
|
||||
users = UserExtensions.where("school_id = #{applied_school.school_id}")
|
||||
users.update_all(:school_id => nil, :department_id => nil)
|
||||
applied_school.school.destroy
|
||||
applied_school.school.departments.destroy_all
|
||||
redirect_to unit_managements_path
|
||||
# 已审批删除
|
||||
elsif params[:tip] == "applied"
|
||||
applied_school.destroy
|
||||
redirect_to unit_managements_path
|
||||
end
|
||||
end
|
||||
|
||||
# 单位审批修改
|
||||
def all_schools
|
||||
apply_schools = ApplyAddSchools.where("status = 0")
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
<td><%= format_time c_shixun.created_at %></td>
|
||||
<td class="class_shixun_delete">
|
||||
<% if c_shixun.status == 0 %>
|
||||
<a href="javascript:void(0);" onclick="delete_confirm_box_2('<%= subject_path(c_shixun) %>', '确定要删除该实训套件吗?')">删除</a>
|
||||
<a href="javascript:void(0)" onclick="delete_confirm_box_2('<%= subject_path(c_shixun) %>', '确定要删除该实训套件吗?')">删除</a>
|
||||
<% else %>
|
||||
--
|
||||
<% end %>
|
||||
|
|
@ -41,6 +41,7 @@
|
|||
</table>
|
||||
|
||||
<script>
|
||||
// alert(window.location.href);
|
||||
$(".eud-pointer").on("click", function(ev){
|
||||
var nArrow = $(this).find("i");
|
||||
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@
|
|||
</td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" onclick="approve('<%= apply.id %>')">批准</a>
|
||||
<%= link_to( l(:button_delete),{ :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure), :class => "application-default-link") %>
|
||||
<%= link_to( l(:button_delete),{ :controller => 'managements', :action => 'delete_applied_schools', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure), :class => "application-default-link") %>
|
||||
<%= link_to '更改',all_schools_managements_path(:school_id =>apply.id), :remote => true, :class => "application-default-link" %>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<%= form_tag edit_applied_department_managements_path(:applied_id =>edit_id), :id => 'schools_list_form' %>
|
||||
<div>
|
||||
<div class="courseReferContainer" style="max-height:200px; overflow: auto;">
|
||||
<div class="courseReferContainer">
|
||||
<% if !department.empty? && !@search.nil? %>
|
||||
<% department.each do |department| %>
|
||||
<ul class="courseSend">
|
||||
<ul class="courseSend" >
|
||||
<li class="" style="display:inline-block">
|
||||
<input name="department_id[]" id="search_school_<%= department.id %>" type="radio" value="<%= department.id %>" class="courseSendCheckbox magic-radio"/>
|
||||
<label for="search_school_<%= department.id %>"><%= truncate(department.name, :lendght => 25)%></label>
|
||||
|
|
@ -14,3 +14,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<script>
|
||||
$(function(){
|
||||
var height=$(".courseReferContainer").height();
|
||||
if (height>200){
|
||||
$(".courseReferContainer").css({"height":"200px","overflow-y":"auto"});
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<%= form_tag edit_applied_schools_managements_path(:applied_id =>edit_id), :id => 'schools_list_form' %>
|
||||
<div>
|
||||
<%#= hidden_field_tag(:send_id, edit_id) %>
|
||||
<div class="courseReferContainer" style="max-height: 240px; overflow: auto;">
|
||||
<div class="courseReferContainer" >
|
||||
<% if !schools.empty? && !@search.nil? %>
|
||||
<% schools.each do |school| %>
|
||||
<ul class="courseSend">
|
||||
|
|
@ -15,3 +15,11 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<script>
|
||||
$(function(){
|
||||
var height=$(".courseReferContainer").height();
|
||||
if (height>200){
|
||||
$(".courseReferContainer").css({"height":"200px","overflow-y":"auto"});
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
|
@ -1601,7 +1601,6 @@ RedmineApp::Application.routes.draw do
|
|||
get 'admin/has_applied_departments', as: :applied_departments
|
||||
get 'admin/approve_applied_departments'
|
||||
delete 'admin/delete_applied_departments'
|
||||
|
||||
get 'admin/leave_messages'
|
||||
match 'admin/messages_list', as: :messages_list
|
||||
match 'admin/project_messages', as: :project_messages
|
||||
|
|
|
|||
Loading…
Reference in New Issue