操作记录记录显示调整

This commit is contained in:
2024-09-27 11:11:53 +08:00
parent 80828d85d7
commit 4329f9dbf0
3 changed files with 23 additions and 25 deletions

View File

@@ -39,14 +39,6 @@ class UserAction < ApplicationRecord
end
end
def action_data
case action_type
when "DestroyUser" then build_mode("User")
when "DestroyProject" then build_mode("Project")
else nil
end
end
def opt_user_name
if user&.id == user_id
"--"
@@ -55,6 +47,14 @@ class UserAction < ApplicationRecord
end
end
def action_info
case action_type
when "DestroyUser" then "账号:#{user&.login}<br/>邮箱:#{user&.mail}<br/>手机号:#{user&.phone}<br/>昵称:#{user&.nickname}<br/>"
when "DestroyProject" then "项目名称:#{project&.name}<br/>项目标识:#{project&.identifier}<br/>"
else "--"
end
end
def user
action_user = if action_type == "DestroyUser" && data_bank.present?
build_mode("User")
@@ -63,6 +63,15 @@ class UserAction < ApplicationRecord
end
action_user
end
def project
action_project = if action_type == "DestroyProject" && data_bank.present?
build_mode("Project")
else
Project.find_by(id: self.action_id)
end
action_project
end
def build_mode(model_name)
model = model_name.constantize.new
model_name.constantize.column_names.each do |col|