Commit 06865e81 by zhaochengxiang

bug fix

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