|
@@ -12,7 +12,7 @@ import consts from '@/utils/consts'
|
|
|
import { dayjsFormat } from '@/utils/util'
|
|
|
import { Button, message, Table } from 'antd'
|
|
|
import { ColumnsType } from 'antd/lib/table'
|
|
|
-import React, { useEffect } from 'react'
|
|
|
+import React, { useEffect, useState } from 'react'
|
|
|
import { Link } from 'react-router-dom'
|
|
|
import { apiCreateSafe, apiSafeList, apiSaveRule } from './api'
|
|
|
import AddModel from './modal'
|
|
@@ -20,7 +20,10 @@ import AddModel from './modal'
|
|
|
|
|
|
const SafeList: React.FC<{}> = () => {
|
|
|
const [ state, setState ] = useListModal(consts.DATA_TYPE.SAFE)
|
|
|
-
|
|
|
+ const [page, setPage] = useState({
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: consts.PAGE_SIZE
|
|
|
+ })
|
|
|
useEffect(() => {
|
|
|
initData()
|
|
|
}, [])
|
|
@@ -31,7 +34,7 @@ const SafeList: React.FC<{}> = () => {
|
|
|
width: '5%',
|
|
|
// eslint-disable-next-line react/display-name
|
|
|
render: (_: string, record: any, i: number) => {
|
|
|
- return <span>{i + 1}</span>
|
|
|
+ return <span>{(page.pageNo - 1) * page.pageSize + i + 1}</span>
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -97,6 +100,7 @@ const SafeList: React.FC<{}> = () => {
|
|
|
]
|
|
|
|
|
|
const initData = (pageNo: number = 1, pageSize: number = consts.PAGE_SIZE) => {
|
|
|
+ setPage({...page, pageNo, pageSize})
|
|
|
const initModal = {
|
|
|
ruleModal: { loading: false, visible: false },
|
|
|
addModal: { loading: false, visible: false }
|
|
@@ -161,7 +165,8 @@ const SafeList: React.FC<{}> = () => {
|
|
|
pagination={{
|
|
|
hideOnSinglePage: true,
|
|
|
size: 'small',
|
|
|
- pageSize: consts.PAGE_SIZE,
|
|
|
+ current: page.pageNo,
|
|
|
+ pageSize: page.pageSize,
|
|
|
onChange: (page, pageSize) => initData(page, pageSize),
|
|
|
total: state.total
|
|
|
}}
|