Commit 8f9b01e2 authored by 黄奎's avatar 黄奎

页面修改

parent 561a6022
......@@ -78,5 +78,10 @@ namespace Edu.Model.ViewModel.Duty
/// 是否完成
/// </summary>
public int IsFinish { get; set; }
/// <summary>
/// 详情编号
/// </summary>
public int DetailId { get; set; }
}
}
......@@ -726,6 +726,27 @@ namespace Edu.Module.Duty
return currentIndex;
}
/// <summary>
/// 计算当前值班人员索引
/// </summary>
/// <param name="planDate">值班日期</param>
/// <param name="PlanDetails">值班班次列表</param>
/// <param name="dutyManId">值班人</param>
/// <returns></returns>
public int CalcCurrentDutyManIndexModule_V2(RB_Duty_Plan_ViewModel model)
{
//当前值班人员索引
int currentIndex = 0;
for (var i = 0; i < model.PlanDetails.Count; i++)
{
if (model.DetailId== model.PlanDetails[i].Id)
{
currentIndex = i;
}
}
return currentIndex;
}
/// <summary>
/// 获取值班详情
/// </summary>
......
......@@ -105,7 +105,7 @@ WHERE 1=1
rowsCount = 0;
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.ID,A.Date,IFNULL(C.SName,'') AS SchoolName,A.CreateBy,A.School_Id
SELECT A.ID,A.Date,IFNULL(C.SName,'') AS SchoolName,A.CreateBy,A.School_Id,B.Id AS DetailId
FROM RB_Duty_Plan AS A INNER JOIN rb_duty_plandetails AS B ON A.Id=B.PlanId
INNER JOIN rb_school AS C ON A.School_Id=C.SId
WHERE 1=1 AND A.`Status`=0
......@@ -137,7 +137,7 @@ WHERE 1=1 AND A.`Status`=0
builder.AppendFormat(@" AND A.{0}<='{1} 23:59:59' ", nameof(RB_Duty_Plan_ViewModel.Date), query.QEndDate);
}
}
builder.AppendFormat(" GROUP BY A.Id,A.Date,C.SName,A.CreateBy,A.School_Id ");
builder.AppendFormat(" GROUP BY A.Id,A.Date,C.SName,A.CreateBy,A.School_Id,B.Id ");
builder.AppendFormat(" ORDER BY A.Date ASC ");
return GetPage<RB_Duty_Plan_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
......
......@@ -120,8 +120,7 @@ namespace Edu.WebApi.Controllers.Duty
int currentIndex = 0;
if (item.PlanDetails != null && item.PlanDetails.Count > 0)
{
currentIndex = dutyPlanModule.CalcCurrentDutyManIndexModule(item.Date,item.PlanDetails,base.UserInfo.Id);
currentIndex = dutyPlanModule.CalcCurrentDutyManIndexModule_V2(item);
//上一个班次索引
int previousIndex = currentIndex - 1;
//下一个班次索引
......@@ -140,16 +139,16 @@ namespace Edu.WebApi.Controllers.Duty
nextModel = item.PlanDetails[nextIndex];
}
}
string GiveMan = "";//交班人
string ReciveMan = "";//接班人
if (currentIndex != 0)
string jiaoBanMan = "";//交班人
string jieBanMan = "";//接班人
if (nextModel != null&&nextModel.Id>0)
{
GiveMan = previousModel?.DutyManName ?? "";
jieBanMan = nextModel?.DutyManName ?? "";
}
if (currentIndex != item.PlanDetails.Count-1)
if (previousModel!=null && previousModel.Id>0)
{
ReciveMan = nextModel?.DutyManName ?? "";
jiaoBanMan = previousModel?.DutyManName ?? "";
}
result.Add(new
{
......@@ -161,8 +160,8 @@ namespace Edu.WebApi.Controllers.Duty
currentModel.StartTime,
currentModel.EndTime,
PlanList = currentModel?.DutyItemList ?? new List<RB_Duty_Item_ViewModel>(),
ReciveMan,
GiveMan,
ReciveMan= jieBanMan,
GiveMan= jiaoBanMan,
item.CreateByName,
currentModel.DutyStatus,
currentModel.DutyStatusStr,
......
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