From 7b0dc30ea157bc611e691655ccf8ade368cb7285 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Thu, 20 Mar 2025 17:19:56 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=88=86=E9=85=8D=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WorkGrids/Services/Implements/WorkGridService.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridService.cs b/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridService.cs index 2bfc0c79..b371413d 100644 --- a/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridService.cs +++ b/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridService.cs @@ -219,9 +219,15 @@ public class WorkGridService : IWorkGridService public async Task AssignAsync(WorkGridUserAssignRequest request) { var currentFactory = _currentUser.GetStringTenantId(); + var role = _currentUser.GetRole(); + var specific = (role is "admin" or "tenant-admin" or "WGZGLY") && request.WorkGridCode.HasValue; var currentUserCode = _currentUser.GetUserClaim(UserClaimConstants.JinkoCode); - var myWorkGrid = await _dbContext.Queryable().Where(x => x.LeaderUserCode == currentUserCode).SingleAsync(); + var myWorkGrid = await _dbContext.Queryable() + .WhereIF(specific, x => x.Code == request.WorkGridCode) + .WhereIF(specific == false, x => x.LeaderUserCode == currentUserCode) + .SingleAsync(); + myWorkGrid.ThrowIfNull("工作网格尚未配置,请联系管理员"); //检查配置的人员