Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
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
zhaochengxiang
szse
Commits
b57146c3
Commit
b57146c3
authored
Apr 06, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
目录树新增编辑刷新节点不重置选中节点
parent
72a097a7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
ModelTable.jsx
src/view/Manage/Model/Component/ModelTable.jsx
+5
-1
ModelTree.jsx
src/view/Manage/Model/Component/ModelTree.jsx
+16
-3
UpdateTreeItemModal.jsx
src/view/Manage/Model/Component/UpdateTreeItemModal.jsx
+1
-1
No files found.
src/view/Manage/Model/Component/ModelTable.jsx
View file @
b57146c3
...
@@ -36,7 +36,7 @@ const ModelTable = (props) => {
...
@@ -36,7 +36,7 @@ const ModelTable = (props) => {
<
Button
icon=
{
<
EditOutlined
/>
}
size=
'small'
/>
<
Button
icon=
{
<
EditOutlined
/>
}
size=
'small'
/>
</
Tooltip
>
</
Tooltip
>
<
Tooltip
placement=
'bottom'
title=
{
'详情'
}
>
<
Tooltip
placement=
'bottom'
title=
{
'详情'
}
>
<
Button
icon=
{
<
ReconciliationOutlined
/>
}
size=
'small'
/>
<
Button
icon=
{
<
ReconciliationOutlined
/>
}
size=
'small'
onClick=
{
()
=>
{
detailItem
(
record
);
}
}
/>
</
Tooltip
>
</
Tooltip
>
<
Tooltip
placement=
'bottom'
title=
{
'提交审核'
}
>
<
Tooltip
placement=
'bottom'
title=
{
'提交审核'
}
>
<
Button
icon=
{
<
CheckOutlined
/>
}
size=
'small'
/>
<
Button
icon=
{
<
CheckOutlined
/>
}
size=
'small'
/>
...
@@ -50,6 +50,10 @@ const ModelTable = (props) => {
...
@@ -50,6 +50,10 @@ const ModelTable = (props) => {
}
}
];
];
const
detailItem
=
(
record
)
=>
{
}
const
deleteItem
=
(
record
)
=>
{
const
deleteItem
=
(
record
)
=>
{
modal
.
confirm
({
modal
.
confirm
({
...
...
src/view/Manage/Model/Component/ModelTree.jsx
View file @
b57146c3
import
React
,
{
useState
,
useEffect
}
from
"react"
;
import
React
,
{
useState
,
useEffect
,
useRef
}
from
"react"
;
import
{
Tooltip
,
Tree
,
Button
,
Modal
,
Spin
}
from
"antd"
;
import
{
Tooltip
,
Tree
,
Button
,
Modal
,
Spin
}
from
"antd"
;
import
{
PlusOutlined
,
EditOutlined
,
SyncOutlined
,
DeleteOutlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
,
EditOutlined
,
SyncOutlined
,
DeleteOutlined
}
from
'@ant-design/icons'
;
...
@@ -19,6 +19,9 @@ const ModelTree = (props) => {
...
@@ -19,6 +19,9 @@ const ModelTree = (props) => {
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
itemRef
=
useRef
();
itemRef
.
current
=
item
;
useEffect
(()
=>
{
useEffect
(()
=>
{
getTreeData
();
getTreeData
();
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
...
@@ -51,9 +54,15 @@ const ModelTree = (props) => {
...
@@ -51,9 +54,15 @@ const ModelTree = (props) => {
setLoading
(
false
);
setLoading
(
false
);
setTreeData
(
data
.
subCatalogs
||
[]);
setTreeData
(
data
.
subCatalogs
||
[]);
setRootId
(
data
.
id
||
''
);
setRootId
(
data
.
id
||
''
);
const
firstItem
=
(
data
.
subCatalogs
||
[]).
length
>
0
?
data
.
subCatalogs
[
0
]:
null
;
let
firstItem
=
itemRef
.
current
;
if
(
firstItem
===
null
)
{
firstItem
=
(
data
.
subCatalogs
||
[]).
length
>
0
?
data
.
subCatalogs
[
0
]:
null
;
setItem
(
firstItem
);
setItem
(
firstItem
);
}
itemRef
.
current
=
firstItem
;
onSelect
&&
onSelect
(
firstItem
?(
firstItem
.
key
||
''
):
''
);
onSelect
&&
onSelect
(
firstItem
?(
firstItem
.
key
||
''
):
''
);
}
}
...
@@ -112,6 +121,8 @@ const ModelTree = (props) => {
...
@@ -112,6 +121,8 @@ const ModelTree = (props) => {
},
},
callback
:
()
=>
{
callback
:
()
=>
{
showMessage
(
'success'
,
'删除目录成功'
);
showMessage
(
'success'
,
'删除目录成功'
);
setItem
(
null
);
itemRef
.
current
=
null
;
getTreeData
();
getTreeData
();
}
}
});
});
...
@@ -120,8 +131,10 @@ const ModelTree = (props) => {
...
@@ -120,8 +131,10 @@ const ModelTree = (props) => {
}
}
const
onUpdateTreeItemModalOk
=
()
=>
{
const
onUpdateTreeItemModalOk
=
(
updateItem
)
=>
{
setVisible
(
false
);
setVisible
(
false
);
setItem
(
updateItem
);
itemRef
.
current
=
updateItem
;
getTreeData
();
getTreeData
();
}
}
...
...
src/view/Manage/Model/Component/UpdateTreeItemModal.jsx
View file @
b57146c3
...
@@ -136,7 +136,7 @@ const UpdateTreeItemModal = (props) => {
...
@@ -136,7 +136,7 @@ const UpdateTreeItemModal = (props) => {
setConfirmLoading
(
false
);
setConfirmLoading
(
false
);
if
(
onOk
)
{
if
(
onOk
)
{
onOk
();
onOk
(
type
===
'add'
?
item
:
payload
);
}
}
}
}
});
});
...
...
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