File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
ruoyi-fastapi-frontend/src/views/system/user Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 217217 </el-col >
218218 <el-col :span =" 12" >
219219 <el-form-item label =" 归属部门" prop =" deptId" >
220- <treeselect v-model =" form.deptId" :options =" deptOptions " :show-count =" true" placeholder =" 请选择归属部门" />
220+ <treeselect v-model =" form.deptId" :options =" enabledDeptOptions " :show-count =" true" placeholder =" 请选择归属部门" />
221221 </el-form-item >
222222 </el-col >
223223 </el-row >
@@ -374,8 +374,10 @@ export default {
374374 userList: null ,
375375 // 弹出层标题
376376 title: " " ,
377- // 部门树选项
377+ // 所有部门树选项
378378 deptOptions: undefined ,
379+ // 过滤掉已禁用部门树选项
380+ enabledDeptOptions: undefined ,
379381 // 是否显示弹出层
380382 open: false ,
381383 // 部门名称
@@ -487,6 +489,19 @@ export default {
487489 getDeptTree () {
488490 deptTreeSelect ().then (response => {
489491 this .deptOptions = response .data ;
492+ this .enabledDeptOptions = this .filterDisabledDept (JSON .parse (JSON .stringify (response .data )));
493+ });
494+ },
495+ // 过滤禁用的部门
496+ filterDisabledDept (deptList ) {
497+ return deptList .filter (dept => {
498+ if (dept .disabled ) {
499+ return false ;
500+ }
501+ if (dept .children && dept .children .length ) {
502+ dept .children = this .filterDisabledDept (dept .children );
503+ }
504+ return true ;
490505 });
491506 },
492507 // 筛选节点
You can’t perform that action at this time.
0 commit comments