Commit 7fa212dc by zhaochengxiang

调整

parent 772ee46b
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 MetadataInfo from './MetadataInfo';
import { dispatch } from '../../../../model';
import { highlightSearchContentByTerms, showMessage } from '../../../../util';
import { highlightSearchContentByTerms, showMessage, paginate } from '../../../../util';
import { AppContext } from '../../../../App';
import Tag from '../../Tag';
import Separate from './Separate';
......@@ -60,6 +60,8 @@ const AssetAction = (props) => {
visible: false,
metadataId: undefined
});
const [ pagination, setPagination ] = useState({ pageNum: 1, pageSize: 20 });
const { pageNum, pageSize } = pagination;
const [modal, contextHolder] = Modal.useModal();
const app = useContext(AppContext);
......@@ -192,6 +194,7 @@ const AssetAction = (props) => {
} else {
setCurrentAction('detail');
if ((id||'')!=='') {
setPagination({...pagination, pageNum: 1});
getElements();
getAssetPaths();
getResourceRelations();
......@@ -242,11 +245,11 @@ const AssetAction = (props) => {
newMetadataColumnList.push(newItem);
});
return newMetadataColumnList;
return paginate(newMetadataColumnList, pageNum, pageSize);
}
return [];
}, [metadataColumnList, standardList])
}, [metadataColumnList, standardList, pagination])
const getAssetPaths = () => {
dispatch({
......@@ -826,6 +829,7 @@ const AssetAction = (props) => {
const onAttributeMaintainChange = (catalogId) => {
if (catalogId === '1') {
setPagination({...pagination, pageNum: 1});
getMetadataAttributes();
} else {
getMetadataStandardList();
......@@ -1022,7 +1026,17 @@ const AssetAction = (props) => {
pagination={{
position: ['bottomLeft'],
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 }) => {
>
<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>
})
}
......
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