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 bf41b840
authored
Jul 27, 2022
by
姜鹏凯
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
审计人员选择问题
1 parent
0168c3e4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
43 deletions
linkwe-pc/src/components/SelectUser.vue
linkwe-pc/src/views/conversation/security/setSensitiveWord.vue
linkwe-pc/src/components/SelectUser.vue
View file @
bf41b84
<
script
>
<
script
>
import
{
getTree
,
getList
}
from
'@/api/organization'
import
{
getTree
,
getList
}
from
'@/api/organization'
import
{
createUniqueString
}
from
'@/utils'
import
{
createUniqueString
}
from
'@/utils'
export
default
{
export
default
{
name
:
'SelectUser'
,
name
:
'SelectUser'
,
components
:
{},
components
:
{},
props
:
{
props
:
{
...
@@ -29,7 +29,7 @@ export default {
...
@@ -29,7 +29,7 @@ export default {
type
:
Array
,
type
:
Array
,
default
:
()
=>
[],
default
:
()
=>
[],
// 必须含有userId和name属性
// 必须含有userId和name属性
validator
(
val
)
{
validator
(
val
)
{
return
val
.
every
((
e
)
=>
e
.
userId
&&
e
.
name
)
return
val
.
every
((
e
)
=>
e
.
userId
&&
e
.
name
)
},
},
},
},
...
@@ -40,7 +40,7 @@ export default {
...
@@ -40,7 +40,7 @@ export default {
},
},
destroyOnClose
:
Boolean
,
destroyOnClose
:
Boolean
,
},
},
data
()
{
data
()
{
return
{
return
{
treeData
:
[],
treeData
:
[],
userList
:
[],
userList
:
[],
...
@@ -48,7 +48,7 @@ export default {
...
@@ -48,7 +48,7 @@ export default {
}
}
},
},
watch
:
{
watch
:
{
defaultValues
(
value
)
{
defaultValues
(
value
)
{
const
checkedUserList
=
[]
const
checkedUserList
=
[]
if
(
!
Array
.
isArray
(
value
)
||
value
.
length
==
0
)
{
if
(
!
Array
.
isArray
(
value
)
||
value
.
length
==
0
)
{
this
.
userList
=
[]
this
.
userList
=
[]
...
@@ -62,42 +62,48 @@ export default {
...
@@ -62,42 +62,48 @@ export default {
this
.
userList
=
checkedUserList
this
.
userList
=
checkedUserList
}
}
},
},
Pvisible
(
val
)
{
Pvisible
(
val
)
{
val
&&
val
&&
this
.
$refs
.
tree
&&
this
.
$refs
.
tree
&&
this
.
$refs
.
tree
.
setCheckedKeys
(
this
.
defaultValues
.
map
((
e
)
=>
e
.
userId
||
e
.
id
))
this
.
$refs
.
tree
.
setCheckedKeys
(
this
.
defaultValues
.
map
((
e
)
=>
e
.
userId
||
e
.
id
))
if
(
this
.
$refs
.
tree
)
{
setTimeout
(()
=>
{
this
.
$refs
.
tree
&&
this
.
$refs
.
tree
.
setCheckedKeys
(
this
.
defaultValues
.
map
((
e
)
=>
e
.
userId
||
e
.
id
))
},
300
);
}
},
},
},
},
computed
:
{
computed
:
{
Pvisible
:
{
Pvisible
:
{
get
()
{
get
()
{
return
this
.
visible
return
this
.
visible
},
},
set
(
val
)
{
set
(
val
)
{
this
.
$emit
(
'update:visible'
,
val
)
this
.
$emit
(
'update:visible'
,
val
)
},
},
},
},
defaultProps
()
{
defaultProps
()
{
let
that
=
this
let
that
=
this
return
{
return
{
label
:
'name'
,
label
:
'name'
,
children
:
'children'
,
children
:
'children'
,
disabled
(
data
,
node
)
{
disabled
(
data
,
node
)
{
return
(
return
(
(
that
.
isOnlyLeaf
&&
data
.
isParty
)
||
(
that
.
isOnlyLeaf
&&
data
.
isParty
)
||
that
.
disabledValues
.
some
((
e
)
=>
e
==
(
data
.
userId
||
data
.
id
))
that
.
disabledValues
.
some
((
e
)
=>
e
==
(
data
.
userId
||
data
.
id
))
)
)
},
},
isLeaf
(
data
,
node
)
{
isLeaf
(
data
,
node
)
{
return
!
data
.
id
return
!
data
.
id
},
},
}
}
},
},
},
},
created
()
{
},
created
()
{
},
mounted
()
{
},
mounted
()
{
},
methods
:
{
methods
:
{
treeFormat
(
list
)
{
treeFormat
(
list
)
{
let
dealOptions
=
[]
let
dealOptions
=
[]
list
.
forEach
((
one
)
=>
{
list
.
forEach
((
one
)
=>
{
let
findIndex
=
list
.
findIndex
((
item
)
=>
{
let
findIndex
=
list
.
findIndex
((
item
)
=>
{
...
@@ -116,7 +122,7 @@ export default {
...
@@ -116,7 +122,7 @@ export default {
})
})
return
dealOptions
return
dealOptions
},
},
loadNode
(
node
,
resolve
)
{
loadNode
(
node
,
resolve
)
{
if
(
node
.
level
===
0
)
{
if
(
node
.
level
===
0
)
{
if
(
!
Array
.
isArray
(
this
.
defaultValues
)
||
this
.
defaultValues
.
length
==
0
)
{
if
(
!
Array
.
isArray
(
this
.
defaultValues
)
||
this
.
defaultValues
.
length
==
0
)
{
this
.
userList
=
[]
this
.
userList
=
[]
...
@@ -139,10 +145,11 @@ export default {
...
@@ -139,10 +145,11 @@ export default {
// })
// })
node
.
data
.
children
&&
rows
.
push
(...
node
.
data
.
children
)
node
.
data
.
children
&&
rows
.
push
(...
node
.
data
.
children
)
resolve
(
rows
)
resolve
(
rows
)
this
.
$refs
.
tree
.
setCheckedKeys
(
this
.
userList
.
map
((
e
)
=>
e
.
userId
||
e
.
id
))
})
})
}
}
},
},
handleTree
(
data
)
{
handleTree
(
data
)
{
return
data
.
map
((
i
)
=>
{
return
data
.
map
((
i
)
=>
{
if
(
i
.
id
)
{
if
(
i
.
id
)
{
i
.
userId
=
i
.
id
i
.
userId
=
i
.
id
...
@@ -152,7 +159,7 @@ export default {
...
@@ -152,7 +159,7 @@ export default {
})
})
},
},
// 选择变化
// 选择变化
handleCheckChange
(
data
,
checked
,
indeterminate
)
{
handleCheckChange
(
data
,
checked
,
indeterminate
)
{
// console.log(arguments)
// console.log(arguments)
if
(
checked
)
{
if
(
checked
)
{
if
(
this
.
isSigleSelect
)
{
if
(
this
.
isSigleSelect
)
{
...
@@ -175,7 +182,7 @@ export default {
...
@@ -175,7 +182,7 @@ export default {
// console.log(data, checked, indeterminate);
// console.log(data, checked, indeterminate);
this
.
userList
=
this
.
unique
(
this
.
userList
)
this
.
userList
=
this
.
unique
(
this
.
userList
)
},
},
unique
(
arr
)
{
unique
(
arr
)
{
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
for
(
var
j
=
i
+
1
;
j
<
arr
.
length
;
j
++
)
{
for
(
var
j
=
i
+
1
;
j
<
arr
.
length
;
j
++
)
{
if
(
arr
[
i
].
userId
.
split
(
'_'
)[
0
]
==
arr
[
j
].
userId
.
split
(
'_'
)[
0
])
{
if
(
arr
[
i
].
userId
.
split
(
'_'
)[
0
]
==
arr
[
j
].
userId
.
split
(
'_'
)[
0
])
{
...
@@ -187,12 +194,12 @@ export default {
...
@@ -187,12 +194,12 @@ export default {
return
arr
return
arr
},
},
// 确 定
// 确 定
submit
()
{
submit
()
{
this
.
Pvisible
=
false
this
.
Pvisible
=
false
this
.
$emit
(
'success'
,
[...
this
.
userList
])
this
.
$emit
(
'success'
,
[...
this
.
userList
])
},
},
// 取消选择
// 取消选择
cancle
(
key
)
{
cancle
(
key
)
{
this
.
$refs
.
tree
.
setChecked
(
key
,
false
)
this
.
$refs
.
tree
.
setChecked
(
key
,
false
)
let
index
=
this
.
userList
.
findIndex
((
i
)
=>
i
.
userId
===
key
)
let
index
=
this
.
userList
.
findIndex
((
i
)
=>
i
.
userId
===
key
)
index
>
-
1
&&
this
.
userList
.
splice
(
index
,
1
)
index
>
-
1
&&
this
.
userList
.
splice
(
index
,
1
)
...
@@ -200,31 +207,14 @@ export default {
...
@@ -200,31 +207,14 @@ export default {
order
>
-
1
&&
this
.
defaultValues
.
slice
().
splice
(
order
,
1
)
order
>
-
1
&&
this
.
defaultValues
.
slice
().
splice
(
order
,
1
)
},
},
},
},
}
}
</
script
>
</
script
>
<
template
>
<
template
>
<el-dialog
<el-dialog
:title=
"title"
:visible
.
sync=
"Pvisible"
:close-on-click-modal=
"false"
:destroy-on-close=
"destroyOnClose"
>
:title=
"title"
:visible
.
sync=
"Pvisible"
:close-on-click-modal=
"false"
:destroy-on-close=
"destroyOnClose"
>
<el-row
:gutter=
"20"
>
<el-row
:gutter=
"20"
>
<el-col
:span=
"12"
:xs=
"24"
>
<el-col
:span=
"12"
:xs=
"24"
>
<div
class=
"head-container"
>
<div
class=
"head-container"
>
<el-tree
<el-tree
node-key=
"userId"
ref=
"tree"
lazy
accordion
show-checkbox
:check-on-click-node=
"false"
:expand-on-click-node=
"true"
:load=
"loadNode"
:props=
"defaultProps"
:check-strictly=
"isOnlyLeaf"
@
check-change=
"handleCheckChange"
></el-tree>
node-key=
"userId"
ref=
"tree"
lazy
accordion
show-checkbox
:check-on-click-node=
"false"
:expand-on-click-node=
"true"
:load=
"loadNode"
:props=
"defaultProps"
:check-strictly=
"isOnlyLeaf"
@
check-change=
"handleCheckChange"
></el-tree>
<!-- :default-checked-keys="
<!-- :default-checked-keys="
defaultValues.map((e) => (isOnlyLeaf ? e.userId : e.userId || e.id))
defaultValues.map((e) => (isOnlyLeaf ? e.userId : e.userId || e.id))
" -->
" -->
...
@@ -247,9 +237,9 @@ export default {
...
@@ -247,9 +237,9 @@ export default {
</
template
>
</
template
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.user-list
{
.user-list
{
.el-row
{
.el-row
{
line-height
:
26px
;
line-height
:
26px
;
}
}
}
}
</
style
>
</
style
>
linkwe-pc/src/views/conversation/security/setSensitiveWord.vue
View file @
bf41b84
This diff is collapsed.
Click to expand it.
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