diff --git a/app/models/journal.rb b/app/models/journal.rb
index ea50646b6..30924437b 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -82,6 +82,14 @@ class Journal < ApplicationRecord
end
end
+ def pm_operate_category
+ if (detail.property == "requirement" || detail.property == "task" || detail.property == "bug") && detail.prop_key.to_s == "1"
+ return "issue"
+ else
+ return detail.property == "attr" ? detail.prop_key : detail.property
+ end
+ end
+
def pm_operate_content
content = ""
detail = self.journal_details.take
@@ -282,6 +290,36 @@ class Journal < ApplicationRecord
content += "将优先级由#{old_value}更改为#{new_value}"
end
return content
+ when 'status_id'
+ old_value = IssueStatus.find_by_id(detail.old_value)&.name
+ new_value = IssueStatus.find_by_id(detail.value)&.name
+ if old_value.nil? || old_value.blank?
+ content += "将状态设置为#{new_value}"
+ else
+ new_value = "未设置" if new_value.blank?
+ content += "将状态由#{old_value}更改为#{new_value}"
+ end
+ case self.issue.pm_issue_type
+ when 'requirement'
+ content.gsub!('新增', '待评审')
+ content.gsub!('正在解决', '进行中')
+ content.gsub!('已解决', '已完成')
+ content.gsub!('关闭', '已关闭')
+ content.gsub!('拒绝', '已拒绝')
+ when 'task'
+ content.gsub!('新增', '待处理')
+ content.gsub!('正在解决', '进行中')
+ content.gsub!('已解决', '已完成')
+ content.gsub!('关闭', '已关闭')
+ content.gsub!('拒绝', '已拒绝')
+ when 'bug'
+ content.gsub!('新增', '待修复')
+ content.gsub!('正在解决', '修复中')
+ content.gsub!('已解决', '已修复')
+ content.gsub!('关闭', '已关闭')
+ content.gsub!('拒绝', '已拒绝')
+ end
+ return content
when 'pm_issue_type'
old_value = detail.old_value
new_value = detail.value
@@ -444,6 +482,16 @@ class Journal < ApplicationRecord
end
end
return content
+ when 'issue'
+ issue = self.issue
+ case issue.pm_issue_type
+ when 1
+ return "创建了需求"
+ when 2
+ return "创建了任务"
+ when 3
+ return "创建了缺陷"
+ end
end
end
diff --git a/app/views/api/pm/issues/journals/_detail.json.jbuilder b/app/views/api/pm/issues/journals/_detail.json.jbuilder
index 58a7ed8fd..fdf4bc716 100644
--- a/app/views/api/pm/issues/journals/_detail.json.jbuilder
+++ b/app/views/api/pm/issues/journals/_detail.json.jbuilder
@@ -11,7 +11,7 @@ json.user do
end
if journal.is_journal_detail?
detail = journal.journal_details.take
- json.operate_category detail.property == "attr" ? detail.prop_key : detail.property
+ json.operate_category journal.pm_operate_category
json.operate_content journal.is_journal_detail? ? journal.pm_operate_content : nil
else
json.notes journal.notes