Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
024f23bc
Commit
024f23bc
authored
Aug 06, 2021
by
zhangleyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:处理添加员工不能重复的问题
parent
b0d5280a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
29 deletions
+37
-29
src/modules/college-manage/components/LeftStructureTree.jsx
+19
-25
src/modules/college-manage/modal/AddOrEditPostGroupModal.jsx
+2
-2
src/modules/college-manage/modal/SetEmployeeModal.jsx
+16
-2
No files found.
src/modules/college-manage/components/LeftStructureTree.jsx
View file @
024f23bc
...
...
@@ -62,29 +62,23 @@ function LeftStructureTree(props) {
const
notFoundContentNode
=
()
=>
{
return
<
span
>
暂无数据
</
span
>
}
const
Complete
=
()
=>
(
<
AutoComplete
dropdownClassName=
"certain-category-search-dropdown"
dropdownMatchSelectWidth=
{
250
}
allowClear
// onChange={(value)=>{setQueryName(value)}}
onSearch=
{
(
value
)
=>
{
setQueryName
(
value
)}
}
notFoundContent=
{
notFoundContentNode
()
}
value=
{
queryName
}
open=
{
open
}
onFocus=
{
()
=>
{
setOpen
(
true
)}
}
onBlur=
{
()
=>
{
setOpen
(
false
)}
}
style=
{
{
width
:
250
,
}
}
options=
{
completeOptions
}
onSelect=
{
confirmSearchSelect
}
placeholder=
'搜索员工、部门'
>
</
AutoComplete
>
);
function
handlePlaceHolder
(){
let
placeholder
=
''
;
switch
(
props
.
treeType
){
case
'departMentTab'
:
placeholder
=
'搜索学员姓名、部门'
;
break
;
case
'postGrouptab'
:
placeholder
=
'搜索学员姓名/岗位/岗位组'
;
break
;
case
'customGroupTab'
:
placeholder
=
'搜索学员姓名/自定义分组集合/自定义分组'
;
break
;
default
:
break
;
}
return
placeholder
}
function
confirmSearchSelect
(
value
,
option
){
console
.
log
(
'option'
,
option
);
setOpen
(
false
);
...
...
@@ -115,7 +109,7 @@ function LeftStructureTree(props) {
const
{
result
=
{}}
=
res
;
const
{
departmentUserVOList
=
[],
departmentVOList
=
[],
subLevelDepartmentVOList
=
[]}
=
result
;
if
(
departmentUserVOList
.
length
>
0
){
userObj
.
label
=
renderTitle
(
'
员工
'
);
userObj
.
label
=
renderTitle
(
'
学员
'
);
userObj
.
options
=
departmentUserVOList
.
map
((
item
,
index
)
=>
{
return
renderItem
(
item
,
'user'
);
})
...
...
@@ -461,7 +455,7 @@ function LeftStructureTree(props) {
}
}
options=
{
completeOptions
}
onSelect=
{
confirmSearchSelect
}
placeholder=
'搜索员工、部门'
placeholder=
{
handlePlaceHolder
()
}
>
</
AutoComplete
>
</
div
>
...
...
src/modules/college-manage/modal/AddOrEditPostGroupModal.jsx
View file @
024f23bc
...
...
@@ -2,7 +2,7 @@
* @Author: wufan
* @Date: 2020-11-27 16:21:49
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-08-06 1
1:43:10
* @LastEditTime: 2021-08-06 1
5:07:53
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -24,7 +24,7 @@ function AddOrEditPostGroupModal(props) {
setIsError
(
false
)
setValidateStatus
(
'success'
);
setNameErrorMsg
(
''
);
if
(
!
postGroupName
||
/^
\s
+$/
.
test
(
postGroupName
)){
if
(
(
!
postGroupName
)
||
/^
\s
+$/
.
test
(
postGroupName
)){
setValidateStatus
(
'error'
);
setNameErrorMsg
(
`
${
props
.
label
}
不能为空`
);
setIsError
(
true
)
...
...
src/modules/college-manage/modal/SetEmployeeModal.jsx
View file @
024f23bc
...
...
@@ -19,13 +19,27 @@ export default class SetEmployeeModal extends React.Component {
})
const
selectedData
=
list
[
0
]
||
{};
this
.
state
=
{
list
,
list
:
this
.
uniqArr
([...
list
])
,
selected
:
selectedData
.
userId
,
roleCode
:
selectedData
.
roleCode
,
submit
:
false
}
}
uniqArr
(
arr
){
let
obj
=
{};
arr
.
map
((
item
,
index
)
=>
{
// 若重复则删除该项
if
(
obj
.
hasOwnProperty
(
item
.
userId
)){
arr
.
splice
(
index
,
1
);
// 不重复则存入obj
}
else
{
obj
[
item
.
userId
]
=
item
.
userName
;
}
});
return
arr
;
}
handleChangeValues
(
value
)
{
const
{
list
,
selected
}
=
this
.
state
;
list
.
map
((
item
)
=>
{
...
...
@@ -34,7 +48,7 @@ export default class SetEmployeeModal extends React.Component {
}
})
this
.
props
.
onChange
(
selected
,
value
);
this
.
setState
({
roleCode
:
value
,
list
});
this
.
setState
({
roleCode
:
value
,
list
});
}
render
()
{
...
...
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