Commit 946cc452 by zhaochengxiang

浏览变更目录

parent 318b6f4c
import React,{ useState, useEffect, useRef, useContext, useMemo } from "react"; import React,{ useState, useEffect, useRef, useContext, useMemo } from "react";
import { Button, Pagination, Space, Modal, Input, Table, Tooltip, Checkbox, Typography, Dropdown, Menu } from "antd"; import { Button, Pagination, Space, Modal, Input, Table, Tooltip, Checkbox, Typography, Dropdown, Menu, Divider } from "antd";
import classNames from 'classnames'; import classNames from 'classnames';
import { Resizable } from 'react-resizable'; import { Resizable } from 'react-resizable';
import ResizeObserver from 'rc-resize-observer'; import ResizeObserver from 'rc-resize-observer';
...@@ -137,13 +137,11 @@ const AssetTable = (props) => { ...@@ -137,13 +137,11 @@ const AssetTable = (props) => {
const [ importAssetVisible, setImportAssetVisible ] = useState(false); const [ importAssetVisible, setImportAssetVisible ] = useState(false);
const [ filterElementVisible, setFilterElementVisible ] = useState(false); const [ filterElementVisible, setFilterElementVisible ] = useState(false);
const [ assetEditVisible, setAssetEditVisible ] = useState(false); const [ assetEditVisible, setAssetEditVisible ] = useState(false);
const [ assetMountVisible, setAssetMountVisible ] = useState(false);
const [ assetDetailDrawerVisible, setAssetDetailDrawerVisible ] = useState(false); const [ assetDetailDrawerVisible, setAssetDetailDrawerVisible ] = useState(false);
// const [ currentAssetId, setCurrentAssetId ] = useState(''); // const [ currentAssetId, setCurrentAssetId ] = 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;
const [ keyword, setKeyword ] = useState(''); const [ keyword, setKeyword ] = useState('');
const [ batchCatalogChange, setBatchCatalogChange ] = useState(false);
const [ fullScreen, setFullScreen ] = useState(false); const [ fullScreen, setFullScreen ] = useState(false);
const [ recursive, setRecursive ] = useState(true); const [ recursive, setRecursive ] = useState(true);
const [ fullSearch, setFullSearch ] = useState(false); const [ fullSearch, setFullSearch ] = useState(false);
...@@ -152,6 +150,10 @@ const AssetTable = (props) => { ...@@ -152,6 +150,10 @@ const AssetTable = (props) => {
const [ assetDeleteModalVisible, setAssetDeleteModalVisible ] = useState(false); const [ assetDeleteModalVisible, setAssetDeleteModalVisible ] = useState(false);
const [ startFlowModalVisible, setStartFlowModalVisible ] = useState(false); const [ startFlowModalVisible, setStartFlowModalVisible ] = useState(false);
const [ users, setUsers ] = useState([]); const [ users, setUsers ] = useState([]);
const [ assetMountParam, setAssetMountParam ] = useState({
visible: false,
ids: undefined
})
const [ modal, contextHolder ] = Modal.useModal(); const [ modal, contextHolder ] = Modal.useModal();
const anchorId = getQueryParam(AnchorId, props?.location?.search); const anchorId = getQueryParam(AnchorId, props?.location?.search);
...@@ -167,19 +169,28 @@ const AssetTable = (props) => { ...@@ -167,19 +169,28 @@ const AssetTable = (props) => {
const actionCol = { const actionCol = {
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
width: 80, width: 120,
fixed: 'right', fixed: 'right',
filter: false, filter: false,
render: (_, record) => { render: (_, record) => {
return ( return (
<React.Fragment> <Space size={5} split={<Divider type='vertical' style={{margin:0}} />}>
{ {
(reference===AssetManageReference||(reference===AssetBrowseReference&&record.hasPermission)) && <a onClick={(e) => { (reference===AssetManageReference||(reference===AssetBrowseReference&&record.hasPermission)) && <a onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
handleItemClick('authorization', record); handleItemClick('authorization', record);
}}>授权</a> }}>授权</a>
} }
</React.Fragment> {
(reference===AssetManageReference||(reference===AssetBrowseReference&&record.hasPermission)) && <a onClick={(e) => {
e.stopPropagation();
setAssetMountParam({
visible: true,
ids: [record.id]
});
}}>变更目录</a>
}
</Space>
) )
} }
} }
...@@ -579,7 +590,10 @@ const AssetTable = (props) => { ...@@ -579,7 +590,10 @@ const AssetTable = (props) => {
} }
const onAssetMountCancel = (refresh = false) => { const onAssetMountCancel = (refresh = false) => {
setAssetMountVisible(false); setAssetMountParam({
visible: false,
ids: undefined
});
if (refresh) { if (refresh) {
setCheckedKeys([]); setCheckedKeys([]);
...@@ -700,8 +714,11 @@ const AssetTable = (props) => { ...@@ -700,8 +714,11 @@ const AssetTable = (props) => {
const onBatchCatalogChangeBtnClick = () => { const onBatchCatalogChangeBtnClick = () => {
if ((checkedKeys||[]).length===0) return; if ((checkedKeys||[]).length===0) return;
setBatchCatalogChange(true);
setAssetMountVisible(true); setAssetMountParam({
visible: true,
ids: checkedKeys
});
} }
const onAssetDeleteModalCancel = () => { const onAssetDeleteModalCancel = () => {
...@@ -1129,9 +1146,9 @@ const AssetTable = (props) => { ...@@ -1129,9 +1146,9 @@ const AssetTable = (props) => {
onSuccess={onImportAssetSuccess} onSuccess={onImportAssetSuccess}
/> />
<AssetMount <AssetMount
visible={ assetMountVisible } visible={ assetMountParam.visible }
reference={reference} reference={reference}
ids={ batchCatalogChange?checkedKeys:[] } ids={ assetMountParam.ids }
onCancel={ onAssetMountCancel } onCancel={ onAssetMountCancel }
{...props} {...props}
/> />
......
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