培训计划 页面开发

master
xiaochanghai 4 months ago
parent fb4537b551
commit ed7d37224d
  1. 8
      Tiobon.Core.Model/Base/Ghre/Ghre_Plan.Dto.Base.cs
  2. 8
      Tiobon.Core.Model/Models/Ghre/Ghre_Plan.cs
  3. 6
      Tiobon.Core.Model/View/Ghre/Ghre_Plan.Dto.View.cs
  4. 32
      Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs

@ -6,7 +6,7 @@
* *
* Ver * Ver
* *
*V0.01 2025/2/27 14:07:52 SimonHsiao *V0.01 2025/2/27 14:48:56 SimonHsiao
* *
* Copyright(c) 2025 Tiobon Corporation. All Rights Reserved. * Copyright(c) 2025 Tiobon Corporation. All Rights Reserved.
* *
@ -31,13 +31,13 @@ public class Ghre_PlanBase
/// <summary> /// <summary>
/// 类别 /// 类别
/// </summary> /// </summary>
public int? PlanType { get; set; } [Display(Name = "PlanType"), Description("类别"), MaxLength(32, ErrorMessage = "类别 不能超过 32 个字符")]
public string PlanType { get; set; }
/// <summary> /// <summary>
/// 部门ID /// 部门ID
/// </summary> /// </summary>
[Display(Name = "DeptId"), Description("部门ID"), MaxLength(10, ErrorMessage = "部门ID 不能超过 10 个字符")] public int? DeptId { get; set; }
public string DeptId { get; set; }
/// <summary> /// <summary>
/// 课程ID /// 课程ID

@ -6,7 +6,7 @@
* *
* Ver * Ver
* *
*V0.01 2025/2/27 14:07:52 SimonHsiao *V0.01 2025/2/27 14:48:56 SimonHsiao
* *
* Copyright(c) 2025 Tiobon Corporation. All Rights Reserved. * Copyright(c) 2025 Tiobon Corporation. All Rights Reserved.
* *
@ -32,13 +32,13 @@ public class Ghre_Plan : BasePoco
/// <summary> /// <summary>
/// 类别 /// 类别
/// </summary> /// </summary>
public int? PlanType { get; set; } [Display(Name = "PlanType"), Description("类别"), MaxLength(32, ErrorMessage = "类别 不能超过 32 个字符")]
public string PlanType { get; set; }
/// <summary> /// <summary>
/// 部门ID /// 部门ID
/// </summary> /// </summary>
[Display(Name = "DeptId"), Description("部门ID"), MaxLength(10, ErrorMessage = "部门ID 不能超过 10 个字符")] public int? DeptId { get; set; }
public string DeptId { get; set; }
/// <summary> /// <summary>
/// 课程ID /// 课程ID

@ -31,4 +31,10 @@ public class Ghre_PlanDto : Ghre_Plan
/// 修改信息 /// 修改信息
/// </summary> /// </summary>
public string UpdateDataInfo { get; set; } public string UpdateDataInfo { get; set; }
public string StaffNames { get; set; }
public string CourseName { get; set; }
public string DeptName { get; set; }
public string SchoolName { get; set; }
} }

@ -16,12 +16,38 @@ public class Ghre_PlanServices : BaseServices<Ghre_Plan, Ghre_PlanDto, InsertGhr
{ {
var result = await base.QueryFilterPage(filter, condition, IsEnable); var result = await base.QueryFilterPage(filter, condition, IsEnable);
var DT_TableDataT1 = result.result.DT_TableDataT1;
for (int i = 0; i < result.result.DT_TableDataT1.Count; i++) var deptIds = DT_TableDataT1.Select(x => x.DeptId).Distinct().ToList();
var courseIds = DT_TableDataT1.Select(x => x.CourseId).Distinct().ToList();
var schoolIds = DT_TableDataT1.Select(x => x.SchoolId).Distinct().ToList();
var staffIds = new List<int>();
for (int i = 0; i < DT_TableDataT1.Count; i++)
{ {
var DT_TableDataT1 = result.result.DT_TableDataT1[i]; if (DT_TableDataT1[i].StaffIds.IsNotEmptyOrNull())
staffIds.AddRange(JsonHelper.JsonToObj<List<int>>(DT_TableDataT1[i].StaffIds));
DT_TableDataT1[i].PlanType = await GetParaLabel("TrainingCategory", DT_TableDataT1[i].PlanType);
DT_TableDataT1[i].PlanType = await GetParaLabel("TrainingCategory", DT_TableDataT1[i].PlanType);
}
staffIds = staffIds.Distinct().ToList();
var staffs = await Db.Queryable<Ghra_Staff>().Where(x => staffIds.Contains(x.StaffID)).ToListAsync();
var depts = await Db.Queryable<Ghro_Dept>().Where(x => deptIds.Contains(x.DeptID)).ToListAsync();
var courses = await Db.Queryable<Ghre_Course>().Where(x => courseIds.Contains(x.Id)).ToListAsync();
var schools = await Db.Queryable<Ghre_School>().Where(x => schoolIds.Contains(x.Id)).ToListAsync();
for (int i = 0; i < DT_TableDataT1.Count; i++)
{
if (DT_TableDataT1[i].StaffIds.IsNotEmptyOrNull())
{
var staffIds1 = JsonHelper.JsonToObj<List<int>>(DT_TableDataT1[i].StaffIds);
if (staffIds1.Any())
DT_TableDataT1[i].StaffNames = string.Join("、", staffs.Where(x => staffIds1.Contains(x.StaffID)).Select(x => x.StaffName));
}
DT_TableDataT1.PlanType = await GetParaLabel("TrainingCategory", result.result.DT_TableDataT1[i].PlanType); DT_TableDataT1[i].CourseName = courses.Where(x => x.Id == DT_TableDataT1[i].CourseId).Select(x => x.CourseName).First();
DT_TableDataT1[i].DeptName = depts.Where(x => x.DeptID == DT_TableDataT1[i].DeptId).Select(x => x.DeptName).First();
DT_TableDataT1[i].SchoolName = courses.Where(x => x.Id == DT_TableDataT1[i].SchoolId).Select(x => x.CourseName).First();
} }
return result; return result;
} }

Loading…
Cancel
Save