diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 4f4436c74..10dfbb2a4 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -83,7 +83,29 @@ namespace IRaCIS.Core.Infra.EFCore.Common } } + /// + /// 翻译单位 + /// + /// 答案类型 + /// 单位 + /// 自定义单位 + /// 单位字典 + /// 答案 + /// + public string Translationunit(string answerType, ValueUnit? unit, string customUnit, List unitDataList,string? answer) + { + if (answerType == "upload") + { + return "❄❅❆❇❈❉❊"; + } + if (unit == ValueUnit.Custom) + { + return answer + customUnit; + } + + return answer + unitDataList.Where(y => y.Unit == unit).Select(x => x.UnitName).FirstIsNullReturnEmpty(); + } public string GetEntityAuditOpt(EntityEntry entityEntry) { if (entityEntry.State == EntityState.Added) @@ -3026,6 +3048,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common QuestionId = t.Id, t.DictionaryCode, t.Unit, + t.CustomUnit, t.ShowOrder, AnswerType = t.Type, }).OrderBy(t => t.ShowOrder).ToListAsync(); @@ -3073,7 +3096,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common new { //如果问题类型是附件 特殊处理 方便前端解析 - Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer, + Answer = Translationunit(u.AnswerType, u.Unit, u.CustomUnit, unitDataList, t.Answer), u.QuestionName, u.QuestionEnName, u.DictionaryCode, @@ -3104,8 +3127,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common (t, u) => new { - Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer + unitDataList.Where(y => y.Unit == u.Unit).Select(x => x.UnitName).FirstIsNullReturnEmpty() - , + Answer = Translationunit(u.AnswerType, u.Unit,u.CustomUnit, unitDataList, t.Answer), u.DictionaryCode, u.QuestionName, u.QuestionEnName, @@ -3233,7 +3255,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common new { //如果问题类型是附件 特殊处理 方便前端解析 - Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer + unitDataList.Where(y => y.Unit == u.Unit).Select(x => x.UnitName).FirstIsNullReturnEmpty(), + Answer = Translationunit(u.AnswerType, u.Unit, u.CustomUnit, unitDataList, t.Answer), //t.Answer /*u.Unit==ValueUnit.Custom? t.Answer+u.CustomUnit:(u.Unit != ValueUnit.None|| u.Unit != null)*/, u.QuestionName, u.QuestionEnName,