Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ethan
/
ant-admin-pro
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit a2d66cfc
authored
2018-01-23 11:11:28 +0800
by
ethanlamzs
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
分页问题
1 parent
add383eb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
10 deletions
mock/schoollist.js
src/components/StandardTableM/index.js
src/routes/devutil/linkmanadm2.js
mock/schoollist.js
View file @
a2d66cf
...
...
@@ -32,12 +32,16 @@ export function getSchoolLists(req, res, u) {
console
.
log
(
url
);
console
.
log
(
params
);
const
count
=
(
params
.
pageSize
*
1
)
||
4
0
;
const
pageSize
=
(
params
.
pageSize
*
1
)
||
1
0
;
const
result
=
schoolList
(
count
,
params
.
name
);
const
result
=
schoolList
(
100
,
params
.
name
);
if
(
res
&&
res
.
json
)
{
res
.
json
({
'list'
:
result
,
'pagination'
:
1
});
res
.
json
({
'list'
:
result
,
'pagination'
:
{
'total'
:
result
.
length
,
'pageSize'
:
pageSize
,
'current'
:
parseInt
(
params
.
currentPage
,
10
)
||
1
,
},});
}
else
{
return
result
;
}
...
...
src/components/StandardTableM/index.js
View file @
a2d66cf
...
...
@@ -36,10 +36,7 @@ class StandardTable extends PureComponent {
render
()
{
const
{
selectedRowKeys
}
=
this
.
state
;
const
{
data
,
loading
,
columns
}
=
this
.
props
;
const
pagination
=
1
;
const
{
data
:
{
list
,
pagination
},
loading
,
columns
}
=
this
.
props
;
const
paginationProps
=
{
showSizeChanger
:
true
,
...
...
@@ -73,7 +70,7 @@ class StandardTable extends PureComponent {
loading
=
{
loading
}
rowKey
=
{
record
=>
record
.
key
}
rowSelection
=
{
rowSelection
}
dataSource
=
{
data
}
dataSource
=
{
list
}
columns
=
{
columns
}
pagination
=
{
paginationProps
}
onChange
=
{
this
.
handleTableChange
}
...
...
src/routes/devutil/linkmanadm2.js
View file @
a2d66cf
...
...
@@ -36,6 +36,29 @@ export default class linkmanadm extends PureComponent {
}
handleStandardTableChange
=
(
pagination
,
filtersArg
,
sorter
)
=>
{
const
{
dispatch
}
=
this
.
props
;
const
{
formValues
}
=
this
.
state
;
const
filters
=
Object
.
keys
(
filtersArg
).
reduce
((
obj
,
key
)
=>
{
const
newObj
=
{
...
obj
};
newObj
[
key
]
=
getValue
(
filtersArg
[
key
]);
return
newObj
;
},
{});
const
params
=
{
currentPage
:
pagination
.
current
,
pageSize
:
pagination
.
pageSize
,
...
formValues
,
...
filters
,
};
if
(
sorter
.
field
)
{
params
.
sorter
=
`
${
sorter
.
field
}
_
${
sorter
.
order
}
`
;
}
dispatch
({
type
:
'schools/fetch'
,
payload
:
params
,
});
}
...
...
@@ -125,7 +148,7 @@ export default class linkmanadm extends PureComponent {
render
()
{
const
{
schools
:
{
data
:{
list
}
},
loading
}
=
this
.
props
;
const
{
schools
:
{
data
},
loading
}
=
this
.
props
;
const
{
selectedRows
,
modalVisible
,
addInputValue
}
=
this
.
state
;
const
columns
=
[
...
...
@@ -187,7 +210,7 @@ export default class linkmanadm extends PureComponent {
<
StandardTable
selectedRows
=
{
selectedRows
}
loading
=
{
loading
}
data
=
{
list
}
data
=
{
data
}
columns
=
{
columns
}
onSelectRow
=
{
this
.
handleSelectRows
}
onChange
=
{
this
.
handleStandardTableChange
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment