Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaochengxiang
szse
Commits
81ad1b4e
Commit
81ad1b4e
authored
Aug 08, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产浏览自定义
parent
c546178a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
42 deletions
+77
-42
AssetManageTree.jsx
src/view/Manage/AssetManage/Component/AssetManageTree.jsx
+5
-3
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+14
-14
AssetTree.jsx
src/view/Manage/AssetManage/Component/AssetTree.jsx
+58
-25
No files found.
src/view/Manage/AssetManage/Component/AssetManageTree.jsx
View file @
81ad1b4e
...
@@ -21,7 +21,7 @@ import { getTemplateType } from '../../../../util/axios';
...
@@ -21,7 +21,7 @@ import { getTemplateType } from '../../../../util/axios';
const
{
Option
}
=
AutoComplete
;
const
{
Option
}
=
AutoComplete
;
const
viewModes
=
[
export
const
viewModes
=
[
{
{
key
:
'dir'
,
key
:
'dir'
,
name
:
'目录视角'
name
:
'目录视角'
...
@@ -512,7 +512,8 @@ const AssetManageTree = (props) => {
...
@@ -512,7 +512,8 @@ const AssetManageTree = (props) => {
}
}
}
}
const
deleteDir
=
()
=>
{
const
deleteDir
=
()
=>
{
console
.
log
(
'currentRightClickDir'
,
currentRightClickDir
)
if
(
currentRightClickDir
.
nodeId
)
{
if
(
currentRightClickDir
.
nodeId
)
{
modal
.
confirm
({
modal
.
confirm
({
title
:
'您确定要删除该目录吗?'
,
title
:
'您确定要删除该目录吗?'
,
...
@@ -521,7 +522,8 @@ const AssetManageTree = (props) => {
...
@@ -521,7 +522,8 @@ const AssetManageTree = (props) => {
type
:
'assetmanage.checkDirectoryDeleteAble'
,
type
:
'assetmanage.checkDirectoryDeleteAble'
,
payload
:
{
payload
:
{
params
:
{
params
:
{
dirId
:
currentRightClickDir
.
nodeId
dirId
:
currentRightClickDir
.
nodeId
,
currentDirIsCustom
:
currentRightClickDir
.
type
===
'custom'
}
}
},
},
callback
:
able
=>
{
callback
:
able
=>
{
...
...
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
81ad1b4e
...
@@ -570,20 +570,20 @@ const AssetTable = (props) => {
...
@@ -570,20 +570,20 @@ const AssetTable = (props) => {
}
}
let
url
=
'assetmanage.listDataAssetsByPage'
;
let
url
=
'assetmanage.listDataAssetsByPage'
;
if
(
reference
===
AssetRecycleReference
)
{
//
if (reference===AssetRecycleReference) {
url
=
'assetmanage.listRecycleBinDataAssetsByPage'
;
//
url = 'assetmanage.listRecycleBinDataAssetsByPage';
}
else
if
((
reference
===
AssetBrowseReference
||
reference
===
ResourceBrowseReference
))
{
//
} else if ((reference===AssetBrowseReference|| reference===ResourceBrowseReference)) {
params
.
checkPermission
=
true
;
//
params.checkPermission = true;
if
(
nodeType
===
'custom'
)
{
//
if (nodeType === 'custom') {
url
=
'assetmanage.listDataAssetsByPersonalCustomType'
;
//
url = 'assetmanage.listDataAssetsByPersonalCustomType';
if
(
reference
===
AssetBrowseReference
)
{
//
if (reference === AssetBrowseReference) {
params
.
resourceType
=
'dataAsset'
;
//
params.resourceType = 'dataAsset';
}
else
if
(
reference
===
ResourceBrowseReference
)
{
//
} else if (reference === ResourceBrowseReference) {
params
.
resourceType
=
'innerSource,outerSource'
;
//
params.resourceType = 'innerSource,outerSource';
}
//
}
}
//
}
}
//
}
dispatchLatestHomepage
({
dispatchLatestHomepage
({
type
:
url
,
type
:
url
,
...
...
src/view/Manage/AssetManage/Component/AssetTree.jsx
View file @
81ad1b4e
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
{
Card
,
Spin
,
Tooltip
,
Tree
,
Modal
,
AutoComplete
,
Select
,
Button
}
from
'antd'
;
import
{
Card
,
Spin
,
Tooltip
,
Tree
,
Modal
,
AutoComplete
,
Select
,
Button
,
Menu
,
Dropdown
}
from
'antd'
;
import
{
ReloadOutlined
,
SettingOutlined
}
from
'@ant-design/icons'
;
import
{
ReloadOutlined
,
SettingOutlined
,
UnorderedListOutlined
}
from
'@ant-design/icons'
;
import
{
useContextMenu
,
Menu
as
RcMenu
,
Item
as
RcItem
}
from
"react-contexify"
;
import
{
useContextMenu
,
Menu
as
RcMenu
,
Item
as
RcItem
}
from
"react-contexify"
;
import
LocalStorage
from
'local-storage'
;
import
LocalStorage
from
'local-storage'
;
...
@@ -15,6 +15,7 @@ import './AssetTree.less';
...
@@ -15,6 +15,7 @@ import './AssetTree.less';
import
'react-contexify/dist/ReactContexify.css'
;
import
'react-contexify/dist/ReactContexify.css'
;
import
{
appId
}
from
'../../../../App'
;
import
{
appId
}
from
'../../../../App'
;
import
{
listSubject
}
from
'./AssetTable'
;
import
{
listSubject
}
from
'./AssetTable'
;
import
{
viewModes
}
from
'./AssetManageTree'
;
const
{
Option
}
=
AutoComplete
;
const
{
Option
}
=
AutoComplete
;
...
@@ -61,6 +62,7 @@ const AssetTree = (props) => {
...
@@ -61,6 +62,7 @@ const AssetTree = (props) => {
const
[
currentTemplateType
,
setTemplateType
]
=
useState
()
const
[
currentTemplateType
,
setTemplateType
]
=
useState
()
const
[
updateDirectoryAction
,
setUpdateDirectoryAction
]
=
useState
(
''
);
const
[
updateDirectoryAction
,
setUpdateDirectoryAction
]
=
useState
(
''
);
const
[
updateDirectoryModalVisible
,
setUpdateDirectoryModalVisible
]
=
useState
(
false
);
const
[
updateDirectoryModalVisible
,
setUpdateDirectoryModalVisible
]
=
useState
(
false
);
const
[
viewSelectedKey
,
setViewSelectedKey
]
=
useState
(
viewModes
[
0
].
key
);
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
...
@@ -70,6 +72,7 @@ const AssetTree = (props) => {
...
@@ -70,6 +72,7 @@ const AssetTree = (props) => {
const
treeDataRef
=
useRef
([]);
const
treeDataRef
=
useRef
([]);
const
dataListRef
=
useRef
([]);
const
dataListRef
=
useRef
([]);
const
viewSelectedKeyRef
=
useRef
(
viewModes
[
0
].
key
)
useEffect
(()
=>
{
useEffect
(()
=>
{
getTemplates
()
getTemplates
()
...
@@ -194,11 +197,9 @@ const AssetTree = (props) => {
...
@@ -194,11 +197,9 @@ const AssetTree = (props) => {
// onSelect && onSelect('', '');
// onSelect && onSelect('', '');
// }
// }
let
url
=
''
;
let
url
=
'assetmanage.queryAllDirectoryAsTree'
;
if
(
reference
===
AssetBrowseReference
)
{
if
(
viewSelectedKeyRef
.
current
===
'custom'
)
{
url
=
'assetmanage.queryAssetDirectoryAsTree'
;
url
=
'assetmanage.queryCustomTypeRootDirectory'
;
}
else
if
(
reference
===
ResourceBrowseReference
)
{
url
=
'assetmanage.queryResourceDirectoryAsTree'
;
}
}
dispatch
({
dispatch
({
...
@@ -207,7 +208,14 @@ const AssetTree = (props) => {
...
@@ -207,7 +208,14 @@ const AssetTree = (props) => {
setLoading
(
false
);
setLoading
(
false
);
refresh
&&
showMessage
(
'success'
,
'操作成功'
);
refresh
&&
showMessage
(
'success'
,
'操作成功'
);
let
newData
=
[...
data
];
let
newData
=
[];
if
(
viewSelectedKeyRef
.
current
===
'dir'
)
{
newData
=
[...
data
];
}
else
{
newData
=
(
data
||
[]).
map
((
item
)
=>
{
return
{...
item
,
text
:
item
.
name
,
nodeId
:
item
.
id
,
type
:
item
.
resourceType
}
});
}
setLoadedKeys
([]);
setLoadedKeys
([]);
setTreeData
(
newData
);
setTreeData
(
newData
);
...
@@ -222,14 +230,6 @@ const AssetTree = (props) => {
...
@@ -222,14 +230,6 @@ const AssetTree = (props) => {
let
defaultItem
=
null
;
let
defaultItem
=
null
;
if
((
defaultSelectedId
||
''
)
===
''
)
{
_dataList
.
forEach
(
item
=>
{
if
((
defaultSelectedId
||
''
)
===
''
)
{
defaultSelectedId
=
item
.
key
;
}
})
}
function
recursion
(
subCatalogs
)
{
function
recursion
(
subCatalogs
)
{
if
((
subCatalogs
||
[]).
length
===
0
)
return
;
if
((
subCatalogs
||
[]).
length
===
0
)
return
;
...
@@ -249,7 +249,6 @@ const AssetTree = (props) => {
...
@@ -249,7 +249,6 @@ const AssetTree = (props) => {
}
}
if
(
resetCurrentDirId
)
{
if
(
resetCurrentDirId
)
{
if
(
defaultItem
)
{
if
(
defaultItem
)
{
const
expandedKeys
=
_dataList
const
expandedKeys
=
_dataList
.
map
(
item
=>
{
.
map
(
item
=>
{
...
@@ -259,15 +258,18 @@ const AssetTree = (props) => {
...
@@ -259,15 +258,18 @@ const AssetTree = (props) => {
return
null
;
return
null
;
})
})
.
filter
((
item
,
i
,
self
)
=>
item
&&
self
.
indexOf
(
item
)
===
i
);
.
filter
((
item
,
i
,
self
)
=>
item
&&
self
.
indexOf
(
item
)
===
i
);
setExpandedKeys
(
[...
expandedKeys
,
defaultSelectedId
]
);
setExpandedKeys
(
expandedKeys
);
setAutoExpandParent
(
true
);
setAutoExpandParent
(
true
);
setCurrentDirId
(
defaultItem
.
nodeId
);
setCurrentDirId
(
defaultItem
.
nodeId
);
onSelect
&&
onSelect
(
defaultItem
.
nodeId
,
defaultItem
.
type
||
''
,
defaultItem
.
allowdLoadDataAsset
);
onSelect
&&
onSelect
(
defaultItem
.
nodeId
,
defaultItem
.
type
||
''
,
defaultItem
.
level
,
defaultItem
.
allowdLoadDataAsset
);
}
}
else
if
((
newData
??[]).
length
>
0
)
{
defaultItem
=
newData
[
0
]
setCurrentDirId
(
defaultItem
.
nodeId
);
onSelect
&&
onSelect
(
defaultItem
.
nodeId
,
defaultItem
.
type
||
''
,
defaultItem
.
level
,
defaultItem
.
allowdLoadDataAsset
);
}
}
}
},
},
error
:
()
=>
{
error
:
()
=>
{
...
@@ -403,7 +405,8 @@ const AssetTree = (props) => {
...
@@ -403,7 +405,8 @@ const AssetTree = (props) => {
type
:
'assetmanage.checkDirectoryDeleteAble'
,
type
:
'assetmanage.checkDirectoryDeleteAble'
,
payload
:
{
payload
:
{
params
:
{
params
:
{
dirId
:
currentRightClickDir
.
nodeId
dirId
:
currentRightClickDir
.
nodeId
,
currentDirIsCustom
:
currentRightClickDir
.
type
===
'custom'
}
}
},
},
callback
:
able
=>
{
callback
:
able
=>
{
...
@@ -514,6 +517,32 @@ const AssetTree = (props) => {
...
@@ -514,6 +517,32 @@ const AssetTree = (props) => {
treeDirectoryChanged
(
option
.
key
);
treeDirectoryChanged
(
option
.
key
);
};
};
const
onViewClick
=
({
key
})
=>
{
if
(
viewSelectedKey
&&
viewSelectedKey
===
key
)
return
;
viewSelectedKeyRef
.
current
=
key
;
setViewSelectedKey
(
key
);
setExpandedKeys
([]);
getAllDirectoryAsTree
();
}
const
viewMenus
=
(
<
Menu
selectedKeys=
{
[
viewSelectedKey
]
}
onClick=
{
onViewClick
}
>
{
viewModes
&&
viewModes
.
map
(
item
=>
{
return
(
<
Menu
.
Item
key=
{
item
.
key
}
value=
{
item
.
key
}
>
<
div
style=
{
{
textAlign
:
'center'
}
}
>
{
item
.
name
}
</
div
>
</
Menu
.
Item
>
)
})
}
</
Menu
>
);
const
onLoadData
=
({
key
,
children
})
=>
const
onLoadData
=
({
key
,
children
})
=>
new
Promise
((
resolve
)
=>
{
new
Promise
((
resolve
)
=>
{
...
@@ -557,7 +586,7 @@ const AssetTree = (props) => {
...
@@ -557,7 +586,7 @@ const AssetTree = (props) => {
>
>
{
item
.
text
}
{
item
.
text
}
{
{
(
item
.
level
!==
1
||
(
item
.
level
===
1
&&
item
.
resourceType
!==
'custom'
))
&&
<
span
>
{
` (${item.dataAssetAndSubDirCount})`
}
</
span
>
viewSelectedKeyRef
.
current
===
'dir'
&&
<
span
>
{
` (${item.dataAssetAndSubDirCount})`
}
</
span
>
}
}
</
span
>
</
span
>
);
);
...
@@ -607,12 +636,16 @@ const AssetTree = (props) => {
...
@@ -607,12 +636,16 @@ const AssetTree = (props) => {
(
templates
??[]).
map
((
item
,
index
)
=>
<
Select
.
Option
key=
{
index
}
value=
{
item
.
type
}
>
{
item
.
name
}
</
Select
.
Option
>)
(
templates
??[]).
map
((
item
,
index
)
=>
<
Select
.
Option
key=
{
index
}
value=
{
item
.
type
}
>
{
item
.
name
}
</
Select
.
Option
>)
}
}
</
Select
>
</
Select
>
<
Dropdown
overlay=
{
viewMenus
}
placement=
"bottomLeft"
>
<
Tooltip
title=
"视角"
>
<
UnorderedListOutlined
className=
'default'
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
</
Dropdown
>
<
Tooltip
title=
"刷新目录"
>
<
Tooltip
title=
"刷新目录"
>
<
ReloadOutlined
className=
'default'
onClick=
{
refreshTree
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
,
flex
:
1
}
}
/>
<
ReloadOutlined
className=
'default'
onClick=
{
refreshTree
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
,
flex
:
1
}
}
/>
</
Tooltip
>
</
Tooltip
>
<
div
style=
{
{
flex
:
1
,
width
:
32
}
}
></
div
>
<
div
style=
{
{
flex
:
1
,
width
:
32
}
}
></
div
>
<
div
style=
{
{
flex
:
1
,
width
:
32
}
}
></
div
>
<
div
style=
{
{
flex
:
1
,
width
:
32
}
}
></
div
>
<
div
style=
{
{
flex
:
1
,
width
:
32
}
}
></
div
>
</
div
>
</
div
>
}
}
bordered=
{
false
}
bordered=
{
false
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment