修改上级部门(选择项排除本身和下级)

This commit is contained in:
RuoYi
2020-05-15 15:30:08 +08:00
parent dc6fe4c985
commit 59e2d4a2df
5 changed files with 62 additions and 4 deletions

View File

@ -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<Ztree> treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId)
{
SysDept dept = new SysDept();
dept.setDeptId(excludeId);
List<Ztree> ztrees = deptService.selectDeptTreeExcludeChild(dept);
return ztrees;
}
/**
* 加载角色部门(数据权限)列表树
*/

View File

@ -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);

View File

@ -28,8 +28,11 @@
<th:block th:include="include :: footer" />
<th:block th:include="include :: ztree-js" />
<script th:inline="javascript">
var prefix = ctx + "system/dept"
var deptId = [[${deptId}]];
var excludeId = [[${excludeId}]];
$(function() {
var url = ctx + "system/dept/treeData";
var url = $.common.isEmpty(excludeId) ? prefix + "/treeData": prefix + "/treeData/" + excludeId;
var options = {
url: url,
expandLevel: 2,