Browse Source

部门管理上级不允许选自己

和田中职
ndbs 5 months ago
parent
commit
ab5b4f5f70
1 changed files with 15 additions and 3 deletions
  1. +15
    -3
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OrganizationModule/Controllers/DepartmentController.cs

+ 15
- 3
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OrganizationModule/Controllers/DepartmentController.cs View File

@@ -19,7 +19,7 @@ namespace Learun.Application.Web.Areas.LR_OrganizationModule.Controllers
private CompanyIBLL companyIBLL = new CompanyBLL(); private CompanyIBLL companyIBLL = new CompanyBLL();


private static DepartmentIBLL departmentIBLL_static = new DepartmentBLL(); private static DepartmentIBLL departmentIBLL_static = new DepartmentBLL();
private static Dictionary<string, DepartmentModel> mapData= departmentIBLL_static.GetModelMap();
private static Dictionary<string, DepartmentModel> mapData = departmentIBLL_static.GetModelMap();
#region 获取视图 #region 获取视图
/// <summary> /// <summary>
/// 主页 /// 主页
@@ -175,6 +175,10 @@ namespace Learun.Application.Web.Areas.LR_OrganizationModule.Controllers
return Fail("部门编号已存在!"); return Fail("部门编号已存在!");
} }
} }
if (keyValue == entity.F_ParentId)
{
return Fail("操作失败,当前项不允许");
}
departmentIBLL.SaveEntity(keyValue, entity); departmentIBLL.SaveEntity(keyValue, entity);
return Success("保存成功!"); return Success("保存成功!");
} }
@@ -187,8 +191,16 @@ namespace Learun.Application.Web.Areas.LR_OrganizationModule.Controllers
[AjaxOnly] [AjaxOnly]
public ActionResult DeleteForm(string keyValue) public ActionResult DeleteForm(string keyValue)
{ {
departmentIBLL.VirtualDelete(keyValue);
return Success("删除成功!");
var list = departmentIBLL.GetAllList().Where(x => x.F_ParentId == keyValue);
if (list.Count() > 0)
{
return Fail("删除失败!拥有下辖项不可直接删除");
}
else
{
departmentIBLL.VirtualDelete(keyValue);
return Success("删除成功!");
}
} }
#endregion #endregion
} }

Loading…
Cancel
Save