Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9c3409a8
authored
Jun 07, 2023
by
xinla
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
扩展选择人员组件:选中部门时,是否用部门代替显示该部门下所有人员 功能
1 parent
23b6171e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
vue3-lw-pc/src/components/SelectUser.vue
vue3-lw-pc/src/components/SelectUser.vue
View file @
9c3409a
...
...
@@ -42,6 +42,11 @@ export default {
default
:
()
=>
[],
},
destroyOnClose
:
Boolean
,
// 选中部门时,是否用部门代替显示该部门下所有人员
departReplaceUser
:
{
type
:
Boolean
,
default
:
false
,
},
},
data
()
{
return
{
...
...
@@ -82,6 +87,19 @@ export default {
},
300
)
}
},
dealedUserList
()
{
if
(
!
this
.
departReplaceUser
)
{
return
this
.
userList
}
// 提取所有部门
let
arr
=
this
.
userList
.
filter
((
e
)
=>
e
.
isParty
)
// 提取所有非选中部门的人员
let
userList
=
this
.
userList
.
filter
((
e
)
=>
!
e
.
isParty
&&
!
arr
.
some
((
e2
)
=>
e
.
userDepts
[
0
]?.
deptId
==
e2
.
deptId
))
// 提取无父级部门
arr
=
arr
.
filter
((
e
)
=>
!
arr
.
some
((
e2
)
=>
e
.
parentId
==
e2
.
id
))
arr
.
push
(...
userList
)
return
arr
},
},
computed
:
{
Pvisible
:
{
...
...
@@ -184,6 +202,14 @@ export default {
getDeptUser
({
deptId
:
node
.
data
.
id
}).
then
(({
rows
})
=>
{
let
arr
=
this
.
handleUser
(
rows
)
node
.
data
.
children
&&
arr
.
push
(...
node
.
data
.
children
)
// 懒加载选中状态的子节点不会触发子节点的选中事件,需要手动触发
if
(
node
.
checked
)
{
setTimeout
(()
=>
{
arr
.
forEach
((
e
)
=>
{
this
.
handleCheckChange
(
e
,
true
)
})
},
200
)
}
resolve
(
arr
)
})
}
...
...
@@ -243,7 +269,7 @@ export default {
// 确 定
submit
()
{
this
.
Pvisible
=
false
this
.
$emit
(
'success'
,
[...
this
.
u
serList
])
this
.
$emit
(
'success'
,
[...
this
.
dealedU
serList
])
},
// 取消选择
cancle
(
key
)
{
...
...
@@ -304,7 +330,7 @@ export default {
</div>
<div
class=
"right user-list"
>
<div>
选择人员列表
</div>
<div
v-for=
"(item, index) in
u
serList"
:key=
"index"
class=
"flex aic"
>
<div
v-for=
"(item, index) in
dealedU
serList"
:key=
"index"
class=
"flex aic"
>
<el-icon-UserFilled
class=
"el-icon-UserFilled"
></el-icon-UserFilled>
<span
class=
"user-name"
>
{{ item.name }}
</span>
<el-icon-minus
class=
"el-icon-minus cp"
title=
"取消选择"
@
click=
"cancle(item.userId)"
></el-icon-minus>
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment