工单的批量修改/删除的接口
This commit is contained in:
parent
b266085e56
commit
d87f44e939
|
@ -251,13 +251,50 @@ class IssuesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
if @issue.delete
|
if @issue.destroy
|
||||||
normal_status(0, "删除成功")
|
normal_status(0, "删除成功")
|
||||||
else
|
else
|
||||||
normal_status(-1, "删除失败")
|
normal_status(-1, "删除失败")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def clean
|
||||||
|
begin
|
||||||
|
issue_ids = params[:ids]
|
||||||
|
if issue_ids.present?
|
||||||
|
if Issue.where(id: issue_ids).destroy_all
|
||||||
|
normal_status(0, "删除成功")
|
||||||
|
else
|
||||||
|
normal_status(-1, "删除失败")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
normal_status(-1, "请选择任务")
|
||||||
|
end
|
||||||
|
rescue Exception => e
|
||||||
|
normal_status(-1, "批量删除失败")
|
||||||
|
raise ActiveRecord::Rollback
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def series_update
|
||||||
|
begin
|
||||||
|
issue_ids = params[:ids]
|
||||||
|
update_params = params[:update_params]
|
||||||
|
if issue_ids.present?
|
||||||
|
if Issue.where(id: issue_ids).update_all(update_params)
|
||||||
|
normal_status(0, "批量更新成功")
|
||||||
|
else
|
||||||
|
normal_status(-1, "批量更新失败")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
normal_status(-1, "请选择任务")
|
||||||
|
end
|
||||||
|
rescue Exception => e
|
||||||
|
normal_status(-1, "批量更新失败")
|
||||||
|
raise ActiveRecord::Rollback
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def copy
|
def copy
|
||||||
@new_issue = @issue.dup
|
@new_issue = @issue.dup
|
||||||
if @new_issue.save
|
if @new_issue.save
|
||||||
|
|
|
@ -7,7 +7,7 @@ class Contents::UpdateForm < BaseForm
|
||||||
|
|
||||||
def check_branch
|
def check_branch
|
||||||
raise "branch和new_branch必须存在一个 " if branch.blank? && new_branch.blank?
|
raise "branch和new_branch必须存在一个 " if branch.blank? && new_branch.blank?
|
||||||
raise "branch和new_branch只能存在一个" if !branch.blank? && !new_branch.blank?
|
# raise "branch和new_branch只能存在一个" if !branch.blank? && !new_branch.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -70,6 +70,8 @@ Rails.application.routes.draw do
|
||||||
collection do
|
collection do
|
||||||
get :commit_issues
|
get :commit_issues
|
||||||
get :index_chosen
|
get :index_chosen
|
||||||
|
post :clean
|
||||||
|
post :series_update
|
||||||
end
|
end
|
||||||
member do
|
member do
|
||||||
post :copy
|
post :copy
|
||||||
|
|
Loading…
Reference in New Issue