Commit f466ff9f authored by 黄奎's avatar 黄奎

页面修改

parent 4635d02f
......@@ -69,7 +69,5 @@ namespace Edu.Model.Entity.Course
/// 课堂视频
/// </summary>
public string VideoUrl { get; set; }
}
}
......@@ -35,5 +35,10 @@ namespace Edu.Model.ViewModel.Duty
/// 创建时间
/// </summary>
public string CreateTimeStr { get { return Common.ConvertHelper.FormatTimeStr(this.CreateTime); } }
/// <summary>
/// 值班事项名称
/// </summary>
public string ItemName { get; set; }
}
}
......@@ -1278,7 +1278,7 @@ namespace Edu.Module.Course
}
if (flag && item.CheckStatus == 1)
{
//flag = CalcGuestHoursModule(guestModel, item);
flag = CalcGuestHoursModule(guestModel, item);
}
}
}
......
......@@ -78,6 +78,20 @@ namespace Edu.Module.Duty
/// <returns></returns>
public bool SetDutyItemModule(RB_Duty_Item_ViewModel model)
{
if (model.DutyCategory == 1)
{
}
else if (model.DutyCategory == 2)
{
model.DutyType = 1;
model.ItemType = 0;
}
else if (model.DutyCategory == 3)
{
model.DutyType = 1;
model.ItemType = 0;
}
if (model.Id == 0)
{
return dutyItemRepository.Insert(model) > 0;
......
......@@ -825,6 +825,17 @@ namespace Edu.Module.Duty
ItemSchools = model.School_Id.ToString(),
Shifts = currentModel.Shift.ToString(),
});
foreach (var dItem in dutyItemList)
{
if (!string.IsNullOrEmpty(dItem.ItemImg))
{
dItem.ItemImgList = Common.Plugin.JsonHelper.DeserializeObject<List<string>>(dItem.ItemImg);
}
else
{
dItem.ItemImgList = new List<string>();
}
}
var PlanList = dutyItemList ?? new List<RB_Duty_Item_ViewModel>();
//获取所有的值班内容
var contentList = duty_ContentRepository.GetDutyContentListRepository(new RB_Duty_Content_ViewModel() { PlanId = model.Id });
......@@ -924,7 +935,7 @@ namespace Edu.Module.Duty
}
else
{
foreach (var item in PlanList)
foreach (var item in PlanList.Where(qitem=>qitem.DutyCategory==1&&qitem.DutyType==2))
{
var c_workModel = currentPlanContetList?.Where(qitem => qitem.ItemId == item.Id && qitem.CreateBy == userId)?.FirstOrDefault();
var itemType = item.ItemType;
......@@ -1181,7 +1192,8 @@ namespace Edu.Module.Duty
/// <param name="DutyMan"></param>
/// <param name="Status">Status(1-值班中,2-已完成)</param>
/// <returns></returns>
public bool DutyCheckModule(int Id, int Shift, int DutyMan, int Status, out string message)
[TransactionCallHandler]
public virtual bool DutyCheckModule(int Id, int Shift, int DutyMan, int Status, List<RB_Duty_Content_ViewModel> worklist, out string message)
{
message = "";
Dictionary<string, object> fileds = new Dictionary<string, object>()
......@@ -1208,15 +1220,22 @@ namespace Edu.Module.Duty
}
if (Status == 2)
{
var workList= duty_ContentRepository.GetDutyContentListRepository(new RB_Duty_Content_ViewModel() { PlanId = Id, PlanShift = Shift, PlanType = 1,CreateBy=DutyMan }).ToList();
if (workList != null && workList.Count > 0)
var workContentList= duty_ContentRepository.GetDutyContentListRepository(new RB_Duty_Content_ViewModel() { PlanId = Id, PlanShift = Shift, PlanType = 1,CreateBy=DutyMan }).ToList();
if (workContentList != null && workContentList.Count > 0)
{
var tempWorkList = workList.Where(qitem => qitem.WorkIsFinish == 0).ToList();
if (tempWorkList!=null&&tempWorkList.Count > 0)
foreach (var item in workContentList)
{
message = "工作清单内还有没有完成的项目,请检查后再提交!";
return false;
}
if (item.ItemType == 1 && item.WorkIsFinish == 0)
{
message = string.Format("请检查【{0}】,已完成请点击“确认完成”按钮!", item.ItemName);
return false;
}
if (item.ItemType == 2 && (string.IsNullOrEmpty(item.WorkContent)))
{
message = string.Format("请填写【{0}】的完成情况!", item.ItemName);
return false;
}
}
}
if (dt < startTime)
{
......@@ -1247,6 +1266,10 @@ namespace Edu.Module.Duty
new WhereHelper(nameof(RB_Duty_PlanDetails_ViewModel.Shift), Shift)
};
var flag = duty_PlanDetailsRepository.Update(fileds, list);
if (flag && worklist != null)
{
flag = duty_ContentRepository.InsertBatch(worklist);
}
return flag;
}
......
......@@ -21,8 +21,8 @@ namespace Edu.Repository.Duty
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Duty_Content AS A
SELECT A.* ,IFNULL(B.ItemName,'') AS ItemName
FROM RB_Duty_Content AS A LEFT JOIN rb_duty_item AS B ON A.ItemId=B.Id
WHERE 1=1
");
if (query == null)
......
......@@ -80,6 +80,10 @@ WHERE 1=1 ");
builder.AppendFormat(" AND A.{0} LIKE @ItemName ", nameof(RB_Duty_Item_ViewModel.ItemName));
parameters.Add("ItemName", "%" + query.ItemName.Trim() + "%");
}
if (query.DutyCategory > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Duty_Item_ViewModel.DutyCategory), query.DutyCategory);
}
if (query.ItemSchoolList != null && query.ItemSchoolList.Count > 0)
{
string str = "";
......@@ -103,6 +107,7 @@ WHERE 1=1 ");
}
}
}
builder.AppendFormat(" ORDER BY A.{0} DESC ", nameof(RB_Duty_Item_ViewModel.Id));
return GetPage<RB_Duty_Item_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
......
......@@ -183,6 +183,7 @@ namespace Edu.WebApi.Controllers.Duty
{
Group_Id = base.UserInfo.Group_Id,
ItemName=base.ParmJObj.GetStringValue("ItemName"),
DutyCategory=base.ParmJObj.GetInt("DutyCategory"),
};
query.ItemSchoolList = Common.Plugin.JsonHelper.DeserializeObject<List<int>>(base.ParmJObj.GetStringValue("ItemSchools"));
var list = dutyModule.GetDutyItemPageModule(pageModel.PageIndex,pageModel.PageSize,out long rowsCount, query);
......@@ -256,27 +257,32 @@ namespace Edu.WebApi.Controllers.Duty
{
query.ItemImg = "";
}
if (string.IsNullOrWhiteSpace(query.ItemName))
{
return ApiResult.Failed("请输入值班事项名称");
}
if (!query.ItemType.HasValue || (int)query.ItemType.Value <= 0)
if (string.IsNullOrWhiteSpace(query.Shifts))
{
return ApiResult.Failed("请选择值班事项类型");
return ApiResult.Failed("请选择班次");
}
if (string.IsNullOrWhiteSpace(query.ItemSchools))
{
return ApiResult.Failed("请选择值班事项对应的学校");
}
if (string.IsNullOrWhiteSpace(query.Shifts))
if (query.DutyCategory == 0)
{
return ApiResult.Failed("请选择班次");
return ApiResult.Failed("请选择分类!");
}
if (query.Id == 0)
if (query.DutyType == 0)
{
query.CreateBy = base.UserInfo.Id;
query.CreateTime = System.DateTime.Now;
return ApiResult.Failed("请选择类型!");
}
if (string.IsNullOrWhiteSpace(query.ItemName))
{
return ApiResult.Failed("请输入值班事项名称");
}
if (query.DutyCategory == 1 && query.DutyType == 2 && base.ParmJObj.GetInt("ItemType") == 0)
{
return ApiResult.Failed("请选择事项类型填写方式!");
}
query.CreateBy = base.UserInfo.Id;
query.CreateTime = System.DateTime.Now;
query.UpdateBy = base.UserInfo.Id;
query.UpdateTime = System.DateTime.Now;
bool retult = dutyModule.SetDutyItemModule(query);
......
......@@ -7,6 +7,7 @@ using Edu.Module.Duty;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -347,7 +348,47 @@ namespace Edu.WebApi.Controllers.Duty
var Id = base.ParmJObj.GetInt("Id");
var Shift = base.ParmJObj.GetInt("Shift");
var Status = base.ParmJObj.GetInt("Status");
var flag = dutyPlanModule.DutyCheckModule(Id, Shift, base.UserInfo.Id, Status,out string message);
//突发事件
int IsBurst = base.ParmJObj.GetInt("IsBurst");
//工作交接说明
int IsHandover = base.ParmJObj.GetInt("IsHandover");
List<RB_Duty_Content_ViewModel> list = new List<RB_Duty_Content_ViewModel>();
if (Status == 2)
{
if (IsBurst == 1)
{
list.Add(new RB_Duty_Content_ViewModel()
{
Id = 0,
PlanShift = Shift,
PlanType =3,
PlanId = Id,
OtherContent = "无",
OtherRemark = "无",
WorkContent = "",
WorkIsFinish = 1,
ItemId = 0,
ItemType = 0,
});
}
if (IsHandover==1)
{
list.Add(new RB_Duty_Content_ViewModel()
{
Id = 0,
PlanShift = Shift,
PlanType = 2,
PlanId = Id,
OtherContent = "无",
OtherRemark = "无",
WorkContent = "",
WorkIsFinish = 1,
ItemId = 0,
ItemType = 0,
});
}
}
var flag = dutyPlanModule.DutyCheckModule(Id, Shift, base.UserInfo.Id, Status, list, out string message);
return flag ? ApiResult.Success() : ApiResult.Failed(message: message);
}
......@@ -391,6 +432,10 @@ namespace Edu.WebApi.Controllers.Duty
{
model.FileURL = "";
}
if (model.PlanType == 1 && string.IsNullOrEmpty(model.WorkContent))
{
return ApiResult.Failed(message: "请填写完成内容!");
}
model.Group_Id = base.UserInfo.Group_Id;
model.Status = Common.Enum.DateStateEnum.Normal;
model.CreateBy = base.UserInfo.Id;
......
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