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
b7f90758
Commit
b7f90758
authored
Mar 16, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
样式调整
parent
44958eab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
10 deletions
+48
-10
index.js
src/util/index.js
+1
-1
index.jsx
src/view/Manage/AssetTask/index.jsx
+47
-9
No files found.
src/util/index.js
View file @
b7f90758
...
...
@@ -124,7 +124,7 @@ export class DeleteTipModal extends React.Component {
export
const
paginate
=
function
(
items
,
pageNum
=
1
,
pageSize
=
10
)
{
const
offset
=
(
pageNum
-
1
)
*
pageSize
;
return
items
.
filter
((
item
,
i
)
=>
i
>=
offset
&&
i
<
offset
+
pageSize
);
return
items
?
.
filter
((
item
,
i
)
=>
i
>=
offset
&&
i
<
offset
+
pageSize
);
}
export
const
IsArr
=
function
(
data
)
{
...
...
src/view/Manage/AssetTask/index.jsx
View file @
b7f90758
import
{
useState
,
useEffect
,
useMemo
}
from
'react'
;
import
{
Button
,
Table
,
Space
}
from
'antd'
;
import
{
Button
,
Table
,
Space
,
Pagination
}
from
'antd'
;
import
TaskDetail
from
'./TaskDetail'
;
import
UpdateTask
from
'./UpdateTask'
;
import
AuditTask
from
'./AuditTask'
;
import
CheckTask
from
'./CheckTask'
;
import
{
dispatch
}
from
'../../../model'
;
import
{
paginate
}
from
'../../../util'
;
export
const
status
=
{
'tobeDistributed'
:
'待分发'
,
...
...
@@ -19,6 +20,8 @@ export const status = {
const
FC
=
(
props
)
=>
{
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
tasks
,
setTasks
]
=
useState
();
const
[
pagination
,
setPagination
]
=
useState
({
pageNum
:
1
,
pageSize
:
20
});
const
{
pageNum
,
pageSize
}
=
pagination
;
const
[
taskDetailParams
,
setTaskDetailParams
]
=
useState
({
visible
:
false
,
task
:
undefined
,
...
...
@@ -114,6 +117,11 @@ const FC = (props) => {
)
},
[
onActionClick
])
const
_tasks
=
useMemo
(()
=>
{
return
paginate
(
tasks
,
pagination
.
pageNum
,
paginate
.
pageSize
)
},
[
pagination
,
tasks
])
useEffect
(()
=>
{
getTasks
();
},
[])
...
...
@@ -156,16 +164,46 @@ const FC = (props) => {
}
return
(
<
div
>
<
div
>
<
div
style=
{
{
backgroundColor
:
'#fff'
,
height
:
'100%'
}
}
>
<
div
className=
'd-flex p-3'
style=
{
{
borderBottom
:
'1px solid #EFEFEF'
,
justifyContent
:
'space-between'
,
alignItems
:
'center'
}
}
>
<
Button
onClick=
{
onAddClick
}
>
新增
</
Button
>
</
div
>
<
Table
rowKey=
'id'
loading=
{
loading
}
columns=
{
columns
}
dataSource=
{
tasks
||
[]
}
/>
<
div
className=
'p-3'
>
<
Table
rowKey=
'id'
loading=
{
loading
}
columns=
{
columns
}
dataSource=
{
_tasks
||
[]
}
pagination=
{
false
}
scroll=
{
(
_tasks
||
[]).
length
===
0
?
null
:
'calc(100vh - 121px - 57px - 24px - 38px - 44px)'
}
/>
{
(
tasks
||
[]).
length
>
0
&&
<
Pagination
className=
"text-center mt-3"
showSizeChanger
showQuickJumper
onChange=
{
(
_pageNum
,
_pageSize
)
=>
{
setPagination
({
pageNum
:
_pageNum
,
pageSize
:
_pageSize
||
20
});
}
}
onShowSizeChange=
{
(
_pageNum
,
_pageSize
)
=>
{
setPagination
({
pageNum
:
1
,
pageSize
:
_pageSize
});
}
}
current=
{
pageNum
}
pageSize=
{
pageSize
}
defaultCurrent=
{
1
}
total=
{
(
tasks
||
[]).
length
}
pageSizeOptions=
{
[
10
,
20
,
50
]
}
showTotal=
{
total
=>
`共 ${(tasks||[]).length} 条`
}
/>
}
</
div
>
<
TaskDetail
visible=
{
taskDetailParams
.
visible
}
...
...
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