Commit 12a13c86 by ruyun.zhang

添加备注说明

parent d10419c7
...@@ -274,19 +274,7 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s ...@@ -274,19 +274,7 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
{ "工作量倾斜", "" }, { "工作量倾斜", "" },
{ "金额", ValueFormating(postDatas.Sum(w => w.IsFactor == 1 ? (w.CellValue * (w.FactorValue ?? 0)) : w.CellValue),"") }, { "金额", ValueFormating(postDatas.Sum(w => w.IsFactor == 1 ? (w.CellValue * (w.FactorValue ?? 0)) : w.CellValue),"") },
}); });
// 保证Key数量一致 DeleteBlankColumn(items);
var keys = items.SelectMany(dict => dict.Keys).Distinct();
foreach (var k in keys)
{
var values = items.SelectMany(dict => dict.Where(kvp => kvp.Key == k).Select(kvp => kvp.Value));
if (!values.Any(w => !string.IsNullOrEmpty(w?.ToString())))
{
foreach (var item in items)
{
item.Remove(k);
}
}
}
var amount = basicData.Where(t => t.SheetID == sheet.ID && t.UnitType == (int)type && t.IsTotal != 1)?.Sum(t => t.IsFactor == 1 ? t.CellValue * (t.FactorValue ?? 0) : t.CellValue) ?? 0; var amount = basicData.Where(t => t.SheetID == sheet.ID && t.UnitType == (int)type && t.IsTotal != 1)?.Sum(t => t.IsFactor == 1 ? t.CellValue * (t.FactorValue ?? 0) : t.CellValue) ?? 0;
detailItemWorkloads.Add(new DeptDetailItem { Title = sheetName, Total = amount, Items = items }); detailItemWorkloads.Add(new DeptDetailItem { Title = sheetName, Total = amount, Items = items });
...@@ -348,18 +336,22 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s ...@@ -348,18 +336,22 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
var settingItem = settings.FirstOrDefault(w => w.Title == detail.Title) ?? new UniteDeptDetailItem() { Children = new List<UniteDeptDetailItem>() }; var settingItem = settings.FirstOrDefault(w => w.Title == detail.Title) ?? new UniteDeptDetailItem() { Children = new List<UniteDeptDetailItem>() };
var gs = settingItem.Children.FirstOrDefault(w => w.Title == post.Key.TypeName) ?? new UniteDeptDetailItem { Format = "" }; var gs = settingItem.Children.FirstOrDefault(w => w.Title == post.Key.TypeName) ?? new UniteDeptDetailItem { Format = "" };
if (string.IsNullOrEmpty(gs.Display))
gs.Display = UniteDept.DisplayRule.始终显示.ToString();
if (!userInfo.IsSecondAdmin || allot.States == (int)AllotStates.绩效下发 || allot.States == (int)AllotStates.归档) if (gs.Display == UniteDept.DisplayRule.始终显示.ToString() || !userInfo.IsSecondAdmin || allot.States == (int)AllotStates.绩效下发 || allot.States == (int)AllotStates.归档)
{ {
var fz = post.Sum(group => group.IsFactor == 1 ? (group.CellValue * (group.FactorValue ?? 0)) : group.CellValue); var fz = post.Sum(group => group.IsFactor == 1 ? (group.CellValue * (group.FactorValue ?? 0)) : group.CellValue);
var row = new Dictionary<string, object> var row = new Dictionary<string, object>
{ {
{ "指标", post.Key.TypeName }, { "指标", post.Key.TypeName },
{ "分值", ValueFormating(fz, gs.Format) } { "分值", ValueFormating(fz, gs.Format) },
{ "说明", gs.Remark },
}; };
items.Add(row); items.Add(row);
} }
} }
DeleteBlankColumn(items);
var amount = basicData?.Where(t => t.SheetID == sheet.ID && t.UnitType == (int)type && t.IsTotal == 1)?.FirstOrDefault()?.CellValue ?? 0; var amount = basicData?.Where(t => t.SheetID == sheet.ID && t.UnitType == (int)type && t.IsTotal == 1)?.FirstOrDefault()?.CellValue ?? 0;
detail.Total = amount; detail.Total = amount;
detail.Items = items; detail.Items = items;
...@@ -398,6 +390,27 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s ...@@ -398,6 +390,27 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
return response; return response;
} }
/// <summary>
/// 删除空白列
/// </summary>
/// <param name="items"></param>
private static void DeleteBlankColumn(List<Dictionary<string, object>> items)
{
// 保证Key数量一致
var keys = items.SelectMany(dict => dict.Keys).Distinct();
foreach (var k in keys)
{
var values = items.SelectMany(dict => dict.Where(kvp => kvp.Key == k).Select(kvp => kvp.Value));
if (!values.Any(w => !string.IsNullOrEmpty(w?.ToString())))
{
foreach (var item in items)
{
item.Remove(k);
}
}
}
}
// 详情页面数值格式化 // 详情页面数值格式化
private string ValueFormating(decimal? value, string format) private string ValueFormating(decimal? value, string format)
{ {
...@@ -550,7 +563,7 @@ public List<UniteDeptDetailItem> GetUniteDeptDetailSetting(int allotId) ...@@ -550,7 +563,7 @@ public List<UniteDeptDetailItem> GetUniteDeptDetailSetting(int allotId)
var temp1 = cofDeptDetail.FirstOrDefault(w => w.Title == detail.Title); var temp1 = cofDeptDetail.FirstOrDefault(w => w.Title == detail.Title);
if (temp1 != null) if (temp1 != null)
{ {
detail.Remark = temp1.Remark; detail.Remark = temp1.Remark;
detail.Format = temp1.Format; detail.Format = temp1.Format;
detail.Sort = temp1.Sort; detail.Sort = temp1.Sort;
detail.Display = temp1.Display; detail.Display = temp1.Display;
...@@ -559,7 +572,7 @@ public List<UniteDeptDetailItem> GetUniteDeptDetailSetting(int allotId) ...@@ -559,7 +572,7 @@ public List<UniteDeptDetailItem> GetUniteDeptDetailSetting(int allotId)
var temp2 = temp1.Children.FirstOrDefault(w => w.Title == item.Title); var temp2 = temp1.Children.FirstOrDefault(w => w.Title == item.Title);
if (temp2 != null) if (temp2 != null)
{ {
item.Remark = temp2.Remark; item.Remark = temp2.Remark;
item.Format = temp2.Format; item.Format = temp2.Format;
item.Sort = temp2.Sort; item.Sort = temp2.Sort;
item.Display = temp2.Display; item.Display = temp2.Display;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment