Commit 20ba0632 by zhaochengxiang

资产列表增加递归展示

parent f1396cb5
import React,{ useState, useEffect, useRef } from "react"; import React,{ useState, useEffect, useRef } from "react";
import { Button, Pagination, Space, Modal, Input, Table, Tooltip } from "antd"; import { Button, Pagination, Space, Modal, Input, Table, Tooltip, Checkbox } from "antd";
import classNames from 'classnames'; import classNames from 'classnames';
import SmoothScroll from 'smooth-scroll'; import SmoothScroll from 'smooth-scroll';
...@@ -33,6 +33,7 @@ const AssetTable = (props) => { ...@@ -33,6 +33,7 @@ const AssetTable = (props) => {
const [ keyword, setKeyword ] = useState(''); const [ keyword, setKeyword ] = useState('');
const [ batchCatalogChange, setBatchCatalogChange ] = useState(false); const [ batchCatalogChange, setBatchCatalogChange ] = useState(false);
const [ fullScreen, setFullScreen ] = useState(false); const [ fullScreen, setFullScreen ] = useState(false);
const [ recursive, setRecursive ] = useState(true);
const [ modal, contextHolder ] = Modal.useModal(); const [ modal, contextHolder ] = Modal.useModal();
const anchorId = getQueryParam(AnchorId, props.location.search); const anchorId = getQueryParam(AnchorId, props.location.search);
...@@ -74,7 +75,7 @@ const AssetTable = (props) => { ...@@ -74,7 +75,7 @@ const AssetTable = (props) => {
getFilterElementsGroupThenGetDataAssets(); getFilterElementsGroupThenGetDataAssets();
} }
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
}, [ keyword, pagination, elementsChanged, assetActionChanged ]) }, [ keyword, pagination, elementsChanged, assetActionChanged, recursive ])
useEffect(() => { useEffect(() => {
if (shouldScrollRef.current) { if (shouldScrollRef.current) {
...@@ -202,14 +203,21 @@ const AssetTable = (props) => { ...@@ -202,14 +203,21 @@ const AssetTable = (props) => {
const getDataAssets = (projectIndex = metadataIndexRef.current) => { const getDataAssets = (projectIndex = metadataIndexRef.current) => {
setLoading(true); setLoading(true);
dispatchLatestHomepage({
type: (reference===AssetRecycleReference)?'assetmanage.listRecycleBinDataAssetsByPage':'assetmanage.listDataAssetsByPage', let params = {
payload: {
dirId: nodeId, dirId: nodeId,
pageNum, pageNum,
pageSize, pageSize,
keyword: keyword keyword: keyword
}, };
if (reference !== AssetRecycleReference) {
params.recursive = recursive;
}
dispatchLatestHomepage({
type: (reference===AssetRecycleReference)?'assetmanage.listRecycleBinDataAssetsByPage':'assetmanage.listDataAssetsByPage',
payload: params,
callback: data => { callback: data => {
const _assets = []; const _assets = [];
...@@ -295,6 +303,10 @@ const AssetTable = (props) => { ...@@ -295,6 +303,10 @@ const AssetTable = (props) => {
setFilterElementVisible(true); setFilterElementVisible(true);
} }
const onRecursiveChange = (e) => {
setRecursive(e.target.checked);
}
const exportAsset = () => { const exportAsset = () => {
if ((checkedKeys||[]).length === 0) { if ((checkedKeys||[]).length === 0) {
showMessage('warn', '请先选择资产'); showMessage('warn', '请先选择资产');
...@@ -427,6 +439,7 @@ const AssetTable = (props) => { ...@@ -427,6 +439,7 @@ const AssetTable = (props) => {
</React.Fragment> </React.Fragment>
} }
<Button onClick={onFilterElementClick}>要素设置</Button> <Button onClick={onFilterElementClick}>要素设置</Button>
<Checkbox onChange={onRecursiveChange} checked={recursive}>递归展示</Checkbox>
</Space> </Space>
<Space> <Space>
<Input <Input
......
...@@ -179,7 +179,7 @@ const VersionCompare = (props) => { ...@@ -179,7 +179,7 @@ const VersionCompare = (props) => {
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item> <Form.Item>
<Checkbox onChange={onOnlyShowChange} value={onlyShowChange}>仅显示差异</Checkbox> <Checkbox onChange={onOnlyShowChange} checked={onlyShowChange}>仅显示差异</Checkbox>
</Form.Item> </Form.Item>
</Form> </Form>
......
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