Commit d502d22e authored by 田翔's avatar 田翔

fix: 增加分页

parent 08aaf5c5
import React, { useEffect, useMemo, useState } from 'react'
import styles from './index.less'
import { Table, Tooltip, message, Button } from 'antd'
import { Table, Tooltip, message, Button, Pagination } from 'antd'
import SearchGroup from './components/SearchGroup'
import TablePack from './components/TablePack'
import { GetAccountConfigInfo, GetAccountPageList, getStationListByUserID, GetTableJson } from '../../apis/process'
......@@ -30,7 +30,7 @@ const TableRender = (props) => {
const userID = window?.globalConfig?.userInfo?.OID || 1
const { accountName } = props
const [detailShow, setDetailShow] = useState(false)
const [params, setParams] = useState({ userID: userID, accountName, direction: 'desc', timeField: '录入时间', pageIndex: 1, pageSize: 100 })
const [params, setParams] = useState({ userID: userID, accountName, direction: 'desc', timeField: '录入时间', total: 0, pageIndex: 1, pageSize: 100 })
const [loading, setLoading] = useState(false)
const [config, setConfig] = useState({ webShowFieldGroup: '', formJson: '', values: [] })
const [dataSource, setDataSource] = useState([])
......@@ -135,6 +135,7 @@ const TableRender = (props) => {
const { code, data, msg } = await GetAccountPageList({ ...params, ...param })
if (code === 0) {
setDataSource(JSON.parse(data.jsonData))
setParams({ ...params, total: data.totalCount, pageIndex: data.pageIndex, pageSize: data.pageSize })
} else {
setDataSource([])
message.error(msg)
......@@ -142,6 +143,10 @@ const TableRender = (props) => {
setLoading(false)
}
const pageChange = (pageIndex, pageSize) => {
getDataSource({ pageIndex, pageSize })
}
const getData = () => {
getConfig()
getDataSource()
......@@ -175,7 +180,16 @@ const TableRender = (props) => {
</div>
</div>
<div className={styles.footer}>
<div className={styles.total}>共计{params.total}条数据</div>
<div className={styles.pagination}>
<Pagination
showQuickJumper
pageSize={params.pageSize}
current={params.pageIndex}
total={params.total}
onChange={pageChange}
/>
</div>
</div>
</div>
<div className={styles.tableDetail} style={{ display: detailShow ? 'block' : 'none' }}>
......
......@@ -66,7 +66,7 @@
}
&:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected) {
td {
background: rgb(237,242,255)!important;
background: rgb(237, 242, 255)!important;
}
}
} // .ant-table-tbody > tr > td:last-child {
......@@ -97,8 +97,12 @@
position: absolute;
bottom: 0;
left: 0;
padding: 0 20px;
width: 100%;
height: 50px;
display: flex;
align-items: center;
justify-content: space-between;
}
}
.tableDetail {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment