From 3624ff4a151e508e84545c566dc7940f166163dc Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Wed, 5 Jun 2024 10:08:56 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E8=80=83=E8=AF=95=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=EF=BC=8C=E5=9F=B9=E8=AE=AD=5F=E8=80=83=E8=AF=95=5F=E6=88=90?= =?UTF-8?q?=E7=BB=A9=E3=80=81=E5=A4=8D=E5=88=B6=E3=80=81=E5=BD=92=E6=A1=A3?= =?UTF-8?q?=E3=80=81=E5=8F=96=E6=B6=88=E5=8F=91=E5=B8=83=E3=80=81=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E3=80=81=E8=80=83=E8=AF=95=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tiobon.Core.Api/Tiobon.Core.Model.xml | 40 ++++++++++++++++ .../View/Ghre/Ghre_Exam.Dto.View.cs | 47 +++++++++++++++---- .../ViewModels/Extend/ToolbarRole.cs | 8 ++++ .../Ghre/Ghre_ExamServices.cs | 29 ++++++++++++ Tiobon.Core/Tiobon.Core.Model.xml | 40 ++++++++++++++++ 5 files changed, 154 insertions(+), 10 deletions(-) create mode 100644 Tiobon.Core.Model/ViewModels/Extend/ToolbarRole.cs 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)