Commit f5ad96d1 by zhaochengxiang

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

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