Commit 7fa212dc by zhaochengxiang

调整

parent 772ee46b
import React, { useEffect, useState, useContext, useMemo, useRef } from 'react'; import React, { useEffect, useState, useContext, useMemo, useRef } from 'react';
import { Form, Spin, Input, Descriptions, Space, Button, Tooltip, Select, Cascader, Radio, Divider, Typography, Modal, Row, Col } from 'antd'; import { Form, Spin, Input, Descriptions, Space, Button, Tooltip, Select, Cascader, Radio, Divider, Typography, Modal, Row, Col, Pagination } from 'antd';
import { DownOutlined, UpOutlined, QuestionCircleOutlined } from '@ant-design/icons'; import { DownOutlined, UpOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import MetadataInfo from './MetadataInfo'; import MetadataInfo from './MetadataInfo';
import { dispatch } from '../../../../model'; import { dispatch } from '../../../../model';
import { highlightSearchContentByTerms, showMessage } from '../../../../util'; import { highlightSearchContentByTerms, showMessage, paginate } from '../../../../util';
import { AppContext } from '../../../../App'; import { AppContext } from '../../../../App';
import Tag from '../../Tag'; import Tag from '../../Tag';
import Separate from './Separate'; import Separate from './Separate';
...@@ -60,6 +60,8 @@ const AssetAction = (props) => { ...@@ -60,6 +60,8 @@ const AssetAction = (props) => {
visible: false, visible: false,
metadataId: undefined metadataId: undefined
}); });
const [ pagination, setPagination ] = useState({ pageNum: 1, pageSize: 20 });
const { pageNum, pageSize } = pagination;
const [modal, contextHolder] = Modal.useModal(); const [modal, contextHolder] = Modal.useModal();
const app = useContext(AppContext); const app = useContext(AppContext);
...@@ -192,6 +194,7 @@ const AssetAction = (props) => { ...@@ -192,6 +194,7 @@ const AssetAction = (props) => {
} else { } else {
setCurrentAction('detail'); setCurrentAction('detail');
if ((id||'')!=='') { if ((id||'')!=='') {
setPagination({...pagination, pageNum: 1});
getElements(); getElements();
getAssetPaths(); getAssetPaths();
getResourceRelations(); getResourceRelations();
...@@ -242,11 +245,11 @@ const AssetAction = (props) => { ...@@ -242,11 +245,11 @@ const AssetAction = (props) => {
newMetadataColumnList.push(newItem); newMetadataColumnList.push(newItem);
}); });
return newMetadataColumnList; return paginate(newMetadataColumnList, pageNum, pageSize);
} }
return []; return [];
}, [metadataColumnList, standardList]) }, [metadataColumnList, standardList, pagination])
const getAssetPaths = () => { const getAssetPaths = () => {
dispatch({ dispatch({
...@@ -826,6 +829,7 @@ const AssetAction = (props) => { ...@@ -826,6 +829,7 @@ const AssetAction = (props) => {
const onAttributeMaintainChange = (catalogId) => { const onAttributeMaintainChange = (catalogId) => {
if (catalogId === '1') { if (catalogId === '1') {
setPagination({...pagination, pageNum: 1});
getMetadataAttributes(); getMetadataAttributes();
} else { } else {
getMetadataStandardList(); getMetadataStandardList();
...@@ -1022,7 +1026,17 @@ const AssetAction = (props) => { ...@@ -1022,7 +1026,17 @@ const AssetAction = (props) => {
pagination={{ pagination={{
position: ['bottomLeft'], position: ['bottomLeft'],
size: 'small', size: 'small',
showTotal: (total) => `${total}` total: (metadataColumnList||[]).length,
showTotal: (total) => `${total}`,
showSizeChanger: true,
current: pageNum,
pageSize,
onChange: (_pageNum, _pageSize) => {
setPagination({ pageNum: _pageNum||1, pageSize: _pageSize || 20 });
},
onShowSizeChange: (_pageNum, _pageSize) => {
setPagination({ pageNum: _pageNum||1, pageSize: _pageSize || 20 });
},
}} }}
/> />
......
...@@ -424,7 +424,9 @@ const Detail = ({ visible, message, id, type, onCancel }) => { ...@@ -424,7 +424,9 @@ const Detail = ({ visible, message, id, type, onCancel }) => {
> >
<Spin spinning={loading}> <Spin spinning={loading}>
{ {
currentMessage?.split('<br />').map((info, index) => { (type === '1') ? currentMessage?.split('<br />').map((info, index) => {
return <Typography.Paragraph key={index}>{info}</Typography.Paragraph>
}) : currentMessage?.split('\n').map((info, index) => {
return <Typography.Paragraph key={index}>{info}</Typography.Paragraph> return <Typography.Paragraph key={index}>{info}</Typography.Paragraph>
}) })
} }
......
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