Commit 06865e81 by zhaochengxiang

bug fix

parent af66eb2f
......@@ -12,7 +12,7 @@ const FC = (props) => {
const { onCancel, onSuccess, visible, metadataId, asset, onChange, reference } = props;
const [loading, setLoading] = useState(false);
const [catalogId, setCatalogId] = useState('1');
const [catalogId, setCatalogId] = useState();
const [logs, setLogs] = useState([]);
const [pagination, setPagination] = useState({ pageNum: 1, pageSize: 20 });
const { pageNum, pageSize } = pagination;
......@@ -86,10 +86,10 @@ const FC = (props) => {
useEffect(() => {
setCatalogId((asset?.templateType==='mdg')?'2':'1')
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [asset])
}, [visible, asset])
useEffect(() => {
if (visible) {
if (visible && catalogId) {
getLogs();
}
//eslint-disable-next-line react-hooks/exhaustive-deps
......@@ -162,7 +162,8 @@ const FC = (props) => {
const reset = () => {
setFileList([]);
setStep(1);
setCatalogId('1');
setCatalogId();
setPagination({ pageNum: 1, pageSize: 20 });
}
const downloadTemplate = () => {
......@@ -303,6 +304,7 @@ const FC = (props) => {
value={catalogId}
onChange={(value) => {
setCatalogId(value);
setPagination({ ...pagination, pageNum: 1 });
}}
style={{ width: 150 }}
>
......@@ -340,7 +342,6 @@ const FC = (props) => {
pageSize={pageSize}
defaultCurrent={1}
total={total}
pageSizeOptions={[10,20]}
showTotal={total => `共 ${total} 条`}
/>
</React.Fragment>
......@@ -351,6 +352,7 @@ const FC = (props) => {
<Radio.Group
onChange={(e) => {
setCatalogId(e.target.value);
setPagination({ ...pagination, pageNum: 1 });
}}
value={catalogId}
>
......
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