|
@@ -700,8 +700,9 @@ namespace OASystem.API.Controllers
|
|
|
Mid = item.Mid,
|
|
|
Name = item.Name,
|
|
|
SystemMenuCode = item.SystemMenuCode,
|
|
|
- opList = ids
|
|
|
- });
|
|
|
+ opList = ids,
|
|
|
+ selList = new string[0]
|
|
|
+ }) ;
|
|
|
}
|
|
|
|
|
|
//公司数据
|
|
@@ -726,10 +727,94 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
[HttpPost]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public IActionResult QueryJobAuto(int jobid)
|
|
|
+ public IActionResult QueryJobAuth(QueryJobAuthDto dto)
|
|
|
{
|
|
|
- var DBdata = _JobPostAuthorityRepository.QueryDto<Sys_JobPostAuthority, JobPostAuthorityView>(x=>x.JpId == jobid).ToList();
|
|
|
- return Ok(JsonView(200, "成功!", DBdata));
|
|
|
+ //选中的操作权限
|
|
|
+ var DBdata = _JobPostAuthorityRepository.QueryDto<Sys_JobPostAuthority, JobPostAuthorityView>(x=>x.JpId == dto.jobid).ToList();
|
|
|
+ var SystemMenuPermissionData = _SystemMenuPermissionRepository.QueryDto<Sys_SystemMenuPermission, SystemMenuPermissionView>(x => x.Mid == dto.moduleId).ToList();
|
|
|
+ if (SystemMenuPermissionData == null || SystemMenuPermissionData.Count() == 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView("暂无数据"));
|
|
|
+ }
|
|
|
+
|
|
|
+ //所有操作
|
|
|
+ var PageOperation = _PageFunctionPermissionRepository.QueryDto<Sys_PageFunctionPermission, Sys_PageFunctionPermission>().ToList();
|
|
|
+
|
|
|
+ //获取所有关联页面
|
|
|
+ var Sys_SystemMenuAndFunction = _SystemMenuAndFunctionRepository.QueryDto<Sys_SystemMenuAndFunction, SystemMenuAndFunctionView>().ToList();
|
|
|
+
|
|
|
+ ArrayList viewData = new ArrayList();
|
|
|
+ //组合页面数据
|
|
|
+ foreach (var item in SystemMenuPermissionData)
|
|
|
+ {
|
|
|
+ ArrayList ids = new ArrayList();
|
|
|
+ foreach (var viewop in PageOperation)
|
|
|
+ {
|
|
|
+ var op = Sys_SystemMenuAndFunction.FirstOrDefault(x => x.SmId == item.Id && x.FId == viewop.Id);
|
|
|
+ if (op != null)
|
|
|
+ {
|
|
|
+ ids.Add(viewop.Id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取本职务的页面拥有的权限
|
|
|
+ var DBwhere = DBdata.Where(x => x.SmId == item.Id && x.JpId == dto.jobid).ToList();
|
|
|
+
|
|
|
+ viewData.Add(new
|
|
|
+ {
|
|
|
+ Id = item.Id,
|
|
|
+ Mid = item.Mid,
|
|
|
+ Name = item.Name,
|
|
|
+ SystemMenuCode = item.SystemMenuCode,
|
|
|
+ opList = ids,
|
|
|
+ selList = DBwhere.Select(x => x.FId)
|
|
|
+ }) ;
|
|
|
+ }
|
|
|
+
|
|
|
+ return Ok(JsonView(200, "成功!", viewData));
|
|
|
+ }
|
|
|
+
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> SaveJobAuth(SaveJobDto dto)
|
|
|
+ {
|
|
|
+ //获取所有关联页面
|
|
|
+ var Sys_SystemMenuAndFunction = _SystemMenuAndFunctionRepository.QueryDto<Sys_SystemMenuAndFunction, SystemMenuAndFunctionView>().ToList();
|
|
|
+
|
|
|
+ List<Sys_JobPostAuthority> adds = new List<Sys_JobPostAuthority>();
|
|
|
+ foreach (var item in dto.Savejobs)
|
|
|
+ {
|
|
|
+ foreach (var fid in item.FIds)
|
|
|
+ {
|
|
|
+ var whereobj = Sys_SystemMenuAndFunction.FirstOrDefault(x => x.FId == fid && x.SmId == item.SmId);
|
|
|
+ if (whereobj != null)
|
|
|
+ {
|
|
|
+ adds.Add(new Sys_JobPostAuthority
|
|
|
+ {
|
|
|
+ CreateTime = DateTime.Now,
|
|
|
+ CreateUserId = 245,
|
|
|
+ FId = fid,
|
|
|
+ JpId = dto.Jpid,
|
|
|
+ SmId = item.SmId
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ _JobPostAuthorityRepository.BeginTran();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ bool isdel = await _JobPostAuthorityRepository.DeleteAsync<Sys_JobPostAuthority>(x => x.JpId == dto.Jpid);
|
|
|
+ int UpRows = _JobPostAuthorityRepository.Adds<Sys_JobPostAuthority>(adds);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ _JobPostAuthorityRepository.RollbackTran();
|
|
|
+ return Ok(JsonView("系统错误!"));
|
|
|
+ }
|
|
|
+
|
|
|
+ _JobPostAuthorityRepository.CommitTran();
|
|
|
+ return Ok(JsonView(200, "成功", new { }));
|
|
|
}
|
|
|
|
|
|
#endregion
|