Commit 8ff4fcd1 by zhaochengxiang

自定义目录下 不允许新增资产

parent d07efa08
......@@ -20,7 +20,7 @@ module.exports = {
'@ant-prefix': 'yy',
// '@border-color-split': 'hsv(0, 0, 85%)',
'@border-radius-base': '4px',
'@primary-color': '#0069AC',
'@primary-color': '#196AD2',
'@success-color': '#8FC31F',
'@warning-color': '#F7AB00',
'@error-color': '#E94848',
......
......@@ -509,7 +509,7 @@ const AssetTable = (props) => {
const moreMenu = (
<Menu>
{
(reference===AssetManageReference) && <Menu.Item>
(reference===AssetManageReference && nodeType!=='custom') && <Menu.Item>
<div className='text-center' onClick={importAsset}>
导入
</div>
......@@ -529,7 +529,7 @@ const AssetTable = (props) => {
</div>
</Menu.Item>
{
//自定义目录下的资产不允许删除
//自定义目录下的资产不允许新增 删除
(nodeType!=='custom') && <Menu.Item disabled={(checkedKeys||[]).length===0}>
<div className='text-center' onClick={deleteAssets}>
删除
......@@ -580,14 +580,14 @@ const AssetTable = (props) => {
>
<Space size={15}>
{
(reference===AssetManageReference) && <Button onClick={addAsset}>新增</Button>
(reference===AssetManageReference && nodeType!=='custom') && <Button onClick={addAsset}>新增</Button>
}
{
(compact && reference===AssetManageReference) ? <Dropdown overlay={moreMenu} placement="bottomCenter">
<Button>其他操作</Button>
</Dropdown> : <React.Fragment>
{
(reference===AssetManageReference) && <Button onClick={importAsset}>导入</Button>
(reference===AssetManageReference && nodeType!=='custom') && <Button onClick={importAsset}>导入</Button>
}
{
(reference===AssetManageReference || reference===AssetRecycleReference) && <React.Fragment>
......@@ -599,7 +599,7 @@ const AssetTable = (props) => {
</Tooltip>
{
//自定义目录下的资产不允许删除
nodeType!=='custom' && <Tooltip title={(checkedKeys||[]).length===0?'请先选择资产':''}>
(nodeType!=='custom') && <Tooltip title={(checkedKeys||[]).length===0?'请先选择资产':''}>
<Button onClick={deleteAssets} disabled={(checkedKeys||[]).length===0} >删除</Button>
</Tooltip>
}
......
......@@ -305,27 +305,24 @@ const AssetTree = (props) => {
return parentKey;
};
const getCurrentType = (key, tree, root=true) => {
let type;
for (let i = 0; i < tree.length; i++) {
const node = tree[i];
const getCurrentType = (key, tree) => {
let type = '';
(tree||[]).forEach(node => {
if (node.nodeId === key) {
type = node.type||'';
if (type === 'custom') {
type += (root?'-root':'');
}
type = node.type||'';
} else if (node.children) {
if (getCurrentType(key, node.children, false)) {
type = getCurrentType(key, node.children, false);
if (getCurrentType(key, node.children)) {
type = getCurrentType(key, node.children);
}
}
}
})
return type;
}
const addDir = () => {
if (currentDirType==='custom-root'||currentDirType==='custom') return;
if (currentDirType==='custom') return;
setUpdateDirectoryAction('add');
setUpdateDirectoryModalVisible(true);
......@@ -338,7 +335,7 @@ const AssetTree = (props) => {
setUpdateDirectoryAction('edit');
setUpdateDirectoryModalVisible(true);
} else if (currentDirType === 'custom-root'|| currentDirType === 'custom') {
} else if (currentDirType === 'custom') {
setCustomDirectoryAction('edit');
setCustomDirectoryModalVisible(true);
......@@ -351,7 +348,7 @@ const AssetTree = (props) => {
}
const importDir = () => {
if (currentDirType==='custom-root'||currentDirType==='custom') return;
if (currentDirType==='custom') return;
setImportDirectoryVisible(true);
}
......@@ -595,13 +592,13 @@ const AssetTree = (props) => {
}}
>
<Tooltip title="新增目录">
<PlusOutlined className={(currentDirType==='custom-root'||currentDirType==='custom')?'disable': 'default'} onClick={addDir} style={{ fontSize:16,cursor: (currentDirType==='custom-root'||currentDirType==='custom')?'not-allowed':'pointer' }}/>
<PlusOutlined className={(currentDirType==='custom')?'disable': 'default'} onClick={addDir} style={{ fontSize:16,cursor: (currentDirType==='custom')?'not-allowed':'pointer' }}/>
</Tooltip>
<Tooltip title="刷新目录">
<ReloadOutlined className='default' onClick={refreshTree} style={{ fontSize:16,cursor:'pointer' }} />
</Tooltip>
<Tooltip title="导入目录">
<ImportOutlined className={(currentDirType==='custom-root'||currentDirType==='custom')?'#disable': 'default'} onClick={importDir} style={{ fontSize:16,cursor:(currentDirType==='custom-root'||currentDirType==='custom')?'not-allowed':'pointer' }} />
<ImportOutlined className={(currentDirType==='custom')?'disable': 'default'} onClick={importDir} style={{ fontSize:16,cursor:(currentDirType==='custom')?'not-allowed':'pointer' }} />
</Tooltip>
<Dropdown overlay={exportMenu} placement="bottomCenter" >
<Tooltip title="导出目录">
......
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