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
57a412e5
Commit
57a412e5
authored
Mar 05, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产目录增加右键
parent
b670d8e6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
33 deletions
+77
-33
index.less
src/index.less
+20
-6
AssetTree.jsx
src/view/Manage/AssetManage/Component/AssetTree.jsx
+56
-26
ModelTree.jsx
src/view/Manage/Model/Component/ModelTree.jsx
+1
-1
No files found.
src/index.less
View file @
57a412e5
...
...
@@ -300,7 +300,7 @@ tr.drop-over-upward td {
}
}
.yy-btn
, .anticon
{
.yy-btn {
svg {
fill: @icon-color !important;
}
...
...
@@ -312,15 +312,29 @@ tr.drop-over-upward td {
}
}
.anticon-disable {
svg {
fill: @icon-disable-color !important;
}
.btn-group {
.anticon {
svg {
fill: @icon-color !important;
}
&:hover {
svg {
fill: @icon-hover-color !important;
}
}
}
&:hover
{
.anticon-disable
{
svg {
fill: @icon-disable-color !important;
}
&:hover {
svg {
fill: @icon-disable-color !important;
}
}
}
}
...
...
src/view/Manage/AssetManage/Component/AssetTree.jsx
View file @
57a412e5
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
{
useMount
,
useUnmount
}
from
'ahooks'
;
import
{
Card
,
Spin
,
Tooltip
,
Tree
,
Input
,
Dropdown
,
Menu
,
Modal
}
from
'antd'
;
import
{
PlusOutlined
,
ImportOutlined
,
E
ditOutlined
,
DeleteOutlined
,
ExportOutlined
,
ReloadOutlined
,
SettingOutlined
,
ArrowUpOutlined
,
ArrowDown
Outlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
,
ImportOutlined
,
E
xportOutlined
,
ReloadOutlined
,
Setting
Outlined
}
from
'@ant-design/icons'
;
import
classNames
from
'classnames'
;
import
{
useContextMenu
,
Menu
as
RcMenu
,
Item
as
RcItem
}
from
"react-contexify"
;
import
{
dispatch
}
from
'../../../../model'
;
import
ImportDirectory
from
'./ImportDirectory'
;
...
...
@@ -10,10 +11,20 @@ import UpdateDirectoryModal from './UpdateDirectoryModal';
import
CustomDirectoryModal
from
'./CustomDirectoryModal'
;
import
{
showMessage
,
getQueryParam
}
from
'../../../../util'
;
import
{
AnchorTimestamp
,
AnchorId
,
AssetManageReference
,
AssetBrowseReference
,
ResourceBrowseReference
,
AssetMountReference
,
AnchorDirId
}
from
'../../../../util/constant'
;
import
'./AssetTree.less'
;
import
'react-contexify/dist/ReactContexify.css'
;
const
AssetTree
=
(
props
)
=>
{
const
MENU_ID
=
'asset-tree'
;
const
{
show
}
=
useContextMenu
({
id
:
MENU_ID
,
});
const
{
checkable
=
false
,
onSelect
,
className
,
onCheck
,
tableId
,
reference
=
AssetManageReference
,
onDirectoryChange
,
centerId
}
=
props
;
const
[
keyword
,
setKeyword
]
=
useState
(
''
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
...
...
@@ -25,6 +36,7 @@ const AssetTree = (props) => {
const
[
autoExpandParent
,
setAutoExpandParent
]
=
useState
(
false
);
const
[
currentDirId
,
setCurrentDirId
]
=
useState
(
''
);
const
[
currentDirType
,
setCurrentDirType
]
=
useState
(
''
);
const
[
currentRightClickDir
,
setCurrentRightClickDir
]
=
useState
({});
const
[
importDirectoryVisible
,
setImportDirectoryVisible
]
=
useState
(
false
);
const
[
updateDirectoryModalVisible
,
setUpdateDirectoryModalVisible
]
=
useState
(
false
);
const
[
updateDirectoryAction
,
setUpdateDirectoryAction
]
=
useState
(
''
);
...
...
@@ -365,16 +377,16 @@ const AssetTree = (props) => {
}
const
deleteDir
=
()
=>
{
if
(
current
DirT
ype
===
'custom'
)
return
;
if
(
current
RightClickDir
.
t
ype
===
'custom'
)
return
;
if
(
current
Dir
Id
)
{
if
(
current
RightClickDir
.
node
Id
)
{
modal
.
confirm
({
title
:
'提示'
,
content
:
'节点下可能包含资产信息,删除后将把资产从该目录上移除,确定继续吗?'
,
onOk
:
()
=>
{
dispatch
({
type
:
'assetmanage.deleteDirectory'
,
payload
:
{
data
:
[
current
Dir
Id
]},
payload
:
{
data
:
[
current
RightClickDir
.
node
Id
]},
callback
:
()
=>
{
showMessage
(
"success"
,
"删除成功"
);
getAllDirectoryAsTree
(
true
);
...
...
@@ -389,7 +401,7 @@ const AssetTree = (props) => {
}
const
moveNode
=
(
steps
)
=>
{
if
((
current
Dir
Id
||
''
)
===
''
)
{
if
((
current
RightClickDir
.
node
Id
||
''
)
===
''
)
{
showMessage
(
'info'
,
'请先选择目录'
);
return
;
}
...
...
@@ -399,7 +411,7 @@ const AssetTree = (props) => {
type
:
'assetmanage.upDownDirectory'
,
payload
:
{
params
:
{
dirId
:
current
Dir
Id
,
dirId
:
current
RightClickDir
.
node
Id
,
steps
}
},
...
...
@@ -510,6 +522,15 @@ const AssetTree = (props) => {
refresh
&&
getAllDirectoryAsTree
(
false
);
}
const
displayMenu
=
(
e
)
=>
{
show
(
e
,
{
position
:
{
x
:
e
.
clientX
+
30
,
y
:
e
.
clientY
-
10
}
});
}
const
exportMenu
=
(
<
Menu
>
<
Menu
.
Item
>
...
...
@@ -547,13 +568,10 @@ const AssetTree = (props) => {
>
{
item
.
text
}
</
span
>
);
if
(
item
.
children
)
{
return
{
title
,
key
:
item
.
nodeId
,
children
:
loop
(
item
.
children
,
false
)
};
return
{
...
item
,
...{
title
,
key
:
item
.
nodeId
,
children
:
loop
(
item
.
children
,
false
)}
};
}
return
{
title
,
key
:
item
.
nodeId
};
return
{
...
item
,
...{
title
,
key
:
item
.
nodeId
}};
});
const
classes
=
classNames
(
'asset-tree'
,
className
,
{
...
...
@@ -566,19 +584,16 @@ const AssetTree = (props) => {
className=
{
classes
}
title=
{
(
reference
===
AssetBrowseReference
||
reference
===
ResourceBrowseReference
||
reference
===
AssetMountReference
)
?
null
:
(
<
div
className=
'flex px-2'
className=
'flex px-2
btn-group
'
style=
{
{
height
:
60
,
alignItems
:
'center'
,
justifyContent
:
'space-
between
'
,
justifyContent
:
'space-
around
'
,
}
}
>
<
Tooltip
title=
"新增目录"
>
<
PlusOutlined
className=
{
(
currentDirType
===
'custom-root'
||
currentDirType
===
'custom'
)?
'anticon-disable'
:
''
}
onClick=
{
addDir
}
style=
{
{
fontSize
:
16
,
cursor
:
(
currentDirType
===
'custom-root'
||
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"修改目录"
>
<
EditOutlined
onClick=
{
editDir
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"刷新目录"
>
<
ReloadOutlined
onClick=
{
refreshTree
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
...
...
@@ -590,15 +605,6 @@ const AssetTree = (props) => {
<
ExportOutlined
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
</
Dropdown
>
<
Tooltip
title=
"上移目录"
>
<
ArrowUpOutlined
onClick=
{
()
=>
{
moveNode
(
1
);
}
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"下移目录"
>
<
ArrowDownOutlined
onClick=
{
()
=>
{
moveNode
(
-
1
);
}
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"删除目录"
>
<
DeleteOutlined
className=
{
(
currentDirType
===
'custom'
)?
'#anticon-disable'
:
''
}
onClick=
{
deleteDir
}
style=
{
{
fontSize
:
16
,
cursor
:(
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"自定义目录"
>
<
SettingOutlined
onClick=
{
customDir
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
...
...
@@ -628,6 +634,12 @@ const AssetTree = (props) => {
onCheck=
{
onTreeCheck
}
checkedKeys=
{
checkedKeys
}
checkStrictly
onRightClick=
{
({
event
,
node
})
=>
{
if
(
reference
===
AssetManageReference
)
{
setCurrentRightClickDir
(
node
);
displayMenu
(
event
);
}
}
}
/>
</
Spin
>
...
...
@@ -635,7 +647,7 @@ const AssetTree = (props) => {
visible=
{
updateDirectoryModalVisible
}
onCancel=
{
onUpdateDirectoryCancel
}
action=
{
updateDirectoryAction
}
dirId=
{
currentDir
Id
}
dirId=
{
(
updateDirectoryAction
===
'add'
)?
currentDirId
:
currentRightClickDir
.
node
Id
}
/>
<
ImportDirectory
visible=
{
importDirectoryVisible
}
...
...
@@ -648,6 +660,24 @@ const AssetTree = (props) => {
action=
{
customDirectoryAction
}
dirId=
{
currentDirId
}
/>
<
RcMenu
id=
{
MENU_ID
}
>
<
RcItem
id=
"edit"
onClick=
{
editDir
}
>
修改目录
</
RcItem
>
<
RcItem
id=
"up"
onClick=
{
()
=>
{
moveNode
(
1
);
}
}
>
上移目录
</
RcItem
>
<
RcItem
id=
"down"
onClick=
{
()
=>
{
moveNode
(
-
1
);
}
}
>
下移目录
</
RcItem
>
{
(
currentRightClickDir
?.
type
!==
'custom'
)
&&
<
RcItem
id=
"delete"
onClick=
{
deleteDir
}
>
删除目录
</
RcItem
>
}
</
RcMenu
>
{
contextHolder
}
</
Card
>
)
...
...
src/view/Manage/Model/Component/ModelTree.jsx
View file @
57a412e5
...
...
@@ -429,7 +429,7 @@ const ModelTree = (props) => {
<
div
className=
{
classes
}
>
{
(
refrence
===
''
)
&&
<
div
className=
'p-3'
className=
'p-3
btn-group
'
style=
{
{
display
:
'flex'
,
borderBottom
:
"1px solid #EFEFEF"
,
...
...
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