diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index 83a58927..91cb80ec 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -153,11 +153,16 @@ public class SysDeptController extends BaseController /** * 选择部门树 + * + * @param deptId 部门ID + * @param excludeId 排除ID */ - @GetMapping("/selectDeptTree/{deptId}") - public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap) + @GetMapping(value = { "/selectDeptTree/{deptId}", "/selectDeptTree/{deptId}/{excludeId}" }) + public String selectDeptTree(@PathVariable("deptId") Long deptId, + @PathVariable(value = "excludeId", required = false) String excludeId, ModelMap mmap) { mmap.put("dept", deptService.selectDeptById(deptId)); + mmap.put("excludeId", excludeId); return prefix + "/tree"; } @@ -172,6 +177,19 @@ public class SysDeptController extends BaseController return ztrees; } + /** + * 加载部门列表树(排除下级) + */ + @GetMapping("/treeData/{excludeId}") + @ResponseBody + public List treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId) + { + SysDept dept = new SysDept(); + dept.setDeptId(excludeId); + List ztrees = deptService.selectDeptTreeExcludeChild(dept); + return ztrees; + } + /** * 加载角色部门(数据权限)列表树 */ diff --git a/ruoyi-admin/src/main/resources/templates/system/dept/edit.html b/ruoyi-admin/src/main/resources/templates/system/dept/edit.html index 7752e29c..eda6f21b 100644 --- a/ruoyi-admin/src/main/resources/templates/system/dept/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/dept/edit.html @@ -113,11 +113,12 @@ /*部门管理-修改-选择部门树*/ function selectDeptTree() { var deptId = $("#treeId").val(); + var excludeId = $("input[name='deptId']").val(); if(deptId > 0) { var options = { title: '部门选择', width: "380", - url: prefix + "/selectDeptTree/" + $("#treeId").val(), + url: prefix + "/selectDeptTree/" + $("#treeId").val() + "/" + excludeId, callBack: doSubmit }; $.modal.openOptions(options); diff --git a/ruoyi-admin/src/main/resources/templates/system/dept/tree.html b/ruoyi-admin/src/main/resources/templates/system/dept/tree.html index 0f35a4b4..977f7f58 100644 --- a/ruoyi-admin/src/main/resources/templates/system/dept/tree.html +++ b/ruoyi-admin/src/main/resources/templates/system/dept/tree.html @@ -28,8 +28,11 @@