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
d27c7e8d
Commit
d27c7e8d
authored
Dec 01, 2020
by
陈前坚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: dictionary
parent
f889c07f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
30 deletions
+27
-30
WebDic.js
src/pages/platformCenter/dictionary/WebDic.js
+26
-29
WebDic.less
src/pages/platformCenter/dictionary/WebDic.less
+1
-1
No files found.
src/pages/platformCenter/dictionary/WebDic.js
View file @
d27c7e8d
...
...
@@ -18,11 +18,11 @@ import styles from './WebDic.less';
const
WebDic
=
()
=>
{
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
level
,
setLevel
]
=
useState
(
0
);
// 设置级别,一级1,二级2
const
[
level
,
setLevel
]
=
useState
(
0
);
// 设置级别,一级1,二级2
,添加条目时使用
const
[
addVisible
,
setAddVisible
]
=
useState
(
false
);
const
[
editVisible
,
setEditVisible
]
=
useState
(
false
);
const
[
data
,
setData
]
=
useState
([]);
// 一级条目
const
[
subData
,
setSubData
]
=
useState
([]);
// 二级条目
const
[
data
,
setData
]
=
useState
([]);
// 一级条目
数据
const
[
subData
,
setSubData
]
=
useState
([]);
// 二级条目
数据
const
[
select
,
setSelect
]
=
useState
({});
// 当前选中条目,可以是一级/二级,修改/删除时设置
const
[
selectColor
,
setSelectColor
]
=
useState
({});
// 当前选中一级条目颜色,修改/删除时设置
const
[
selectID
,
setSelectID
]
=
useState
(
'-1'
);
// 当前选中一级条目的ID,添加二级条目时使用
...
...
@@ -57,8 +57,7 @@ const WebDic = () => {
<
Button
type
=
"primary"
size
=
"small"
onClick
=
{
e
=>
{
e
.
stopPropagation
();
onClick
=
{()
=>
{
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelectColor
(
record
);
...
...
@@ -72,26 +71,27 @@ const WebDic = () => {
>
修改
<
/Button
>
<
Popconfirm
title
=
"是否删除该数据?"
okText
=
"确认"
cancelText
=
"取消"
onConfirm
=
{
submitDelete
}
>
<
Button
size
=
"small"
danger
onClick
=
{
e
=>
{
e
.
stopPropagation
();
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelectColor
(
record
);
}
}}
<
div
onClick
=
{
e
=>
e
.
stopPropagation
()}
>
<
Popconfirm
title
=
"是否删除该数据?"
okText
=
"确认"
cancelText
=
"取消"
onConfirm
=
{
submitDelete
}
>
删除
<
/Button
>
<
/Popconfirm
>
<
Button
size
=
"small"
danger
onClick
=
{()
=>
{
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelectColor
(
record
);
}
}}
>
删除
<
/Button
>
<
/Popconfirm
>
<
/div
>
<
/Space
>
),
},
...
...
@@ -122,8 +122,8 @@ const WebDic = () => {
setData
(
res
);
// 设置一级条目数据
if
(
first
)
{
setSelect
(
res
[
0
]);
// 默认当前选中一级条目第一条
setSelectColor
(
res
[
0
]);
setSelectID
(
res
[
0
].
nodeID
);
// 设置选中的一级条目ID,用于添加二级条目
// setSelectColor(res[0]);
setFirst
(
false
);
// 获取二级条目数据,默认一级条目第一条,递归一次(条件parentID === '-1')
if
(
res
[
0
]
&&
res
[
0
].
parentID
===
'-1'
)
{
...
...
@@ -239,11 +239,8 @@ const WebDic = () => {
})
.
then
(
res
=>
{
if
(
res
.
success
)
{
// 删除一级条目时要重新设置first为true,默认并选中一级条目第一条纪录
if
(
select
.
parentID
===
'-1'
)
{
// setFirst(true);
}
getData
(
select
.
parentID
);
setSubData
([]);
notification
.
success
({
message
:
'删除成功'
,
});
...
...
src/pages/platformCenter/dictionary/WebDic.less
View file @
d27c7e8d
...
...
@@ -35,7 +35,7 @@
border-top: 1px solid #f0eded;
}
.ant-table-pagination{
padding-top: 1
0
px;
padding-top: 1
6
px;
background: white;
padding-right: 20px;
}
...
...
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