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