Commit 34d81ae3 authored by liudong1993's avatar liudong1993

OKR调整

parent 84a58e03
......@@ -18,5 +18,20 @@ namespace Edu.Model.ViewModel.OKR
/// 关联部门/人员名称
/// </summary>
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
string empIds = string.Join(",", elist.Select(x => x.RelationId));
var e2list = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = empIds });
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
return list.Select(x => new
{
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
q.Sort,
q.IsLock,
q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new
KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{
z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name,
......@@ -1508,7 +1515,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort,
q.IsLock,
q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new
KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{
z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name,
......@@ -1521,9 +1528,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
x.AuditRemark,
AuditTime= Common.ConvertHelper.FormatTime(x.AuditTime),
x.AuditUserId,
AccountName= UserReidsCache.GetUserLoginInfo((x.CreateBy > 0?x.CreateBy: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
{
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)
{
......@@ -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();
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())
{
item.ProgressState = item.KeyResultList.Max(x => x.ProgressState);
......@@ -1869,7 +1889,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
z.IsLock,
z.IsNotLook,
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
{
......@@ -1883,7 +1907,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort,
q.IsLock,
q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new
KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{
z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name,
......@@ -1905,7 +1929,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort,
q.IsLock,
q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new
KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{
z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name,
......@@ -1918,9 +1942,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
x.AuditRemark,
AuditTime= Common.ConvertHelper.FormatTime(x.AuditTime),
x.AuditUserId,
AccountName = UserReidsCache.GetUserLoginInfo((x.CreateBy > 0 ? x.CreateBy : 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
{
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)
{
......@@ -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();
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())
{
item.ProgressState = item.KeyResultList.Max(x => x.ProgressState);
......@@ -2148,7 +2185,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
z.IsLock,
z.IsNotLook,
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
{
......@@ -2162,7 +2203,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort,
q.IsLock,
q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new
KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{
z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name,
......@@ -2184,7 +2225,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort,
q.IsLock,
q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new
KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{
z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name,
......@@ -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
q.Sort,
q.IsLock,
q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new
KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{
z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name,
......@@ -3048,7 +3094,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
q.Sort,
q.IsLock,
q.IsNotLook,
KeyResultList = q.KeyResultList.Select(z => new
KeyResultList = q.KeyResultList.OrderBy(q => q.Sort).Select(z => new
{
z.Id,
Name = z.IsNotLook == 1 ? "" : z.Name,
......@@ -3061,9 +3107,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
x.AuditRemark,
AuditTime = Common.ConvertHelper.FormatTime(x.AuditTime),
x.AuditUserId,
AccountName = UserReidsCache.GetUserLoginInfo((x.CreateBy > 0 ? x.CreateBy : 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
Weight = 0;
}
decimal diff = 0;
if ((list.Count() + 1) * Weight != 100)
if (Weight > 0 && (list.Count() + 1) * Weight != 100)
{
diff = 100 - (list.Count() + 1) * Weight;
}
......@@ -4194,10 +4239,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
if (IsUpdate)
{
//平摊
if ((list.Count() - 1) * Weight != 100)
if (Weight > 0 && (list.Count() - 1) * Weight != 100)
{
diff = 100 - (list.Count() - 1) * Weight;
}
decimal NowWeight = Weight + diff;
int MaxSort1 = list.Where(x => x.Id != model.Id).Max(x => x.Sort);
foreach (var item in list.Where(x => x.Id != model.Id))
......
......@@ -1357,12 +1357,13 @@ namespace Edu.WebApi.Controllers.OKR
var userInfo = base.UserInfo;
var dmodel = JsonHelper.DeserializeObject<RB_OKR_Rule_ViewModel>(RequestParm.Msg.ToString());
dmodel.Group_Id = userInfo.Group_Id;
dmodel.Enable = 1;
var list = okrPeriodModule.GetOKRRuleDownLoadList(dmodel);
return ApiResult.Success("", list.Select(x => new
{
x.Id,
x.RuleName,
x.Remark
}));
}
......@@ -1538,7 +1539,10 @@ namespace Edu.WebApi.Controllers.OKR
x.Id,
x.Type,
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