mirror of https://gitee.com/y_project/RuoYi.git
部门修改不允许最后层级节点选择
parent
6a592827e8
commit
d24481f9a5
|
@ -149,7 +149,7 @@ public class SysDeptController extends BaseController
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Map<String, Object>> treeData()
|
public List<Map<String, Object>> treeData()
|
||||||
{
|
{
|
||||||
List<Map<String, Object>> tree = deptService.selectDeptTree();
|
List<Map<String, Object>> tree = deptService.selectDeptTree(new SysDept());
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -744,6 +744,17 @@
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
// 不允许最后层级节点选择
|
||||||
|
notAllowLastLevel: function(_tree) {
|
||||||
|
var nodes = _tree.getSelectedNodes();
|
||||||
|
for (var i = 0; i < nodes.length; i++) {
|
||||||
|
if (nodes[i].level == nodes.length + 1) {
|
||||||
|
$.modal.msgError("不能选择最后层级节点(" + nodes[i].name + ")");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
// 隐藏/显示搜索栏
|
// 隐藏/显示搜索栏
|
||||||
toggleSearch: function() {
|
toggleSearch: function() {
|
||||||
$('#search').slideToggle(200);
|
$('#search').slideToggle(200);
|
||||||
|
|
|
@ -123,10 +123,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function doSubmit(index, layero){
|
function doSubmit(index, layero){
|
||||||
var body = layer.getChildFrame('body', index);
|
var tree = layero.find("iframe")[0].contentWindow.$._tree;
|
||||||
$("#treeId").val(body.find('#treeId').val());
|
if ($.tree.notAllowLastLevel(tree)) {
|
||||||
$("#treeName").val(body.find('#treeName').val());
|
var body = layer.getChildFrame('body', index);
|
||||||
layer.close(index);
|
$("#treeId").val(body.find('#treeId').val());
|
||||||
|
$("#treeName").val(body.find('#treeName').val());
|
||||||
|
layer.close(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -23,9 +23,10 @@ public interface ISysDeptService
|
||||||
/**
|
/**
|
||||||
* 查询部门管理树
|
* 查询部门管理树
|
||||||
*
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
* @return 所有部门信息
|
* @return 所有部门信息
|
||||||
*/
|
*/
|
||||||
public List<Map<String, Object>> selectDeptTree();
|
public List<Map<String, Object>> selectDeptTree(SysDept dept);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询菜单
|
* 根据角色ID查询菜单
|
||||||
|
|
|
@ -28,6 +28,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
/**
|
/**
|
||||||
* 查询部门管理数据
|
* 查询部门管理数据
|
||||||
*
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
* @return 部门信息集合
|
* @return 部门信息集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,13 +41,15 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
/**
|
/**
|
||||||
* 查询部门管理树
|
* 查询部门管理树
|
||||||
*
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
* @return 所有部门信息
|
* @return 所有部门信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> selectDeptTree()
|
@DataScope(tableAlias = "d")
|
||||||
|
public List<Map<String, Object>> selectDeptTree(SysDept dept)
|
||||||
{
|
{
|
||||||
List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
|
List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
|
||||||
List<SysDept> deptList = selectDeptList(new SysDept());
|
List<SysDept> deptList = deptMapper.selectDeptList(dept);
|
||||||
trees = getTrees(deptList, false, null);
|
trees = getTrees(deptList, false, null);
|
||||||
return trees;
|
return trees;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue