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
2bdca006
Commit
2bdca006
authored
Nov 26, 2021
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改数据字典搜索状态编辑删除未保存搜索状态问题
parent
3cd24a36
Pipeline
#38903
skipped with stages
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1862 additions
and
1696 deletions
+1862
-1696
index.js
src/pages/dataCenter/dictionary/index.js
+57
-52
AppDic.js
src/pages/dataCenter/dictionary1/AppDic.js
+29
-31
WebDic.js
src/pages/dataCenter/dictionary1/WebDic.js
+1144
-1083
schemeDetail.jsx
src/pages/platformCenter/schemeDetail/schemeDetail.jsx
+628
-526
api.js
src/services/common/api.js
+4
-4
No files found.
src/pages/dataCenter/dictionary/index.js
View file @
2bdca006
/* eslint-disable react-hooks/rules-of-hooks */
/*
* @Description:
* @Description:
* @Author: leizhe
* @Date: 2021-05-27 16:31:05
* @LastEditTime: 2021-11-
02 11:41:28
* @LastEditTime: 2021-11-
26 16:43:17
* @LastEditors: leizhe
*/
import
React
,
{
useState
,
useEffect
}
from
'react'
;
...
...
@@ -20,7 +21,6 @@ import {
Button
,
Upload
,
Search
,
}
from
'antd'
;
import
PageContainer
from
'@/components/BasePageContainer'
;
import
{
...
...
@@ -31,21 +31,23 @@ import {
import
{
SearchDataDictionaryList
,
EditDataDictionary
,
DeleteDataDictionary
DeleteDataDictionary
,
}
from
'@/services/dataCenter/api'
;
import
styles
from
'./index.less'
;
import
{
useHistory
}
from
'react-router-dom'
;
import
styles
from
'./index.less'
;
const
dictionary
=
()
=>
{
const
[
searchData
,
setSearchData
]
=
useState
([]);
// 搜索框表格数据
// eslint-disable-next-line react-hooks/rules-of-hooks
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
false
);
const
[
searchWord
,
setSearchWord
]
=
useState
(
''
);
// 关键字
const
[
editVisible
,
setEditVisible
]
=
useState
(
false
);
//
编辑二级条目
const
[
editVisible1
,
setEditVisible1
]
=
useState
(
false
);
//
编辑一级条目
const
[
editVisible
,
setEditVisible
]
=
useState
(
false
);
//
编辑二级条目
const
[
editVisible1
,
setEditVisible1
]
=
useState
(
false
);
//
编辑一级条目
const
[
select
,
setSelect
]
=
useState
({});
// 当前选中条目,可以是一级/二级,修改/删除时设置
const
history
=
useHistory
();
const
[
editForm
]
=
Form
.
useForm
();
const
[
title
,
setTitle
]
=
useState
(
''
)
const
[
title
,
setTitle
]
=
useState
(
''
);
// eslint-disable-next-line no-shadow
const
{
Search
}
=
Input
;
const
columns2
=
[
...
...
@@ -104,12 +106,13 @@ const dictionary = () => {
onClick
=
{()
=>
{
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
||
record
.
parentID
===
null
)
{
setTitle
(
'确认删除一级目录数据,删除一级目录数据会将其二级目录子数据一起删除'
);
setTitle
(
'确认删除一级目录数据,删除一级目录数据会将其二级目录子数据一起删除'
,
);
}
else
{
setTitle
(
'确认删除二级条目数据'
);
}
}
}
}}
style
=
{{
fontSize
:
'16px'
,
margin
:
'0px 10px'
,
...
...
@@ -124,19 +127,19 @@ const dictionary = () => {
},
];
//修改
//
修改
const
submitEdit
=
()
=>
{
const
nodeName
=
editForm
.
getFieldValue
(
'nodeName'
);
const
nodeValue
=
editForm
.
getFieldValue
(
'nodeValue'
);
if
(
nodeName
)
{
EditDataDictionary
({
nodeID
:
select
.
nodeID
,
nodeName
:
nodeName
,
nodeValue
:
nodeValue
nodeName
,
nodeValue
,
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setEditVisible
(
false
);
sumbitSearch
()
sumbitSearch
()
;
// getData(select.parentID === '-1' ? null : select.parentID);
notification
.
success
({
message
:
'提交成功'
,
...
...
@@ -144,8 +147,6 @@ const dictionary = () => {
// if (flag1 === 1) {
// sumbitSearch()
// }
}
else
{
notification
.
error
({
message
:
'提交失败'
,
...
...
@@ -159,20 +160,20 @@ const dictionary = () => {
description
:
'名称不能为空'
,
});
}
}
}
;
const
submitEdit1
=
()
=>
{
const
nodeName
=
editForm
.
getFieldValue
(
'nodeName'
);
if
(
nodeName
)
{
EditDataDictionary
({
nodeID
:
select
.
nodeID
,
nodeName
:
nodeName
,
nodeValue
:
'-'
nodeName
,
nodeValue
:
'-'
,
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setEditVisible1
(
false
);
sumbitSearch
()
sumbitSearch
()
;
// getData(select.parentID === '-1' ? null : select.parentID);
notification
.
success
({
message
:
'提交成功'
,
});
...
...
@@ -192,7 +193,7 @@ const dictionary = () => {
description
:
'名称不能为空'
,
});
}
}
}
;
const
sumbitSearch
=
()
=>
{
SearchDataDictionaryList
({
key
:
searchWord
}).
then
(
res
=>
{
...
...
@@ -209,29 +210,30 @@ const dictionary = () => {
};
const
submitDelete
=
()
=>
{
console
.
log
(
select
)
console
.
log
(
select
)
;
DeleteDataDictionary
({
nodeID
:
select
.
nodeID
,
}).
then
(
res
=>
{
nodeID
:
select
.
nodeID
,
})
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
// if (flag1 === 1) {
// sumbitSearch()
// }
sumbitSearch
()
notification
.
success
({
message
:
'删除成功'
,
});
// if (flag1 === 1) {
// sumbitSearch()
// }
sumbitSearch
();
notification
.
success
({
message
:
'删除成功'
,
});
}
else
{
notification
.
error
({
message
:
'删除失败'
,
description
:
res
.
message
,
});
notification
.
error
({
message
:
'删除失败'
,
description
:
res
.
message
,
});
}
})
.
catch
(
err
=>
{
message
.
error
(
err
);
})
}
})
.
catch
(
err
=>
{
message
.
error
(
err
);
});
};
// 获取搜索框的值
const
handleSearch
=
e
=>
{
setSearchWord
(
e
.
target
.
value
);
...
...
@@ -246,7 +248,7 @@ const dictionary = () => {
};
const
back
=
()
=>
{
history
.
push
({
pathname
:
'/dataCenter/dictionary1'
pathname
:
'/dataCenter/dictionary1'
,
});
};
...
...
@@ -265,13 +267,17 @@ const dictionary = () => {
/
>
<
/div
>
<
div
className
=
{
styles
.
btn
}
>
<
Button
type
=
"primary"
icon
=
{
<
RollbackOutlined
/>
}
onClick
=
{()
=>
back
()}
>
<
Button
type
=
"primary"
icon
=
{
<
RollbackOutlined
/>
}
onClick
=
{()
=>
back
()}
>
返回
<
/Button
>
<
/div
>
<
/div
>
<
Table
size
=
'small'
size
=
"small"
bordered
key
=
""
columns
=
{
columns2
}
...
...
@@ -280,15 +286,14 @@ const dictionary = () => {
pagination
=
{
pagenation
}
onRow
=
{
record
=>
({
onClick
:
()
=>
{
setSelect
(
record
);
setSelect
(
record
);
},
})}
})}
/
>
<
/div
>
{
/*修改一级条目 */
}
{
/*
修改一级条目 */
}
<
Modal
title
=
{
'修改一级条目'
}
title
=
"修改一级条目"
visible
=
{
editVisible1
}
onOk
=
{
submitEdit1
}
onCancel
=
{()
=>
{
...
...
@@ -307,10 +312,10 @@ const dictionary = () => {
<
/Form.Item
>
<
/Form
>
<
/Modal
>
{
/*修改二级条目 */
}
{
/*
修改二级条目 */
}
<
Modal
title
=
{
'修改二级条目'
}
title
=
"修改二级条目"
visible
=
{
editVisible
}
onOk
=
{
submitEdit
}
onCancel
=
{()
=>
{
...
...
src/pages/dataCenter/dictionary1/AppDic.js
View file @
2bdca006
...
...
@@ -140,7 +140,7 @@ const AppDic = () => {
// message.error(err);
// });
GetKeyValue
({}).
then
(
resnew
=>
{
if
(
resnew
.
code
==
0
)
{
if
(
resnew
.
code
==
=
0
)
{
let
res
=
resnew
.
data
;
if
(
res
.
length
>
0
)
{
res
.
map
(
item
=>
{
...
...
@@ -152,6 +152,7 @@ const AppDic = () => {
}
else
{
notification
.
error
({
message
:
'获取失败'
,
// eslint-disable-next-line no-undef
description
:
res
.
msg
,
});
}
...
...
@@ -196,7 +197,7 @@ const AppDic = () => {
value
,
desc
:
description
,
}).
then
(
res
=>
{
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
=
0
)
{
setAddVisible
(
false
);
getData
();
notification
.
success
({
...
...
@@ -276,7 +277,7 @@ const AppDic = () => {
value
,
desc
:
description
,
}).
then
(
res
=>
{
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
=
0
)
{
setEditVisible
(
false
);
getData
();
notification
.
success
({
...
...
@@ -354,45 +355,42 @@ const AppDic = () => {
height
:
'calc(100vh-200px)'
,
display
:
'flex'
,
alignItems
:
'center'
,
justifyContent
:
'space-between'
justifyContent
:
'space-between'
,
}}
>
<
span
>
数据字典
<
/span
>
<
div
>
<
Tooltip
title
=
"添加"
>
<
PlusSquareOutlined
onClick
=
{()
=>
{
setAddVisible
(
true
);
addForm
.
resetFields
();
}}
style
=
{{
color
:
'#1890FF'
,
fontSize
:
'20px'
,
marginRight
:
'22px'
,
}}
/
>
<
/Tooltip
>
<
Popconfirm
title
=
"是否重置默认配置?"
okText
=
"确认"
cancelText
=
"取消"
onConfirm
=
{
submitReset
}
>
<
Tooltip
title
=
"还原"
>
<
SyncOutlined
<
Tooltip
title
=
"添加"
>
<
PlusSquareOutlined
onClick
=
{()
=>
{
setAddVisible
(
true
);
addForm
.
resetFields
();
}}
style
=
{{
color
:
'#1890FF'
,
fontSize
:
'20px'
,
marginRight
:
'
30
px'
,
marginRight
:
'
22
px'
,
}}
/
>
<
/Tooltip
>
<
/Popconfirm
>
<
Popconfirm
title
=
"是否重置默认配置?"
okText
=
"确认"
cancelText
=
"取消"
onConfirm
=
{
submitReset
}
>
<
Tooltip
title
=
"还原"
>
<
SyncOutlined
style
=
{{
color
:
'#1890FF'
,
fontSize
:
'20px'
,
marginRight
:
'30px'
,
}}
/
>
<
/Tooltip
>
<
/Popconfirm
>
<
/div
>
<
/div
>
<
Table
size
=
"small"
...
...
src/pages/dataCenter/dictionary1/WebDic.js
View file @
2bdca006
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Table
,
Tooltip
,
Spin
,
Modal
,
Form
,
Input
,
Space
,
Popconfirm
,
notification
,
message
,
Row
,
Col
,
Button
,
Upload
Table
,
Tooltip
,
Spin
,
Modal
,
Form
,
Input
,
Space
,
Popconfirm
,
notification
,
message
,
Row
,
Col
,
Button
,
Upload
,
}
from
'antd'
;
import
{
EditTwoTone
,
DeleteOutlined
,
CloudSyncOutlined
,
SearchOutlined
,
PlusSquareFilled
,
MinusCircleOutlined
,
PlusOutlined
,
LogoutOutlined
,
DownloadOutlined
,
UploadOutlined
,
SyncOutlined
}
from
'@ant-design/icons'
;
import
{
EditTwoTone
,
DeleteOutlined
,
PlusSquareFilled
,
MinusCircleOutlined
,
PlusOutlined
,
DownloadOutlined
,
UploadOutlined
,
SyncOutlined
,
}
from
'@ant-design/icons'
;
import
{
GetDataDictionaryList
,
EditDataDictionary
,
AddDataDictionary
,
DeleteDataDictionary
,
AddDataDictionaryList
,
SearchDataDictionaryList
,
ExportDataDictionary
,
ImportDataDictionary
,
DataDictionaryChangeOrder
}
from
'@/services/dataCenter/api'
import
{
GetDataDictionaryList
,
EditDataDictionary
,
AddDataDictionary
,
DeleteDataDictionary
,
AddDataDictionaryList
,
SearchDataDictionaryList
,
DataDictionaryChangeOrder
,
}
from
'@/services/dataCenter/api'
;
import
styles
from
'./WebDic.less'
;
import
{
useHistory
}
from
'react-router-dom'
;
import
{
useHistory
,
Link
}
from
'react-router-dom'
;
import
map
from
'@/pages/user/login/components/Login/map'
;
import
{
Link
}
from
'react-router-dom'
;
import
{
GetMetaData
}
from
'@/services/platform/gis'
;
import
DragTable
from
'@/components/DragTable/DragTable'
;
const
WebDic
=
()
=>
{
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
level
,
setLevel
]
=
useState
(
0
);
// 设置级别,一级1,二级2,添加条目时使用
const
[
data
,
setData
]
=
useState
([]);
// 一级条目数据
const
[
subData
,
setSubData
]
=
useState
([]);
// 二级条目数据
const
[
searchData
,
setSearchData
]
=
useState
([]);
// 搜索框表格数据
const
[
first
,
setFirst
]
=
useState
(
true
);
// 是否第一次加载
const
[
select
,
setSelect
]
=
useState
({});
// 当前选中条目,可以是一级/二级,修改/删除时设置
const
[
twoSelectColor
,
setTwoSelectColor
]
=
useState
({});
const
[
selectColor
,
setSelectColor
]
=
useState
({});
// 当前选中一级条目颜色,修改/删除时设置
const
[
selectID
,
setSelectID
]
=
useState
(
'-1'
);
// 当前选中一级条目的ID,添加二级条目时使用
const
[
addVisible
,
setAddVisible
]
=
useState
(
false
);
// 添加二级条目
const
[
addVisible1
,
setAddVisible1
]
=
useState
(
false
);
// 添加一级条目
const
[
addForm
]
=
Form
.
useForm
();
const
[
editVisible
,
setEditVisible
]
=
useState
(
false
);
// 编辑二级条目
const
[
editVisible1
,
setEditVisible1
]
=
useState
(
false
);
// 编辑一级条目
const
[
editForm
]
=
Form
.
useForm
();
const
[
searchVisible
,
setSearchVisible
]
=
useState
(
false
);
const
[
searchWord
,
setSearchWord
]
=
useState
(
''
);
// 关键字
const
{
Search
}
=
Input
;
const
[
files
,
setFiles
]
=
useState
(
''
);
const
[
flag
,
setFlag
]
=
useState
(
0
);
const
[
flag1
,
setFlag1
]
=
useState
(
0
);
// 搜索框数据是否刷新
const
[
isloading
,
setIsloading
]
=
useState
(
false
);
const
history
=
useHistory
();
const
[
showSearchStyle
,
setShowSearchStyle
]
=
useState
(
false
);
// 是否显示模糊查询样式
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
level
,
setLevel
]
=
useState
(
0
);
// 设置级别,一级1,二级2,添加条目时使用
const
[
data
,
setData
]
=
useState
([]);
// 一级条目数据
const
[
subData
,
setSubData
]
=
useState
([]);
// 二级条目数据
const
[
searchData
,
setSearchData
]
=
useState
([]);
// 搜索框表格数据
const
[
first
,
setFirst
]
=
useState
(
true
);
// 是否第一次加载
const
[
select
,
setSelect
]
=
useState
({});
// 当前选中条目,可以是一级/二级,修改/删除时设置
const
[
twoSelectColor
,
setTwoSelectColor
]
=
useState
({});
const
[
selectColor
,
setSelectColor
]
=
useState
({});
// 当前选中一级条目颜色,修改/删除时设置
const
[
selectID
,
setSelectID
]
=
useState
(
'-1'
);
// 当前选中一级条目的ID,添加二级条目时使用
const
[
addVisible
,
setAddVisible
]
=
useState
(
false
);
//添加二级条目
const
[
addVisible1
,
setAddVisible1
]
=
useState
(
false
);
//添加一级条目
const
[
addForm
]
=
Form
.
useForm
();
const
[
editVisible
,
setEditVisible
]
=
useState
(
false
);
//编辑二级条目
const
[
editVisible1
,
setEditVisible1
]
=
useState
(
false
);
//编辑一级条目
const
[
editForm
]
=
Form
.
useForm
();
const
[
searchVisible
,
setSearchVisible
]
=
useState
(
false
);
const
[
searchWord
,
setSearchWord
]
=
useState
(
''
);
// 关键字
const
{
Search
}
=
Input
;
const
[
files
,
setFiles
]
=
useState
(
''
);
const
[
flag
,
setFlag
]
=
useState
(
0
);
const
[
flag1
,
setFlag1
]
=
useState
(
0
);
//搜索框数据是否刷新
const
[
isloading
,
setIsloading
]
=
useState
(
false
)
const
history
=
useHistory
();
const
[
showSearchStyle
,
setShowSearchStyle
]
=
useState
(
false
);
// 是否显示模糊查询样式
const
[
orderTable
,
setOrderTable
]
=
useState
([]);
const
[
orderTable1
,
setOrderTable1
]
=
useState
([]);
const
[
fgg
,
setFgg
]
=
useState
(
0
);
const
[
InPutVisible
,
setInPutVisible
]
=
useState
(
false
);
const
[
InPutVisible
,
setInPutVisible
]
=
useState
(
false
);
const
columns
=
[
{
title
:
()
=>
(
<
span
className
=
{
styles
.
font
}
>
序号
<
/span>
)
,
key
:
'nodeID '
,
dataIndex
:
'nodeID'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
span
>
{(
index
+
1
)}
<
/span
>
<
/Space
>
),
width
:
60
,
align
:
'center'
},
{
title
:
()
=>
(
<
span
className
=
{
styles
.
font
}
>
名称
<
/span>
)
,
dataIndex
:
'nodeName'
,
key
:
'nodeName'
,
render
:
item
=>
searchStyle
(
item
),
},
{
title
:
()
=>
(
<
span
className
=
{
styles
.
font
}
>
操作
<
/span>
)
,
key
:
'action'
,
width
:
100
,
align
:
'center'
,
render
:
record
=>
(
<
Space
>
<
Tooltip
title
=
"编辑"
>
<
EditTwoTone
onClick
=
{()
=>
{
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelectColor
(
record
);
}
setEditVisible1
(
true
);
editForm
.
setFieldsValue
({
nodeName
:
record
.
nodeName
,
nodeValue
:
record
.
nodeValue
,
});
}}
style
=
{{
fontSize
:
'16px'
}}
/
>
<
/Tooltip
>
<
div
onClick
=
{
e
=>
e
.
stopPropagation
()}
>
<
Tooltip
title
=
"删除"
>
<
Popconfirm
title
=
"是否确认删除该数据,删除一级目录数据会将其二级目录子数据一起删除?"
okText
=
"确认"
cancelText
=
"取消"
onConfirm
=
{
submitDelete
}
>
<
DeleteOutlined
onClick
=
{()
=>
{
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelectColor
(
record
);
}
}
}
style
=
{{
fontSize
:
'16px'
,
margin
:
'0px 10px'
,
color
:
'#e86060'
,
}}
/
>
<
/Popconfirm
>
<
/Tooltip
>
<
/div
>
<
/Space
>
),
},
];
const
columns1
=
[
{
title
:
()
=>
(
<
span
className
=
{
styles
.
font
}
>
序号
<
/span>
)
,
dataIndex
:
'nodeID'
,
key
:
'nodeID'
,
width
:
60
,
align
:
'center'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
span
>
{(
index
+
1
)}
<
/span
>
<
/Space
>
),
},
{
title
:
()
=>
(
<
span
className
=
{
styles
.
font
}
>
名称
<
/span>
)
,
dataIndex
:
'nodeName'
,
key
:
'nodeName'
,
},
{
title
:
()
=>
(
<
span
className
=
{
styles
.
font
}
>
值
<
/span>
)
,
dataIndex
:
'nodeValue'
,
key
:
'nodeValue'
,
render
:
record
=>
{
if
(
!
record
)
{
return
'-'
;
const
columns
=
[
{
title
:
()
=>
<
span
className
=
{
styles
.
font
}
>
序号
<
/span>
,
key
:
'nodeID '
,
dataIndex
:
'nodeID'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
span
>
{
index
+
1
}
<
/span
>
<
/Space
>
),
width
:
60
,
align
:
'center'
,
},
{
title
:
()
=>
<
span
className
=
{
styles
.
font
}
>
名称
<
/span>
,
dataIndex
:
'nodeName'
,
key
:
'nodeName'
,
render
:
item
=>
searchStyle
(
item
),
},
{
title
:
()
=>
<
span
className
=
{
styles
.
font
}
>
操作
<
/span>
,
key
:
'action'
,
width
:
100
,
align
:
'center'
,
render
:
record
=>
(
<
Space
>
<
Tooltip
title
=
"编辑"
>
<
EditTwoTone
onClick
=
{()
=>
{
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelectColor
(
record
);
}
return
record
;
},
},
{
title
:
()
=>
(
<
span
className
=
{
styles
.
font
}
>
操作
<
/span>
)
,
key
:
'action'
,
width
:
100
,
align
:
'center'
,
render
:
record
=>
(
<
Space
>
<
Tooltip
title
=
"编辑"
>
<
EditTwoTone
onClick
=
{()
=>
{
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelectColor
(
record
);
}
setEditVisible
(
true
);
editForm
.
setFieldsValue
({
nodeName
:
record
.
nodeName
,
nodeValue
:
record
.
nodeValue
,
});
}}
style
=
{{
fontSize
:
'16px'
}}
/
>
<
/Tooltip
>
<
div
onClick
=
{
e
=>
e
.
stopPropagation
()}
>
<
Tooltip
title
=
"删除"
>
<
Popconfirm
title
=
"是否删除该数据?"
okText
=
"确认"
cancelText
=
"取消"
onConfirm
=
{
submitDelete
}
>
<
DeleteOutlined
onClick
=
{()
=>
{
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelectColor
(
record
);
}
}}
style
=
{{
fontSize
:
'16px'
,
margin
:
'0px 10px'
,
color
:
'#e86060'
,
}}
/
>
<
/Popconfirm
>
<
/Tooltip
>
<
/div
>
<
/Space
>
),
},
];
const
columns2
=
[
{
title
:
()
=>
(
<
span
className
=
{
styles
.
font
}
>
名称
<
/span>
)
,
dataIndex
:
'nodeName'
,
key
:
'nodeName'
,
},
{
title
:
()
=>
(
<
span
className
=
{
styles
.
font
}
>
值
<
/span>
)
,
dataIndex
:
'nodeValue'
,
width
:
400
,
key
:
'nodeValue'
,
render
:
record
=>
{
if
(
!
record
)
{
return
'-'
;
}
return
record
;
},
},
{
title
:
()
=>
(
<
span
className
=
{
styles
.
font
}
>
操作
<
/span>
)
,
key
:
'action'
,
width
:
100
,
align
:
'center'
,
render
:
record
=>
(
<
Space
>
<
Tooltip
title
=
"编辑"
>
<
EditTwoTone
onClick
=
{()
=>
{
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelectColor
(
record
);
}
if
(
record
.
parentID
===
'-1'
||
record
.
parentID
===
null
)
{
setEditVisible1
(
true
);
}
else
{
setEditVisible
(
true
);
}
editForm
.
setFieldsValue
({
nodeName
:
record
.
nodeName
,
nodeValue
:
record
.
nodeValue
,
});
}}
style
=
{{
fontSize
:
'16px'
}}
/
>
<
/Tooltip
>
<
div
onClick
=
{
e
=>
e
.
stopPropagation
()}
>
<
Tooltip
title
=
"删除"
>
<
Popconfirm
title
=
"是否确认删除该数据,删除一级目录数据会将其二级目录子数据一起删除?"
okText
=
"确认"
cancelText
=
"取消"
onConfirm
=
{
submitDelete
}
>
<
DeleteOutlined
onClick
=
{()
=>
{
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelectColor
(
record
);
}
}
}
style
=
{{
fontSize
:
'16px'
,
margin
:
'0px 10px'
,
color
:
'#e86060'
,
}}
/
>
<
/Popconfirm
>
<
/Tooltip
>
<
/div
>
<
/Space
>
),
}
]
setEditVisible1
(
true
);
editForm
.
setFieldsValue
({
nodeName
:
record
.
nodeName
,
nodeValue
:
record
.
nodeValue
,
});
}}
style
=
{{
fontSize
:
'16px'
}}
/
>
<
/Tooltip
>
<
div
onClick
=
{
e
=>
e
.
stopPropagation
()}
>
<
Tooltip
title
=
"删除"
>
<
Popconfirm
title
=
"是否确认删除该数据,删除一级目录数据会将其二级目录子数据一起删除?"
okText
=
"确认"
cancelText
=
"取消"
onConfirm
=
{
submitDelete
}
>
<
DeleteOutlined
onClick
=
{()
=>
{
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelectColor
(
record
);
}
}}
style
=
{{
fontSize
:
'16px'
,
margin
:
'0px 10px'
,
color
:
'#e86060'
,
}}
/
>
<
/Popconfirm
>
<
/Tooltip
>
<
/div
>
<
/Space
>
),
},
];
// 模糊查询匹配的样式
const
searchStyle
=
val
=>
{
let
n
;
if
(
showSearchStyle
)
{
n
=
val
.
replace
(
new
RegExp
(
searchWord
,
'g'
),
`<span style='color:red'>
${
searchWord
}
</span>`
,
);
}
else
{
n
=
val
;
const
columns1
=
[
{
title
:
()
=>
<
span
className
=
{
styles
.
font
}
>
序号
<
/span>
,
dataIndex
:
'nodeID'
,
key
:
'nodeID'
,
width
:
60
,
align
:
'center'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
>
<
span
>
{
index
+
1
}
<
/span
>
<
/Space
>
),
},
{
title
:
()
=>
<
span
className
=
{
styles
.
font
}
>
名称
<
/span>
,
dataIndex
:
'nodeName'
,
key
:
'nodeName'
,
},
{
title
:
()
=>
<
span
className
=
{
styles
.
font
}
>
值
<
/span>
,
dataIndex
:
'nodeValue'
,
key
:
'nodeValue'
,
render
:
record
=>
{
if
(
!
record
)
{
return
'-'
;
}
return
<
div
dangerouslySetInnerHTML
=
{{
__html
:
n
}}
/>
;
};
return
record
;
},
},
{
title
:
()
=>
<
span
className
=
{
styles
.
font
}
>
操作
<
/span>
,
key
:
'action'
,
width
:
100
,
align
:
'center'
,
render
:
record
=>
(
<
Space
>
<
Tooltip
title
=
"编辑"
>
<
EditTwoTone
onClick
=
{()
=>
{
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelectColor
(
record
);
}
setEditVisible
(
true
);
editForm
.
setFieldsValue
({
nodeName
:
record
.
nodeName
,
nodeValue
:
record
.
nodeValue
,
});
}}
style
=
{{
fontSize
:
'16px'
}}
/
>
<
/Tooltip
>
<
div
onClick
=
{
e
=>
e
.
stopPropagation
()}
>
<
Tooltip
title
=
"删除"
>
<
Popconfirm
title
=
"是否删除该数据?"
okText
=
"确认"
cancelText
=
"取消"
onConfirm
=
{
submitDelete
}
>
<
DeleteOutlined
onClick
=
{()
=>
{
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelectColor
(
record
);
}
}}
style
=
{{
fontSize
:
'16px'
,
margin
:
'0px 10px'
,
color
:
'#e86060'
,
}}
/
>
<
/Popconfirm
>
<
/Tooltip
>
<
/div
>
<
/Space
>
),
},
];
const
setRowClassName
=
record
=>
{
return
record
.
nodeID
===
selectColor
.
nodeID
?
styles
.
clickRowStyle
:
''
;
}
// const columns2 = [
// {
// title: () => <span className={styles.font}>名称</span>,
// dataIndex: 'nodeName',
// key: 'nodeName',
// },
// {
// title: () => <span className={styles.font}>值</span>,
// dataIndex: 'nodeValue',
// width: 400,
// key: 'nodeValue',
// render: record => {
// if (!record) {
// return '-';
// }
// return record;
// },
// },
// {
// title: () => <span className={styles.font}>操作</span>,
// key: 'action',
// width: 100,
// align: 'center',
// render: record => (
// <Space>
// <Tooltip title="编辑">
// <EditTwoTone
// onClick={() => {
// setSelect(record);
// if (record.parentID === '-1') {
// setSelectColor(record);
// }
// if (record.parentID === '-1' || record.parentID === null) {
// setEditVisible1(true);
// } else {
// setEditVisible(true);
// }
// editForm.setFieldsValue({
// nodeName: record.nodeName,
// nodeValue: record.nodeValue,
// });
// }}
// style={{ fontSize: '16px' }}
// />
// </Tooltip>
// <div onClick={e => e.stopPropagation()}>
// <Tooltip title="删除">
// <Popconfirm
// title="是否确认删除该数据,删除一级目录数据会将其二级目录子数据一起删除?"
// okText="确认"
// cancelText="取消"
// onConfirm={submitDelete}
// >
// <DeleteOutlined
// onClick={() => {
// setSelect(record);
// if (record.parentID === '-1') {
// setSelectColor(record);
// }
// }}
// style={{
// fontSize: '16px',
// margin: '0px 10px',
// color: '#e86060',
// }}
// />
// </Popconfirm>
// </Tooltip>
// </div>
// </Space>
// ),
// },
// ];
const
setRowClassName1
=
record
=>
{
return
record
.
nodeID
===
twoSelectColor
.
nodeID
?
styles
.
clickRowStyle
:
''
;
// 模糊查询匹配的样式
const
searchStyle
=
val
=>
{
let
n
;
if
(
showSearchStyle
)
{
n
=
val
.
replace
(
new
RegExp
(
searchWord
,
'g'
),
`<span style='color:red'>
${
searchWord
}
</span>`
,
);
}
else
{
n
=
val
;
}
return
<
div
dangerouslySetInnerHTML
=
{{
__html
:
n
}}
/>
;
};
// 获取搜索框的值
const
handleSearch
=
e
=>
{
setSearchWord
(
e
.
target
.
value
);
};
useEffect
(()
=>
{
getData
(
null
);
//首次加载可以为空
},
[
flag
]);
const
setRowClassName
=
record
=>
record
.
nodeID
===
selectColor
.
nodeID
?
styles
.
clickRowStyle
:
''
;
const
setRowClassName1
=
record
=>
record
.
nodeID
===
twoSelectColor
.
nodeID
?
styles
.
clickRowStyle
:
''
;
// const setOd = e => {
// setOrderTable(e)
// setFgg(fgg + 1)
// }
// 获取搜索框的值
const
handleSearch
=
e
=>
{
setSearchWord
(
e
.
target
.
value
);
};
// const setOd1 = e => {
// setOrderTable1(e)
// setFgg(fgg + 1)
// }
useEffect
(()
=>
{
getData
(
null
);
// 首次加载可以为空
},
[
flag
]);
// useEffect(() => {
// setOrderTable(data);
// setOrderTable1(subData);
// }, [fgg]);
// 根据orderTable值改变flowIDs
useEffect
(()
=>
{
let
ids
=
''
;
console
.
log
(
data
)
data
.
forEach
((
item
,
index
)
=>
{
if
(
index
===
data
.
length
-
1
)
{
ids
+=
`
${
item
.
nodeID
}
`
;
}
else
{
ids
+=
`
${
item
.
nodeID
}
,`
;
}
});
console
.
log
(
ids
)
let
bb
=
ids
.
split
(
","
)
console
.
log
(
bb
)
setLoading
(
true
)
DataDictionaryChangeOrder
(
bb
).
then
(
res
=>
{
setLoading
(
false
)
})
},
[
data
]);
useEffect
(()
=>
{
let
ids
=
''
;
console
.
log
(
subData
)
if
(
subData
!=
''
){
subData
.
forEach
((
item
,
index
)
=>
{
if
(
index
===
subData
.
length
-
1
)
{
ids
+=
`
${
item
.
nodeID
}
`
;
}
else
{
ids
+=
`
${
item
.
nodeID
}
,`
;
}
});
}
console
.
log
(
ids
)
let
bb
=
ids
.
split
(
","
)
console
.
log
(
bb
)
setIsloading
(
true
)
DataDictionaryChangeOrder
(
bb
).
then
(
res
=>
{
setIsloading
(
false
)
})
},
[
subData
]);
// 根据父节点nodeID(即parentID)获取子节点数据,一级条目parentID = -1
const
getData
=
value
=>
{
console
.
log
(
value
);
isLoadingShow
(
value
,
true
)
GetDataDictionaryList
({
nodeID
:
value
}).
then
(
resnew
=>
{
if
(
resnew
.
code
===
0
)
{
// if (resnew.data.length > 0) {
let
res
=
resnew
.
data
;
if
(
res
.
length
>
0
)
{
res
.
map
(
item
=>
{
item
.
key
=
item
.
nodeID
;
return
item
;
});
// const setOd = e => {
// setOrderTable(e)
// setFgg(fgg + 1)
// }
}
//是否首次加载
if
(
value
===
null
||
value
===
'-1'
)
{
setData
(
res
);
// setOd(res)
// const setOd1 = e => {
// setOrderTable1(e)
// setFgg(fgg + 1)
// }
console
.
log
(
res
)
console
.
log
(
first
)
if
(
first
)
{
setSelect
(
res
[
0
]);
// 默认当前选中一级条目第一条
setSelectColor
(
res
[
0
]);
setSelectID
(
res
[
0
].
nodeID
);
// 设置选中的一级条目ID,用于添加二级条目
setFirst
(
false
);
getData
(
res
[
0
].
nodeID
);
//拿到nodeID再次调用接口就回直接进入下面的循环,靠nodeID获取子节点二级条目
}
}
else
if
(
value
)
{
console
.
log
(
res
);
setSubData
(
res
);
//设置二级条目,res为空[]时也要设置
// setOd1(res)
}
isLoadingShow
(
value
,
false
)
// } else {
// console.log(3)
// isLoadingShow(value, false)
// }
}
else
{
isLoadingShow
(
value
,
false
)
notification
.
error
({
message
:
'获取失败'
,
description
:
resnew
.
msg
,
});
}
});
};
const
isLoadingShow
=
(
value
,
data
)
=>
{
if
(
!
value
||
value
==
-
1
)
{
setLoading
(
data
);
}
else
{
setIsloading
(
data
)
// useEffect(() => {
// setOrderTable(data);
// setOrderTable1(subData);
// }, [fgg]);
// 根据orderTable值改变flowIDs
useEffect
(()
=>
{
let
ids
=
''
;
console
.
log
(
data
);
data
.
forEach
((
item
,
index
)
=>
{
if
(
index
===
data
.
length
-
1
)
{
ids
+=
`
${
item
.
nodeID
}
`
;
}
else
{
ids
+=
`
${
item
.
nodeID
}
,`
;
}
});
console
.
log
(
ids
);
let
bb
=
ids
.
split
(
','
);
console
.
log
(
bb
);
setLoading
(
true
);
DataDictionaryChangeOrder
(
bb
).
then
(
res
=>
{
setLoading
(
false
);
});
},
[
data
]);
useEffect
(()
=>
{
let
ids
=
''
;
console
.
log
(
subData
);
if
(
subData
!==
''
)
{
subData
.
forEach
((
item
,
index
)
=>
{
if
(
index
===
subData
.
length
-
1
)
{
ids
+=
`
${
item
.
nodeID
}
`
;
}
else
{
ids
+=
`
${
item
.
nodeID
}
,`
;
}
});
}
// const onSearch = () => {
// setSearchVisible(true)
// setFlag1(1)
// }
const
onSearch
=
()
=>
{
history
.
push
({
pathname
:
'/dataCenter/dictionary'
console
.
log
(
ids
);
let
bb
=
ids
.
split
(
','
);
console
.
log
(
bb
);
setIsloading
(
true
);
DataDictionaryChangeOrder
(
bb
).
then
(
res
=>
{
setIsloading
(
false
);
});
},
[
subData
]);
// 根据父节点nodeID(即parentID)获取子节点数据,一级条目parentID = -1
const
getData
=
value
=>
{
console
.
log
(
value
);
isLoadingShow
(
value
,
true
);
GetDataDictionaryList
({
nodeID
:
value
}).
then
(
resnew
=>
{
if
(
resnew
.
code
===
0
)
{
// if (resnew.data.length > 0) {
let
res
=
resnew
.
data
;
if
(
res
.
length
>
0
)
{
res
.
map
(
item
=>
{
item
.
key
=
item
.
nodeID
;
return
item
;
});
}
// 是否首次加载
if
(
value
===
null
||
value
===
'-1'
)
{
setData
(
res
);
// setOd(res)
console
.
log
(
res
);
console
.
log
(
first
);
if
(
first
)
{
setSelect
(
res
[
0
]);
// 默认当前选中一级条目第一条
setSelectColor
(
res
[
0
]);
setSelectID
(
res
[
0
].
nodeID
);
// 设置选中的一级条目ID,用于添加二级条目
setFirst
(
false
);
getData
(
res
[
0
].
nodeID
);
// 拿到nodeID再次调用接口就回直接进入下面的循环,靠nodeID获取子节点二级条目
}
}
else
if
(
value
)
{
console
.
log
(
res
);
setSubData
(
res
);
// 设置二级条目,res为空[]时也要设置
// setOd1(res)
}
isLoadingShow
(
value
,
false
);
// } else {
// console.log(3)
// isLoadingShow(value, false)
// }
}
else
{
isLoadingShow
(
value
,
false
);
notification
.
error
({
message
:
'获取失败'
,
description
:
resnew
.
msg
,
});
}
});
};
// eslint-disable-next-line no-shadow
const
isLoadingShow
=
(
value
,
data
)
=>
{
if
(
!
value
||
value
===
-
1
)
{
setLoading
(
data
);
}
else
{
setIsloading
(
data
);
}
//搜索
const
sumbitSearch
=
()
=>
{
SearchDataDictionaryList
({
key
:
searchWord
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setSearchData
(
res
.
data
);
}
// else {
// notification.error({
// message: '提交失败',
// description: res.message,
// })
// }
})
}
const
resetSearch
=
()
=>
{
setFlag1
(
0
)
setSearchVisible
(
false
);
setSearchWord
(
''
);
// 搜索框置空
setSearchData
([]);
}
};
// const onSearch = () => {
// setSearchVisible(true)
// setFlag1(1)
// }
// const onSearch = () => {
// history.push({
// pathname: '/dataCenter/dictionary',
// });
// };
// 搜索
const
sumbitSearch
=
()
=>
{
SearchDataDictionaryList
({
key
:
searchWord
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setSearchData
(
res
.
data
);
}
// else {
// notification.error({
// message: '提交失败',
// description: res.message,
// })
// }
});
};
// const resetSearch = () => {
// setFlag1(0);
// setSearchVisible(false);
// setSearchWord(''); // 搜索框置空
// setSearchData([]);
// };
//
上传
// const submitInPut = () => {
// ImportDataDictionary({ file: files }).then((res) => {
// if (res.code === 0) {
// notification.success({
// message: '执行成功',
// });
// } else {
// notification.error({
// message: '执行失败',
// description: res.message,
// })
// }
// })
// }
//
上传
// const submitInPut = () => {
// ImportDataDictionary({ file: files }).then((res) => {
// if (res.code === 0) {
// notification.success({
// message: '执行成功',
// });
// } else {
// notification.error({
// message: '执行失败',
// description: res.message,
// })
// }
// })
// }
//
导出
// const submitOutPut = () => {
// ExportDataDictionary().then((res) => {
// notification.success({
// message: '执行成功',
// });
// })
// }
// const inPutOutPut = () => {
// setInPutOutPutVisible(true);
// }
//
导出
// const submitOutPut = () => {
// ExportDataDictionary().then((res) => {
// notification.success({
// message: '执行成功',
// });
// })
// }
// const inPutOutPut = () => {
// setInPutOutPutVisible(true);
// }
const
setItem
=
value
=>
{
setLevel
(
value
)
if
(
value
===
1
)
{
setAddVisible1
(
true
);
}
if
(
value
===
2
)
{
setAddVisible
(
true
);
}
addForm
.
resetFields
();
const
setItem
=
value
=>
{
setLevel
(
value
);
if
(
value
===
1
)
{
setAddVisible1
(
true
);
}
if
(
value
===
2
)
{
setAddVisible
(
true
);
}
addForm
.
resetFields
();
};
//添加二级条目
const
submitAdd
=
value
=>
{
console
.
log
(
value
)
if
(
value
.
length
===
0
)
{
notification
.
error
({
message
:
'提交失败'
,
description
:
'请先选择一级条目'
,
// 添加二级条目
const
submitAdd
=
value
=>
{
console
.
log
(
value
);
if
(
value
.
length
===
0
)
{
notification
.
error
({
message
:
'提交失败'
,
description
:
'请先选择一级条目'
,
});
}
else
{
const
nodeName1
=
addForm
.
getFieldsValue
();
const
nodeName
=
addForm
.
getFieldsValue
().
nodeName1
;
const
nodeValue
=
addForm
.
getFieldsValue
().
nodeValue1
;
console
.
log
(
nodeName1
);
console
.
log
(
nodeName
);
let
arr
=
[];
let
result
=
nodeName1
.
users
;
if
(
result
)
{
// eslint-disable-next-line array-callback-return
result
.
map
((
item
,
index
)
=>
{
if
(
item
)
{
arr
.
push
({
nodeName
:
item
.
nodeName
,
nodeValue
:
item
.
nodeValue
,
parentID
:
Number
(
value
),
});
}
});
}
arr
.
unshift
({
nodeName
,
nodeValue
,
parentID
:
Number
(
value
)
});
AddDataDictionaryList
([...
arr
]).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setAddVisible
(
false
);
getData
(
value
);
notification
.
success
({
message
:
'提交成功'
,
});
}
else
{
const
nodeName1
=
addForm
.
getFieldsValue
()
const
nodeName
=
addForm
.
getFieldsValue
().
nodeName1
;
const
nodeValue
=
addForm
.
getFieldsValue
().
nodeValue1
;
console
.
log
(
nodeName1
);
console
.
log
(
nodeName
);
let
arr
=
[]
let
result
=
nodeName1
.
users
if
(
result
)
{
result
.
map
((
item
,
index
)
=>
{
if
(
item
===
undefined
)
{
}
else
{
arr
.
push
({
nodeName
:
item
.
nodeName
,
nodeValue
:
item
.
nodeValue
,
parentID
:
Number
(
value
)
})
}
})
}
arr
.
unshift
({
nodeName
,
nodeValue
,
parentID
:
Number
(
value
)
})
AddDataDictionaryList
([...
arr
]).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setAddVisible
(
false
);
getData
(
value
);
notification
.
success
({
message
:
'提交成功'
,
});
}
else
{
notification
.
error
({
message
:
'提交失败'
,
description
:
res
.
msg
,
});
}
})
notification
.
error
({
message
:
'提交失败'
,
description
:
res
.
msg
,
});
}
});
}
//添加一级条目
const
submitAdd1
=
value
=>
{
const
nodeName
=
addForm
.
getFieldValue
(
'nodeName'
);
AddDataDictionary
({
nodeID
:
value
,
nodeName
:
nodeName
,
nodeValue
:
'-'
,
}).
then
(
res
=>
{
console
.
log
(
res
.
msg
)
if
(
res
.
code
===
0
)
{
setAddVisible1
(
false
);
getData
(
null
);
setSubData
(
res
.
msg
);
// res.message为添加成功返回的一级条目ID
// // 设置添加二级条目的父级ID及父级ID选中状态
setSelect
({
nodeID
:
res
.
msg
,
parentID
:
'-1'
});
setSelectID
(
res
.
msg
);
setSelectColor
({
nodeID
:
res
.
msg
});
};
// 添加一级条目
const
submitAdd1
=
value
=>
{
const
nodeName
=
addForm
.
getFieldValue
(
'nodeName'
);
AddDataDictionary
({
nodeID
:
value
,
nodeName
,
nodeValue
:
'-'
,
}).
then
(
res
=>
{
console
.
log
(
res
.
msg
);
if
(
res
.
code
===
0
)
{
setAddVisible1
(
false
);
getData
(
null
);
setSubData
(
res
.
msg
);
// res.message为添加成功返回的一级条目ID
// // 设置添加二级条目的父级ID及父级ID选中状态
setSelect
({
nodeID
:
res
.
msg
,
parentID
:
'-1'
});
setSelectID
(
res
.
msg
);
setSelectColor
({
nodeID
:
res
.
msg
});
notification
.
success
({
message
:
'提交成功'
,
});
}
else
{
notification
.
error
({
message
:
'提交失败'
,
description
:
res
.
msg
,
});
}
notification
.
success
({
message
:
'提交成功'
,
});
}
}
else
{
notification
.
error
({
message
:
'提交失败'
,
description
:
res
.
msg
,
});
}
});
};
//修改
const
submitEdit
=
()
=>
{
const
nodeName
=
editForm
.
getFieldValue
(
'nodeName'
);
const
nodeValue
=
editForm
.
getFieldValue
(
'nodeValue'
);
if
(
nodeName
)
{
EditDataDictionary
({
nodeID
:
select
.
nodeID
,
nodeName
:
nodeName
,
nodeValue
:
nodeValue
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setEditVisible
(
false
);
getData
(
select
.
parentID
===
'-1'
?
null
:
select
.
parentID
);
notification
.
success
({
message
:
'提交成功'
,
});
if
(
flag1
===
1
)
{
sumbitSearch
()
}
// 修改
const
submitEdit
=
()
=>
{
const
nodeName
=
editForm
.
getFieldValue
(
'nodeName'
);
const
nodeValue
=
editForm
.
getFieldValue
(
'nodeValue'
);
if
(
nodeName
)
{
EditDataDictionary
({
nodeID
:
select
.
nodeID
,
nodeName
,
nodeValue
,
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setEditVisible
(
false
);
getData
(
select
.
parentID
===
'-1'
?
null
:
select
.
parentID
);
}
else
{
notification
.
error
({
message
:
'提交失败'
,
description
:
res
.
msg
,
});
}
});
notification
.
success
({
message
:
'提交成功'
,
});
if
(
flag1
===
1
)
{
sumbitSearch
();
}
}
else
{
notification
.
error
({
message
:
'提交失败'
,
description
:
'名称不能为空'
,
});
notification
.
error
({
message
:
'提交失败'
,
description
:
res
.
msg
,
});
}
});
}
else
{
notification
.
error
({
message
:
'提交失败'
,
description
:
'名称不能为空'
,
});
}
const
submitEdit1
=
()
=>
{
const
nodeName
=
editForm
.
getFieldValue
(
'nodeName'
);
if
(
nodeName
)
{
EditDataDictionary
({
nodeID
:
select
.
nodeID
,
nodeName
:
nodeName
,
nodeValue
:
'-'
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setEditVisible1
(
false
);
getData
(
select
.
parentID
===
'-1'
?
null
:
select
.
parentID
);
notification
.
success
({
message
:
'提交成功'
,
});
if
(
flag1
===
1
)
{
sumbitSearch
()
}
}
else
{
notification
.
error
({
message
:
'提交失败'
,
description
:
res
.
msg
,
});
}
});
};
const
submitEdit1
=
()
=>
{
const
nodeName
=
editForm
.
getFieldValue
(
'nodeName'
);
if
(
nodeName
)
{
EditDataDictionary
({
nodeID
:
select
.
nodeID
,
nodeName
,
nodeValue
:
'-'
,
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setEditVisible1
(
false
);
if
(
flag1
===
0
)
{
getData
(
select
.
parentID
===
'-1'
?
null
:
select
.
parentID
);
}
else
{
submitSearchUser
();
}
notification
.
success
({
message
:
'提交成功'
,
});
if
(
flag1
===
1
)
{
sumbitSearch
();
}
}
else
{
notification
.
error
({
message
:
'提交失败'
,
description
:
'名称不能为空'
,
});
notification
.
error
({
message
:
'提交失败'
,
description
:
res
.
msg
,
});
}
});
}
else
{
notification
.
error
({
message
:
'提交失败'
,
description
:
'名称不能为空'
,
});
}
//删除
const
submitDelete
=
()
=>
{
DeleteDataDictionary
({
nodeID
:
select
.
nodeID
,
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
flag1
===
1
)
{
sumbitSearch
()
}
getData
(
select
.
parentID
===
'-1'
?
null
:
select
.
parentID
);
if
(
select
.
parentID
===
'-1'
)
{
setSubData
([]);
}
notification
.
success
({
message
:
'删除成功'
,
});
}
else
{
notification
.
error
({
message
:
'删除失败'
,
description
:
res
.
message
,
});
}
})
.
catch
(
err
=>
{
message
.
error
(
err
);
})
}
const
pagenation
=
{
showTotal
:
(
total
,
range
)
=>
`第
${
range
[
0
]}
-
${
range
[
1
]}
条/共
${
total
}
条`
,
pageSizeOptions
:
[
10
,
20
,
50
,
100
],
defaultPageSize
:
'20'
,
// showQuickJumper: true,
showSizeChanger
:
true
,
};
};
// 删除
const
submitDelete
=
()
=>
{
DeleteDataDictionary
({
nodeID
:
select
.
nodeID
,
})
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
flag1
===
0
)
{
getData
(
select
.
parentID
===
'-1'
?
null
:
select
.
parentID
);
}
else
{
submitSearchUser
();
}
if
(
select
.
parentID
===
'-1'
)
{
setSubData
([]);
}
notification
.
success
({
message
:
'删除成功'
,
});
}
else
{
notification
.
error
({
message
:
'删除失败'
,
description
:
res
.
message
,
});
}
})
.
catch
(
err
=>
{
message
.
error
(
err
);
});
};
const
pagenation
=
{
showTotal
:
(
total
,
range
)
=>
`第
${
range
[
0
]}
-
${
range
[
1
]}
条/共
${
total
}
条`
,
pageSizeOptions
:
[
10
,
20
,
50
,
100
],
defaultPageSize
:
'20'
,
// showQuickJumper: true,
showSizeChanger
:
true
,
};
const
props
=
{
name
:
'file'
,
action
:
`/PandaOMS/OMS/DataManger/ImportDataDictionary`
,
headers
:
{
authorization
:
'authorization-text'
,
},
beforeUpload
:
(
file
)
=>
{
console
.
log
(
'filee'
,
file
);
// setFiles(file.file)
},
onChange
(
info
)
{
console
.
log
(
info
,
'info'
);
setFiles
(
info
.
file
);
if
(
info
.
file
.
status
!==
'uploading'
)
{
console
.
log
(
info
.
file
,
info
.
fileList
);
}
if
(
info
.
file
.
status
===
'done'
)
{
console
.
log
(
1
);
message
.
success
(
`
${
info
.
file
.
name
}
导入成功`
);
setFirst
(
true
)
}
else
if
(
info
.
file
.
status
===
'error'
)
{
message
.
error
(
`
${
info
.
file
.
name
}
导入失败.`
);
}
},
};
const
props
=
{
name
:
'file'
,
action
:
`/PandaOMS/OMS/DataManger/ImportDataDictionary`
,
headers
:
{
authorization
:
'authorization-text'
,
},
beforeUpload
:
file
=>
{
console
.
log
(
'filee'
,
file
);
// setFiles(file.file)
},
onChange
(
info
)
{
console
.
log
(
info
,
'info'
);
setFiles
(
info
.
file
);
if
(
info
.
file
.
status
!==
'uploading'
)
{
console
.
log
(
info
.
file
,
info
.
fileList
);
}
if
(
info
.
file
.
status
===
'done'
)
{
console
.
log
(
1
);
message
.
success
(
`
${
info
.
file
.
name
}
导入成功`
);
setFirst
(
true
);
}
else
if
(
info
.
file
.
status
===
'error'
)
{
message
.
error
(
`
${
info
.
file
.
name
}
导入失败.`
);
}
},
};
const
input1
=
()
=>
{
setFlag
(
flag
+
1
)
setInPutVisible
(
false
);
}
const
submitInput
=
()
=>
{
setInPutVisible
(
true
);
}
const
submitSearchUser
=
()
=>
{
SearchDataDictionaryList
({
key
:
searchWord
,
type
:
1
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setShowSearchStyle
(
true
);
if
(
res
.
data
.
length
==
0
)
{
setData
(
res
.
data
)
setSubData
([])
}
else
{
setData
(
res
.
data
)
getData
(
res
.
data
[
0
].
nodeID
)
}
}
else
{
notification
.
error
({
message
:
'提交失败'
,
description
:
res
.
msg
,
})
}
})
}
const
handleReset
=
()
=>
{
setSearchWord
(
''
);
setLoading
(
true
)
setIsloading
(
true
)
GetDataDictionaryList
({
nodeID
:
null
}).
then
(
resnew
=>
{
if
(
resnew
.
code
===
0
)
{
setLoading
(
false
)
setIsloading
(
false
)
let
res
=
resnew
.
data
;
if
(
res
.
length
>
0
)
{
res
.
map
(
item
=>
{
item
.
key
=
item
.
nodeID
;
return
item
;
});
}
setData
(
res
);
setSelect
(
res
[
0
]);
// 默认当前选中一级条目第一条
setSelectColor
(
res
[
0
]);
setSelectID
(
res
[
0
].
nodeID
);
// 设置选中的一级条目ID,用于添加二级条目
getData
(
res
[
0
].
nodeID
);
//拿到nodeID再次调用接口就回直接进入下面的循环,靠nodeID获取子节点二级条目
setShowSearchStyle
(
false
);
}
setLoading
(
false
)
setIsloading
(
false
)
const
input1
=
()
=>
{
setFlag
(
flag
+
1
);
setInPutVisible
(
false
);
};
const
submitInput
=
()
=>
{
setInPutVisible
(
true
);
};
const
submitSearchUser
=
()
=>
{
setFlag1
(
1
);
SearchDataDictionaryList
({
key
:
searchWord
,
type
:
1
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setShowSearchStyle
(
true
);
if
(
res
.
data
.
length
===
0
)
{
setData
(
res
.
data
);
setSubData
([]);
}
else
{
setData
(
res
.
data
);
getData
(
res
.
data
[
0
].
nodeID
);
}
}
else
{
notification
.
error
({
message
:
'提交失败'
,
description
:
res
.
msg
,
});
}
}
});
};
// 拖拽回调函数
const
dragCallBack
=
value
=>
{
// console.log(value)
// console.log(orderTable)
if
(
value
)
{
setData
(
value
)
const
handleReset
=
()
=>
{
setFlag1
(
0
);
setSearchWord
(
''
);
setLoading
(
true
);
setIsloading
(
true
);
GetDataDictionaryList
({
nodeID
:
null
}).
then
(
resnew
=>
{
if
(
resnew
.
code
===
0
)
{
setLoading
(
false
);
setIsloading
(
false
);
let
res
=
resnew
.
data
;
if
(
res
.
length
>
0
)
{
res
.
map
(
item
=>
{
item
.
key
=
item
.
nodeID
;
return
item
;
});
}
};
const
dragCallBack1
=
e
=>
{
// console.log(e)
// console.log(orderTable1)
if
(
e
)
{
setSubData
(
e
);
}
};
setData
(
res
);
setSelect
(
res
[
0
]);
// 默认当前选中一级条目第一条
setSelectColor
(
res
[
0
]);
setSelectID
(
res
[
0
].
nodeID
);
// 设置选中的一级条目ID,用于添加二级条目
getData
(
res
[
0
].
nodeID
);
// 拿到nodeID再次调用接口就回直接进入下面的循环,靠nodeID获取子节点二级条目
setShowSearchStyle
(
false
);
}
setLoading
(
false
);
setIsloading
(
false
);
});
};
// 拖拽回调函数
const
dragCallBack
=
value
=>
{
// console.log(value)
// console.log(orderTable)
if
(
value
)
{
setData
(
value
);
}
};
const
dragCallBack1
=
e
=>
{
// console.log(e)
// console.log(orderTable1)
if
(
e
)
{
setSubData
(
e
);
}
};
return
(
<
div
className
=
{
styles
.
WebDic
}
>
<
Spin
spinning
=
{
loading
}
tip
=
"loading..."
>
<
div
className
=
{
styles
.
item
}
>
{
/* <span>
return
(
<
div
className
=
{
styles
.
WebDic
}
>
<
Spin
spinning
=
{
loading
}
tip
=
"loading..."
>
<
div
className
=
{
styles
.
item
}
>
{
/* <span>
<SearchOutlined onClick={() => onSearch()} /><span style={{ verticalAlign: 'middle', marginLeft: '6px', marginRight: "40px", cursor: "pointer" }} onClick={() => onSearch()}>查找条目</span>
</span> */
}
<
span
>
<
Search
style
=
{{
width
:
260
,
marginRight
:
'20px'
,
marginLeft
:
'10px'
}}
placeholder
=
"搜索一级条目数据"
onSearch
=
{
submitSearchUser
}
onChange
=
{
e
=>
handleSearch
(
e
)}
enterButton
value
=
{
searchWord
}
/
>
<
Button
style
=
{{
marginRight
:
'40px'
}}
icon
=
{
<
SyncOutlined
/>
}
onClick
=
{
handleReset
}
>
重置
<
/Button
>
<
/span
>
<
span
>
<
DownloadOutlined
/><
span
style
=
{{
verticalAlign
:
'middle'
,
marginLeft
:
'6px'
,
marginRight
:
"40px"
,
cursor
:
"pointer"
}}
><
a
style
=
{{
color
:
'rgba(0, 0, 0, 0.85)'
}}
href
=
"/PandaOMS/OMS/DataManger/ExportDataDictionary"
>
导出数据
<
/a></
span
>
<
/span
>
<
span
>
<
UploadOutlined
/><
span
style
=
{{
verticalAlign
:
'middle'
,
marginLeft
:
'6px'
,
marginRight
:
"40px"
,
cursor
:
"pointer"
}}
><
span
style
=
{{
color
:
'rgba(0, 0, 0, 0.85)'
}}
onClick
=
{()
=>
submitInput
()}
>
导入数据
<
/span></
span
>
<
/span
>
<
/div
>
<
Row
style
=
{{
background
:
'white'
}}
>
<
Col
span
=
{
8
}
className
=
{
styles
.
left
}
>
{
/* 一级条目 表格 */
}
<
DragTable
size
=
"small"
rowKey
=
{
record
=>
record
.
nodeID
}
columns
=
{
columns
}
dataSource
=
{
data
}
scroll
=
{{
y
:
'calc(100vh - 370px)'
}}
bordered
dragCallBack
=
{
dragCallBack
}
className
=
{
styles
.
pab
}
title
=
{()
=>
{
return
<
div
>
<
span
>
一级条目
<
/span
>
<
Tooltip
title
=
"添加一级条目配置"
>
<
PlusSquareFilled
onClick
=
{()
=>
setItem
(
1
)}
style
=
{{
color
:
'#1890FF'
,
fontSize
:
'25px'
,
marginTop
:
'3px'
,
float
:
'right'
,
}}
/
>
<
/Tooltip
>
<
/div
>
}}
rowClassName
=
{
setRowClassName
}
onClick
=
{
record
=>
{
getData
(
record
.
nodeID
);
setSelect
(
record
);
setSelectColor
(
record
);
setSelectID
(
record
.
nodeID
);
}}
ItemTypes
=
'first'
pagination
=
{
pagenation
}
/
>
<
/Col
>
<
Col
span
=
{
16
}
>
{
/* 二级条目 表格 */
}
<
Spin
spinning
=
{
isloading
}
tip
=
"loading..."
>
<
DragTable
size
=
"small"
ItemTypes
=
'second'
bordered
rowKey
=
{
record
=>
record
.
nodeID
}
columns
=
{
columns1
}
dragCallBack
=
{
dragCallBack1
}
className
=
{
styles
.
tab
}
dataSource
=
{
subData
}
scroll
=
{{
x
:
'max-content'
,
y
:
'calc(100vh - 340px)'
}}
rowClassName
=
{
setRowClassName1
}
onClick
=
{
record
=>
{
setSelect
(
record
);
setTwoSelectColor
(
record
);
}}
title
=
{()
=>
{
return
<
div
>
<
span
>
二级条目
<
/span
>
<
Tooltip
title
=
"添加二级条目配置"
>
<
PlusSquareFilled
onClick
=
{()
=>
setItem
(
2
)}
style
=
{{
color
:
'#1890FF'
,
fontSize
:
'25px'
,
marginTop
:
'3px'
,
float
:
'right'
,
}}
/
>
<
/Tooltip
>
<
/div
>
}}
pagination
=
{
pagenation
}
/
>
<
/Spin
>
<
/Col
>
<
/Row
>
<
/Spin
>
{
/*添加一级*/
}
<
Modal
title
=
{
'添加一级条目'
}
visible
=
{
addVisible1
}
width
=
"500px"
onOk
=
{()
=>
{
submitAdd1
(
'-1'
);
}}
onCancel
=
{()
=>
{
setAddVisible1
(
false
);
}}
okText
=
"确认"
cancelText
=
"取消"
<
span
>
<
Search
style
=
{{
width
:
260
,
marginRight
:
'20px'
,
marginLeft
:
'10px'
}}
placeholder
=
"搜索一级条目数据"
onSearch
=
{
submitSearchUser
}
onChange
=
{
e
=>
handleSearch
(
e
)}
enterButton
value
=
{
searchWord
}
/
>
<
Button
style
=
{{
marginRight
:
'40px'
}}
icon
=
{
<
SyncOutlined
/>
}
onClick
=
{
handleReset
}
>
<
Form
autoComplete
=
"off"
form
=
{
addForm
}
labelCol
=
{{
span
:
3
}}
>
<
Form
.
Item
name
=
"nodeName"
label
=
"名称"
rules
=
{[{
required
:
true
,
message
:
'不能为空'
}]}
>
<
Input
placeholder
=
"请输入名称"
style
=
{{
width
:
'95%'
}}
/
>
<
/Form.Item
>
<
/Form
>
<
/Modal
>
{
/*添加二级*/
}
<
Modal
title
=
'添加二级条目'
visible
=
{
addVisible
}
width
=
"500px"
onOk
=
{()
=>
{
submitAdd
(
selectID
);
}}
onCancel
=
{()
=>
{
setAddVisible
(
false
);
}}
okText
=
"确认"
cancelText
=
"取消"
重置
<
/Button
>
<
/span
>
<
span
>
<
DownloadOutlined
/>
<
span
style
=
{{
verticalAlign
:
'middle'
,
marginLeft
:
'6px'
,
marginRight
:
'40px'
,
cursor
:
'pointer'
,
}}
>
<
a
style
=
{{
color
:
'rgba(0, 0, 0, 0.85)'
}}
href
=
"/PandaOMS/OMS/DataManger/ExportDataDictionary"
>
导出数据
<
/a
>
<
/span
>
<
/span
>
<
span
>
<
UploadOutlined
/>
<
span
style
=
{{
verticalAlign
:
'middle'
,
marginLeft
:
'6px'
,
marginRight
:
'40px'
,
cursor
:
'pointer'
,
}}
>
<
Form
autoComplete
=
"off"
form
=
{
addForm
}
labelCol
=
{{
span
:
7
}}
>
<
span
style
=
{{
color
:
'rgba(0, 0, 0, 0.85)'
}}
onClick
=
{()
=>
submitInput
()}
>
导入数据
<
/span
>
<
/span
>
<
/span
>
<
/div
>
<
Row
style
=
{{
background
:
'white'
}}
>
<
Col
span
=
{
8
}
className
=
{
styles
.
left
}
>
{
/* 一级条目 表格 */
}
<
DragTable
size
=
"small"
rowKey
=
{
record
=>
record
.
nodeID
}
columns
=
{
columns
}
dataSource
=
{
data
}
scroll
=
{{
y
:
'calc(100vh - 370px)'
}}
bordered
dragCallBack
=
{
dragCallBack
}
className
=
{
styles
.
pab
}
title
=
{()
=>
(
<
div
>
<
span
>
一级条目
<
/span
>
<
Tooltip
title
=
"添加一级条目配置"
>
<
PlusSquareFilled
onClick
=
{()
=>
setItem
(
1
)}
style
=
{{
color
:
'#1890FF'
,
fontSize
:
'25px'
,
marginTop
:
'3px'
,
float
:
'right'
,
}}
/
>
<
/Tooltip
>
<
/div
>
)}
rowClassName
=
{
setRowClassName
}
onClick
=
{
record
=>
{
getData
(
record
.
nodeID
);
setSelect
(
record
);
setSelectColor
(
record
);
setSelectID
(
record
.
nodeID
);
}}
ItemTypes
=
"first"
pagination
=
{
pagenation
}
/
>
<
/Col
>
<
Col
span
=
{
16
}
>
{
/* 二级条目 表格 */
}
<
Spin
spinning
=
{
isloading
}
tip
=
"loading..."
>
<
DragTable
size
=
"small"
ItemTypes
=
"second"
bordered
rowKey
=
{
record
=>
record
.
nodeID
}
columns
=
{
columns1
}
dragCallBack
=
{
dragCallBack1
}
className
=
{
styles
.
tab
}
dataSource
=
{
subData
}
scroll
=
{{
x
:
'max-content'
,
y
:
'calc(100vh - 340px)'
}}
rowClassName
=
{
setRowClassName1
}
onClick
=
{
record
=>
{
setSelect
(
record
);
setTwoSelectColor
(
record
);
}}
title
=
{()
=>
(
<
div
>
<
span
>
二级条目
<
/span
>
<
Tooltip
title
=
"添加二级条目配置"
>
<
PlusSquareFilled
onClick
=
{()
=>
setItem
(
2
)}
style
=
{{
color
:
'#1890FF'
,
fontSize
:
'25px'
,
marginTop
:
'3px'
,
float
:
'right'
,
}}
/
>
<
/Tooltip
>
<
/div
>
)}
pagination
=
{
pagenation
}
/
>
<
/Spin
>
<
/Col
>
<
/Row
>
<
/Spin
>
{
/* 添加一级 */
}
<
Modal
title
=
"添加一级条目"
visible
=
{
addVisible1
}
width
=
"500px"
onOk
=
{()
=>
{
submitAdd1
(
'-1'
);
}}
onCancel
=
{()
=>
{
setAddVisible1
(
false
);
}}
okText
=
"确认"
cancelText
=
"取消"
>
<
Form
autoComplete
=
"off"
form
=
{
addForm
}
labelCol
=
{{
span
:
3
}}
>
<
Form
.
Item
name
=
"nodeName"
label
=
"名称"
rules
=
{[{
required
:
true
,
message
:
'不能为空'
}]}
>
<
Input
placeholder
=
"请输入名称"
style
=
{{
width
:
'95%'
}}
/
>
<
/Form.Item
>
<
/Form
>
<
/Modal
>
{
/* 添加二级 */
}
<
Modal
title
=
"添加二级条目"
visible
=
{
addVisible
}
width
=
"500px"
onOk
=
{()
=>
{
submitAdd
(
selectID
);
}}
onCancel
=
{()
=>
{
setAddVisible
(
false
);
}}
okText
=
"确认"
cancelText
=
"取消"
>
<
Form
autoComplete
=
"off"
form
=
{
addForm
}
labelCol
=
{{
span
:
7
}}
>
<
Row
>
<
Col
span
=
{
11
}
>
<
Form
.
Item
name
=
"nodeName1"
label
=
"名称"
rules
=
{[
{
required
:
true
,
message
:
'不能为空'
},
{
validator
:
(
rule
,
value
)
=>
{
const
nodeName
=
addForm
.
getFieldsValue
().
nodeName1
;
// 第一项的nodeName
const
nodeName1
=
addForm
.
getFieldsValue
();
let
result
=
nodeName1
.
users
;
let
arr
=
[];
if
(
result
)
{
// eslint-disable-next-line array-callback-return
result
.
map
(
item
=>
{
if
(
item
)
{
let
a
=
item
.
nodeName
;
if
(
a
!==
''
)
{
arr
.
push
(
a
);
}
}
});
}
arr
.
unshift
(
nodeName
);
console
.
log
(
arr
);
if
(
new
Set
(
arr
).
size
!==
arr
.
length
)
{
// eslint-disable-next-line prefer-promise-reject-errors
return
Promise
.
reject
(
'用户名重复'
);
}
return
Promise
.
resolve
();
},
},
]}
>
<
Input
placeholder
=
"请输入名称"
/>
<
/Form.Item
>
<
/Col
>
<
Col
span
=
{
11
}
>
<
Form
.
Item
name
=
"nodeValue1"
label
=
"值"
>
<
Input
placeholder
=
"请输入值"
/>
<
/Form.Item
>
<
/Col
>
<
/Row
>
<
Form
.
List
name
=
"users"
>
{(
fields
,
{
add
,
remove
})
=>
(
<>
{
fields
.
map
(({
key
,
name
,
fieldKey
,
...
restField
})
=>
(
<
Space
key
=
{
key
}
style
=
{{
display
:
'flex'
,
marginBottom
:
8
}}
>
<
Row
>
<
Col
span
=
{
11
}
>
<
Form
.
Item
name
=
'nodeName1'
label
=
"名称"
rules
=
{[
{
required
:
true
,
message
:
'不能为空'
},
{
validator
:
(
rule
,
value
)
=>
{
const
nodeName
=
addForm
.
getFieldsValue
().
nodeName1
;
//第一项的nodeName
const
nodeName1
=
addForm
.
getFieldsValue
();
let
result
=
nodeName1
.
users
;
let
arr
=
[];
if
(
result
)
{
result
.
map
(
item
=>
{
if
(
item
===
undefined
)
{
}
else
{
let
a
=
item
.
nodeName
if
(
a
!==
''
)
{
arr
.
push
(
a
)
}
}
})
}
arr
.
unshift
(
nodeName
)
console
.
log
(
arr
)
if
(
new
Set
(
arr
).
size
!==
arr
.
length
)
{
return
Promise
.
reject
(
'用户名重复'
)
}
return
Promise
.
resolve
();
}
<
Col
span
=
{
11
}
>
<
Form
.
Item
{...
restField
}
name
=
{[
name
,
'nodeName'
]}
label
=
"名称"
fieldKey
=
{[
fieldKey
,
'frist'
]}
rules
=
{[
{
required
:
true
,
message
:
'不能为空'
},
{
validator
:
(
rule
,
value
,
callback
)
=>
{
const
nodeName
=
addForm
.
getFieldsValue
()
.
nodeName1
;
// 第一项的nodeName
const
nodeName1
=
addForm
.
getFieldsValue
();
let
result
=
nodeName1
.
users
;
let
arr
=
[];
// eslint-disable-next-line array-callback-return
result
.
map
(
item
=>
{
if
(
item
)
{
let
a
=
item
.
nodeName
;
if
(
a
!==
''
)
{
arr
.
push
(
a
);
}
]}
>
<
Input
placeholder
=
"请输入名称"
/>
<
/Form.Item
>
<
/Col
>
<
Col
span
=
{
11
}
>
<
Form
.
Item
name
=
'nodeValue1'
label
=
"值"
>
<
Input
placeholder
=
"请输入值"
/>
<
/Form.Item
>
<
/Col
>
<
/Row
>
<
Form
.
List
name
=
"users"
>
{(
fields
,
{
add
,
remove
})
=>
(
<>
{
fields
.
map
(({
key
,
name
,
fieldKey
,
...
restField
})
=>
(
<
Space
key
=
{
key
}
style
=
{{
display
:
'flex'
,
marginBottom
:
8
}}
>
<
Row
>
<
Col
span
=
{
11
}
>
<
Form
.
Item
{...
restField
}
name
=
{[
name
,
'nodeName'
]}
label
=
"名称"
fieldKey
=
{[
fieldKey
,
'frist'
]}
rules
=
{
[
{
required
:
true
,
message
:
'不能为空'
},
{
validator
:
(
rule
,
value
,
callback
)
=>
{
const
nodeName
=
addForm
.
getFieldsValue
().
nodeName1
;
//第一项的nodeName
const
nodeName1
=
addForm
.
getFieldsValue
();
let
result
=
nodeName1
.
users
;
let
arr
=
[];
result
.
map
(
item
=>
{
if
(
item
===
undefined
)
{
}
else
{
let
a
=
item
.
nodeName
if
(
a
!==
''
)
{
arr
.
push
(
a
)
}
}
})
if
(
nodeName
!==
undefined
)
{
arr
.
unshift
(
nodeName
)
}
}
});
if
(
nodeName
!==
undefined
)
{
arr
.
unshift
(
nodeName
);
}
console
.
log
(
arr
)
if
(
new
Set
(
arr
).
size
!==
arr
.
length
)
{
arr
=
[...
new
Set
(
arr
)]
console
.
log
(
arr
)
callback
(
'用户名重复'
)
}
}
}
]
}
>
<
Input
placeholder
=
"请输入名称"
/>
<
/Form.Item
>
<
/Col
>
<
Col
span
=
{
11
}
>
<
Form
.
Item
{...
restField
}
name
=
{[
name
,
'nodeValue'
]}
label
=
"值"
fieldKey
=
{[
fieldKey
,
'last'
]}
>
<
Input
placeholder
=
"请输入值"
/>
<
/Form.Item
>
<
/Col
>
<
Col
span
=
{
2
}
>
<
Tooltip
title
=
"移除条目项"
>
<
MinusCircleOutlined
onClick
=
{()
=>
remove
(
name
)}
style
=
{{
marginLeft
:
'20px'
,
fontSize
:
'20px'
}}
/
>
<
/Tooltip
>
<
/Col
>
<
/Row
>
<
/Space
>
))}
<
Form
.
Item
>
<
Button
type
=
"dashed"
onClick
=
{()
=>
add
()}
block
icon
=
{
<
PlusOutlined
/>
}
style
=
{{
width
:
'353px'
,
marginLeft
:
'61px'
}}
>
新增条目项
<
/Button
>
<
/Form.Item
>
<
/
>
)}
<
/Form.List
>
<
/Form
>
<
/Modal
>
{
/*修改一级条目 */
}
<
Modal
title
=
{
'修改一级条目'
}
visible
=
{
editVisible1
}
onOk
=
{
submitEdit1
}
onCancel
=
{()
=>
{
setEditVisible1
(
false
);
}}
okText
=
"确认"
cancelText
=
"取消"
>
<
Form
form
=
{
editForm
}
labelCol
=
{{
span
:
3
}}
>
<
Form
.
Item
name
=
"nodeName"
label
=
"名称"
rules
=
{[{
required
:
true
,
message
:
'不能为空'
}]}
>
<
Input
placeholder
=
"请输入名称"
style
=
{{
width
:
'90%'
}}
/
>
<
/Form.Item
>
<
/Form
>
<
/Modal
>
{
/*修改二级条目 */
}
console
.
log
(
arr
);
if
(
new
Set
(
arr
).
size
!==
arr
.
length
)
{
arr
=
[...
new
Set
(
arr
)];
console
.
log
(
arr
);
callback
(
'用户名重复'
);
}
},
},
]}
>
<
Input
placeholder
=
"请输入名称"
/>
<
/Form.Item
>
<
/Col
>
<
Col
span
=
{
11
}
>
<
Form
.
Item
{...
restField
}
name
=
{[
name
,
'nodeValue'
]}
label
=
"值"
fieldKey
=
{[
fieldKey
,
'last'
]}
>
<
Input
placeholder
=
"请输入值"
/>
<
/Form.Item
>
<
/Col
>
<
Col
span
=
{
2
}
>
<
Tooltip
title
=
"移除条目项"
>
<
MinusCircleOutlined
onClick
=
{()
=>
remove
(
name
)}
style
=
{{
marginLeft
:
'20px'
,
fontSize
:
'20px'
}}
/
>
<
/Tooltip
>
<
/Col
>
<
/Row
>
<
/Space
>
))}
<
Form
.
Item
>
<
Button
type
=
"dashed"
onClick
=
{()
=>
add
()}
block
icon
=
{
<
PlusOutlined
/>
}
style
=
{{
width
:
'353px'
,
marginLeft
:
'61px'
}}
>
新增条目项
<
/Button
>
<
/Form.Item
>
<
/
>
)}
<
/Form.List
>
<
/Form
>
<
/Modal
>
{
/* 修改一级条目 */
}
<
Modal
title
=
"修改一级条目"
visible
=
{
editVisible1
}
onOk
=
{
submitEdit1
}
onCancel
=
{()
=>
{
setEditVisible1
(
false
);
}}
okText
=
"确认"
cancelText
=
"取消"
>
<
Form
form
=
{
editForm
}
labelCol
=
{{
span
:
3
}}
>
<
Form
.
Item
name
=
"nodeName"
label
=
"名称"
rules
=
{[{
required
:
true
,
message
:
'不能为空'
}]}
>
<
Input
placeholder
=
"请输入名称"
style
=
{{
width
:
'90%'
}}
/
>
<
/Form.Item
>
<
/Form
>
<
/Modal
>
{
/* 修改二级条目 */
}
<
Modal
title
=
{
'修改二级条目'
}
visible
=
{
editVisible
}
onOk
=
{
submitEdit
}
onCancel
=
{()
=>
{
setEditVisible
(
false
);
}}
okText
=
"确认"
cancelText
=
"取消"
>
<
Form
form
=
{
editForm
}
labelCol
=
{{
span
:
3
}}
>
<
Form
.
Item
name
=
"nodeName"
label
=
"名称"
rules
=
{[{
required
:
true
,
message
:
'不能为空'
}]}
>
<
Input
placeholder
=
"请输入名称"
style
=
{{
width
:
'90%'
}}
/
>
<
/Form.Item
>
<
Form
.
Item
name
=
"nodeValue"
label
=
"值"
>
<
Input
placeholder
=
"请输入值"
style
=
{{
width
:
'90%'
}}
/
>
<
/Form.Item
>
<
/Form
>
<
/Modal
>
<
Modal
title
=
"修改二级条目"
visible
=
{
editVisible
}
onOk
=
{
submitEdit
}
onCancel
=
{()
=>
{
setEditVisible
(
false
);
}}
okText
=
"确认"
cancelText
=
"取消"
>
<
Form
form
=
{
editForm
}
labelCol
=
{{
span
:
3
}}
>
<
Form
.
Item
name
=
"nodeName"
label
=
"名称"
rules
=
{[{
required
:
true
,
message
:
'不能为空'
}]}
>
<
Input
placeholder
=
"请输入名称"
style
=
{{
width
:
'90%'
}}
/
>
<
/Form.Item
>
<
Form
.
Item
name
=
"nodeValue"
label
=
"值"
>
<
Input
placeholder
=
"请输入值"
style
=
{{
width
:
'90%'
}}
/
>
<
/Form.Item
>
<
/Form
>
<
/Modal
>
<
Modal
title
=
{
'查找条目'
}
visible
=
{
searchVisible
}
width
=
'700px'
onOk
=
{
resetSearch
}
onCancel
=
{()
=>
{
setSearchVisible
(
false
);
setSearchWord
(
''
);
// 搜索框置空
setSearchData
([]);
}}
okText
=
"确认"
cancelText
=
"取消"
>
<
Search
style
=
{{
width
:
470
,
marginBottom
:
25
}}
placeholder
=
"输入关键字"
onSearch
=
{
sumbitSearch
}
onChange
=
{
e
=>
handleSearch
(
e
)}
enterButton
value
=
{
searchWord
}
/
>
<
Table
size
=
"small"
bordered
key
=
''
columns
=
{
columns2
}
dataSource
=
{
searchData
}
scroll
=
{{
x
:
'max-content'
,
y
:
'calc(100vh - 700px)'
}}
rowClassName
=
{
setRowClassName
}
onRow
=
{
record
=>
({
onClick
:
()
=>
{
setSelect
(
record
);
setSelectColor
(
record
);
setSelectID
(
record
.
nodeID
);
},
})}
pagination
=
{
pagenation
}
/
>
<
/Modal
>
<
Modal
title
=
{
'导入数据'
}
visible
=
{
InPutVisible
}
onOk
=
{
input1
}
onCancel
=
{()
=>
{
setInPutVisible
(
false
)
}}
okText
=
"确认"
cancelText
=
"取消"
>
<
Upload
{...
props
}
>
<
UploadOutlined
/><
span
style
=
{{
verticalAlign
:
'middle'
,
marginLeft
:
'6px'
,
marginRight
:
"40px"
,
cursor
:
"pointer"
}}
><
a
style
=
{{
color
:
'rgb(24 144 255)'
}}
>
请选择将要导入的数据文件(仅支持
Excel
文件)
<
/a></
span
>
<
/Upload
>
<
/Modal
>
<
/div
>
);
{
/* <Modal
title="查找条目"
visible={searchVisible}
width="700px"
onOk={resetSearch}
onCancel={() => {
setSearchVisible(false);
setSearchWord(''); // 搜索框置空
setSearchData([]);
}}
okText="确认"
cancelText="取消"
>
<Search
style={{ width: 470, marginBottom: 25 }}
placeholder="输入关键字"
onSearch={sumbitSearch}
onChange={e => handleSearch(e)}
enterButton
value={searchWord}
/>
<Table
size="small"
bordered
key=""
columns={columns2}
dataSource={searchData}
scroll={{ x: 'max-content', y: 'calc(100vh - 700px)' }}
rowClassName={setRowClassName}
onRow={record => ({
onClick: () => {
setSelect(record);
setSelectColor(record);
setSelectID(record.nodeID);
},
})}
pagination={pagenation}
/>
</Modal> */
}
<
Modal
title
=
"导入数据"
visible
=
{
InPutVisible
}
onOk
=
{
input1
}
onCancel
=
{()
=>
{
setInPutVisible
(
false
);
}}
okText
=
"确认"
cancelText
=
"取消"
>
<
Upload
{...
props
}
>
<
UploadOutlined
/>
<
span
style
=
{{
verticalAlign
:
'middle'
,
marginLeft
:
'6px'
,
marginRight
:
'40px'
,
cursor
:
'pointer'
,
}}
>
<
a
style
=
{{
color
:
'rgb(24 144 255)'
}}
>
请选择将要导入的数据文件(仅支持
Excel
文件)
<
/a
>
<
/span
>
<
/Upload
>
<
/Modal
>
<
/div
>
);
};
export
default
WebDic
;
\ No newline at end of file
export
default
WebDic
;
src/pages/platformCenter/schemeDetail/schemeDetail.jsx
View file @
2bdca006
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
/* eslint-disable radix */
/* eslint-disable camelcase */
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
SiteModal
from
'@/components/Modal/SiteModa'
;
import
{
Form
,
Input
,
notification
,
Select
,
Checkbox
,
message
,
Button
,
Card
,
Switch
as
Switchs
}
from
'antd'
import
{
Form
,
Input
,
notification
,
Select
,
Checkbox
,
message
,
Button
,
Card
,
Switch
as
Switchs
,
}
from
'antd'
;
import
BaseForm
from
'@/components/BaseForm/index'
;
import
{
Switch
}
from
'react-router'
;
import
{
iteratee
}
from
'lodash'
;
import
styles
from
'./schemeDetail.less'
;
import
v
from
'voca'
;
import
{
UsergroupDeleteOutlined
}
from
'@ant-design/icons'
;
import
VisibleRoleModal
from
'../messageManage/projectManage/components/RolseSelect/VisibleRoleModal'
import
VisibleIISAgentConfig
from
'../messageManage/projectManage/components/IISAgentConfig/VisibleIISAgentConfig'
import
{
GetMessageTemplate
}
from
'@/services/platform/messagemanage'
import
moment
from
'moment'
import
{
UpdateMessageConfig
,
InsertMessageConfig
,
AddIISAgentConfig
}
from
'@/services/platform/messagemanage'
import
moment
from
'moment'
;
import
{
useHistory
}
from
'react-router-dom'
;
import
VisibleRoleModal
from
'../messageManage/projectManage/components/RolseSelect/VisibleRoleModal'
;
import
VisibleIISAgentConfig
from
'../messageManage/projectManage/components/IISAgentConfig/VisibleIISAgentConfig'
;
import
{
GetMessageTemplate
,
UpdateMessageConfig
,
InsertMessageConfig
,
AddIISAgentConfig
,
// eslint-disable-next-line import/no-duplicates
}
from
'@/services/platform/messagemanage'
;
import
styles
from
'./schemeDetail.less'
;
const
{
Item
}
=
Form
;
const
{
TextArea
}
=
Input
;
const
EditModal
=
props
=>
{
const
history
=
useHistory
();
const
[
form
]
=
Form
.
useForm
();
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
plan
,
setPlan
]
=
useState
(
''
);
const
[
isStart
,
setIsStart
]
=
useState
(
false
);
const
[
IISConfig
,
setIISConfig
]
=
useState
(
null
)
const
[
isUse
,
setIsUse
]
=
useState
(
"0"
)
const
[
btnType
,
setBtnType
]
=
useState
(
"定时推送"
)
const
{
template
,
confirmModal
}
=
props
.
location
.
state
const
[
currentTrench
,
setCurrentTrench
]
=
useState
({
isMessageShow
:
false
,
isAPPShow
:
false
,
isWEBShow
:
false
,
isWXShow
:
false
,
isEnterpriseWXShow
:
false
,
})
const
[
APP_ITEMS
,
setAPP_ITEMS
]
=
useState
([])
const
[
WEB_ITEMS
,
setWEB_ITEMS
]
=
useState
([])
const
[
WX_ITEMS
,
setWX_ITEMS
]
=
useState
([])
const
[
MES_ITEMS
,
setMES_ITEMS
]
=
useState
([])
const
[
EN_ITEMS
,
setEN_ITEMS
]
=
useState
([])
const
[
listType
,
setListType
]
=
useState
([{
title
:
'定时推送'
,
desc
:
'用于周期性简报的定时推送,如智能巡检、运行周报。'
},
{
title
:
'监控报警'
,
desc
:
'设备硬件故障,阈值超限,状态突变,采集超时等异常情况报警。'
},
{
title
:
'工单办理'
,
desc
:
'在工单系统中,针对特定人员的通知,包括工作办理、审核、会签、回退等操作。'
},
{
title
:
'平台公告'
,
desc
:
'由运维人员向所有用户或特定用户发送的事务公告,如系统升级、维护。'
}])
useEffect
(()
=>
{
GetMessageTemplate
().
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
let
arr1
=
[]
let
arr2
=
[]
let
arr3
=
[]
let
arr4
=
[]
let
arr5
=
[]
res
.
data
.
map
((
item
,
index
)
=>
{
if
(
item
.
Type
===
"公众号"
)
{
arr1
.
push
(
item
)
}
if
(
item
.
Type
===
"短信"
)
{
arr2
.
push
(
item
)
}
if
(
item
.
Type
===
"APP"
)
{
arr3
.
push
(
item
)
}
if
(
item
.
Type
===
"WEB"
)
{
arr4
.
push
(
item
)
}
if
(
item
.
Type
===
"企业微信"
)
{
arr5
.
push
(
item
)
}
})
setAPP_ITEMS
(
arr3
)
setMES_ITEMS
(
arr2
)
setWX_ITEMS
(
arr1
)
setWEB_ITEMS
(
arr4
)
setEN_ITEMS
(
arr5
)
}
}
)
},
[])
useEffect
(()
=>
{
console
.
log
(
'template'
,
template
);
console
.
log
(
template
.
WorkWeiXinTemplateId
)
let
aa
if
(
template
.
WorkWeiXinTemplateId
==
null
||
template
.
WorkWeiXinTemplateId
==
''
)
{
aa
=
''
const
history
=
useHistory
();
const
[
form
]
=
Form
.
useForm
();
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
plan
,
setPlan
]
=
useState
(
''
);
const
[
isStart
,
setIsStart
]
=
useState
(
false
);
const
[
IISConfig
,
setIISConfig
]
=
useState
(
null
);
const
[
isUse
,
setIsUse
]
=
useState
(
'0'
);
const
[
btnType
,
setBtnType
]
=
useState
(
'定时推送'
);
const
{
template
,
confirmModal
}
=
props
.
location
.
state
;
const
[
currentTrench
,
setCurrentTrench
]
=
useState
({
isMessageShow
:
false
,
isAPPShow
:
false
,
isWEBShow
:
false
,
isWXShow
:
false
,
isEnterpriseWXShow
:
false
,
});
// eslint-disable-next-line camelcase
const
[
APP_ITEMS
,
setAPP_ITEMS
]
=
useState
([]);
const
[
WEB_ITEMS
,
setWEB_ITEMS
]
=
useState
([]);
const
[
WX_ITEMS
,
setWX_ITEMS
]
=
useState
([]);
const
[
MES_ITEMS
,
setMES_ITEMS
]
=
useState
([]);
const
[
EN_ITEMS
,
setEN_ITEMS
]
=
useState
([]);
const
[
listType
,
setListType
]
=
useState
([
{
title
:
'定时推送'
,
desc
:
'用于周期性简报的定时推送,如智能巡检、运行周报。'
,
},
{
title
:
'监控报警'
,
desc
:
'设备硬件故障,阈值超限,状态突变,采集超时等异常情况报警。'
,
},
{
title
:
'工单办理'
,
desc
:
'在工单系统中,针对特定人员的通知,包括工作办理、审核、会签、回退等操作。'
,
},
{
title
:
'平台公告'
,
desc
:
'由运维人员向所有用户或特定用户发送的事务公告,如系统升级、维护。'
,
},
]);
useEffect
(()
=>
{
GetMessageTemplate
().
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
let
arr1
=
[];
let
arr2
=
[];
let
arr3
=
[];
let
arr4
=
[];
let
arr5
=
[];
// eslint-disable-next-line array-callback-return
res
.
data
.
map
((
item
,
index
)
=>
{
if
(
item
.
Type
===
'公众号'
)
{
arr1
.
push
(
item
);
}
if
(
item
.
Type
===
'短信'
)
{
arr2
.
push
(
item
);
}
if
(
item
.
Type
===
'APP'
)
{
arr3
.
push
(
item
);
}
if
(
item
.
Type
===
'WEB'
)
{
arr4
.
push
(
item
);
}
if
(
item
.
Type
===
'企业微信'
)
{
arr5
.
push
(
item
);
}
});
setAPP_ITEMS
(
arr3
);
setMES_ITEMS
(
arr2
);
setWX_ITEMS
(
arr1
);
setWEB_ITEMS
(
arr4
);
setEN_ITEMS
(
arr5
);
}
});
},
[]);
useEffect
(()
=>
{
console
.
log
(
'template'
,
template
);
console
.
log
(
template
.
WorkWeiXinTemplateId
);
let
aa
;
if
(
template
.
WorkWeiXinTemplateId
==
null
||
template
.
WorkWeiXinTemplateId
===
''
)
{
aa
=
''
;
}
else
{
// eslint-disable-next-line radix
aa
=
parseInt
(
template
.
WorkWeiXinTemplateId
);
}
if
(
template
.
ThemeName
)
{
form
.
setFieldsValue
({
name
:
template
.
MsgType
,
isStart
:
template
.
IsStarted
===
'0'
?
'关闭'
:
'开启'
,
to_person
:
template
.
PushGroup
,
push_mode
:
template
.
PushMode
===
null
?
''
:
template
.
PushMode
.
split
(
','
),
app_template
:
template
.
AppTemplateID
,
app_path
:
template
.
AppFunctionPath
,
wx_template
:
template
.
PublicTemplateID
?
parseInt
(
template
.
PublicTemplateID
)
:
''
,
h5_path
:
template
.
PublicPath
,
miniprogram_path
:
template
.
MiniAppRoute
,
web_template
:
template
.
WebTemplateID
,
web_path
:
template
.
WebFunctionPath
,
message_template
:
template
.
MsgTemplateID
,
enterprise_template
:
aa
,
});
setPlan
(
template
.
MsgType
);
setBtnType
(
template
.
type
);
setIsUse
(
template
.
IsStarted
);
setCurrentTrench
({
isAPPShow
:
!!
(
template
.
PushMode
&&
template
.
PushMode
.
split
(
','
).
indexOf
(
'平台弹框'
)
>
-
1
),
isWXShow
:
!!
(
template
.
PushMode
&&
template
.
PushMode
.
split
(
','
).
indexOf
(
'公众号推送'
)
>
-
1
),
isWEBShow
:
!!
(
template
.
PushMode
&&
template
.
PushMode
.
split
(
','
).
indexOf
(
'平台弹框'
)
>
-
1
),
isMessageShow
:
!!
(
template
.
PushMode
&&
template
.
PushMode
.
split
(
','
).
indexOf
(
'短信推送'
)
>
-
1
),
isEnterpriseWXShow
:
!!
(
template
.
PushMode
&&
template
.
PushMode
.
split
(
','
).
indexOf
(
'企业微信推送'
)
>
-
1
),
});
}
else
{
console
.
log
(
111
);
setBtnType
(
'定时推送'
);
}
},
[
props
]);
const
onNameChange
=
e
=>
{
setPlan
(
e
.
target
.
value
);
};
const
onSubmit
=
()
=>
{
let
fv
=
form
.
getFieldValue
();
console
.
log
(
fv
.
enterprise_template
);
let
aa
;
if
(
fv
.
enterprise_template
===
undefined
)
{
aa
=
''
;
}
else
{
aa
=
fv
.
enterprise_template
.
toString
();
}
console
.
log
(
fv
);
let
push_mode
=
(
currentTrench
.
isAPPShow
||
currentTrench
.
isWEBShow
?
'平台弹框'
:
''
)
+
(
currentTrench
.
isWXShow
?
',公众号推送'
:
''
)
+
(
currentTrench
.
isMessageShow
?
',短信推送'
:
''
)
+
(
currentTrench
.
isEnterpriseWXShow
?
',企业微信推送'
:
''
);
if
(
template
.
ThemeName
)
{
let
a
=
{
ID
:
template
.
ID
,
ThemeName
:
template
.
ThemeName
,
MsgType
:
fv
.
name
,
PublicTemplateID
:
fv
.
wx_template
.
toString
(),
PublicConfig
:
template
.
PublicConfig
,
PublicPath
:
fv
.
h5_path
,
MsgTemplateName
:
template
.
MsgTemplateName
,
MsgTemplateCode
:
template
.
MsgTemplateCode
,
MsgConfig
:
template
.
MsgConfig
,
MiniAppRoute
:
fv
.
miniprogram_path
,
AppFunctionPath
:
fv
.
app_path
,
AppConfig
:
template
.
AppConfig
,
WebFunctionPath
:
fv
.
web_path
,
WebConfig
:
template
.
WebConfig
,
IsDelete
:
template
.
IsDelete
,
InputTime
:
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
),
Pusher
:
template
.
Pusher
,
PushMode
:
push_mode
,
PushPath
:
template
.
PushPath
,
IsStarted
:
isUse
,
MsgTemplateID
:
fv
.
message_template
,
AppTemplateID
:
fv
.
app_template
,
WebTemplateID
:
fv
.
web_template
,
PushGroup
:
fv
.
to_person
?
fv
.
to_person
.
toString
()
:
''
,
WorkWeiXinTemplateId
:
aa
,
};
UpdateMessageConfig
(
a
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
IISConfig
)
{
// eslint-disable-next-line no-shadow
AddIISAgentConfig
(
IISConfig
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
message
.
success
(
'保存成功'
);
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
,
});
}
});
}
else
{
message
.
success
(
'保存成功'
);
}
}
else
{
aa
=
parseInt
(
template
.
WorkWeiXinTemplateId
)
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
,
});
}
if
(
template
.
ThemeName
)
{
form
.
setFieldsValue
({
name
:
template
.
MsgType
,
isStart
:
template
.
IsStarted
===
"0"
?
"关闭"
:
"开启"
,
to_person
:
template
.
PushGroup
,
push_mode
:
template
.
PushMode
===
null
?
''
:
template
.
PushMode
.
split
(
","
),
app_template
:
template
.
AppTemplateID
,
app_path
:
template
.
AppFunctionPath
,
wx_template
:
template
.
PublicTemplateID
?
parseInt
(
template
.
PublicTemplateID
)
:
''
,
h5_path
:
template
.
PublicPath
,
miniprogram_path
:
template
.
MiniAppRoute
,
web_template
:
template
.
WebTemplateID
,
web_path
:
template
.
WebFunctionPath
,
message_template
:
template
.
MsgTemplateID
,
enterprise_template
:
aa
,
})
setPlan
(
template
.
MsgType
)
setBtnType
(
template
.
type
)
setIsUse
(
template
.
IsStarted
)
setCurrentTrench
({
isAPPShow
:
template
.
PushMode
&&
template
.
PushMode
.
split
(
","
).
indexOf
(
"平台弹框"
)
>
-
1
?
true
:
false
,
isWXShow
:
template
.
PushMode
&&
template
.
PushMode
.
split
(
","
).
indexOf
(
"公众号推送"
)
>
-
1
?
true
:
false
,
isWEBShow
:
template
.
PushMode
&&
template
.
PushMode
.
split
(
","
).
indexOf
(
"平台弹框"
)
>
-
1
?
true
:
false
,
isMessageShow
:
template
.
PushMode
&&
template
.
PushMode
.
split
(
","
).
indexOf
(
"短信推送"
)
>
-
1
?
true
:
false
,
isEnterpriseWXShow
:
template
.
PushMode
&&
template
.
PushMode
.
split
(
","
).
indexOf
(
"企业微信推送"
)
>
-
1
?
true
:
false
,
})
}
else
{
console
.
log
(
111
)
setBtnType
(
'定时推送'
)
}
},
[
props
])
const
onNameChange
=
(
e
)
=>
{
setPlan
(
e
.
target
.
value
)
}
const
onSubmit
=
()
=>
{
let
fv
=
form
.
getFieldValue
()
console
.
log
(
fv
.
enterprise_template
)
let
aa
if
(
fv
.
enterprise_template
==
undefined
)
{
aa
=
''
});
}
else
{
let
bb
;
if
(
fv
.
enterprise_template
===
undefined
)
{
bb
=
''
;
}
else
{
bb
=
fv
.
enterprise_template
.
toString
();
}
console
.
log
(
fv
.
enterprise_template
);
let
b
=
{
ThemeName
:
'定时推送'
,
MsgType
:
fv
.
name
,
PublicTemplateID
:
fv
.
wx_template
?
fv
.
wx_template
.
toString
()
:
null
,
PublicConfig
:
template
.
PublicConfig
,
PublicPath
:
fv
.
h5_path
,
MsgTemplateName
:
template
.
MsgTemplateName
,
MsgTemplateCode
:
template
.
MsgTemplateCode
,
MsgConfig
:
template
.
MsgConfig
,
MiniAppRoute
:
fv
.
miniprogram_path
,
AppFunctionPath
:
fv
.
app_path
,
AppConfig
:
template
.
AppConfig
,
WebFunctionPath
:
fv
.
web_path
,
WebConfig
:
template
.
WebConfig
,
IsDelete
:
template
.
IsDelete
,
InputTime
:
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
),
Pusher
:
template
.
Pusher
,
PushMode
:
push_mode
,
PushPath
:
template
.
PushPath
,
IsStarted
:
isUse
,
MsgTemplateID
:
fv
.
message_template
,
AppTemplateID
:
fv
.
app_template
,
WebTemplateID
:
fv
.
web_template
,
PushGroup
:
fv
.
to_person
?
fv
.
to_person
.
toString
()
:
''
,
WorkWeiXinTemplateId
:
bb
,
};
InsertMessageConfig
(
b
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
IISConfig
)
{
// eslint-disable-next-line no-shadow
AddIISAgentConfig
(
IISConfig
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
message
.
success
(
'保存成功'
);
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
,
});
}
});
}
else
{
message
.
success
(
'保存成功'
);
}
}
else
{
aa
=
fv
.
enterprise_template
.
toString
()
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
,
});
}
console
.
log
(
fv
)
let
push_mode
=
((
currentTrench
.
isAPPShow
||
currentTrench
.
isWEBShow
)
?
'平台弹框'
:
''
)
+
(
currentTrench
.
isWXShow
?
',公众号推送'
:
''
)
+
(
currentTrench
.
isMessageShow
?
',短信推送'
:
''
)
+
(
currentTrench
.
isEnterpriseWXShow
?
',企业微信推送'
:
''
)
if
(
template
.
ThemeName
)
{
let
a
=
{
ID
:
template
.
ID
,
ThemeName
:
template
.
ThemeName
,
MsgType
:
fv
.
name
,
PublicTemplateID
:
fv
.
wx_template
.
toString
(),
PublicConfig
:
template
.
PublicConfig
,
PublicPath
:
fv
.
h5_path
,
MsgTemplateName
:
template
.
MsgTemplateName
,
MsgTemplateCode
:
template
.
MsgTemplateCode
,
MsgConfig
:
template
.
MsgConfig
,
MiniAppRoute
:
fv
.
miniprogram_path
,
AppFunctionPath
:
fv
.
app_path
,
AppConfig
:
template
.
AppConfig
,
WebFunctionPath
:
fv
.
web_path
,
WebConfig
:
template
.
WebConfig
,
IsDelete
:
template
.
IsDelete
,
InputTime
:
moment
().
format
(
"YYYY-MM-DD HH:mm:ss"
),
Pusher
:
template
.
Pusher
,
PushMode
:
push_mode
,
PushPath
:
template
.
PushPath
,
IsStarted
:
isUse
,
MsgTemplateID
:
fv
.
message_template
,
AppTemplateID
:
fv
.
app_template
,
WebTemplateID
:
fv
.
web_template
,
PushGroup
:
fv
.
to_person
?
fv
.
to_person
.
toString
()
:
''
,
WorkWeiXinTemplateId
:
aa
,
}
UpdateMessageConfig
(
a
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
IISConfig
)
{
AddIISAgentConfig
(
IISConfig
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
message
.
success
(
"保存成功"
)
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
,
});
}
}
)
}
else
{
message
.
success
(
"保存成功"
)
}
});
}
};
const
onIISAgentSubmit
=
value
=>
{
console
.
log
(
'value'
,
value
);
setIISConfig
(
value
);
};
const
onPushSubmit
=
value
=>
{
console
.
log
(
value
,
'onPushSubmit'
);
};
const
layout
=
{
layout
:
'horizontal'
,
labelCol
:
{
span
:
2
,
},
wrapperCol
:
{
span
:
24
,
},
};
const
onChange
=
value
=>
{
setIsUse
(
value
?
'1'
:
'0'
);
};
const
back
=
()
=>
{
history
.
push
(
'/platformCenter/notify'
);
};
const
tailLayout
=
{
wrapperCol
:
{
offset
:
21
,
span
:
24
},
};
const
onTypeChange
=
(
value
,
type
)
=>
{
let
data
=
{
...
currentTrench
};
data
[
type
]
=
value
;
setCurrentTrench
(
data
);
};
return
(
<
div
className=
{
styles
.
editModal_container
}
>
<
Form
form=
{
form
}
{
...
layout
}
onFinish=
{
onSubmit
}
>
<
div
className=
{
styles
.
content
}
>
<
Card
title=
"方案"
style=
{
{
width
:
'100%'
}
}
>
<
Item
label=
"方案名称"
name=
"name"
rules=
{
[
{
required
:
true
,
message
:
'请输入方案名称'
,
},
]
}
>
<
Input
style=
{
{
width
:
'25rem'
}
}
placeholder=
"请输入方案名称"
disabled=
{
!!
template
.
ThemeName
}
onChange=
{
onNameChange
}
/>
</
Item
>
<
Item
label=
"方案类型"
>
<
div
className=
{
styles
.
cardList
}
>
{
listType
.
map
(
item
=>
(
<
div
key=
{
item
.
title
}
className=
{
styles
.
cardListItem
}
>
<
Button
type=
{
item
.
title
===
btnType
?
'primary'
:
'default'
}
style=
{
{
cursor
:
'not-allowed'
,
marginRight
:
'1rem'
}
}
>
{
item
.
title
}
</
Button
>
{
' '
}
<
span
>
{
item
.
desc
}
</
span
>
</
div
>
))
}
</
div
>
</
Item
>
</
Card
>
{
btnType
===
'定时推送'
&&
(
<
Card
title=
"推送信息"
style=
{
{
width
:
'100%'
,
marginTop
:
'1rem'
}
}
>
<
div
style=
{
{
display
:
'flex'
,
alignItems
:
'center'
}
}
>
<
Item
label=
"推送组"
name=
"to_person"
labelCol=
{
{
span
:
3
}
}
style=
{
{
paddingTop
:
'1.6rem'
,
width
:
'35rem'
}
}
>
<
VisibleRoleModal
style=
{
{
display
:
'flex'
,
width
:
'35rem'
,
alignItems
:
'center'
,
}
}
onSubmit=
{
onPushSubmit
}
selectValue=
{
template
&&
template
.
PushGroup
?
template
.
PushGroup
:
[]
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
,
});
title=
{
<
UsergroupDeleteOutlined
style=
{
{
fontSize
:
'18px'
}
}
/>
}
}
)
/>
</
Item
>
}
else
{
let
bb
if
(
fv
.
enterprise_template
==
undefined
)
{
bb
=
''
}
else
{
bb
=
fv
.
enterprise_template
.
toString
()
<
div
style=
{
{
display
:
'flex'
,
width
:
'30rem'
,
margin
:
'0 2rem'
,
alignItems
:
'center'
,
}
}
>
推送计划:
{
' '
}
<
VisibleIISAgentConfig
agentConfig=
{
template
.
item
&&
template
.
item
.
AgentConfig
}
value=
{
plan
}
onIISAgentSubmit=
{
onIISAgentSubmit
}
/>
</
div
>
<
span
>
是否启用:
<
Switchs
checked=
{
isUse
!==
'0'
}
onChange=
{
onChange
}
/>
</
span
>
</
div
>
</
Card
>
)
}
<
div
className=
{
styles
.
push_trench
}
>
{
<
div
className=
{
styles
.
trench_card
}
>
<
div
className=
{
styles
.
card_title
}
>
<
div
className=
{
styles
.
lable
}
>
APP
</
div
>
<
Switchs
onChange=
{
e
=>
onTypeChange
(
e
,
'isAPPShow'
)
}
checked=
{
currentTrench
.
isAPPShow
}
/>
</
div
>
<
div
className=
{
styles
.
card_body
}
>
<
Item
label=
"模板"
labelAlign=
"left"
name=
"app_template"
labelCol=
{
{
span
:
2
}
}
>
<
Select
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isAPPShow
}
>
{
APP_ITEMS
.
map
((
item
,
idx
)
=>
(
<
Select
.
Option
value=
{
item
.
Id
}
key=
{
idx
}
>
{
item
.
LikeName
}
</
Select
.
Option
>
))
}
</
Select
>
</
Item
>
<
Item
label=
"功能路径"
name=
"app_path"
labelAlign=
"left"
labelCol=
{
{
span
:
2
}
}
>
<
TextArea
rows=
{
4
}
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isAPPShow
}
placeholder=
"请输入功能路径"
/>
</
Item
>
</
div
>
</
div
>
}
console
.
log
(
fv
.
enterprise_template
)
let
b
=
{
ThemeName
:
"定时推送"
,
MsgType
:
fv
.
name
,
PublicTemplateID
:
fv
.
wx_template
?
fv
.
wx_template
.
toString
()
:
null
,
PublicConfig
:
template
.
PublicConfig
,
PublicPath
:
fv
.
h5_path
,
MsgTemplateName
:
template
.
MsgTemplateName
,
MsgTemplateCode
:
template
.
MsgTemplateCode
,
MsgConfig
:
template
.
MsgConfig
,
MiniAppRoute
:
fv
.
miniprogram_path
,
AppFunctionPath
:
fv
.
app_path
,
AppConfig
:
template
.
AppConfig
,
WebFunctionPath
:
fv
.
web_path
,
WebConfig
:
template
.
WebConfig
,
IsDelete
:
template
.
IsDelete
,
InputTime
:
moment
().
format
(
"YYYY-MM-DD HH:mm:ss"
),
Pusher
:
template
.
Pusher
,
PushMode
:
push_mode
,
PushPath
:
template
.
PushPath
,
IsStarted
:
isUse
,
MsgTemplateID
:
fv
.
message_template
,
AppTemplateID
:
fv
.
app_template
,
WebTemplateID
:
fv
.
web_template
,
PushGroup
:
fv
.
to_person
?
fv
.
to_person
.
toString
()
:
''
,
WorkWeiXinTemplateId
:
bb
,
{
<
div
className=
{
styles
.
trench_card
}
>
<
div
className=
{
styles
.
card_title
}
>
<
div
className=
{
styles
.
lable
}
>
公众号
</
div
>
<
Switchs
onChange=
{
e
=>
onTypeChange
(
e
,
'isWXShow'
)
}
checked=
{
currentTrench
.
isWXShow
}
/>
</
div
>
<
div
className=
{
styles
.
card_body
}
>
<
Item
label=
"模板"
name=
"wx_template"
labelAlign=
"left"
labelCol=
{
{
span
:
3
}
}
>
<
Select
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isWXShow
}
>
{
WX_ITEMS
.
map
((
item
,
idx
)
=>
(
<
Select
.
Option
value=
{
item
.
Id
}
key=
{
idx
}
>
{
item
.
LikeName
}
</
Select
.
Option
>
))
}
</
Select
>
</
Item
>
<
Item
label=
"H5路由"
name=
"h5_path"
labelAlign=
"left"
labelCol=
{
{
span
:
3
}
}
>
<
Input
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isWXShow
}
placeholder=
"请输入功能路径"
/>
</
Item
>
<
Item
label=
"小程序路由"
name=
"miniprogram_path"
labelAlign=
"left"
labelCol=
{
{
span
:
3
}
}
>
<
Input
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isWXShow
}
placeholder=
"请输入功能路径"
/>
</
Item
>
</
div
>
</
div
>
}
{
<
div
className=
{
styles
.
trench_card
}
>
<
div
className=
{
styles
.
card_title
}
>
<
div
className=
{
styles
.
lable
}
>
WEB
</
div
>
<
Switchs
onChange=
{
e
=>
onTypeChange
(
e
,
'isWEBShow'
)
}
checked=
{
currentTrench
.
isWEBShow
}
/>
</
div
>
<
div
className=
{
styles
.
card_body
}
>
<
Item
label=
"模板"
name=
"web_template"
labelCol=
{
{
span
:
2
}
}
labelAlign=
"left"
>
<
Select
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isWEBShow
}
>
{
WEB_ITEMS
.
map
((
item
,
idx
)
=>
(
<
Select
.
Option
value=
{
item
.
Id
}
key=
{
idx
}
>
{
item
.
LikeName
}
</
Select
.
Option
>
))
}
</
Select
>
</
Item
>
<
Item
label=
"功能路径"
name=
"web_path"
labelAlign=
"left"
labelCol=
{
{
span
:
2
}
}
>
<
TextArea
rows=
{
4
}
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isWEBShow
}
placeholder=
"请输入功能路径"
/>
</
Item
>
</
div
>
</
div
>
}
InsertMessageConfig
(
b
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
IISConfig
)
{
AddIISAgentConfig
(
IISConfig
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
message
.
success
(
"保存成功"
)
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
,
});
}
}
)
}
else
{
message
.
success
(
"保存成功"
)
}
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
,
});
}
}
)
}
}
const
onIISAgentSubmit
=
(
value
)
=>
{
console
.
log
(
'value'
,
value
);
setIISConfig
(
value
)
}
const
onPushSubmit
=
(
value
)
=>
{
console
.
log
(
value
,
"onPushSubmit"
)
}
const
layout
=
{
layout
:
'horizontal'
,
labelCol
:
{
span
:
2
,
},
wrapperCol
:
{
span
:
24
,
},
};
const
onChange
=
(
value
)
=>
{
setIsUse
(
value
?
'1'
:
'0'
)
}
const
back
=
()
=>
{
history
.
push
(
'/platformCenter/notify'
)
}
const
tailLayout
=
{
wrapperCol
:
{
offset
:
21
,
span
:
24
},
};
const
onTypeChange
=
(
value
,
type
)
=>
{
let
data
=
{
...
currentTrench
}
data
[
type
]
=
value
setCurrentTrench
(
data
)
}
return
(
<
div
className=
{
styles
.
editModal_container
}
>
<
Form
form=
{
form
}
{
...
layout
}
onFinish=
{
onSubmit
}
>
<
div
className=
{
styles
.
content
}
>
<
Card
title=
"方案"
style=
{
{
width
:
'100%'
}
}
>
<
Item
label=
"方案名称"
name=
"name"
rules=
{
[
{
required
:
true
,
message
:
'请输入方案名称'
,
},
]
}
>
<
Input
style=
{
{
width
:
'25rem'
}
}
placeholder=
"请输入方案名称"
disabled=
{
template
.
ThemeName
?
true
:
false
}
onChange=
{
onNameChange
}
/>
</
Item
>
<
Item
label=
"方案类型"
>
<
div
className=
{
styles
.
cardList
}
>
{
listType
.
map
(
item
=>
{
return
<
div
key=
{
item
.
title
}
className=
{
styles
.
cardListItem
}
><
Button
type=
{
item
.
title
===
btnType
?
'primary'
:
'default'
}
style=
{
{
cursor
:
'not-allowed'
,
marginRight
:
'1rem'
}
}
>
{
item
.
title
}
</
Button
>
<
span
>
{
item
.
desc
}
</
span
></
div
>
})
}
</
div
>
</
Item
>
</
Card
>
{
btnType
===
'定时推送'
&&
(<
Card
title=
"推送信息"
style=
{
{
width
:
'100%'
,
marginTop
:
'1rem'
}
}
>
<
div
style=
{
{
display
:
'flex'
,
alignItems
:
'center'
}
}
>
<
Item
label=
"推送组"
name=
"to_person"
labelCol=
{
{
span
:
3
}
}
style=
{
{
paddingTop
:
'1.6rem'
,
width
:
'35rem'
}
}
>
<
VisibleRoleModal
style=
{
{
display
:
'flex'
,
width
:
'35rem'
,
alignItems
:
'center'
}
}
onSubmit=
{
onPushSubmit
}
selectValue=
{
template
&&
template
.
PushGroup
?
template
.
PushGroup
:
[]
}
title=
{
<
UsergroupDeleteOutlined
style=
{
{
fontSize
:
'18px'
}
}
/>
}
/>
</
Item
>
<
div
style=
{
{
display
:
'flex'
,
width
:
'30rem'
,
margin
:
'0 2rem'
,
alignItems
:
'center'
}
}
>
推送计划:
<
VisibleIISAgentConfig
agentConfig=
{
template
.
item
&&
template
.
item
.
AgentConfig
}
value=
{
plan
}
onIISAgentSubmit=
{
onIISAgentSubmit
}
/>
</
div
>
<
span
>
是否启用:
<
Switchs
checked=
{
isUse
===
'0'
?
false
:
true
}
onChange=
{
onChange
}
/>
</
span
>
</
div
>
</
Card
>)
}
<
div
className=
{
styles
.
push_trench
}
>
{
<
div
className=
{
styles
.
trench_card
}
>
<
div
className=
{
styles
.
card_title
}
>
<
div
className=
{
styles
.
lable
}
>
APP
</
div
>
<
Switchs
onChange=
{
e
=>
onTypeChange
(
e
,
'isAPPShow'
)
}
checked=
{
currentTrench
.
isAPPShow
}
/>
</
div
>
<
div
className=
{
styles
.
card_body
}
>
<
Item
label=
"模板"
labelAlign=
'left'
name=
"app_template"
labelCol=
{
{
span
:
2
}
}
>
<
Select
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isAPPShow
}
>
{
APP_ITEMS
.
map
((
item
,
idx
)
=>
{
return
(
<
Select
.
Option
value=
{
item
.
Id
}
key=
{
idx
}
>
{
item
.
LikeName
}
</
Select
.
Option
>
)
})
}
</
Select
>
</
Item
>
<
Item
label=
"功能路径"
name=
"app_path"
labelAlign=
'left'
labelCol=
{
{
span
:
2
}
}
>
<
TextArea
rows=
{
4
}
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isAPPShow
}
placeholder=
"请输入功能路径"
/>
</
Item
>
</
div
>
</
div
>
}
{
<
div
className=
{
styles
.
trench_card
}
>
<
div
className=
{
styles
.
card_title
}
>
<
div
className=
{
styles
.
lable
}
>
公众号
</
div
>
<
Switchs
onChange=
{
e
=>
onTypeChange
(
e
,
'isWXShow'
)
}
checked=
{
currentTrench
.
isWXShow
}
/>
</
div
>
<
div
className=
{
styles
.
card_body
}
>
<
Item
label=
"模板"
name=
"wx_template"
labelAlign=
'left'
labelCol=
{
{
span
:
3
}
}
>
<
Select
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isWXShow
}
>
{
WX_ITEMS
.
map
((
item
,
idx
)
=>
{
return
(
<
Select
.
Option
value=
{
item
.
Id
}
key=
{
idx
}
>
{
item
.
LikeName
}
</
Select
.
Option
>
)
})
}
</
Select
>
</
Item
>
<
Item
label=
"H5路由"
name=
"h5_path"
labelAlign=
'left'
labelCol=
{
{
span
:
3
}
}
>
<
Input
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isWXShow
}
placeholder=
"请输入功能路径"
/>
</
Item
>
<
Item
label=
"小程序路由"
name=
"miniprogram_path"
labelAlign=
'left'
labelCol=
{
{
span
:
3
}
}
>
<
Input
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isWXShow
}
placeholder=
"请输入功能路径"
/>
</
Item
>
</
div
>
</
div
>
}
{
<
div
className=
{
styles
.
trench_card
}
>
<
div
className=
{
styles
.
card_title
}
>
<
div
className=
{
styles
.
lable
}
>
WEB
</
div
>
<
Switchs
onChange=
{
e
=>
onTypeChange
(
e
,
'isWEBShow'
)
}
checked=
{
currentTrench
.
isWEBShow
}
/>
</
div
>
<
div
className=
{
styles
.
card_body
}
>
<
Item
label=
"模板"
name=
"web_template"
labelCol=
{
{
span
:
2
}
}
labelAlign=
'left'
>
<
Select
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isWEBShow
}
>
{
WEB_ITEMS
.
map
((
item
,
idx
)
=>
{
return
(
<
Select
.
Option
value=
{
item
.
Id
}
key=
{
idx
}
>
{
item
.
LikeName
}
</
Select
.
Option
>
)
})
}
</
Select
>
</
Item
>
<
Item
label=
"功能路径"
name=
"web_path"
labelAlign=
'left'
labelCol=
{
{
span
:
2
}
}
>
<
TextArea
rows=
{
4
}
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isWEBShow
}
placeholder=
"请输入功能路径"
/>
</
Item
>
</
div
>
</
div
>
}
{
<
div
className=
{
styles
.
trench_card
}
>
<
div
className=
{
styles
.
card_title
}
>
<
div
className=
{
styles
.
lable
}
>
短信推送
</
div
>
<
Switchs
onChange=
{
e
=>
onTypeChange
(
e
,
'isMessageShow'
)
}
checked=
{
currentTrench
.
isMessageShow
}
/>
</
div
>
<
div
className=
{
styles
.
card_body
}
>
<
Item
label=
"模板"
labelAlign=
'left'
name=
"message_template"
labelCol=
{
{
span
:
2
}
}
>
<
Select
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isMessageShow
}
>
{
MES_ITEMS
.
map
((
item
,
idx
)
=>
{
return
(
<
Select
.
Option
value=
{
item
.
Id
}
key=
{
idx
}
>
{
item
.
LikeName
}
</
Select
.
Option
>
)
})
}
</
Select
>
</
Item
>
</
div
>
</
div
>
}
{
<
div
className=
{
styles
.
trench_card
}
>
<
div
className=
{
styles
.
card_title
}
>
<
div
className=
{
styles
.
lable
}
>
企业微信
</
div
>
<
Switchs
onChange=
{
e
=>
onTypeChange
(
e
,
'isEnterpriseWXShow'
)
}
checked=
{
currentTrench
.
isEnterpriseWXShow
}
/>
</
div
>
<
div
className=
{
styles
.
card_body
}
>
<
Item
label=
"模板"
labelAlign=
'left'
name=
"enterprise_template"
labelCol=
{
{
span
:
2
}
}
>
<
Select
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isEnterpriseWXShow
}
>
{
EN_ITEMS
.
map
((
item
,
idx
)
=>
{
return
(
<
Select
.
Option
value=
{
item
.
Id
}
key=
{
idx
}
>
{
item
.
LikeName
}
</
Select
.
Option
>
)
})
}
</
Select
>
</
Item
>
</
div
>
</
div
>
}
</
div
>
{
<
div
className=
{
styles
.
trench_card
}
>
<
div
className=
{
styles
.
card_title
}
>
<
div
className=
{
styles
.
lable
}
>
短信推送
</
div
>
<
Switchs
onChange=
{
e
=>
onTypeChange
(
e
,
'isMessageShow'
)
}
checked=
{
currentTrench
.
isMessageShow
}
/>
</
div
>
<
div
className=
{
styles
.
card_body
}
>
<
Item
label=
"模板"
labelAlign=
"left"
name=
"message_template"
labelCol=
{
{
span
:
2
}
}
>
<
Select
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isMessageShow
}
>
{
MES_ITEMS
.
map
((
item
,
idx
)
=>
(
<
Select
.
Option
value=
{
item
.
Id
}
key=
{
idx
}
>
{
item
.
LikeName
}
</
Select
.
Option
>
))
}
</
Select
>
</
Item
>
</
div
>
</
div
>
}
{
<
div
className=
{
styles
.
trench_card
}
>
<
div
className=
{
styles
.
card_title
}
>
<
div
className=
{
styles
.
lable
}
>
企业微信
</
div
>
<
Switchs
onChange=
{
e
=>
onTypeChange
(
e
,
'isEnterpriseWXShow'
)
}
checked=
{
currentTrench
.
isEnterpriseWXShow
}
/>
</
div
>
<
Item
{
...
tailLayout
}
style=
{
{
marginTop
:
'1rem'
}
}
>
<
Button
htmlType=
"button"
onClick=
{
back
}
style=
{
{
marginRight
:
'2rem'
}
}
>
返回
</
Button
>
<
Button
type=
"primary"
htmlType=
"submit"
>
确定
</
Button
>
</
Item
>
</
Form
>
<
div
>
</
div
>
<
div
className=
{
styles
.
card_body
}
>
<
Item
label=
"模板"
labelAlign=
"left"
name=
"enterprise_template"
labelCol=
{
{
span
:
2
}
}
>
<
Select
style=
{
{
width
:
'97%'
}
}
disabled=
{
!
currentTrench
.
isEnterpriseWXShow
}
>
{
EN_ITEMS
.
map
((
item
,
idx
)
=>
(
<
Select
.
Option
value=
{
item
.
Id
}
key=
{
idx
}
>
{
item
.
LikeName
}
</
Select
.
Option
>
))
}
</
Select
>
</
Item
>
</
div
>
</
div
>
}
</
div
>
</
div
>
)
}
export
default
EditModal
;
\ No newline at end of file
<
Item
{
...
tailLayout
}
style=
{
{
marginTop
:
'1rem'
}
}
>
<
Button
htmlType=
"button"
onClick=
{
back
}
style=
{
{
marginRight
:
'2rem'
}
}
>
返回
</
Button
>
<
Button
type=
"primary"
htmlType=
"submit"
>
确定
</
Button
>
</
Item
>
</
Form
>
<
div
/>
</
div
>
);
};
export
default
EditModal
;
src/services/common/api.js
View file @
2bdca006
/*
* @Description:
* @Description:
* @Author: leizhe
* @Date: 2021-07-08 16:18:14
* @LastEditTime: 2021-11-26 1
5:53:25
* @LastEditTime: 2021-11-26 1
6:28:39
* @LastEditors: leizhe
*/
import
{
post
,
postForm
,
get
,
PUBLISH_SERVICE
}
from
'../index'
;
...
...
@@ -16,6 +16,6 @@ export const getSysConfigurate = params =>
);
export
const
gateWayConfig
=
params
=>
get
(
`/PandaCore/GCK/Basis/GateWayConfig`
,
params
);
//获取网关配置
//
获取网关配置
export
const
GetGateWay
=
param
=>
get
(
`
${
PUBLISH_SERVICE
}
/HostManager/GetGateWay`
,
param
);
get
(
`
${
PUBLISH_SERVICE
}
/HostManager/GetGateWay`
,
param
);
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