diff --git a/ruoyi-fastapi-frontend/src/views/system/user/index.vue b/ruoyi-fastapi-frontend/src/views/system/user/index.vue index f539004..2eca079 100644 --- a/ruoyi-fastapi-frontend/src/views/system/user/index.vue +++ b/ruoyi-fastapi-frontend/src/views/system/user/index.vue @@ -315,7 +315,7 @@ { watch(deptName, (val) => { proxy.$refs["deptTreeRef"].filter(val); }); -/** 查询部门下拉树结构 */ -function getDeptTree() { - deptTreeSelect().then((response) => { - deptOptions.value = response.data; - }); -} /** 查询用户列表 */ function getList() { loading.value = true; @@ -644,6 +639,25 @@ function getList() { } ); } +/** 查询部门下拉树结构 */ +function getDeptTree() { + deptTreeSelect().then(response => { + deptOptions.value = response.data; + enabledDeptOptions.value = filterDisabledDept(JSON.parse(JSON.stringify(response.data))); + }); +}; +/** 过滤禁用的部门 */ +function filterDisabledDept(deptList) { + return deptList.filter(dept => { + if (dept.disabled) { + return false; + } + if (dept.children && dept.children.length) { + dept.children = filterDisabledDept(dept.children); + } + return true; + }); +}; /** 节点单击事件 */ function handleNodeClick(data) { queryParams.value.deptId = data.id;