Commit 34d81ae3 authored by liudong1993's avatar liudong1993

OKR调整

parent 84a58e03
...@@ -18,5 +18,20 @@ namespace Edu.Model.ViewModel.OKR ...@@ -18,5 +18,20 @@ namespace Edu.Model.ViewModel.OKR
/// 关联部门/人员名称 /// 关联部门/人员名称
/// </summary> /// </summary>
public string RelationName { get; set; } public string RelationName { get; set; }
/// <summary>
/// 用户头像
/// </summary>
public string UserIcon { get; set; }
/// <summary>
/// 岗位名称
/// </summary>
public string PostName { get; set; }
/// <summary>
/// 部门名称
/// </summary>
public string DeptName { get; set; }
} }
} }
\ No newline at end of file
...@@ -1077,7 +1077,11 @@ namespace Edu.Module.OKR ...@@ -1077,7 +1077,11 @@ namespace Edu.Module.OKR
string empIds = string.Join(",", elist.Select(x => x.RelationId)); string empIds = string.Join(",", elist.Select(x => x.RelationId));
var e2list = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = empIds }); var e2list = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = empIds });
foreach (var item in elist) { foreach (var item in elist) {
item.RelationName = e2list.Where(x => x.Id == item.RelationId).FirstOrDefault()?.EmployeeName ?? ""; var emModel = e2list.Where(x => x.Id == item.RelationId).FirstOrDefault();
item.RelationName = emModel?.EmployeeName ?? "";
item.UserIcon = emModel?.UserIcon ?? "";
item.PostName = emModel?.PostName ?? "";
item.DeptName = emModel?.DeptName ?? "";
} }
} }
} }
...@@ -1167,7 +1171,10 @@ namespace Edu.Module.OKR ...@@ -1167,7 +1171,10 @@ namespace Edu.Module.OKR
return list.Select(x => new return list.Select(x => new
{ {
x.Id, x.Id,
x.EmployeeName x.EmployeeName,
x.UserIcon,
x.DeptName,
x.PostName
}); });
} }
...@@ -1486,7 +1493,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1486,7 +1493,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort, q.Sort,
q.IsLock, q.IsLock,
q.IsNotLook, q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{ {
z.Id, z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name, Name = z.IsNotLook == 1 ? "" : z.Name,
...@@ -1508,7 +1515,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1508,7 +1515,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort, q.Sort,
q.IsLock, q.IsLock,
q.IsNotLook, q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{ {
z.Id, z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name, Name = z.IsNotLook == 1 ? "" : z.Name,
...@@ -1521,9 +1528,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1521,9 +1528,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
x.AuditRemark, x.AuditRemark,
AuditTime= Common.ConvertHelper.FormatTime(x.AuditTime), AuditTime= Common.ConvertHelper.FormatTime(x.AuditTime),
x.AuditUserId, x.AuditUserId,
AccountName= UserReidsCache.GetUserLoginInfo((x.CreateBy > 0?x.CreateBy:0))?.AccountName??"",
AuditUserName = UserReidsCache.GetUserLoginInfo((x.AuditUserId > 0 ? x.AuditUserId : 0))?.AccountName ?? "", AuditUserName = UserReidsCache.GetUserLoginInfo((x.AuditUserId > 0 ? x.AuditUserId : 0))?.AccountName ?? "",
UserIcon = UserReidsCache.GetUserLoginInfo((x.CreateBy > 0 ? x.CreateBy : 0))?.UserIcon ?? "", UserIcon = UserReidsCache.GetUserLoginInfo((x.AuditUserId > 0 ? x.AuditUserId : 0))?.UserIcon ?? "",
}); });
} }
...@@ -1763,6 +1769,13 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1763,6 +1769,13 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{ {
ScoreRuleList = oKR_ScoreDetailRepository.GetList(new RB_OKR_ScoreDetail_ViewModel() { ScoreIds = scoreRuleIds }); ScoreRuleList = oKR_ScoreDetailRepository.GetList(new RB_OKR_ScoreDetail_ViewModel() { ScoreIds = scoreRuleIds });
} }
//查询规则名称
string ruleIds = string.Join(",", krList.Where(x => x.RuleId > 0).Select(x => x.RuleId).Distinct());
var krRuleList = new List<RB_OKR_Rule_ViewModel>();
if (!string.IsNullOrEmpty(ruleIds))
{
krRuleList = oKR_RuleRepository.GetList(new RB_OKR_Rule_ViewModel() { RuleIds = ruleIds });
}
foreach (var item in sdqlist) foreach (var item in sdqlist)
{ {
...@@ -1778,6 +1791,13 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1778,6 +1791,13 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{ {
item.KeyResultList = krList.Where(x => x.ObjectiveId == item.Id).ToList(); item.KeyResultList = krList.Where(x => x.ObjectiveId == item.Id).ToList();
GetDQListLookPermission_V2(userInfo, MyUnderlingList, pList, pkrList, item); GetDQListLookPermission_V2(userInfo, MyUnderlingList, pList, pkrList, item);
foreach (var qitem in item.KeyResultList)
{
if (qitem.RuleId > 0)
{
qitem.RuleName = krRuleList.Where(x => x.Id == qitem.RuleId).FirstOrDefault()?.RuleName ?? "";
}
}
if (item.IsDefaultState == 1 && item.KeyResultList.Any()) if (item.IsDefaultState == 1 && item.KeyResultList.Any())
{ {
item.ProgressState = item.KeyResultList.Max(x => x.ProgressState); item.ProgressState = item.KeyResultList.Max(x => x.ProgressState);
...@@ -1869,7 +1889,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1869,7 +1889,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
z.IsLock, z.IsLock,
z.IsNotLook, z.IsNotLook,
z.ScoreName, z.ScoreName,
z.ScoreColor z.ScoreColor,
z.RuleId,
z.RuleName,
RuleSTime = z.RuleSTime.HasValue ? z.RuleSTime.Value.ToString("yyyy-MM-dd") : "",
RuleETime = z.RuleETime.HasValue ? z.RuleETime.Value.ToString("yyyy-MM-dd") : ""
}), }),
ParentList = x.ParentList.Select(y => new ParentList = x.ParentList.Select(y => new
{ {
...@@ -1883,7 +1907,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1883,7 +1907,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort, q.Sort,
q.IsLock, q.IsLock,
q.IsNotLook, q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{ {
z.Id, z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name, Name = z.IsNotLook == 1 ? "" : z.Name,
...@@ -1905,7 +1929,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1905,7 +1929,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort, q.Sort,
q.IsLock, q.IsLock,
q.IsNotLook, q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{ {
z.Id, z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name, Name = z.IsNotLook == 1 ? "" : z.Name,
...@@ -1918,9 +1942,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1918,9 +1942,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
x.AuditRemark, x.AuditRemark,
AuditTime= Common.ConvertHelper.FormatTime(x.AuditTime), AuditTime= Common.ConvertHelper.FormatTime(x.AuditTime),
x.AuditUserId, x.AuditUserId,
AccountName = UserReidsCache.GetUserLoginInfo((x.CreateBy > 0 ? x.CreateBy : 0))?.AccountName ?? "",
AuditUserName = UserReidsCache.GetUserLoginInfo((x.AuditUserId > 0 ? x.AuditUserId : 0))?.AccountName ?? "", AuditUserName = UserReidsCache.GetUserLoginInfo((x.AuditUserId > 0 ? x.AuditUserId : 0))?.AccountName ?? "",
UserIcon = UserReidsCache.GetUserLoginInfo((x.CreateBy > 0 ? x.CreateBy : 0))?.UserIcon ?? "", UserIcon = UserReidsCache.GetUserLoginInfo((x.AuditUserId > 0 ? x.AuditUserId : 0))?.UserIcon ?? "",
}) })
}; };
} }
...@@ -2036,6 +2059,13 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2036,6 +2059,13 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{ {
ScoreRuleList = oKR_ScoreDetailRepository.GetList(new RB_OKR_ScoreDetail_ViewModel() { ScoreIds = scoreRuleIds }); ScoreRuleList = oKR_ScoreDetailRepository.GetList(new RB_OKR_ScoreDetail_ViewModel() { ScoreIds = scoreRuleIds });
} }
//查询规则名称
string ruleIds = string.Join(",", krList.Where(x => x.RuleId > 0).Select(x => x.RuleId).Distinct());
var krRuleList = new List<RB_OKR_Rule_ViewModel>();
if (!string.IsNullOrEmpty(ruleIds))
{
krRuleList = oKR_RuleRepository.GetList(new RB_OKR_Rule_ViewModel() { RuleIds = ruleIds });
}
foreach (var item in sdqlist) foreach (var item in sdqlist)
{ {
...@@ -2051,6 +2081,13 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2051,6 +2081,13 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{ {
item.KeyResultList = krList.Where(x => x.ObjectiveId == item.Id).ToList(); item.KeyResultList = krList.Where(x => x.ObjectiveId == item.Id).ToList();
GetDQListLookPermission_V2(userInfo, MyUnderlingList, pList, pkrList, item); GetDQListLookPermission_V2(userInfo, MyUnderlingList, pList, pkrList, item);
foreach (var qitem in item.KeyResultList)
{
if (qitem.RuleId > 0)
{
qitem.RuleName = krRuleList.Where(x => x.Id == qitem.RuleId).FirstOrDefault()?.RuleName ?? "";
}
}
if (item.IsDefaultState == 1 && item.KeyResultList.Any()) if (item.IsDefaultState == 1 && item.KeyResultList.Any())
{ {
item.ProgressState = item.KeyResultList.Max(x => x.ProgressState); item.ProgressState = item.KeyResultList.Max(x => x.ProgressState);
...@@ -2148,7 +2185,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2148,7 +2185,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
z.IsLock, z.IsLock,
z.IsNotLook, z.IsNotLook,
z.ScoreName, z.ScoreName,
z.ScoreColor z.ScoreColor,
z.RuleId,
z.RuleName,
RuleSTime = z.RuleSTime.HasValue ? z.RuleSTime.Value.ToString("yyyy-MM-dd") : "",
RuleETime = z.RuleETime.HasValue ? z.RuleETime.Value.ToString("yyyy-MM-dd") : ""
}), }),
ParentList = x.ParentList.Select(y => new ParentList = x.ParentList.Select(y => new
{ {
...@@ -2162,7 +2203,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2162,7 +2203,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort, q.Sort,
q.IsLock, q.IsLock,
q.IsNotLook, q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{ {
z.Id, z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name, Name = z.IsNotLook == 1 ? "" : z.Name,
...@@ -2184,7 +2225,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2184,7 +2225,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort, q.Sort,
q.IsLock, q.IsLock,
q.IsNotLook, q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{ {
z.Id, z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name, Name = z.IsNotLook == 1 ? "" : z.Name,
...@@ -2194,6 +2235,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2194,6 +2235,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}), }),
}) })
}), }),
x.AuditRemark,
AuditTime = Common.ConvertHelper.FormatTime(x.AuditTime),
x.AuditUserId,
AuditUserName = UserReidsCache.GetUserLoginInfo((x.AuditUserId > 0 ? x.AuditUserId : 0))?.AccountName ?? "",
UserIcon = UserReidsCache.GetUserLoginInfo((x.AuditUserId > 0 ? x.AuditUserId : 0))?.UserIcon ?? "",
}; };
} }
...@@ -3026,7 +3072,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -3026,7 +3072,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort, q.Sort,
q.IsLock, q.IsLock,
q.IsNotLook, q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{ {
z.Id, z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name, Name = z.IsNotLook == 1 ? "" : z.Name,
...@@ -3048,7 +3094,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -3048,7 +3094,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort, q.Sort,
q.IsLock, q.IsLock,
q.IsNotLook, q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{ {
z.Id, z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name, Name = z.IsNotLook == 1 ? "" : z.Name,
...@@ -3061,9 +3107,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -3061,9 +3107,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
x.AuditRemark, x.AuditRemark,
AuditTime = Common.ConvertHelper.FormatTime(x.AuditTime), AuditTime = Common.ConvertHelper.FormatTime(x.AuditTime),
x.AuditUserId, x.AuditUserId,
AccountName = UserReidsCache.GetUserLoginInfo((x.CreateBy > 0 ? x.CreateBy : 0))?.AccountName ?? "",
AuditUserName = UserReidsCache.GetUserLoginInfo((x.AuditUserId > 0 ? x.AuditUserId : 0))?.AccountName ?? "", AuditUserName = UserReidsCache.GetUserLoginInfo((x.AuditUserId > 0 ? x.AuditUserId : 0))?.AccountName ?? "",
UserIcon = UserReidsCache.GetUserLoginInfo((x.CreateBy > 0 ? x.CreateBy : 0))?.UserIcon ?? "", UserIcon = UserReidsCache.GetUserLoginInfo((x.AuditUserId > 0 ? x.AuditUserId : 0))?.UserIcon ?? "",
}; };
} }
...@@ -3334,7 +3379,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -3334,7 +3379,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
Weight = 0; Weight = 0;
} }
decimal diff = 0; decimal diff = 0;
if ((list.Count() + 1) * Weight != 100) if (Weight > 0 && (list.Count() + 1) * Weight != 100)
{ {
diff = 100 - (list.Count() + 1) * Weight; diff = 100 - (list.Count() + 1) * Weight;
} }
...@@ -4194,10 +4239,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -4194,10 +4239,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
if (IsUpdate) if (IsUpdate)
{ {
//平摊 //平摊
if ((list.Count() - 1) * Weight != 100) if (Weight > 0 && (list.Count() - 1) * Weight != 100)
{ {
diff = 100 - (list.Count() - 1) * Weight; diff = 100 - (list.Count() - 1) * Weight;
} }
decimal NowWeight = Weight + diff; decimal NowWeight = Weight + diff;
int MaxSort1 = list.Where(x => x.Id != model.Id).Max(x => x.Sort); int MaxSort1 = list.Where(x => x.Id != model.Id).Max(x => x.Sort);
foreach (var item in list.Where(x => x.Id != model.Id)) foreach (var item in list.Where(x => x.Id != model.Id))
......
...@@ -1357,12 +1357,13 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -1357,12 +1357,13 @@ namespace Edu.WebApi.Controllers.OKR
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
var dmodel = JsonHelper.DeserializeObject<RB_OKR_Rule_ViewModel>(RequestParm.Msg.ToString()); var dmodel = JsonHelper.DeserializeObject<RB_OKR_Rule_ViewModel>(RequestParm.Msg.ToString());
dmodel.Group_Id = userInfo.Group_Id; dmodel.Group_Id = userInfo.Group_Id;
dmodel.Enable = 1;
var list = okrPeriodModule.GetOKRRuleDownLoadList(dmodel); var list = okrPeriodModule.GetOKRRuleDownLoadList(dmodel);
return ApiResult.Success("", list.Select(x => new return ApiResult.Success("", list.Select(x => new
{ {
x.Id, x.Id,
x.RuleName, x.RuleName,
x.Remark
})); }));
} }
...@@ -1538,7 +1539,10 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -1538,7 +1539,10 @@ namespace Edu.WebApi.Controllers.OKR
x.Id, x.Id,
x.Type, x.Type,
x.RelationId, x.RelationId,
x.RelationName x.RelationName,
x.UserIcon,
x.PostName,
x.DeptName
})); }));
} }
......
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