Commit 8ff4fcd1 by zhaochengxiang

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

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