Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wms
Project
Project
Details
Activity
Releases
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
wuhao
wms
Commits
540ed2bf
Commit
540ed2bf
authored
Jul 01, 2022
by
wuhao
🎯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
loasder
parent
ede0ff04
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
24 deletions
+36
-24
index.jsx
src/components/TreeRender/index.jsx
+36
-24
No files found.
src/components/TreeRender/index.jsx
View file @
540ed2bf
...
...
@@ -19,13 +19,20 @@ function TreeRender({ url, deleteurl, saveurl, onselected }) {
visible
:
false
});
const
{
data
,
loading
,
refresh
}
=
useRequest
(()
=>
{
return
doFetch
({
url
,
params
:
{
title
:
search
}
})
},{
refreshDeps
:[
search
]
return
doFetch
({
url
,
params
:
{
title
:
search
}
})
},
{
refreshDeps
:
[
search
]
});
const
ref1
=
useRef
(),
ref2
=
useRef
();
const
treeData
=
useMemo
(()
=>
{
return
data
?.
data
?.
dataList
??
[]
let
res
=
data
?.
data
?.
dataList
??
[];
return
[
{
title
:
"全部"
,
key
:
"0"
,
children
:
res
}
]
},
[
data
]);
const
loop
=
data
=>
data
.
map
(
item
=>
{
...
...
@@ -50,24 +57,29 @@ function TreeRender({ url, deleteurl, saveurl, onselected }) {
const
actiontitle
=
(
<
div
style=
{
{
display
:
"flex"
,
alignItems
:
"center"
}
}
>
{
title
}
<
Divider
type=
'vertical'
style=
{
{
margin
:
"0 6px"
}
}
></
Divider
>
<
Tooltip
title=
"编辑"
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
();
setsavetitle
(
null
)
if
(
getPrem
(
"enElectricityMeterType_save"
,
"ifs"
))
{
setModal
({
visible
:
true
,
closable
:
true
,
title
:
"修改节点名称"
,
okText
:
"修改"
,
cancelText
:
"取消"
,
placeholder
:
item
.
title
,
key
:
item
.
key
})
}
}
}
>
<
FormOutlined
style=
{
{
color
:
"#1890ff"
}
}
/>
</
Tooltip
>
{
item
.
key
!=
"0"
&&
<
Divider
type=
'vertical'
style=
{
{
margin
:
"0 6px"
}
}
></
Divider
>
}
{
item
.
key
!=
"0"
&&
<
Tooltip
title=
"编辑"
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
();
setsavetitle
(
null
)
if
(
getPrem
(
"enElectricityMeterType_save"
,
"ifs"
))
{
setModal
({
visible
:
true
,
closable
:
true
,
title
:
"修改节点名称"
,
okText
:
"修改"
,
cancelText
:
"取消"
,
placeholder
:
item
.
title
,
key
:
item
.
key
})
}
}
}
>
<
FormOutlined
style=
{
{
color
:
"#1890ff"
}
}
/>
</
Tooltip
>
}
<
Divider
type=
'vertical'
style=
{
{
margin
:
"0 6px"
}
}
></
Divider
>
<
Tooltip
title=
"新增"
>
<
PlusSquareOutlined
...
...
@@ -94,7 +106,7 @@ function TreeRender({ url, deleteurl, saveurl, onselected }) {
<
Divider
type=
'vertical'
style=
{
{
margin
:
"0 6px"
}
}
></
Divider
>
}
{
(
!
item
.
children
||
item
.
children
.
length
==
0
)
&&
(
!
item
.
children
||
item
.
children
.
length
==
0
)
&&
(
item
.
key
!=
"0"
)
&&
<
Popconfirm
placement=
'bottom'
title=
"是否删除该节点?"
...
...
@@ -216,7 +228,7 @@ function TreeRender({ url, deleteurl, saveurl, onselected }) {
</
div
>
}
</
Modal
>
<
Search
value=
{
search
}
style=
{
{
margin
:
'16px 0 8px 0'
}
}
placeholder=
"搜索"
onChange=
{
(
e
)
=>
{
<
Search
value=
{
search
}
style=
{
{
margin
:
'16px 0 8px 0'
}
}
placeholder=
"搜索"
onChange=
{
(
e
)
=>
{
setsearch
(
e
.
target
.
value
)
}
}
/>
...
...
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