Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
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
ReactWeb5
CivManage
Commits
37504d29
Commit
37504d29
authored
Apr 22, 2021
by
mayongxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
角色选择组件优化
parent
89f2dd41
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
121 additions
and
52 deletions
+121
-52
ProjectManage.less
...formCenter/messageManage/projectManage/ProjectManage.less
+12
-7
EditModal.jsx
...nter/messageManage/projectManage/components/EditModal.jsx
+4
-1
VisibleRoleModal.jsx
...projectManage/components/RolseSelect/VisibleRoleModal.jsx
+64
-20
AddModal.jsx
...nter/messageManage/templateManage/components/AddModal.jsx
+16
-7
EditModal.jsx
...ter/messageManage/templateManage/components/EditModal.jsx
+25
-17
No files found.
src/pages/platformCenter/messageManage/projectManage/ProjectManage.less
View file @
37504d29
.project_container{
.project_container
{
width: 100%;
height: calc(100vh - 124px);
.operate_bar{
.operate_bar
{
width: 100%;
height: 60px;
background-color: white;
...
...
@@ -10,32 +10,37 @@
flex-direction: row;
justify-content: flex-start;
align-items: center;
.template_type{
.template_type {
height: 60px;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
.title{
.title {
margin-left: 5px;
margin-right: 5px;
}
}
.fast_search{
.fast_search {
height: 60px;
margin-right: 10px;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
.title{
.title {
margin-left: 20px;
margin-right: 5px;
}
}
}
.list_view{
.list_view {
width: 100%;
height: calc(100vh - 184px);
background-color: white;
...
...
src/pages/platformCenter/messageManage/projectManage/components/EditModal.jsx
View file @
37504d29
...
...
@@ -221,6 +221,9 @@ const EditModal = props => {
}
const
onPushSubmit
=
(
value
)
=>
{
console
.
log
(
value
,
"onPushSubmit"
)
}
return
(
<
SiteModal
...
...
@@ -264,7 +267,7 @@ const EditModal = props => {
name=
"to_person"
>
<
VisibleRoleModal
/>
<
VisibleRoleModal
onSubmit=
{
onPushSubmit
}
/>
</
Item
>
<
Item
label=
"定时计划"
...
...
src/pages/platformCenter/messageManage/projectManage/components/RolseSelect/VisibleRoleModal.jsx
View file @
37504d29
...
...
@@ -7,6 +7,8 @@ import classnames from 'classnames';
import
styles
from
'./VisibleRoleModal.less'
import
{
ManOutlined
}
from
'@ant-design/icons'
;
import
{
RoleGroupList
}
from
'@/services/platform/messagemanage'
import
{
useTheme
}
from
'bizcharts'
;
const
checkIsGroup
=
node
=>
node
.
children
?.
length
>
0
;
...
...
@@ -19,7 +21,10 @@ const VisibleRoleModal = props => {
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
previewVisible
,
setPreviewVisible
]
=
useState
(
false
)
const
[
selectRole
,
setSelectRole
]
=
useState
([])
const
[
dataTree
,
setDataTree
]
=
useState
([])
const
[
dataTree
,
setDataTree
]
=
useState
([])
const
[
dataLeafs
,
setDataLeafs
]
=
useState
([])
const
[
selectValues
,
setSelectValues
]
=
useState
([])
const
{
onSubmit
}
=
props
const
GetRoleGroupList
=
()
=>
{
...
...
@@ -27,46 +32,57 @@ const VisibleRoleModal = props => {
res
=>
{
//数据转换
let
tree
=
[]
res
.
data
.
roleList
.
map
((
item
,
index
)
=>
{
let
leafs
=
[]
res
.
data
.
roleList
.
map
((
item
,
index
)
=>
{
tree
.
push
({
name
:
item
.
visibleTitle
,
id
:
index
,
children
:
item
.
roleList
.
map
((
roleItem
)
=>
{
return
(
name
:
item
.
visibleTitle
,
id
:
index
,
children
:
item
.
roleList
.
map
((
roleItem
)
=>
{
leafs
.
push
({
name
:
roleItem
.
roleName
,
id
:
roleItem
.
roleID
,
})
return
(
{
name
:
roleItem
.
roleName
,
id
:
roleItem
.
roleName
,
children
:[]
name
:
roleItem
.
roleName
,
id
:
roleItem
.
roleID
,
children
:
[]
}
)
})
})
})
setDataTree
(
tree
)
setDataLeafs
(
leafs
)
}
)
}
useEffect
(()
=>
{
setSelectRole
(
props
.
value
)
GetRoleGroupList
()
},
[
props
])
const
onSubmit
=
()
=>
{
}
const
handleCancel
=
()
=>
{
setPreviewVisible
(
false
)
}
const
handleOk
=
()
=>
{
setPreviewVisible
(
false
)
onSubmit
&&
onSubmit
(
selectValues
)
}
const
handleClick
=
()
=>
{
setPreviewVisible
(
true
)
}
const
onChange2
=
(
value
)
=>
{
console
.
log
(
value
)
setSelectRole
(
value
.
toString
())
const
strArr
=
[]
for
(
const
item
of
value
)
{
strArr
.
push
(
item
.
name
)
}
setSelectRole
(
strArr
.
toString
())
setSelectValues
(
value
)
}
return
(
...
...
@@ -90,7 +106,7 @@ const VisibleRoleModal = props => {
>
<
div
className=
{
styles
.
list_card
}
>
<
ListCard
{
...
props
}
onChange2=
{
onChange2
}
data=
{
dataTree
}
/>
<
ListCard
{
...
props
}
onChange2=
{
onChange2
}
data=
{
dataTree
}
dataLeafs=
{
dataLeafs
}
/>
</
div
>
</
SiteModal
>
</
div
>
...
...
@@ -113,7 +129,7 @@ const checkChildrenByCondition = (
const
ListCard
=
props
=>
{
const
{
onChange
,
onChange2
,
data
}
=
props
const
{
onChange
,
onChange2
,
data
,
dataLeafs
}
=
props
const
[
changedItem
,
setChangedItem
]
=
useState
({
item
:
{}
});
const
[
valueList
,
setValueList
]
=
useState
([]);
...
...
@@ -122,13 +138,19 @@ const ListCard = props => {
const
result
=
data
.
map
(
item
=>
getAllID
(
item
)).
flat
(
Infinity
);
setValueList
(
result
);
// eslint-disable-next-line no-unused-expressions
onChange
&&
onChange
(
result
);
onChange2
&&
onChange2
(
result
);
const
fliterResult
=
filterChildren
(
result
)
const
strArr
=
[]
for
(
const
item
of
fliterResult
)
{
strArr
.
push
(
item
.
name
)
}
onChange
&&
onChange
(
strArr
.
toString
())
onChange2
&&
onChange2
(
fliterResult
)
}
else
{
setValueList
([]);
// eslint-disable-next-line no-unused-expressions
onChange
&&
onChange
([]);
onChange2
&&
onChange2
(
result
);
const
fliterResult
=
filterChildren
(
result
)
onChange
&&
onChange
(
fliterResult
)
onChange2
&&
onChange2
(
fliterResult
)
}
};
...
...
@@ -144,6 +166,19 @@ const ListCard = props => {
}
return
result
;
};
const
filterChildren
=
(
select
)
=>
{
let
selectLeafs
=
[]
for
(
const
leaf
of
dataLeafs
)
{
for
(
const
id
of
select
)
{
if
(
id
==
leaf
.
id
)
{
selectLeafs
.
push
(
leaf
)
}
}
}
return
selectLeafs
}
const
updateValueList
=
(
checkedKeys
,
childrenKeys
,
sourceItem
)
=>
{
const
removekeys
=
_
.
difference
(
childrenKeys
,
checkedKeys
);
...
...
@@ -152,8 +187,17 @@ const ListCard = props => {
setValueList
(
result
);
if
(
sourceItem
)
setChangedItem
(
sourceItem
);
// eslint-disable-next-line no-unused-expressions
onChange
&&
onChange
(
result
);
onChange2
&&
onChange2
(
result
);
// onChange && onChange(result);
// onChange2 && onChange2(result);
const
fliterResult
=
filterChildren
(
result
)
const
strArr
=
[]
for
(
const
item
of
fliterResult
)
{
strArr
.
push
(
item
.
name
)
}
onChange
&&
onChange
(
strArr
.
toString
())
onChange2
&&
onChange2
(
fliterResult
)
}
useEffect
(()
=>
{
...
...
src/pages/platformCenter/messageManage/templateManage/components/AddModal.jsx
View file @
37504d29
import
React
,
{
useState
,
useEffect
}
from
'react'
import
React
,
{
useState
,
useEffect
}
from
'react'
import
SiteModal
from
'@/components/Modal/SiteModa'
;
import
{
Form
,
Input
,
notification
,
Select
}
from
'antd'
const
{
Item
}
=
Form
;
const
{
TextArea
}
=
Input
;
const
AddModal
=
props
=>
{
...
...
@@ -10,8 +11,13 @@ const AddModal = props => {
const
[
form
]
=
Form
.
useForm
();
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
onSubmit
=
()
=>
{
let
result
=
form
.
getFieldValue
()
props
.
onSubmit
&
props
.
onSubmit
({...
result
})
form
.
submit
()
}
const
onSubmitSuccess
=
()
=>
{
const
result
=
form
.
getFieldValue
()
props
.
onSubmit
&
props
.
onSubmit
({
Id
:
props
.
template
.
Id
,
...
result
})
}
// useEffect(()=>{
...
...
@@ -30,7 +36,8 @@ const AddModal = props => {
onOk=
{
()
=>
onSubmit
()
}
confirmLoading=
{
loading
}
>
<
Form
form=
{
form
}
labelCol=
{
{
span
:
4
}
}
>
<
div
style=
{
{
width
:
"750px"
,
height
:
"400px"
,
overflowY
:
"scroll"
}
}
>
<
Form
form=
{
form
}
labelCol=
{
{
span
:
4
}
}
onFinish=
{
onSubmitSuccess
}
>
<
Item
label=
"模板名称"
name=
"name"
...
...
@@ -92,7 +99,7 @@ const AddModal = props => {
},
]
}
>
<
Input
placeholder=
"请输入模板参数"
/>
<
TextArea
rows=
{
4
}
placeholder=
"请输入模板参数"
/>
</
Item
>
<
Item
label=
"参数说明"
...
...
@@ -104,7 +111,7 @@ const AddModal = props => {
},
]
}
>
<
Input
placeholder=
"请输入参数说明"
/>
<
TextArea
rows=
{
4
}
placeholder=
"请输入参数说明"
/>
</
Item
>
<
Item
label=
"参数解析"
...
...
@@ -116,10 +123,12 @@ const AddModal = props => {
},
]
}
>
<
Input
placeholder=
"请输入参数解析"
/>
<
TextArea
rows=
{
4
}
placeholder=
"请输入参数解析"
/>
</
Item
>
</
Form
>
</
div
>
</
SiteModal
>
)
}
...
...
src/pages/platformCenter/messageManage/templateManage/components/EditModal.jsx
View file @
37504d29
import
React
,
{
useState
,
useEffect
}
from
'react'
import
React
,
{
useState
,
useEffect
}
from
'react'
import
SiteModal
from
'@/components/Modal/SiteModa'
;
import
{
Form
,
Input
,
notification
,
Select
}
from
'antd'
const
{
Item
}
=
Form
;
const
{
Item
}
=
Form
;
const
{
TextArea
}
=
Input
;
const
EditModal
=
props
=>
{
const
[
form
]
=
Form
.
useForm
();
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
onSubmit
=
()
=>
{
let
result
=
form
.
getFieldValue
()
props
.
onSubmit
&
props
.
onSubmit
({
Id
:
props
.
template
.
Id
,...
result
})
form
.
submit
()
}
const
onSubmitSuccess
=
()
=>
{
const
result
=
form
.
getFieldValue
()
props
.
onSubmit
&
props
.
onSubmit
({
Id
:
props
.
template
.
Id
,
...
result
})
}
useEffect
(()
=>
{
useEffect
(()
=>
{
form
.
setFieldsValue
({
name
:
props
.
template
.
name
,
type
:
props
.
template
.
type
,
third_name
:
props
.
template
.
third_name
,
third_id
:
props
.
template
.
third_id
,
params
:
props
.
template
.
template_params
,
desc
:
props
.
template
.
desc
,
analysis_params
:
props
.
template
.
analysis_params
,
name
:
props
.
template
.
name
,
type
:
props
.
template
.
type
,
third_name
:
props
.
template
.
third_name
,
third_id
:
props
.
template
.
third_id
,
params
:
props
.
template
.
template_params
,
desc
:
props
.
template
.
desc
,
analysis_params
:
props
.
template
.
analysis_params
,
})
},[
props
.
template
])
},
[
props
.
template
])
return
(
<
SiteModal
{
...
props
}
...
...
@@ -38,7 +44,8 @@ const EditModal = props => {
onOk=
{
()
=>
onSubmit
()
}
confirmLoading=
{
loading
}
>
<
Form
form=
{
form
}
labelCol=
{
{
span
:
4
}
}
>
<
div
style=
{
{
width
:
"750px"
,
height
:
"400px"
,
overflowY
:
"scroll"
}
}
>
<
Form
form=
{
form
}
labelCol=
{
{
span
:
4
}
}
onFinish=
{
onSubmitSuccess
}
>
<
Item
label=
"模板名称"
name=
"name"
...
...
@@ -100,7 +107,7 @@ const EditModal = props => {
},
]
}
>
<
Input
placeholder=
"请输入模板参数"
/>
<
TextArea
rows=
{
4
}
placeholder=
"请输入模板参数"
/>
</
Item
>
<
Item
label=
"参数说明"
...
...
@@ -112,7 +119,7 @@ const EditModal = props => {
},
]
}
>
<
Input
placeholder=
"请输入参数说明"
/>
<
TextArea
rows=
{
4
}
placeholder=
"请输入参数说明"
/>
</
Item
>
<
Item
label=
"参数解析"
...
...
@@ -124,10 +131,11 @@ const EditModal = props => {
},
]
}
>
<
Input
placeholder=
"请输入参数解析"
/>
<
TextArea
rows=
{
4
}
placeholder=
"请输入参数解析"
/>
</
Item
>
</
Form
>
</
div
>
</
SiteModal
>
)
}
...
...
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