From ab5b4f5f7026aae6bb906bdc442640a3d629eebb Mon Sep 17 00:00:00 2001 From: ndbs Date: Mon, 3 Jun 2024 09:15:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E7=AE=A1=E7=90=86=E4=B8=8A?= =?UTF-8?q?=E7=BA=A7=E4=B8=8D=E5=85=81=E8=AE=B8=E9=80=89=E8=87=AA=E5=B7=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/DepartmentController.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OrganizationModule/Controllers/DepartmentController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OrganizationModule/Controllers/DepartmentController.cs index 38319dbc2..97866595e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OrganizationModule/Controllers/DepartmentController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OrganizationModule/Controllers/DepartmentController.cs @@ -19,7 +19,7 @@ namespace Learun.Application.Web.Areas.LR_OrganizationModule.Controllers private CompanyIBLL companyIBLL = new CompanyBLL(); private static DepartmentIBLL departmentIBLL_static = new DepartmentBLL(); - private static Dictionary mapData= departmentIBLL_static.GetModelMap(); + private static Dictionary mapData = departmentIBLL_static.GetModelMap(); #region 获取视图 /// /// 主页 @@ -175,6 +175,10 @@ namespace Learun.Application.Web.Areas.LR_OrganizationModule.Controllers return Fail("部门编号已存在!"); } } + if (keyValue == entity.F_ParentId) + { + return Fail("操作失败,当前项不允许"); + } departmentIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } @@ -187,8 +191,16 @@ namespace Learun.Application.Web.Areas.LR_OrganizationModule.Controllers [AjaxOnly] 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 }