diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml index cf414191..262bc0fb 100644 --- a/Tiobon.Core.Api/Tiobon.Core.Model.xml +++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml @@ -7036,6 +7036,46 @@ 修改信息 + + + 可查看明细 + + + + + 可编辑 + + + + + 可复制 + + + + + 可作废 + + + + + 可预览 + + + + + 显示考试链接按钮 + + + + + 显示成绩按钮 + + + + + 可取消归档 + + 考试通知记录(Dto.View) diff --git a/Tiobon.Core.Model/View/Ghre/Ghre_Exam.Dto.View.cs b/Tiobon.Core.Model/View/Ghre/Ghre_Exam.Dto.View.cs index c01cd48b..d016bdc9 100644 --- a/Tiobon.Core.Model/View/Ghre/Ghre_Exam.Dto.View.cs +++ b/Tiobon.Core.Model/View/Ghre/Ghre_Exam.Dto.View.cs @@ -38,14 +38,41 @@ public class Ghre_ExamDto : Ghre_Exam public string ExamModeLabel { get; set; } public string OpenClassName { get; set; } - public int canCheckbox { get; set; } = 1; // checkbox是否可选 1 是 0否 - public int canDetail { get; set; } = 1; // 可查看明细 - public int canEdit { get; set; } = 1; // 可编辑 - public int canCopy { get; set; } = 1; // 可复制 - public int canDelete { get; set; } = 1; // 可作废 - public int canPreview { get; set; } = 1; // 可预览 - public int showLink { get; set; } = 1; // 显示考试链接按钮 - public int showResult { get; set; } = 1; // 显示成绩按钮 - public int canClose { get; set; } = 1; // 可取消归档 - public int canCancelRelease { get; set; } = 1;// 可取消发布 + /// + /// 可查看明细 + /// + public int canDetail { get; set; } = 1; + + /// + /// 可编辑 + /// + public int canEdit { get; set; } = 1; + + /// + /// 可复制 + /// + public int canCopy { get; set; } = 1; + /// + /// 可作废 + /// + public int canDelete { get; set; } = 1; + /// + /// 可预览 + /// + public int canPreview { get; set; } = 1; + + /// + /// 显示考试链接按钮 + /// + public int showLink { get; set; } = 1; + + /// + /// 显示成绩按钮 + /// + public int showResult { get; set; } = 1; + + /// + /// 可取消归档 + /// + public int canClose { get; set; } = 1; } diff --git a/Tiobon.Core.Model/ViewModels/Extend/ToolbarRole.cs b/Tiobon.Core.Model/ViewModels/Extend/ToolbarRole.cs new file mode 100644 index 00000000..a912f2c4 --- /dev/null +++ b/Tiobon.Core.Model/ViewModels/Extend/ToolbarRole.cs @@ -0,0 +1,8 @@ +namespace Tiobon.Core.Model; + +public class ToolbarRole +{ + public string RoleNo { get; set; } + public string RoleName { get; set; } + +} diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs index 304c99cd..ac6afa31 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs @@ -649,6 +649,14 @@ public class Ghre_ExamServices : BaseServices(sql); + + sql = $@"SELECT A.RoleId, B.RoleNo, B.RoleName + FROM Ghrs_UserRole A LEFT JOIN Ghrs_Role B ON A.RoleId = B.RoleId + WHERE A.UserID = {App.User.ID} + AND A.IsEnable = 1 + AND B.IsEnable = 1 + AND B.RoleNo LIKE 'TrainingExam%'"; + var toolbarRoles = DbAccess.QueryList(sql); #endregion data.ForEach(x => @@ -686,6 +694,17 @@ public class Ghre_ExamServices : BaseServices x.fnKey == "DetailYN")) x.canDetail = 0; + + if (!toolbarRoles.Any(x => x.RoleNo == "TrainingExamCopy")) + x.canCopy = 0; + if (!toolbarRoles.Any(x => x.RoleNo == "TrainingExamPreview")) + x.canPreview = 0; + if (!toolbarRoles.Any(x => x.RoleNo == "TrainingExamLink")) + x.showLink = 0; + if (!toolbarRoles.Any(x => x.RoleNo == "TrainingExamGrade")) + x.showResult = 0; + if (!toolbarRoles.Any(x => x.RoleNo == "TrainingExamArchive")) + x.canClose = 0; }); return new ServicePageResult(filter.pageNum, totalCount, filter.pageSize, data); @@ -1040,6 +1059,16 @@ public class Ghre_ExamServices : BaseServices GetStatus(long id) { + string sql = $@"SELECT A.RoleId, B.RoleNo, B.RoleName + FROM Ghrs_UserRole A LEFT JOIN Ghrs_Role B ON A.RoleId = B.RoleId + WHERE A.UserID = {App.User.ID} + AND A.IsEnable = 1 + AND B.IsEnable = 1 + AND B.RoleNo ='TrainingExamCancelRelease'"; + var toolbarRoles = DbAccess.QueryList(sql); + if (!toolbarRoles.Any()) + return ServiceResult.OprateFailed("暂无取消发布权限!"); + if (await _ghre_ExamRecordServices.AnyAsync(x => x.ExamId == id)) return ServiceResult.OprateFailed("已有学员参与考试,不可取消发布!"); diff --git a/Tiobon.Core/Tiobon.Core.Model.xml b/Tiobon.Core/Tiobon.Core.Model.xml index cf414191..262bc0fb 100644 --- a/Tiobon.Core/Tiobon.Core.Model.xml +++ b/Tiobon.Core/Tiobon.Core.Model.xml @@ -7036,6 +7036,46 @@ 修改信息 + + + 可查看明细 + + + + + 可编辑 + + + + + 可复制 + + + + + 可作废 + + + + + 可预览 + + + + + 显示考试链接按钮 + + + + + 显示成绩按钮 + + + + + 可取消归档 + + 考试通知记录(Dto.View)