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
e2292fa3
Commit
e2292fa3
authored
Jul 08, 2021
by
shaoan123
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改变量
parent
5aaf3257
Pipeline
#31267
skipped with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
24 deletions
+29
-24
index.jsx
src/pages/platformCenter/bsmanager/tablemanager/index.jsx
+29
-24
No files found.
src/pages/platformCenter/bsmanager/tablemanager/index.jsx
View file @
e2292fa3
...
...
@@ -36,9 +36,10 @@ const TableManager = () => {
const
[
searchValue
,
setSearchValue
]
=
useState
(
''
)
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
true
)
const
[
tableList
,
setTableList
]
=
useState
([])
const
[
groupArr
,
setGroupArr
]
=
useState
({})
const
[
groupArr
,
setGroupArr
]
=
useState
([])
const
[
allData
,
setAllData
]
=
useState
([])
const
[
tableData
,
setTableData
]
=
useState
([])
const
[
spread
,
setSpread
]
=
useState
([])
const
[
spread
,
setSpread
]
=
useState
([])
useEffect
((
record
)
=>
{
loadTable
(
searchValue
)
getField
()
...
...
@@ -135,13 +136,16 @@ const TableManager = () => {
setTableData
(
res
.
data
.
root
)
let
groupData
=
formateArrDataA
(
res
.
data
.
root
,
'groupName'
)
let
newArr
=
[]
Object
.
keys
(
groupData
).
map
((
item
,
index
)
=>
{
newArr
.
push
({
type
:
item
,
key
:
index
})
Object
.
keys
(
groupData
).
map
((
item
,
index
)
=>
{
newArr
.
push
({
type
:
item
,
key
:
index
})
})
setGroupArr
({
groupData
,
newArr
})
setAllData
(
groupData
)
setGroupArr
(
newArr
)
}
}
)
).
catch
(
e
=>
{
setTreeLoading
(
true
)
})
}
const
formateArrDataA
=
(
initialArr
,
name
)
=>
{
// 判定传参是否符合规则
...
...
@@ -288,26 +292,27 @@ const TableManager = () => {
},
];
return
<
Table
columns=
{
columns1
}
dataSource=
{
spread
}
pagination=
{
false
}
/>;
return
<
Table
columns=
{
columns1
}
dataSource=
{
spread
}
pagination=
{
false
}
/>;
};
const
columns
=
[
{
title
:
'类型'
,
dataIndex
:
'type'
,
key
:
'type'
,
render
:
text
=>
{
return
(<
div
>
{
text
}
(
{
groupArr
.
groupData
[
text
].
length
}
个)
</
div
>)
}
},
{
title
:
'类型'
,
dataIndex
:
'type'
,
key
:
'type'
,
render
:
text
=>
{
return
(<
div
style=
{
{
color
:
'#3764a0'
}
}
>
{
text
}
(
{
allData
[
text
].
length
}
个)
</
div
>)
}
},
];
const
openClick
=
(
status
,
item
)
=>
{
if
(
!
status
)
return
let
arr
=
[]
groupArr
.
groupData
[
item
.
type
].
map
((
item
,
index
)
=>
{
arr
.
push
({...
item
,
key
:
index
})
})
setSpread
(
arr
)
}
const
openClick
=
(
status
,
item
)
=>
{
if
(
!
status
)
return
let
arr
=
[]
allData
[
item
.
type
].
map
((
item
,
index
)
=>
{
arr
.
push
({
...
item
,
key
:
index
})
})
setSpread
(
arr
)
}
return
(
<
Spin
tip=
"loading..."
spinning=
{
treeLoading
}
>
<
PageContainer
>
...
...
@@ -353,11 +358,11 @@ const TableManager = () => {
className=
"components-table-demo-nested"
columns=
{
columns
}
expandable=
{
{
expandedRowRender
}
}
dataSource=
{
groupArr
.
newArr
}
dataSource=
{
groupArr
}
onExpand=
{
openClick
}
// 展开时触发的回调
size=
"small"
style=
{
{
height
:
'8rem'
}
}
style=
{
{
height
:
'8rem'
}
}
pagination=
{
{
showTotal
:
(
total
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
,
...
...
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