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
80345082
Commit
80345082
authored
Aug 04, 2021
by
shaoan123
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改消息平台模块
parent
4b453311
Pipeline
#32512
skipped with stages
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
108 additions
and
93 deletions
+108
-93
ProjectManage.jsx
...tformCenter/messageManage/projectManage/ProjectManage.jsx
+0
-1
VisibleIISAgentConfig.jsx
...anage/components/IISAgentConfig/VisibleIISAgentConfig.jsx
+23
-16
TemplateManage.jsx
...ormCenter/messageManage/templateManage/TemplateManage.jsx
+56
-52
AddModal.jsx
...nter/messageManage/templateManage/components/AddModal.jsx
+6
-5
EditModal.jsx
...ter/messageManage/templateManage/components/EditModal.jsx
+23
-19
No files found.
src/pages/platformCenter/messageManage/projectManage/ProjectManage.jsx
View file @
80345082
...
@@ -304,7 +304,6 @@ const ProjectManage = () => {
...
@@ -304,7 +304,6 @@ const ProjectManage = () => {
/>
/>
</
div
>
</
div
>
<
Button
type=
"primary"
onClick=
{
handleReset
}
>
重置
</
Button
>
<
Button
type=
"primary"
onClick=
{
handleReset
}
>
重置
</
Button
>
<
Button
type=
"primary"
style=
{
{
marginLeft
:
"10px"
}
}
icon=
{
<
PlusCircleOutlined
/>
}
onClick=
{
onAddClick
}
><
span
style=
{
{
marginTop
:
"-3px"
}
}
>
新增
</
span
></
Button
>
<
Button
type=
"primary"
style=
{
{
marginLeft
:
"10px"
}
}
icon=
{
<
PlusCircleOutlined
/>
}
onClick=
{
onAddClick
}
><
span
style=
{
{
marginTop
:
"-3px"
}
}
>
新增
</
span
></
Button
>
</
div
>
</
div
>
...
...
src/pages/platformCenter/messageManage/projectManage/components/IISAgentConfig/VisibleIISAgentConfig.jsx
View file @
80345082
...
@@ -40,12 +40,11 @@ const VisibleIISAgentConfig = props => {
...
@@ -40,12 +40,11 @@ const VisibleIISAgentConfig = props => {
const
dateFormat
=
'YYYY-MM-DD HH:mm:ss'
;
const
dateFormat
=
'YYYY-MM-DD HH:mm:ss'
;
const
{
agentConfig
,
value
,
onIISAgentSubmit
}
=
props
const
{
agentConfig
,
value
,
onIISAgentSubmit
}
=
props
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
'agentConfig'
,
agentConfig
);
if
(
agentConfig
)
{
if
(
agentConfig
)
{
let
startTime
=
agentConfig
.
LoopMode
===
'ByOnce'
?
moment
(
new
Date
(
new
Date
().
toLocaleDateString
()),
'YYYY-MM-DD 00:00:00'
).
add
(
1
,
'days'
)
:
moment
(
new
Date
(
new
Date
().
toLocaleDateString
()),
'YYYY-MM-DD 00:00:00'
)
let
startTime
=
agentConfig
.
LoopMode
===
'ByOnce'
?
moment
(
new
Date
(
new
Date
().
toLocaleDateString
()),
'YYYY-MM-DD 00:00:00'
).
add
(
1
,
'days'
)
:
moment
(
new
Date
(
new
Date
().
toLocaleDateString
()),
'YYYY-MM-DD 00:00:00'
)
form
.
setFieldsValue
({
form
.
setFieldsValue
({
is_enable
:
agentConfig
.
Enabled
,
is_enable
:
agentConfig
.
Enabled
,
url_type
:
agentConfig
.
Absolute
?
false
:
tru
e
,
url_type
:
agentConfig
.
Absolute
?
true
:
fals
e
,
url_path
:
agentConfig
.
Url
,
url_path
:
agentConfig
.
Url
,
request_header
:
agentConfig
.
CustomHeader
,
request_header
:
agentConfig
.
CustomHeader
,
plan_type
:
agentConfig
.
LoopMode
,
plan_type
:
agentConfig
.
LoopMode
,
...
@@ -108,23 +107,20 @@ const VisibleIISAgentConfig = props => {
...
@@ -108,23 +107,20 @@ const VisibleIISAgentConfig = props => {
setInterval
(
1
)
setInterval
(
1
)
setLoop_unit
(
'Hour'
)
setLoop_unit
(
'Hour'
)
}
}
},
[
agentConfig
])
useEffect
(()
=>
{
if
(
value
)
{
if
(
value
)
{
form
.
setFieldsValue
({
form
.
setFieldsValue
({
name
:
value
name
:
value
})
})
setSelectRole
(
props
.
value
)
setSelectRole
(
props
.
value
)
}
}
},
[
props
])
},
[
props
])
const
handleCancel
=
()
=>
{
const
handleCancel
=
()
=>
{
setPreviewVisible
(
false
)
setPreviewVisible
(
false
)
}
}
const
handleOk
=
()
=>
{
const
handleOk
=
async
()
=>
{
let
fv
=
form
.
getFieldValue
()
let
fv
=
form
.
getFieldValue
()
if
((
fv
.
loop_mode
===
'ByDay'
&&
!
selectValues
.
length
)
||
(
fv
.
loop_mode
===
'ByWeek'
&&
!
weekData
.
length
))
{
if
((
fv
.
loop_mode
===
'ByDay'
&&
!
selectValues
.
length
)
||
(
fv
.
loop_mode
===
'ByWeek'
&&
!
weekData
.
length
))
{
message
.
warning
(
'请选择计划执行日'
)
message
.
warning
(
'请选择计划执行日'
)
...
@@ -135,7 +131,7 @@ const VisibleIISAgentConfig = props => {
...
@@ -135,7 +131,7 @@ const VisibleIISAgentConfig = props => {
CustomHeader
:
fv
.
request_header
||
''
,
CustomHeader
:
fv
.
request_header
||
''
,
StartFrom
:
fv
.
start_time
&&
fv
.
start_time
.
format
(
dateFormat
),
StartFrom
:
fv
.
start_time
&&
fv
.
start_time
.
format
(
dateFormat
),
EndAt
:
fv
.
end_time
&&
fv
.
end_time
.
format
(
dateFormat
),
EndAt
:
fv
.
end_time
&&
fv
.
end_time
.
format
(
dateFormat
),
LoopMode
:
fv
.
loop_mode
,
LoopMode
:
fv
.
loop_mode
===
'ByOnce'
?
'BYLOOP'
:
fv
.
loop_mode
,
LoopUnit
:
loop_unit
,
LoopUnit
:
loop_unit
,
MonthOfYear
:
null
,
MonthOfYear
:
null
,
WeekOfMonth
:
null
,
WeekOfMonth
:
null
,
...
@@ -148,17 +144,18 @@ const VisibleIISAgentConfig = props => {
...
@@ -148,17 +144,18 @@ const VisibleIISAgentConfig = props => {
AllowLog
:
fv
.
enable_log
,
AllowLog
:
fv
.
enable_log
,
Enabled
:
isUse
,
Enabled
:
isUse
,
Timeout
:
fv
.
time_out
?
parseInt
(
fv
.
time_out
)
:
30
,
Timeout
:
fv
.
time_out
?
parseInt
(
fv
.
time_out
)
:
30
,
Absolute
:
tru
e
,
Absolute
:
fv
.
url_typ
e
,
SiteInfo
:
null
,
SiteInfo
:
null
,
Name
:
fv
.
name
,
Name
:
fv
.
name
,
Tolerate
:
null
,
Tolerate
:
null
,
UseTimeout
:
waitCheck
UseTimeout
:
waitCheck
}
}
fv
.
time_out
?
data
.
MillisecondsTimeout
=
parseInt
(
fv
.
time_out
)
:
''
fv
.
time_out
?
data
.
MillisecondsTimeout
=
parseInt
(
fv
.
time_out
)
:
''
onIISAgentSubmit
&&
onIISAgentSubmit
(
setPreviewVisible
(
false
)
await
onIISAgentSubmit
&&
onIISAgentSubmit
(
data
data
)
)
setPreviewVisible
(
false
)
}
}
const
handleClick
=
()
=>
{
const
handleClick
=
()
=>
{
if
(
value
)
{
if
(
value
)
{
...
@@ -233,18 +230,22 @@ const VisibleIISAgentConfig = props => {
...
@@ -233,18 +230,22 @@ const VisibleIISAgentConfig = props => {
setIsUse
(
value
)
setIsUse
(
value
)
}
}
const
handleExe
=
(
e
)
=>
{
const
handleExe
=
(
e
)
=>
{
let
obj
=
form
.
getFieldValue
()
let
value
=
e
.
target
.
value
let
value
=
e
.
target
.
value
setIsType
(
value
)
setIsType
(
value
)
if
(
value
===
'执行一次'
)
{
if
(
value
===
'执行一次'
)
{
changeLoopMode
(
'ByOnce'
)
changeLoopMode
(
'ByOnce'
)
setLoop_unit
(
'Second'
)
form
.
setFieldsValue
({
form
.
setFieldsValue
({
loop_mode
:
'ByOnce'
,
loop_mode
:
'ByOnce'
,
hour_of_day
:
''
,
hour_of_day
:
''
,
day_of_week
:
''
day_of_week
:
''
,
end_time
:
obj
.
start_time
})
})
if
(
!
agentConfig
)
{
if
(
!
agentConfig
)
{
form
.
setFieldsValue
({
form
.
setFieldsValue
({
start_time
:
moment
(
new
Date
(
new
Date
().
toLocaleDateString
()),
'YYYY-MM-DD 00:00:00'
).
add
(
1
,
'days'
)
start_time
:
moment
(
new
Date
(
new
Date
().
toLocaleDateString
()),
'YYYY-MM-DD 00:00:00'
).
add
(
1
,
'days'
),
end_time
:
moment
(
new
Date
(
new
Date
().
toLocaleDateString
()),
'YYYY-MM-DD 00:00:00'
).
add
(
1
,
'days'
)
})
})
setExeTime
(
moment
().
add
(
1
,
'days'
).
format
(
'YYYY-MM-DD 00:00:00'
))
setExeTime
(
moment
().
add
(
1
,
'days'
).
format
(
'YYYY-MM-DD 00:00:00'
))
}
}
...
@@ -253,7 +254,8 @@ const VisibleIISAgentConfig = props => {
...
@@ -253,7 +254,8 @@ const VisibleIISAgentConfig = props => {
changeLoopMode
(
'BYLOOP'
)
changeLoopMode
(
'BYLOOP'
)
setExeType
(
true
)
setExeType
(
true
)
form
.
setFieldsValue
({
form
.
setFieldsValue
({
loop_mode
:
'BYLOOP'
loop_mode
:
'BYLOOP'
,
end_time
:
''
})
})
if
(
!
agentConfig
)
{
if
(
!
agentConfig
)
{
form
.
setFieldsValue
({
form
.
setFieldsValue
({
...
@@ -279,6 +281,12 @@ const VisibleIISAgentConfig = props => {
...
@@ -279,6 +281,12 @@ const VisibleIISAgentConfig = props => {
}
}
const
changeStartTime
=
(
e
)
=>
{
const
changeStartTime
=
(
e
)
=>
{
setExeTime
(
moment
(
e
).
format
(
'YYYY-MM-DD HH:mm:ss'
))
setExeTime
(
moment
(
e
).
format
(
'YYYY-MM-DD HH:mm:ss'
))
let
obj
=
form
.
getFieldValue
()
if
(
obj
.
loop_mode
===
'ByOnce'
)
setLoop_unit
(
'Second'
)
form
.
setFieldsValue
({
end_time
:
moment
(
e
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
})
}
}
const
changeDay
=
(
data
)
=>
{
const
changeDay
=
(
data
)
=>
{
console
.
log
(
'data'
,
data
);
console
.
log
(
'data'
,
data
);
...
@@ -305,7 +313,6 @@ const VisibleIISAgentConfig = props => {
...
@@ -305,7 +313,6 @@ const VisibleIISAgentConfig = props => {
visible=
{
previewVisible
}
visible=
{
previewVisible
}
onOk=
{
()
=>
handleOk
()
}
onOk=
{
()
=>
handleOk
()
}
confirmLoading=
{
loading
}
confirmLoading=
{
loading
}
visible=
{
previewVisible
}
onCancel=
{
handleCancel
}
onCancel=
{
handleCancel
}
>
>
...
...
src/pages/platformCenter/messageManage/templateManage/TemplateManage.jsx
View file @
80345082
...
@@ -9,9 +9,10 @@ import {
...
@@ -9,9 +9,10 @@ import {
Popconfirm
,
Popconfirm
,
message
,
message
,
Tooltip
,
Tooltip
,
notification
notification
,
Spin
}
from
'antd'
;
}
from
'antd'
;
import
{
PlusCircleOutlined
,
EditTwoTone
,
DeleteOutlined
}
from
'@ant-design/icons'
;
import
{
PlusCircleOutlined
,
EditTwoTone
,
DeleteOutlined
}
from
'@ant-design/icons'
;
const
{
Search
}
=
Input
;
const
{
Search
}
=
Input
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
...
@@ -35,9 +36,9 @@ const TemplateManage = () => {
...
@@ -35,9 +36,9 @@ const TemplateManage = () => {
});
});
const
[
currentTemplate
,
setCurrentTempalte
]
=
useState
({});
const
[
currentTemplate
,
setCurrentTempalte
]
=
useState
({});
const
[
data
,
setData
]
=
useState
([])
const
[
data
,
setData
]
=
useState
([])
const
[
flag
,
setFlag
]
=
useState
(
0
)
const
[
flag
,
setFlag
]
=
useState
(
0
)
const
[
option
,
setOption
]
=
useState
([]);
// 下拉列表数据
const
[
option
,
setOption
]
=
useState
([]);
// 下拉列表数据
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
useEffect
(()
=>
{
useEffect
(()
=>
{
getTemplateList
()
getTemplateList
()
...
@@ -45,18 +46,20 @@ const TemplateManage = () => {
...
@@ -45,18 +46,20 @@ const TemplateManage = () => {
},
[
flag
])
},
[
flag
])
const
getTemplateList
=
(
obj
)
=>
{
const
getTemplateList
=
(
obj
)
=>
{
setTreeLoading
(
true
)
GetMessageTemplate
(
obj
).
then
(
GetMessageTemplate
(
obj
).
then
(
res
=>
{
res
=>
{
setTreeLoading
(
false
)
let
list
=
[]
let
list
=
[]
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
res
.
data
.
map
((
item
,
index
)
=>
{
res
.
data
.
map
((
item
,
index
)
=>
{
list
.
push
({
list
.
push
({
key
:
item
.
Id
,
key
:
item
.
Id
,
Id
:
item
.
Id
,
Id
:
item
.
Id
,
name
:
item
.
LikeName
,
name
:
item
.
LikeName
,
type
:
item
.
Type
,
type
:
item
.
Type
,
third_name
:
item
.
Name
,
third_name
:
item
.
Name
,
third_id
:
item
.
No
,
third_id
:
item
.
No
,
template_params
:
item
.
TDescription
,
template_params
:
item
.
TDescription
,
analysis_params
:
item
.
ParsingRules
,
analysis_params
:
item
.
ParsingRules
,
desc
:
item
.
ParsingDescription
desc
:
item
.
ParsingDescription
...
@@ -65,12 +68,14 @@ const TemplateManage = () => {
...
@@ -65,12 +68,14 @@ const TemplateManage = () => {
setData
(
list
)
setData
(
list
)
}
}
}
}
)
).
catch
(
e
=>
{
setTreeLoading
(
false
)
})
}
}
const
selectFocus
=
(
obj
)
=>
{
const
selectFocus
=
(
obj
)
=>
{
GetThirdpartyTemplates
(
obj
).
then
(
res
=>
{
GetThirdpartyTemplates
(
obj
).
then
(
res
=>
{
if
(
res
.
msg
===
"Ok"
)
{
if
(
res
.
msg
===
"Ok"
)
{
setOption
(
res
.
data
);
setOption
(
res
.
data
);
}
else
{
}
else
{
notification
.
error
({
notification
.
error
({
...
@@ -90,57 +95,57 @@ const TemplateManage = () => {
...
@@ -90,57 +95,57 @@ const TemplateManage = () => {
title
:
'编号'
,
title
:
'编号'
,
dataIndex
:
'Id'
,
dataIndex
:
'Id'
,
key
:
'Id'
,
key
:
'Id'
,
align
:
'center'
,
align
:
'center'
,
width
:
80
,
width
:
80
,
render
:
text
=>
<
a
>
{
text
}
</
a
>,
render
:
text
=>
<
a
>
{
text
}
</
a
>,
},
},
{
{
title
:
'模板名称'
,
title
:
'模板名称'
,
dataIndex
:
'name'
,
dataIndex
:
'name'
,
key
:
'name'
,
key
:
'name'
,
align
:
'center'
,
align
:
'center'
,
},
},
{
{
title
:
'模板类型'
,
title
:
'模板类型'
,
dataIndex
:
'type'
,
dataIndex
:
'type'
,
key
:
'type'
,
key
:
'type'
,
align
:
'center'
,
align
:
'center'
,
},
},
{
{
title
:
'第三方模板名称'
,
title
:
'第三方模板名称'
,
dataIndex
:
'third_name'
,
dataIndex
:
'third_name'
,
key
:
'third_name'
,
key
:
'third_name'
,
align
:
'center'
,
align
:
'center'
,
},
},
{
{
title
:
'第三方模版编号'
,
title
:
'第三方模版编号'
,
dataIndex
:
'third_id'
,
dataIndex
:
'third_id'
,
key
:
'third_id'
,
key
:
'third_id'
,
align
:
'center'
,
align
:
'center'
,
},
},
{
{
title
:
'模板参数'
,
title
:
'模板参数'
,
dataIndex
:
'template_params'
,
dataIndex
:
'template_params'
,
key
:
'template_params'
,
key
:
'template_params'
,
align
:
'center'
,
align
:
'center'
,
},
},
{
{
title
:
'模板参数说明'
,
title
:
'模板参数说明'
,
dataIndex
:
'desc'
,
dataIndex
:
'desc'
,
key
:
'desc'
,
key
:
'desc'
,
align
:
'center'
,
align
:
'center'
,
},
},
{
{
title
:
'解析参数'
,
title
:
'解析参数'
,
dataIndex
:
'analysis_params'
,
dataIndex
:
'analysis_params'
,
key
:
'analysis_params'
,
key
:
'analysis_params'
,
align
:
'center'
,
align
:
'center'
,
},
},
{
{
title
:
'操作'
,
title
:
'操作'
,
dataIndex
:
'action'
,
dataIndex
:
'action'
,
key
:
'action'
,
key
:
'action'
,
align
:
'center'
,
align
:
'center'
,
width
:
150
,
width
:
150
,
ellipsis
:
true
,
ellipsis
:
true
,
render
:
(
text
,
record
)
=>
(
render
:
(
text
,
record
)
=>
(
...
@@ -166,7 +171,7 @@ const TemplateManage = () => {
...
@@ -166,7 +171,7 @@ const TemplateManage = () => {
delTemplate
(
record
);
delTemplate
(
record
);
}
}
}
}
>
>
<
DeleteOutlined
style=
{
{
fontSize
:
'16px'
,
color
:
'#e86060'
}
}
/>
<
DeleteOutlined
style=
{
{
fontSize
:
'16px'
,
color
:
'#e86060'
}
}
/>
</
Popconfirm
>
</
Popconfirm
>
</
div
>
</
div
>
</
Tooltip
>
</
Tooltip
>
...
@@ -191,22 +196,21 @@ const TemplateManage = () => {
...
@@ -191,22 +196,21 @@ const TemplateManage = () => {
}
}
}
}
const
changeDesc
=
(
record
)
=>
{
const
changeDesc
=
(
record
)
=>
{
setCurrentTempalte
(
record
)
setCurrentTempalte
(
record
)
handleShowModal
(
"editVisible"
,
true
)
handleShowModal
(
"editVisible"
,
true
)
}
}
const
AddTemplate
=
()
=>
{
const
AddTemplate
=
()
=>
{
handleShowModal
(
"addVisible"
,
true
)
handleShowModal
(
"addVisible"
,
true
)
}
}
const
delTemplate
=
(
record
)
=>
{
const
delTemplate
=
(
record
)
=>
{
DeleteMessageTemplate
({
DeleteMessageTemplate
({
id
:
record
.
Id
id
:
record
.
Id
}).
then
(
}).
then
(
res
=>
{
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
message
.
success
(
"模板删除成功!"
)
message
.
success
(
"模板删除成功!"
)
setFlag
(
flag
+
1
)
setFlag
(
flag
+
1
)
}
else
{
}
else
{
message
.
warn
(
"模板删除失败!"
)
message
.
warn
(
"模板删除失败!"
)
}
}
}
}
...
@@ -221,23 +225,22 @@ const TemplateManage = () => {
...
@@ -221,23 +225,22 @@ const TemplateManage = () => {
handleShowModal
(
"editVisible"
,
false
)
handleShowModal
(
"editVisible"
,
false
)
}
}
const
onSubmit
=
(
result
)
=>
{
const
onSubmit
=
(
result
)
=>
{
console
.
log
(
result
)
UpdateMessageTemplate
({
UpdateMessageTemplate
({
Id
:
result
.
Id
,
Id
:
result
.
Id
,
Type
:
result
.
type
,
Type
:
result
.
type
,
LikeName
:
result
.
name
,
LikeName
:
result
.
name
,
Name
:
result
.
third_name
,
Name
:
result
.
third_name
,
No
:
result
.
third_id
,
No
:
result
.
third_id
,
ParsingRules
:
result
.
analysis_params
,
ParsingRules
:
result
.
analysis_params
,
ParsingDescription
:
result
.
desc
,
ParsingDescription
:
result
.
desc
,
TDescription
:
result
.
params
TDescription
:
result
.
params
}).
then
(
}).
then
(
res
=>
{
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
message
.
success
(
"模板保存成功!"
)
message
.
success
(
"模板保存成功!"
)
handleShowModal
(
"editVisible"
,
false
)
handleShowModal
(
"editVisible"
,
false
)
setFlag
(
flag
+
1
)
setFlag
(
flag
+
1
)
}
else
{
}
else
{
message
.
warn
(
"模板保存失败!"
)
message
.
warn
(
"模板保存失败!"
)
}
}
}
}
...
@@ -249,20 +252,20 @@ const TemplateManage = () => {
...
@@ -249,20 +252,20 @@ const TemplateManage = () => {
}
}
const
onAddSubmit
=
(
result
)
=>
{
const
onAddSubmit
=
(
result
)
=>
{
InsertMessageTemplate
({
InsertMessageTemplate
({
Type
:
result
.
type
,
Type
:
result
.
type
,
LikeName
:
result
.
name
,
LikeName
:
result
.
name
,
Name
:
result
.
third_name
,
Name
:
result
.
third_name
,
No
:
result
.
third_id
,
No
:
result
.
third_id
,
ParsingRules
:
result
.
analysis_params
,
ParsingRules
:
result
.
analysis_params
,
ParsingDescription
:
result
.
desc
,
ParsingDescription
:
result
.
desc
,
TDescription
:
result
.
params
TDescription
:
result
.
params
}).
then
(
}).
then
(
res
=>
{
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
message
.
success
(
"模板添加成功!"
)
message
.
success
(
"模板添加成功!"
)
handleShowModal
(
"addVisible"
,
false
)
handleShowModal
(
"addVisible"
,
false
)
setFlag
(
flag
+
1
)
setFlag
(
flag
+
1
)
}
else
{
}
else
{
message
.
warn
(
"模板添加失败!"
)
message
.
warn
(
"模板添加失败!"
)
}
}
}
}
...
@@ -271,6 +274,7 @@ const TemplateManage = () => {
...
@@ -271,6 +274,7 @@ const TemplateManage = () => {
return
(
return
(
<
div
className=
{
styles
.
template_container
}
>
<
div
className=
{
styles
.
template_container
}
>
<
Spin
tip=
"loading..."
spinning=
{
treeLoading
}
>
<
div
className=
{
styles
.
operate_bar
}
>
<
div
className=
{
styles
.
operate_bar
}
>
<
div
className=
{
styles
.
template_type
}
>
<
div
className=
{
styles
.
template_type
}
>
<
div
className=
{
styles
.
title
}
>
模板类型
</
div
>
<
div
className=
{
styles
.
title
}
>
模板类型
</
div
>
...
@@ -295,7 +299,7 @@ const TemplateManage = () => {
...
@@ -295,7 +299,7 @@ const TemplateManage = () => {
</
div
>
</
div
>
<
Button
type=
"primary"
onClick=
{
handleReset
}
>
重置
</
Button
>
<
Button
type=
"primary"
onClick=
{
handleReset
}
>
重置
</
Button
>
<
Button
type=
"primary"
style=
{
{
marginLeft
:
"10px"
}
}
icon=
{
<
PlusCircleOutlined
style=
{
{
verticalAlign
:
"middle"
}
}
/>
}
onClick=
{
AddTemplate
}
><
span
style=
{
{
marginTop
:
"-3px"
}
}
>
新增
</
span
></
Button
>
<
Button
type=
"primary"
style=
{
{
marginLeft
:
"10px"
}
}
icon=
{
<
PlusCircleOutlined
style=
{
{
verticalAlign
:
"middle"
}
}
/>
}
onClick=
{
AddTemplate
}
><
span
style=
{
{
marginTop
:
"-3px"
}
}
>
新增
</
span
></
Button
>
</
div
>
</
div
>
<
div
className=
{
styles
.
list_view
}
>
<
div
className=
{
styles
.
list_view
}
>
...
@@ -313,7 +317,7 @@ const TemplateManage = () => {
...
@@ -313,7 +317,7 @@ const TemplateManage = () => {
onCancel=
{
()
=>
handleShowModal
(
'editVisible'
,
false
)
}
onCancel=
{
()
=>
handleShowModal
(
'editVisible'
,
false
)
}
option=
{
option
}
option=
{
option
}
confirmModal=
{
editModal
}
confirmModal=
{
editModal
}
onSubmit=
{
onSubmit
}
onSubmit=
{
onSubmit
}
/>
/>
<
AddModal
<
AddModal
visible=
{
visibleParams
.
addVisible
}
visible=
{
visibleParams
.
addVisible
}
...
@@ -321,9 +325,9 @@ const TemplateManage = () => {
...
@@ -321,9 +325,9 @@ const TemplateManage = () => {
onCancel=
{
()
=>
handleShowModal
(
'addVisible'
,
false
)
}
onCancel=
{
()
=>
handleShowModal
(
'addVisible'
,
false
)
}
option=
{
option
}
option=
{
option
}
confirmModal=
{
addModal
}
confirmModal=
{
addModal
}
onSubmit=
{
onAddSubmit
}
onSubmit=
{
onAddSubmit
}
/>
/>
</
Spin
>
</
div
>
</
div
>
)
)
}
}
...
...
src/pages/platformCenter/messageManage/templateManage/components/AddModal.jsx
View file @
80345082
...
@@ -21,7 +21,6 @@ const AddModal = props => {
...
@@ -21,7 +21,6 @@ const AddModal = props => {
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
option
)
{
if
(
option
)
{
console
.
log
(
'option'
,
option
);
setTemplateName
(
option
.
filter
(
item
=>
item
.
Type
===
'公众号'
))
setTemplateName
(
option
.
filter
(
item
=>
item
.
Type
===
'公众号'
))
form
.
setFieldsValue
({
form
.
setFieldsValue
({
type
:
'公众号'
type
:
'公众号'
...
@@ -151,7 +150,7 @@ const AddModal = props => {
...
@@ -151,7 +150,7 @@ const AddModal = props => {
<
Item
<
Item
label=
"模板参数"
label=
"模板参数"
labelCol=
{
{
span
:
6
}
}
name=
"params"
name=
"params"
rules=
{
[
rules=
{
[
{
{
...
@@ -160,11 +159,12 @@ const AddModal = props => {
...
@@ -160,11 +159,12 @@ const AddModal = props => {
},
},
]
}
]
}
>
>
<
TextArea
rows=
{
4
}
placeholder=
"first|Second|Third|Four"
/>
<
TextArea
rows=
{
4
}
style=
{
{
width
:
'96%'
}
}
placeholder=
"first|Second|Third|Four"
/>
</
Item
>
</
Item
>
<
Item
<
Item
label=
"参数说明"
label=
"参数说明"
name=
"desc"
name=
"desc"
labelCol=
{
{
span
:
6
}
}
rules=
{
[
rules=
{
[
{
{
required
:
true
,
required
:
true
,
...
@@ -172,11 +172,12 @@ const AddModal = props => {
...
@@ -172,11 +172,12 @@ const AddModal = props => {
},
},
]
}
]
}
>
>
<
TextArea
rows=
{
4
}
placeholder=
"first: 标题信息|Second: 展示内容|Third: 时间|Four: 备注信息"
/>
<
TextArea
style=
{
{
width
:
'96%'
}
}
rows=
{
4
}
placeholder=
"first: 标题信息|Second: 展示内容|Third: 时间|Four: 备注信息"
/>
</
Item
>
</
Item
>
<
Item
<
Item
label=
"参数解析"
label=
"参数解析"
name=
"analysis_params"
name=
"analysis_params"
labelCol=
{
{
span
:
6
}
}
rules=
{
[
rules=
{
[
{
{
required
:
true
,
required
:
true
,
...
@@ -184,7 +185,7 @@ const AddModal = props => {
...
@@ -184,7 +185,7 @@ const AddModal = props => {
},
},
]
}
]
}
>
>
<
TextArea
rows=
{
4
}
placeholder=
"param1|param2|param3|param4"
/>
<
TextArea
rows=
{
4
}
style=
{
{
width
:
'96%'
}
}
placeholder=
"param1|param2|param3|param4"
/>
</
Item
>
</
Item
>
</
Form
>
</
Form
>
</
div
>
</
div
>
...
...
src/pages/platformCenter/messageManage/templateManage/components/EditModal.jsx
View file @
80345082
...
@@ -9,6 +9,7 @@ const EditModal = props => {
...
@@ -9,6 +9,7 @@ const EditModal = props => {
const
{
option
}
=
props
;
const
{
option
}
=
props
;
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
[
templateName
,
setTemplateName
]
=
useState
([]);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
onSubmit
=
()
=>
{
const
onSubmit
=
()
=>
{
form
.
submit
()
form
.
submit
()
...
@@ -30,6 +31,9 @@ const EditModal = props => {
...
@@ -30,6 +31,9 @@ const EditModal = props => {
desc
:
props
.
template
.
desc
,
desc
:
props
.
template
.
desc
,
analysis_params
:
props
.
template
.
analysis_params
,
analysis_params
:
props
.
template
.
analysis_params
,
})
})
if
(
option
)
{
setTemplateName
(
option
.
filter
(
item
=>
item
.
Type
===
props
.
template
.
type
))
}
},
[
props
.
template
])
},
[
props
.
template
])
const
layout
=
{
const
layout
=
{
...
@@ -42,13 +46,17 @@ const EditModal = props => {
...
@@ -42,13 +46,17 @@ const EditModal = props => {
},
},
};
};
const
onChange
=
value
=>
{
const
onChangeType
=
(
value
)
=>
{
const
{
length
}
=
value
;
console
.
log
(
option
.
filter
(
item
=>
item
.
Type
===
value
),
'123'
);
setTemplateName
(
option
.
filter
(
item
=>
item
.
Type
===
value
))
}
const
onChange
=
(
value
,
option
)
=>
{
form
.
setFieldsValue
({
form
.
setFieldsValue
({
dbName
:
value
[
length
-
1
],
third_id
:
option
.
code
})
;
})
};
// setTemplateName(option.filter(item => item.Type === value))
};
return
(
return
(
<
SiteModal
<
SiteModal
{
...
props
}
{
...
props
}
...
@@ -90,7 +98,7 @@ const EditModal = props => {
...
@@ -90,7 +98,7 @@ const EditModal = props => {
},
},
]
}
]
}
>
>
<
Select
>
<
Select
onChange=
{
(
value
)
=>
onChangeType
(
value
)
}
>
<
Select
.
Option
value=
"公众号"
>
公众号
</
Select
.
Option
>
<
Select
.
Option
value=
"公众号"
>
公众号
</
Select
.
Option
>
<
Select
.
Option
value=
"短信"
>
短信
</
Select
.
Option
>
<
Select
.
Option
value=
"短信"
>
短信
</
Select
.
Option
>
</
Select
>
</
Select
>
...
@@ -112,17 +120,13 @@ const EditModal = props => {
...
@@ -112,17 +120,13 @@ const EditModal = props => {
{
/* <Input placeholder="请输入模板名称" /> */
}
{
/* <Input placeholder="请输入模板名称" /> */
}
<
Select
<
Select
placeholder=
"请选择模板名称"
placeholder=
"请选择模板名称"
// onFocus={() => {
onChange=
{
(
value
,
option
)
=>
onChange
(
value
,
option
)
}
// selectFocus();
// }}
onChange=
{
e
=>
{
onChange
(
e
);
}
}
>
>
{
option
&&
{
templateName
&&
option
.
length
>
0
&&
templateName
.
length
>
0
&&
option
.
map
((
item
,
index
)
=>
(
templateName
.
map
((
item
,
index
)
=>
(
<
Option
value=
{
item
.
Name
}
key=
{
item
.
Name
+
index
}
>
<
Option
value=
{
item
.
Name
}
key=
{
item
.
Name
+
index
}
code=
{
item
.
Code
}
>
{
item
.
Name
}
{
item
.
Name
}
</
Option
>
</
Option
>
))
}
))
}
...
@@ -154,7 +158,7 @@ const EditModal = props => {
...
@@ -154,7 +158,7 @@ const EditModal = props => {
<
Item
<
Item
label=
"模板参数"
label=
"模板参数"
name=
"params"
name=
"params"
labelCol=
"{span:10}"
labelCol=
{
{
span
:
3
}
}
style=
{
{
marginLeft
:
'1.4rem'
}
}
style=
{
{
marginLeft
:
'1.4rem'
}
}
rules=
{
[
rules=
{
[
{
{
...
@@ -176,7 +180,7 @@ const EditModal = props => {
...
@@ -176,7 +180,7 @@ const EditModal = props => {
<
Col
span=
{
23
}
>
<
Col
span=
{
23
}
>
<
Item
<
Item
label=
"参数说明"
label=
"参数说明"
labelCol=
"{span:10}"
labelCol=
{
{
span
:
3
}
}
style=
{
{
marginLeft
:
'1.4rem'
}
}
style=
{
{
marginLeft
:
'1.4rem'
}
}
name=
"desc"
name=
"desc"
rules=
{
[
rules=
{
[
...
@@ -199,7 +203,7 @@ const EditModal = props => {
...
@@ -199,7 +203,7 @@ const EditModal = props => {
<
Col
span=
{
23
}
>
<
Col
span=
{
23
}
>
<
Item
<
Item
label=
"参数解析"
label=
"参数解析"
labelCol=
"{span:10}"
labelCol=
{
{
span
:
3
}
}
style=
{
{
marginLeft
:
'1.4rem'
}
}
style=
{
{
marginLeft
:
'1.4rem'
}
}
name=
"analysis_params"
name=
"analysis_params"
rules=
{
[
rules=
{
[
...
...
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