Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyang
sts网站
Commits
d487ffc9
Commit
d487ffc9
authored
Dec 11, 2024
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户管理过滤掉已禁用部门(IB5H7F)
parent
5a1e7bae
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
TreeSelect.java
...rc/main/java/com/ruoyi/common/core/domain/TreeSelect.java
+16
-0
index.vue
ruoyi-ui/src/views/system/user/index.vue
+17
-2
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java
View file @
d487ffc9
...
...
@@ -4,8 +4,10 @@ import java.io.Serializable;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.ruoyi.common.constant.UserConstants
;
import
com.ruoyi.common.core.domain.entity.SysDept
;
import
com.ruoyi.common.core.domain.entity.SysMenu
;
import
com.ruoyi.common.utils.StringUtils
;
/**
* Treeselect树结构实体类
...
...
@@ -22,6 +24,9 @@ public class TreeSelect implements Serializable
/** 节点名称 */
private
String
label
;
/** 节点禁用 */
private
boolean
disabled
=
false
;
/** 子节点 */
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
private
List
<
TreeSelect
>
children
;
...
...
@@ -35,6 +40,7 @@ public class TreeSelect implements Serializable
{
this
.
id
=
dept
.
getDeptId
();
this
.
label
=
dept
.
getDeptName
();
this
.
disabled
=
StringUtils
.
equals
(
UserConstants
.
DEPT_DISABLE
,
dept
.
getStatus
());
this
.
children
=
dept
.
getChildren
().
stream
().
map
(
TreeSelect:
:
new
).
collect
(
Collectors
.
toList
());
}
...
...
@@ -65,6 +71,16 @@ public class TreeSelect implements Serializable
this
.
label
=
label
;
}
public
boolean
isDisabled
()
{
return
disabled
;
}
public
void
setDisabled
(
boolean
disabled
)
{
this
.
disabled
=
disabled
;
}
public
List
<
TreeSelect
>
getChildren
()
{
return
children
;
...
...
ruoyi-ui/src/views/system/user/index.vue
View file @
d487ffc9
...
...
@@ -105,7 +105,7 @@
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"归属部门"
prop=
"deptId"
>
<treeselect
v-model=
"form.deptId"
:options=
"
d
eptOptions"
:show-count=
"true"
placeholder=
"请选择归属部门"
/>
<treeselect
v-model=
"form.deptId"
:options=
"
enabledD
eptOptions"
:show-count=
"true"
placeholder=
"请选择归属部门"
/>
</el-form-item>
</el-col>
</el-row>
...
...
@@ -230,8 +230,10 @@ export default {
userList
:
null
,
// 弹出层标题
title
:
""
,
// 部门树选项
//
所有
部门树选项
deptOptions
:
undefined
,
// 过滤掉已禁用部门树选项
enabledDeptOptions
:
undefined
,
// 是否显示弹出层
open
:
false
,
// 部门名称
...
...
@@ -343,6 +345,19 @@ export default {
getDeptTree
()
{
deptTreeSelect
().
then
(
response
=>
{
this
.
deptOptions
=
response
.
data
;
this
.
enabledDeptOptions
=
this
.
filterDisabledDept
(
JSON
.
parse
(
JSON
.
stringify
(
response
.
data
)));
});
},
// 过滤禁用的部门
filterDisabledDept
(
deptList
)
{
return
deptList
.
filter
(
dept
=>
{
if
(
dept
.
disabled
)
{
return
false
;
}
if
(
dept
.
children
&&
dept
.
children
.
length
)
{
dept
.
children
=
this
.
filterDisabledDept
(
dept
.
children
);
}
return
true
;
});
},
// 筛选节点
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment