diff --git a/src/components/ClusterMgtList/index.js b/src/components/ClusterMgtList/index.js index ec597d326..15d87aeee 100644 --- a/src/components/ClusterMgtList/index.js +++ b/src/components/ClusterMgtList/index.js @@ -49,6 +49,9 @@ class Index extends Component { showUpdateKubernetes: false, showUpdateKubernetesTasks: false, isShowAddNodeModal: false, + pageSize: 10, + total: 0, + current: 1 } } //节点状态 @@ -143,6 +146,14 @@ class Index extends Component { } } + total = (total) => `共 ${total} 条`; + pageChange = (current, pageSize) => { + console.log(current, pageSize); + this.setState({ + pageSize, + current + }) + } render() { const { nodeList, rowClusterInfo, showInfo, form, eventId } = this.props const { selectArr, isShowAddNodeModal } = this.state @@ -287,6 +298,17 @@ class Index extends Component { sm: { span: 16 } } }; + const pagination = { + total: nodeList.length || 0, + current: this.state.current, + pageSize: this.state.pageSize, + showQuickJumper: true, + showSizeChanger: true, + showTotal: this.total, + onChange: this.pageChange, + onShowSizeChange :this.pageChange, + hideOnSinglePage: nodeList.length <= 10 + }; return ( <> index} dataSource={nodeList} - pagination={nodeList && nodeList.length > 10 ? true : false} + pagination={pagination} onRow={this.onClickRow} rowClassName={styles.rowStyle} /> diff --git a/src/components/EnvironmentVariable/index.js b/src/components/EnvironmentVariable/index.js index 7074ab1d2..b245be427 100644 --- a/src/components/EnvironmentVariable/index.js +++ b/src/components/EnvironmentVariable/index.js @@ -748,22 +748,19 @@ class EnvironmentVariable extends React.Component { components={components} columns={columns} dataSource={innerEnvsList} - pagination={false} + pagination={{ + current: page, + pageSize: page_size, + total: Number(total), + onChange: this.onPageChange, + onShowSizeChange: this.onShowSizeChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + pageSizeOptions:['5', '10', '20', '30'], + hideOnSinglePage: Number(total) <= 5 + }} /> -
- {Number(total) >page_size && - - } -
diff --git a/src/components/GatewayRouteHttp/index.js b/src/components/GatewayRouteHttp/index.js index 071933cfe..f350703f1 100644 --- a/src/components/GatewayRouteHttp/index.js +++ b/src/components/GatewayRouteHttp/index.js @@ -30,7 +30,9 @@ export default class index extends Component { routeDrawer: false, dataSource: [], type: 'add', - tableLoading: true + tableLoading: true, + pageSize: 10, + page: 1 }; } componentDidMount() { @@ -158,12 +160,20 @@ export default class index extends Component { const ComponentID = serviceName.slice(-8); dispatch(routerRedux.push(`/team/${teamName}/region/${regionName}/components/${ComponentID}/overview`)); } + onPageChange = (page_num, page_size) => { + this.setState({ + page: page_num, + pageSize: page_size + }) + } render() { const { routeDrawer, dataSource, editInfo, - tableLoading + tableLoading, + page, + pageSize } = this.state; const { appID, @@ -305,6 +315,17 @@ export default class index extends Component { columns={columns} loading={tableLoading} rowKey={record => record.name || record.serviceName} + pagination={{ + current: page, + pageSize: pageSize, + total: dataSource.length , + onChange: this.onPageChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + onShowSizeChange: this.onPageChange, + hideOnSinglePage: dataSource.length <= 10 + }} />
{routeDrawer && diff --git a/src/components/GatewayRouteTcp/index.js b/src/components/GatewayRouteTcp/index.js index 7fa1dfd83..32685cb57 100644 --- a/src/components/GatewayRouteTcp/index.js +++ b/src/components/GatewayRouteTcp/index.js @@ -34,7 +34,9 @@ export default class index extends Component { type: 'add', tableLoading: true, comList:[], - outer_url:'' + outer_url:'', + pageSize: 10, + page: 1 }; } componentWillMount(){ @@ -201,13 +203,21 @@ export default class index extends Component { ) ); } + onPageChange = (page_num, page_size) => { + this.setState({ + page: page_num, + pageSize: page_size + }) + } render() { const { routeDrawer, dataSource, editInfo, tableLoading, - outer_url + outer_url, + pageSize, + page } = this.state; const { appID, @@ -315,6 +325,17 @@ export default class index extends Component { dataSource={dataSource} columns={columns} loading={tableLoading} + pagination={{ + current: page, + pageSize: pageSize, + total: dataSource.length , + onChange: this.onPageChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + onShowSizeChange: this.onPageChange, + hideOnSinglePage: dataSource.length <= 10 + }} /> {routeDrawer && diff --git a/src/components/RelatumComponentInfo/index.js b/src/components/RelatumComponentInfo/index.js index 3fd3f17d0..59f2fcd78 100644 --- a/src/components/RelatumComponentInfo/index.js +++ b/src/components/RelatumComponentInfo/index.js @@ -28,7 +28,7 @@ export default class Index extends PureComponent { viewRelationInfo: null, showText: null, page: 1, - pageSize: 8, + pageSize: 5, total: 0, serviceId: '' }; @@ -37,8 +37,8 @@ export default class Index extends PureComponent { this.loadRelationedApp(); } - onPageChange = page => { - this.setState({ page }, () => { + onPageChange = (page, pageSize) => { + this.setState({ page, pageSize }, () => { this.loadRelationedApp(); }); }; @@ -145,12 +145,18 @@ export default class Index extends PureComponent { index} - pagination={this.state.total > this.state.pageSize ? { + pagination={{ current: this.state.page, pageSize: this.state.pageSize, total: this.state.total, - onChange: this.onPageChange - } : false} + onChange: this.onPageChange , + onShowSizeChange: this.onPageChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + pageSizeOptions:['5', '10', '20', '30'], + hideOnSinglePage: Number(this.state.total) <= 5 + }} columns={[ { // title: '组件名', diff --git a/src/components/Team/TeamMemberList/index.js b/src/components/Team/TeamMemberList/index.js index 2488faf55..a6512e904 100644 --- a/src/components/Team/TeamMemberList/index.js +++ b/src/components/Team/TeamMemberList/index.js @@ -195,7 +195,6 @@ export default class MemberList extends PureComponent { 8 ? pagination : false} team={currentTeam} onMoveTeam={this.onMoveTeam} onDelete={this.onDelMember} diff --git a/src/components/TeamImageTable/index.js b/src/components/TeamImageTable/index.js index 5ed98cc92..64a76ac04 100644 --- a/src/components/TeamImageTable/index.js +++ b/src/components/TeamImageTable/index.js @@ -9,19 +9,38 @@ class TeamMemberTable extends PureComponent { constructor(props) { super(props) this.state = { + page: 1, + pageSize: 10 } } + onPageChange = (page, pageSize) => { + this.setState({ + page, + pageSize + }); + } render() { + const { page, pageSize } = this.state const { list, members, - pagination, onDelete, onEditAction, onMoveTeam, memberPermissions: { isEdit, isDelete, isAccess }, team, } = this.props; + const pagination = { + current: page, + pageSize: pageSize, + total: list.length , + onChange: this.onPageChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + onShowSizeChange: this.onPageChange, + hideOnSinglePage: list.length<=10 + } const columns = [ { title: formatMessage({id: 'teamManage.tabs.image.table.imageAddress'}), @@ -86,7 +105,7 @@ class TeamMemberTable extends PureComponent { ]; return ( -
index} pagination={list.length > 8 ? pagination : false} dataSource={list} columns={columns} /> +
index} pagination={pagination} dataSource={list} columns={columns} /> ); } } diff --git a/src/components/TeamMemberTable/index.js b/src/components/TeamMemberTable/index.js index 9f4434ba4..df2688792 100644 --- a/src/components/TeamMemberTable/index.js +++ b/src/components/TeamMemberTable/index.js @@ -6,10 +6,23 @@ import cookie from '@/utils/cookie'; import roleUtil from '../../utils/role'; class TeamMemberTable extends PureComponent { + constructor(props) { + super(props); + this.state = { + page: 1, + pageSize: 10 + }; + } + onPageChange = (page, pageSize) => { + this.setState({ + page, + pageSize + }); + } render() { + const { page, pageSize } = this.state; const { list, - pagination, onDelete, onEditAction, onMoveTeam, @@ -17,6 +30,17 @@ class TeamMemberTable extends PureComponent { team, users } = this.props; + const pagination = { + current: page, + pageSize: pageSize, + total: list.length , + onChange: this.onPageChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + onShowSizeChange: this.onPageChange, + hideOnSinglePage: list.length<=10 + } const columns = [ { title: formatMessage({id: 'teamManage.tabs.member.table.userName'}), diff --git a/src/layouts/PageHeaderLayout.less b/src/layouts/PageHeaderLayout.less index c80600de1..ba16608c0 100644 --- a/src/layouts/PageHeaderLayout.less +++ b/src/layouts/PageHeaderLayout.less @@ -16,6 +16,22 @@ .ant-card-bordered{ border-radius: 5px; } + .ant-pagination-disabled>.ant-pagination-item-link { + background-color: #efefef; + } + + .ant-pagination-item-active { + background-color: @primary-color; + &>a { + color: #fff; + } + } + .ant-pagination-item-active:focus { + background-color: @primary-color; + &>a { + color: #fff; + } + } } .content { padding: 24px 0 0 0; @@ -41,6 +57,7 @@ } } + @media screen and (max-width: @screen-sm) { .content { margin: 24px 0 0; diff --git a/src/pages/Component/customEnvironmentVariables.js b/src/pages/Component/customEnvironmentVariables.js index 4f6f63642..6d7dde082 100644 --- a/src/pages/Component/customEnvironmentVariables.js +++ b/src/pages/Component/customEnvironmentVariables.js @@ -65,6 +65,8 @@ export default class Index extends React.Component { isAttrNameList: [], errorDelete: false, toDeleteVolumeErr: null, + mntpageSize: 5, + mntPage: 1 }; } componentDidMount() { @@ -118,16 +120,28 @@ export default class Index extends React.Component { } }); }; - onPageChange = page => { + onPageChange = (page, pageSize) => { this.setState( { - page + page, + page_size: pageSize }, () => { this.fetchInnerEnvs(); } ); }; + onMntPageChange = (page, pageSize) => { + this.setState( + { + mntPage: page, + mntpageSize: pageSize + }, + () => { + this.loadMntList(); + } + ); + } onEditVar = data => { this.setState({ showEditVar: data }); @@ -324,11 +338,12 @@ export default class Index extends React.Component { }); }; loadMntList = () => { + const { mntpageSize , mntPage} = this.state; getMnt({ team_name: globalUtil.getCurrTeamName(), app_alias: this.props.appAlias, - page: 1, - page_size: 1000, + page: mntPage, + page_size: mntpageSize, volume_type: ['config-file'] }).then(data => { if (data) { @@ -485,7 +500,7 @@ export default class Index extends React.Component { } render() { if (!this.canView()) return ; - const { mntList } = this.state; + const { mntList, page, page_size } = this.state; const { baseInfo, volumes } = this.props; const wraps = { wordBreak: 'break-all', @@ -542,7 +557,20 @@ export default class Index extends React.Component { >
`共 ${total} 条`, + pageSizeOptions:['5', '10', '20', '30'], + hideOnSinglePage: Number(volumes.length) <= 5 + } + } columns={[ { title: formatMessage({ id: 'componentOverview.body.tab.env.setting.volume_name' }), @@ -600,7 +628,18 @@ export default class Index extends React.Component { >
`共 ${total} 条`, + pageSizeOptions:['5', '10', '20', '30'], + hideOnSinglePage: Number(mntList.length) <= 5 + }} rowKey={(record,index) => index} columns={[ { diff --git a/src/pages/Component/mnt.js b/src/pages/Component/mnt.js index 6d4b82d7b..93953b62a 100644 --- a/src/pages/Component/mnt.js +++ b/src/pages/Component/mnt.js @@ -46,7 +46,12 @@ export default class Index extends PureComponent { editor: null, volumeOpts: [], relyComponent: false, - relyComponentList: [] + relyComponentList: [], + page: 1, + pageSize: 5, + mntPage: 1, + mntPageSize: 5, + mntTotal:0 }; } @@ -121,17 +126,19 @@ export default class Index extends PureComponent { }); }; loadMntList = () => { + const {mntPage, mntPageSize ,mntTotal} = this.state getMnt({ team_name: globalUtil.getCurrTeamName(), app_alias: this.props.appAlias, - page: 1, - page_size: 1000, + page: mntPage, + page_size: mntPageSize, volume_type: ['share-file', 'memoryfs', 'local'], type: 'mnt' }).then(data => { if (data) { this.setState({ - mntList: data.list || [] + mntList: data.list || [], + mntTotal: data.total || 0 }); } }); @@ -278,6 +285,18 @@ export default class Index extends PureComponent { } return obj[key] || '-' } + onPageChange = (page, pageSize) => { + this.setState({ + page: page, + pageSize: pageSize + }); + } + onMntPageChange = (page, pageSize) => { + this.setState({ + mntPage: page, + mntPageSize: pageSize + }); + } render() { const { mntList, relyComponent, relyComponentList } = this.state; const { volumes, method, appDetail } = this.props; @@ -371,7 +390,18 @@ export default class Index extends PureComponent { >
`共 ${total} 条`, + pageSizeOptions:['5', '10', '20', '30'], + hideOnSinglePage: Number(volumes.length) <= 5 + }} rowKey={(record,index) => index} columns={[ { @@ -487,7 +517,20 @@ export default class Index extends PureComponent { >
`共 ${total} 条`, + pageSizeOptions:['5', '10', '20', '30'], + hideOnSinglePage: Number(this.state.mntTotal) <= 5 + } + } rowKey={(record,index) => index} columns={[ { diff --git a/src/pages/Component/relation.js b/src/pages/Component/relation.js index 863f8866a..612731af6 100644 --- a/src/pages/Component/relation.js +++ b/src/pages/Component/relation.js @@ -52,7 +52,7 @@ export default class Index extends PureComponent { viewRelationInfo: null, showText: null, page: 1, - pageSize: 8, + pageSize: 5, total: 0 }; } @@ -66,8 +66,8 @@ export default class Index extends PureComponent { onViewRelationInfo = data => { this.setState({ viewRelationInfo: data }); }; - onPageChange = page => { - this.setState({ page }, () => { + onPageChange = (page, pageSize) => { + this.setState({ page, pageSize }, () => { this.loadRelationedApp(); }); }; @@ -175,12 +175,18 @@ export default class Index extends PureComponent {
index} - pagination={this.state.total > this.state.pageSize ? { + pagination={{ current: this.state.page, pageSize: this.state.pageSize, total: this.state.total, - onChange: this.onPageChange - } : false} + onChange: this.onPageChange, + onShowSizeChange: this.onPageChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + pageSizeOptions:['5', '10', '20', '30'], + hideOnSinglePage: Number(this.state.total) <= 5 + }} columns={[ { // title: '组件名', diff --git a/src/pages/Configuration/Table/index.js b/src/pages/Configuration/Table/index.js index 29e2a81db..8b8fc1abb 100644 --- a/src/pages/Configuration/Table/index.js +++ b/src/pages/Configuration/Table/index.js @@ -49,12 +49,11 @@ export default class ConfigurationTable extends PureComponent { componentDidMount() { this.fetchConfigurationList(); } - onPageChange = page => { - this.setState({ page }, () => { + onPageChange = (page, pageSize) => { + this.setState({ page, pageSize }, () => { this.fetchConfigurationList(); }); }; - fetchConfigurationList = () => { const { dispatch, teamName, regionName, appID } = this.props; const { page, pageSize, query } = this.state; @@ -252,13 +251,18 @@ export default class ConfigurationTable extends PureComponent {
index} - pagination={total > pageSize ? { + pagination={{ size: 'default', current: page, pageSize, total, - onChange: this.onPageChange - } : false} + onChange: this.onPageChange, + onShowSizeChange: this.onPageChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + hideOnSinglePage: total<=10 + }} dataSource={apps || []} loading={loading} columns={[ diff --git a/src/pages/Create/market.js b/src/pages/Create/market.js index 5e685ec8a..5962ade71 100644 --- a/src/pages/Create/market.js +++ b/src/pages/Create/market.js @@ -349,6 +349,7 @@ export default class Main extends PureComponent { if (Array.isArray(res)) { const helmQuery = helmPag.query; const helmPage = helmPag.page; + const helmPageSize = helmPag.pageSize if (helmQuery) { const arr = []; const ql = helmQuery.length; @@ -362,9 +363,9 @@ export default class Main extends PureComponent { }); setHelmPag.total = arr.length; helmList = - arr.length > 9 ? arr.splice((helmPage - 1) * 9, 9) : arr; + arr.length > helmPageSize ? arr.splice((helmPage - 1) * helmPageSize, helmPageSize) : arr; } else { - helmList = res.splice(helmPage > 1 ? (helmPage - 1) * 9 : 0, 9); + helmList = res.splice(helmPage > 1 ? (helmPage - 1) * helmPageSize : 0, helmPageSize); } } this.setState({ @@ -412,10 +413,11 @@ export default class Main extends PureComponent { } }; - hanldePageChange = page => { + hanldePageChange = (page, pageSize) => { this.setState( { - page + page, + pageSize }, () => { this.getApps(); @@ -423,22 +425,23 @@ export default class Main extends PureComponent { ); }; - hanldeCloudPageChange = page => { + hanldeCloudPageChange = (page, page_size) => { this.setState( { - cloudPage: page + cloudPage: page, + cloudPageSize: page_size }, () => { this.getCloudRecommendApps(); } ); }; - hanldeHelmPageChange = page => { + hanldeHelmPageChange = (page,pageSize) => { const { helmPag, scopeMax } = this.state; - const paginfo = Object.assign({}, helmPag, { page }); + const paginfo = Object.assign({}, helmPag, { page, pageSize }); this.setState( { - helmPag: paginfo + helmPag: paginfo, }, () => { this.getHelmAppStore(scopeMax.slice(5)); @@ -1079,28 +1082,36 @@ export default class Main extends PureComponent { current: moreState ? 1 : page, pageSize: moreState ? 3 : pageSize, total: moreState ? 1 : total, - hideOnSinglePage: setHideOnSinglePage, - onChange: v => { - this.hanldePageChange(v); - } + onChange: this.hanldePageChange, + showQuickJumper: true, + showSizeChanger: true, + onShowSizeChange: this.hanldePageChange, + pageSizeOptions: ['9', '18', '27', '36'], + hideOnSinglePage: total <= 9 }; const cloudPaginationProps = { current: moreState ? 1 : cloudPage, pageSize: moreState ? 3 : cloudPageSize, total: moreState ? 1 : cloudTotal, - hideOnSinglePage: setHideOnSinglePage, - onChange: v => { - this.hanldeCloudPageChange(v); - } + onChange:this.hanldeCloudPageChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + onShowSizeChange: this.hanldeCloudPageChange, + pageSizeOptions: ['9', '18', '27', '36'], + hideOnSinglePage: cloudTotal <= 9 }; const helmPaginationProps = { current: moreState ? 1 : helmPag.page, pageSize: moreState ? 3 : helmPag.pageSize, total: moreState ? 1 : helmPag.total, - hideOnSinglePage: setHideOnSinglePage, - onChange: v => { - this.hanldeHelmPageChange(v); - } + onChange:this.hanldeHelmPageChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + onShowSizeChange: this.hanldeHelmPageChange, + pageSizeOptions: ['9', '18', '27', '36'], + hideOnSinglePage: helmPag.total <= 9 }; let isInstall = true; diff --git a/src/pages/Create/market_plugin.js b/src/pages/Create/market_plugin.js index 39ed58e7c..f7d4d0f69 100644 --- a/src/pages/Create/market_plugin.js +++ b/src/pages/Create/market_plugin.js @@ -332,6 +332,7 @@ export default class Main extends PureComponent { if (Array.isArray(res)) { const helmQuery = helmPag.query; const helmPage = helmPag.page; + const helmPageSize = helmPag.pageSize if (helmQuery) { const arr = []; const ql = helmQuery.length; @@ -345,9 +346,9 @@ export default class Main extends PureComponent { }); setHelmPag.total = arr.length; helmList = - arr.length > 9 ? arr.splice((helmPage - 1) * 9, 9) : arr; + arr.length > helmPageSize ? arr.splice((helmPage - 1) * helmPageSize, helmPageSize) : arr; } else { - helmList = res.splice(helmPage > 1 ? (helmPage - 1) * 9 : 0, 9); + helmList = res.splice(helmPage > 1 ? (helmPage - 1) * helmPageSize : 0, helmPageSize); } } this.setState({ @@ -394,10 +395,11 @@ export default class Main extends PureComponent { } }; - hanldePageChange = page => { + hanldePageChange = (page, pageSize) => { this.setState( { - page + page, + pageSize }, () => { this.getApps(); @@ -405,22 +407,23 @@ export default class Main extends PureComponent { ); }; - hanldeCloudPageChange = page => { + hanldeCloudPageChange = (page, page_size) => { this.setState( { - cloudPage: page + cloudPage: page, + cloudPageSize: page_size }, () => { this.getCloudRecommendApps(); } ); }; - hanldeHelmPageChange = page => { + hanldeHelmPageChange = (page,pageSize) => { const { helmPag, scopeMax } = this.state; - const paginfo = Object.assign({}, helmPag, { page }); + const paginfo = Object.assign({}, helmPag, { page, pageSize }); this.setState( { - helmPag: paginfo + helmPag: paginfo, }, () => { this.getHelmAppStore(scopeMax.slice(5)); @@ -1063,28 +1066,36 @@ export default class Main extends PureComponent { current: moreState ? 1 : page, pageSize: moreState ? 3 : pageSize, total: moreState ? 1 : total, - hideOnSinglePage: setHideOnSinglePage, - onChange: v => { - this.hanldePageChange(v); - } + onChange: this.hanldePageChange, + showQuickJumper: true, + showSizeChanger: true, + onShowSizeChange: this.hanldePageChange, + pageSizeOptions: ['9', '18', '27', '36'], + hideOnSinglePage: total <= 9 }; const cloudPaginationProps = { current: moreState ? 1 : cloudPage, pageSize: moreState ? 3 : cloudPageSize, total: moreState ? 1 : cloudTotal, - hideOnSinglePage: setHideOnSinglePage, - onChange: v => { - this.hanldeCloudPageChange(v); - } + onChange:this.hanldeCloudPageChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + onShowSizeChange: this.hanldeCloudPageChange, + pageSizeOptions: ['9', '18', '27', '36'], + hideOnSinglePage: cloudTotal <= 9 }; const helmPaginationProps = { current: moreState ? 1 : helmPag.page, pageSize: moreState ? 3 : helmPag.pageSize, total: moreState ? 1 : helmPag.total, - hideOnSinglePage: setHideOnSinglePage, - onChange: v => { - this.hanldeHelmPageChange(v); - } + onChange:this.hanldeHelmPageChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + onShowSizeChange: this.hanldeHelmPageChange, + pageSizeOptions: ['9', '18', '27', '36'], + hideOnSinglePage: helmPag.total <= 9 }; let isInstall = true; diff --git a/src/pages/EnterpriseShared/index.js b/src/pages/EnterpriseShared/index.js index 6bcf357f5..a83043def 100644 --- a/src/pages/EnterpriseShared/index.js +++ b/src/pages/EnterpriseShared/index.js @@ -400,7 +400,7 @@ export default class EnterpriseShared extends PureComponent { }, callback: res => { if (res && res.status_code === 200) { - const arr = res.filter(item => {item.name === ID}); + const arr = res.filter(item => { item.name === ID }); this.setState( { helmTab: Array.isArray(res) ? res : [], @@ -1427,6 +1427,16 @@ export default class EnterpriseShared extends PureComponent { dispatch(routerRedux.push(`/enterprise/${eid}/shared/import`)); } + onShowSizeChangeMarket = (page, pageSize) => { + const { marketInfo, marketPag } = this.state; + const setMarketPag = Object.assign({}, marketPag, { + page, + pageSize + }); + this.setState({ marketPag: setMarketPag }, () => { + this.getMarkets(marketInfo && marketInfo.name); + }); + } render() { const { match: { @@ -1728,6 +1738,10 @@ export default class EnterpriseShared extends PureComponent { pageSize={this.state.pageSize} total={Number(this.state.total)} onChange={this.onPageChangeApp} + showTotal={total => `共 ${total} 条`} + showSizeChanger + onShowSizeChange={this.onPageChangeApp} + hideOnSinglePage={Number(this.state.total) <= 10} /> } @@ -1791,15 +1805,17 @@ export default class EnterpriseShared extends PureComponent { noCloudMarket(false) )}
- {Number(marketPag.total) > 10 && - - } + `共 ${total} 条`} + showSizeChanger + onShowSizeChange={this.onPageChangeAppMarket} + hideOnSinglePage={Number(marketPag.total) <= 10} + />
@@ -1840,15 +1856,17 @@ export default class EnterpriseShared extends PureComponent { )}
- {Number(helmPag.total) > 10 && - - } + `共 ${total} 条`} + showSizeChanger + onShowSizeChange={this.onPageChangeAppHelm} + hideOnSinglePage={Number(helmPag.total) <= 10} + />
); diff --git a/src/pages/EnterpriseShared/index.less b/src/pages/EnterpriseShared/index.less index e3b32b9b9..efc153ffe 100644 --- a/src/pages/EnterpriseShared/index.less +++ b/src/pages/EnterpriseShared/index.less @@ -410,15 +410,6 @@ overflow: visible !important; margin-left: 0 !important; } - .ant-pagination-item-link { - background-color: #efefef; - } - .ant-pagination-item-active { - background-color: @primary-color; - & > a { - color: #fff; - } - } } overflow: visible !important; @@ -450,20 +441,6 @@ } .details_card_style { padding: 24px 0; - :global { - .ant-pagination { - margin: 16px 20px !important; - } - .ant-pagination-item-link { - background-color: #efefef; - } - .ant-pagination-item-active { - background-color: @primary-color; - & > a { - color: #fff; - } - } - } } .visiblePagination { :global { diff --git a/src/pages/EnterpriseTeams/index.js b/src/pages/EnterpriseTeams/index.js index 30fb321c4..3d8927a82 100644 --- a/src/pages/EnterpriseTeams/index.js +++ b/src/pages/EnterpriseTeams/index.js @@ -180,6 +180,11 @@ export default class EnterpriseTeams extends PureComponent { pageSize={this.state.page_size} total={Number(this.state.total)} onChange={this.onPageChangeTeam} + showQuickJumper + showTotal={total => `共 ${total} 条`} + showSizeChanger + onShowSizeChange={this.onPageChangeTeam} + hideOnSinglePage={this.state.total <= 10} /> ); handleSearchUserTeam = name => { diff --git a/src/pages/EnterpriseUsers/index.js b/src/pages/EnterpriseUsers/index.js index caccfba37..4d3169c8a 100644 --- a/src/pages/EnterpriseUsers/index.js +++ b/src/pages/EnterpriseUsers/index.js @@ -439,12 +439,17 @@ export default class EnterpriseUsers extends PureComponent { )}
10 ? { + pagination={{ current: page, pageSize, total, - onChange: this.onPageChange - } : false} + onChange: this.onPageChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + onShowSizeChange: this.onPageChange, + hideOnSinglePage: total <= 10 + }} dataSource={adminList} columns={columns} /> diff --git a/src/pages/Extension/index.less b/src/pages/Extension/index.less index 015133f76..8c23a111a 100644 --- a/src/pages/Extension/index.less +++ b/src/pages/Extension/index.less @@ -67,17 +67,7 @@ overflow: visible !important; } - .ant-pagination-item-link { - background-color: #efefef; - } - - .ant-pagination-item-active { - background-color: @primary-color; - - &>a { - color: #fff; - } - } + } } diff --git a/src/pages/Group/ComponentList.js b/src/pages/Group/ComponentList.js index b5f5b18d4..055e0ad4e 100644 --- a/src/pages/Group/ComponentList.js +++ b/src/pages/Group/ComponentList.js @@ -371,6 +371,9 @@ export default class ComponentList extends Component { onChange: this.onSelectChange }; const pagination = { + hideOnSinglePage: total <= 10, + showQuickJumper: true, + showTotal: (total) => `共 ${total} 条`, pageSize, current, total, diff --git a/src/pages/Group/Publish.js b/src/pages/Group/Publish.js index ee9bf5d63..902c2f44a 100644 --- a/src/pages/Group/Publish.js +++ b/src/pages/Group/Publish.js @@ -73,8 +73,8 @@ export default class AppPublishList extends PureComponent { this.handleShare('', {}); }; - onPageChange = page => { - this.setState({ page }, () => { + onPageChange = (page, pageSize) => { + this.setState({ page, pageSize }, () => { this.fetchPublishRecoder(); }); }; @@ -322,12 +322,17 @@ export default class AppPublishList extends PureComponent {
index} - pagination={total > 10 ? { + pagination={ { current: page, pageSize, total, - onChange: this.onPageChange - } : false} + onChange: this.onPageChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + onShowSizeChange: this.onPageChange, + hideOnSinglePage: total<=10 + } } dataSource={recoders || []} columns={[ { diff --git a/src/pages/LogManagement/index.less b/src/pages/LogManagement/index.less index ff4b59e9b..548bb33e6 100644 --- a/src/pages/LogManagement/index.less +++ b/src/pages/LogManagement/index.less @@ -50,15 +50,6 @@ .ant-tabs-nav-container-scrolling{ overflow: visible !important; } - .ant-pagination-item-link { - background-color: #efefef; - } - .ant-pagination-item-active { - background-color: @primary-color; - & > a { - color: #fff; - } - } } } .tabsStyle{ diff --git a/src/pages/NewGateway/GatewayCertificate/index.js b/src/pages/NewGateway/GatewayCertificate/index.js index 4f6e4a844..33b335f23 100644 --- a/src/pages/NewGateway/GatewayCertificate/index.js +++ b/src/pages/NewGateway/GatewayCertificate/index.js @@ -59,9 +59,9 @@ class Control extends Component { this.load(); } - onPageChange = pageNumber => { + onPageChange = (pageNumber, pageSize) => { this.setState({ licenseLoading: true }); - this.setState({ page: pageNumber }, () => { + this.setState({ page: pageNumber, pageSize }, () => { this.load(); }); }; @@ -455,10 +455,15 @@ class Control extends Component {
`共 ${total} 条`, + onShowSizeChange: this.onPageChange, + hideOnSinglePage: licenseList.length<=10 }} rowKey={this.rowKey} dataSource={licenseList} diff --git a/src/pages/NewGateway/GatewayService/index.js b/src/pages/NewGateway/GatewayService/index.js index 3246af36a..3c4fb55c3 100644 --- a/src/pages/NewGateway/GatewayService/index.js +++ b/src/pages/NewGateway/GatewayService/index.js @@ -27,7 +27,9 @@ export default class index extends Component { serviceDrawer: this.props.open ? this.props.open : false, tableLoading: true, dataSource: [], - editInfo: {} + editInfo: {}, + pageSize: 10, + page: 1 }; } componentDidMount() { @@ -148,12 +150,20 @@ export default class index extends Component { }) } + onPageChange = (page_num, page_size) => { + this.setState({ + page: page_num, + pageSize: page_size + }) +} render() { const { serviceDrawer, dataSource, editInfo, - tableLoading + tableLoading, + pageSize, + page } = this.state; const { appID, @@ -237,6 +247,17 @@ export default class index extends Component { dataSource={dataSource} columns={columns} loading={tableLoading} + pagination={{ + current: page, + pageSize: pageSize, + total: dataSource.length , + onChange: this.onPageChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + onShowSizeChange: this.onPageChange, + hideOnSinglePage: dataSource.length<=10 + }} /> {serviceDrawer && diff --git a/src/pages/Resource/index.js b/src/pages/Resource/index.js index 2e1a224a0..c3e5fe307 100644 --- a/src/pages/Resource/index.js +++ b/src/pages/Resource/index.js @@ -35,6 +35,9 @@ class Index extends PureComponent { isSubmit: true, loadingSwitch: true, resourcePermission: roleUtil.queryPermissionsInfo(this.props.currentTeamPermissionsInfo && this.props.currentTeamPermissionsInfo.team, 'app_resources', `app_${globalUtil.getAppID()}`), + page: 1, + pageSize: 10, + total: 0 }; } componentDidMount() { @@ -276,6 +279,12 @@ class Index extends PureComponent { } }); } + onPageChange = (page, pageSize) => { + this.setState({ + page, + pageSize + }) + } render() { const { form: { getFieldDecorator, setFieldsValue }, @@ -296,11 +305,26 @@ class Index extends PureComponent { isDelete, isCreate, isEdit, - } + }, + page, + pageSize, + total } = this.state; if (!isAccess) { return roleUtil.noPermission() } + const paginationProps = { + pageSize, + total: content.length, + page, + current: page, + onChange: this.onPageChange, + showQuickJumper: true, + showSizeChanger: true, + showTotal: (total) => `共 ${total} 条`, + onShowSizeChange: this.onPageChange, + hideOnSinglePage: content.length<=10 + } const isBool = (type == "add") ? true : false const rowSelection = { selectedRowKeys, @@ -485,6 +509,7 @@ class Index extends PureComponent { columns={columns} rowSelection={rowSelection} rowKey={record => record.ID} + pagination={paginationProps} /> )} diff --git a/src/pages/TeamDashboard/Index.js b/src/pages/TeamDashboard/Index.js index d805150da..452a6cef9 100644 --- a/src/pages/TeamDashboard/Index.js +++ b/src/pages/TeamDashboard/Index.js @@ -562,6 +562,9 @@ export default class Index extends PureComponent { total={total} pageSizeOptions={pageSizeOptions} onChange={this.handleChangePage} + showQuickJumper + showTotal={(total) => `共 ${total} 条`} + hideOnSinglePage={ total <= 12} /> }