diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs index 53a55a43..ed3e2c43 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs @@ -59,9 +59,6 @@ public class Ghre_ExamServices : BaseServices(); - - - #region 定义页面的操作按钮 string sql = @"SELECT fnKey, fnKeyValue, @@ -218,6 +215,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); + if (toolbars.Any(x => x.fnKey == "NewYN")) Toolbar.Add(new Toolbar() { @@ -241,10 +246,10 @@ public class Ghre_ExamServices : BaseServices x.RoleNo == "TrainingExamCancelRelease")) Toolbar.Add(new Toolbar() { - fnKey = "Release", + fnKey = "CancelRelease", fnKeyValue = null, fnTitle = "取消发布", fnType = "table", @@ -1018,15 +1023,19 @@ public class Ghre_ExamServices : BaseServices UpdateStatus(long[] ids, string status) { - string sql = $@"SELECT A.RoleId, B.RoleNo, B.RoleName + + if (status == "Draft") + { + 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("暂无取消发布权限!"); + var toolbarRoles = DbAccess.QueryList(sql); + if (!toolbarRoles.Any()) + return ServiceResult.OprateFailed("暂无取消发布权限!"); + } if (status != "Released" && status != "Disabled" && status != "Draft") throw new Exception("无效的状态");