Commit f5ad96d1 by zhaochengxiang

资产挂载目录不包含自定义目录

parent 7c120bb4
...@@ -63,6 +63,7 @@ export class App extends React.Component { ...@@ -63,6 +63,7 @@ export class App extends React.Component {
<AssetTree <AssetTree
reference='metadata' reference='metadata'
readOnly={true} readOnly={true}
showCustom={false}
checkable={true} checkable={true}
onCheck={(values) => { onCheck={(values) => {
callback&&callback(values); callback&&callback(values);
......
...@@ -13,7 +13,7 @@ import './AssetTree.less'; ...@@ -13,7 +13,7 @@ import './AssetTree.less';
const AssetTree = (props) => { const AssetTree = (props) => {
const { readOnly = false, checkable = false, onSelect, className, onCheck, tableId, reference='' } = props; const { readOnly = false, checkable = false, onSelect, className, onCheck, tableId, reference='', showCustom=true } = props;
const [ keyword, setKeyword ] = useState(''); const [ keyword, setKeyword ] = useState('');
const [ loading, setLoading ] = useState(false); const [ loading, setLoading ] = useState(false);
const [ treeData, setTreeData ] = useState([]); const [ treeData, setTreeData ] = useState([]);
...@@ -90,11 +90,18 @@ const AssetTree = (props) => { ...@@ -90,11 +90,18 @@ const AssetTree = (props) => {
type: 'assetmanage.queryAllDirectoryAsTree', type: 'assetmanage.queryAllDirectoryAsTree',
callback: data => { callback: data => {
setLoading(false); setLoading(false);
setTreeData(data);
let newData = [...data];
if (!showCustom) {
console.log('test');
newData = (newData||[]).filter(item => item.type!=='custom');
}
setTreeData(newData);
const _dataList = [], _groupIds = []; const _dataList = [], _groupIds = [];
generateList(data, _dataList); generateList(newData, _dataList);
generateGroupIds(data, _groupIds); generateGroupIds(newData, _groupIds);
setDataList(_dataList); setDataList(_dataList);
setGroupIds(_groupIds); setGroupIds(_groupIds);
...@@ -115,7 +122,7 @@ const AssetTree = (props) => { ...@@ -115,7 +122,7 @@ const AssetTree = (props) => {
} }
if ((defaultSelectedId||'') !== '') { if ((defaultSelectedId||'') !== '') {
recursion(data); recursion(newData);
} }
if (resetCurrentDirId) { if (resetCurrentDirId) {
...@@ -124,7 +131,7 @@ const AssetTree = (props) => { ...@@ -124,7 +131,7 @@ const AssetTree = (props) => {
const expandedKeys = _dataList const expandedKeys = _dataList
.map(item => { .map(item => {
if (item.key.indexOf(defaultSelectedId) > -1) { if (item.key.indexOf(defaultSelectedId) > -1) {
return getParentKey(item.key, data); return getParentKey(item.key, newData);
} }
return null; return null;
}) })
...@@ -139,8 +146,8 @@ const AssetTree = (props) => { ...@@ -139,8 +146,8 @@ const AssetTree = (props) => {
} else { } else {
const _currentDirId = (data&&data[0]?(data[0].nodeId||''):''); const _currentDirId = (newData&&newData[0]?(newData[0].nodeId||''):'');
const _type = (data&&data[0]?(data[0].type||''):''); const _type = (newData&&newData[0]?(newData[0].type||''):'');
setCurrentDirId(_currentDirId); setCurrentDirId(_currentDirId);
setCurrentDirType(_type); setCurrentDirType(_type);
......
...@@ -61,6 +61,7 @@ const AssetMount = (props) => { ...@@ -61,6 +61,7 @@ const AssetMount = (props) => {
<AssetTree <AssetTree
readOnly={true} readOnly={true}
checkable={true} checkable={true}
showCustom={false}
onCheck={onCheck} onCheck={onCheck}
tableId={refrence==='asset-manage'?id:''} tableId={refrence==='asset-manage'?id:''}
reference='mount' reference='mount'
......
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