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
b7e1128f
Commit
b7e1128f
authored
Nov 23, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产目录增加回收站
parent
cf5168c3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
35 deletions
+62
-35
index.jsx
src/view/Manage/AssetBrowse/index.jsx
+4
-2
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+37
-20
AssetTree.jsx
src/view/Manage/AssetManage/Component/AssetTree.jsx
+15
-10
index.jsx
src/view/Manage/AssetManage/index.jsx
+6
-3
No files found.
src/view/Manage/AssetBrowse/index.jsx
View file @
b7e1128f
...
...
@@ -10,10 +10,12 @@ import '../AssetManage/index.less';
const
AssetBrowse
=
(
props
)
=>
{
const
[
nodeId
,
setNodeId
]
=
useState
(
''
);
const
[
nodeType
,
setNodeType
]
=
useState
(
''
);
const
[
expandTree
,
setExpandTree
]
=
useState
(
true
);
const
onTreeSelect
=
(
value
)
=>
{
const
onTreeSelect
=
(
value
,
type
)
=>
{
setNodeId
(
value
||
''
);
setNodeType
(
type
);
}
const
treeToggleClick
=
()
=>
{
...
...
@@ -35,7 +37,7 @@ const AssetBrowse = (props) => {
</
div
>
</
div
>
<
div
className=
'right'
>
<
AssetTable
nodeId=
{
nodeId
}
readOnly
{
...
props
}
/>
<
AssetTable
nodeId=
{
nodeId
}
nodeType=
{
nodeType
}
readOnly
{
...
props
}
/>
</
div
>
</
div
>
)
...
...
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
b7e1128f
...
...
@@ -19,7 +19,7 @@ import "./AssetTable.less";
const
AssetTable
=
(
props
)
=>
{
const
{
readOnly
=
false
,
className
,
nodeId
}
=
props
;
const
{
readOnly
=
false
,
className
,
nodeId
,
nodeType
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
columns
,
setColumns
]
=
useState
([]);
const
[
assets
,
setAssets
]
=
useState
([]);
...
...
@@ -307,16 +307,21 @@ const AssetTable = (props) => {
const
deleteAsset
=
(
item
)
=>
{
modal
.
confirm
({
title
:
'提示'
,
content
:
'该资产在所有目录上唯一存在,移除后,你可以前往“未分类资产”重新挂载。
'
,
content
:
(
nodeType
!==
'RecycleBin'
)?
'该资产在所有目录上唯一存在,移除后,你可以前往“垃圾回收站”重新挂载。'
:
'您确定要永久删除该资产吗?
'
,
onOk
:
()
=>
{
let
payload
=
{
data
:[
item
.
id
]
}
if
(
nodeType
!==
'RecycleBin'
)
{
payload
.
params
=
{
dirId
:
nodeId
}
}
dispatch
({
type
:
'assetmanage.unloadDataAssets'
,
payload
:
{
params
:
{
dirId
:
nodeId
},
data
:[
item
.
id
]
},
type
:
(
nodeType
!==
'RecycleBin'
)?
'assetmanage.unloadDataAssets'
:
'assetmanage.deleteDataAssets'
,
payload
,
callback
:
()
=>
{
showMessage
(
"success"
,
"删除成功"
)
getDataAssets
();
...
...
@@ -359,17 +364,21 @@ const AssetTable = (props) => {
if
((
selectedKeys
||
[]).
length
>
0
)
{
modal
.
confirm
({
title
:
'提示'
,
content
:
`你已选择了
${
selectedKeys
.
length
}
个资产,确定把它们都从挂载目录上移除吗?`
,
content
:
(
nodeType
!==
'RecycleBin'
)?
'这些资产在所有目录上唯一存在,移除后,你可以前往“垃圾回收站”重新挂载。'
:
'您确定要永久删除这些资产吗?'
,
onOk
:
()
=>
{
let
payload
=
{
data
:
selectedKeys
}
if
(
nodeType
!==
'RecycleBin'
)
{
payload
.
params
=
{
dirId
:
nodeId
}
}
dispatch
({
type
:
'assetmanage.unloadDataAssets'
,
payload
:
{
params
:
{
dirId
:
nodeId
},
data
:
selectedKeys
},
type
:
(
nodeType
!==
'RecycleBin'
)?
'assetmanage.unloadDataAssets'
:
'assetmanage.deleteDataAssets'
,
payload
,
callback
:
()
=>
{
showMessage
(
"success"
,
"删除成功"
);
getDataAssets
();
...
...
@@ -489,8 +498,16 @@ const AssetTable = (props) => {
title=
{
<
div
className=
'd-flex'
style=
{
{
justifyContent
:
'space-between'
}
}
>
<
Space
>
{
!
readOnly
&&
<
Button
onClick=
{
addAsset
}
>
新增
</
Button
>
}
{
!
readOnly
&&
<
Button
onClick=
{
importAsset
}
>
导入
</
Button
>
}
{
!
readOnly
&&
<
Tooltip
title=
{
(
nodeType
===
'RecycleBin'
)?
'回收站不允许直接新增资产'
:
''
}
>
<
Button
onClick=
{
addAsset
}
disabled=
{
nodeType
===
'RecycleBin'
}
>
新增
</
Button
>
</
Tooltip
>
}
{
!
readOnly
&&
<
Tooltip
title=
{
(
nodeType
===
'RecycleBin'
)?
'回收站不允许直接导入资产'
:
''
}
>
<
Button
onClick=
{
importAsset
}
disabled=
{
nodeType
===
'RecycleBin'
}
>
导入
</
Button
>
</
Tooltip
>
}
<
Tooltip
title=
{
(
selectedKeys
||
[]).
length
===
0
?
'请先选择资产'
:
''
}
>
<
Button
onClick=
{
exportAsset
}
disabled=
{
(
selectedKeys
||
[]).
length
===
0
}
>
导出
</
Button
>
</
Tooltip
>
...
...
src/view/Manage/AssetManage/Component/AssetTree.jsx
View file @
b7e1128f
...
...
@@ -221,7 +221,7 @@ const AssetTree = (props) => {
const
node
=
tree
[
i
];
if
(
node
.
nodeId
===
key
)
{
type
=
node
.
type
||
''
;
if
(
type
!==
'
'
)
{
if
(
type
===
'custom
'
)
{
type
+=
(
root
?
'-root'
:
''
);
}
...
...
@@ -235,7 +235,7 @@ const AssetTree = (props) => {
}
const
addDir
=
()
=>
{
if
(
currentDirType
===
'custom-root'
||
currentDirType
===
'custom'
)
return
;
if
(
currentDirType
===
'custom-root'
||
currentDirType
===
'custom'
||
currentDirType
===
'RecycleBin'
)
return
;
setUpdateDirectoryAction
(
'add'
);
setUpdateDirectoryModalVisible
(
true
);
...
...
@@ -243,6 +243,8 @@ const AssetTree = (props) => {
const
editDir
=
()
=>
{
if
(
currentDirType
===
'RecycleBin'
)
return
;
if
((
currentDirType
||
''
)
===
''
)
{
setUpdateDirectoryAction
(
'edit'
);
...
...
@@ -261,7 +263,7 @@ const AssetTree = (props) => {
}
const
importDir
=
()
=>
{
if
(
currentDirType
===
'custom-root'
||
currentDirType
===
'custom'
)
return
;
if
(
currentDirType
===
'custom-root'
||
currentDirType
===
'custom'
||
currentDirType
===
'RecycleBin'
)
return
;
setImportDirectoryVisible
(
true
);
}
...
...
@@ -287,7 +289,7 @@ const AssetTree = (props) => {
}
const
deleteDir
=
()
=>
{
if
(
currentDirType
===
'custom'
)
return
;
if
(
currentDirType
===
'custom'
||
currentDirType
===
'RecycleBin'
)
return
;
if
(
currentDirId
)
{
modal
.
confirm
({
...
...
@@ -347,8 +349,11 @@ const AssetTree = (props) => {
}
setCurrentDirId
(
keys
[
0
]);
setCurrentDirType
(
getCurrentType
(
keys
[
0
],
treeData
));
onSelect
&&
onSelect
(
keys
[
0
]);
const
_currentDirType
=
getCurrentType
(
keys
[
0
],
treeData
);
setCurrentDirType
(
_currentDirType
);
onSelect
&&
onSelect
(
keys
[
0
],
_currentDirType
);
}
const
onTreeCheck
=
(
values
,
e
)
=>
{
...
...
@@ -457,16 +462,16 @@ const AssetTree = (props) => {
}
}
>
<
Tooltip
title=
"新增目录"
>
<
PlusOutlined
onClick=
{
addDir
}
style=
{
{
fontSize
:
16
,
cursor
:
(
currentDirType
===
'custom-root'
||
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
,
color
:
(
currentDirType
===
'custom-root'
||
currentDirType
===
'custom
'
)?
'#bfbfbf'
:
''
}
}
/>
<
PlusOutlined
onClick=
{
addDir
}
style=
{
{
fontSize
:
16
,
cursor
:
(
currentDirType
===
'custom-root'
||
currentDirType
===
'custom'
||
currentDirType
===
'RecycleBin'
)?
'not-allowed'
:
'pointer'
,
color
:
(
currentDirType
===
'custom-root'
||
currentDirType
===
'custom'
||
currentDirType
===
'RecycleBin
'
)?
'#bfbfbf'
:
''
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"修改"
className=
'ml-3'
>
<
EditOutlined
onClick=
{
editDir
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer
'
}
}
/>
<
EditOutlined
onClick=
{
editDir
}
style=
{
{
fontSize
:
16
,
cursor
:
(
currentDirType
===
'RecycleBin'
)?
'not-allowed'
:
'pointer'
,
color
:
(
currentDirType
===
'RecycleBin'
)?
'#bfbfbf'
:
'
'
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"刷新"
className=
'ml-3'
>
<
SyncOutlined
onClick=
{
refreshTree
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"导入"
className=
'ml-3'
>
<
ImportOutlined
onClick=
{
importDir
}
style=
{
{
fontSize
:
16
,
cursor
:(
currentDirType
===
'custom-root'
||
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
,
color
:
(
currentDirType
===
'custom-root'
||
currentDirType
===
'custom
'
)?
'#bfbfbf'
:
''
}
}
/>
<
ImportOutlined
onClick=
{
importDir
}
style=
{
{
fontSize
:
16
,
cursor
:(
currentDirType
===
'custom-root'
||
currentDirType
===
'custom'
||
currentDirType
===
'RecycleBin'
)?
'not-allowed'
:
'pointer'
,
color
:
(
currentDirType
===
'custom-root'
||
currentDirType
===
'custom'
||
currentDirType
===
'RecycleBin
'
)?
'#bfbfbf'
:
''
}
}
/>
</
Tooltip
>
<
Dropdown
overlay=
{
exportMenu
}
placement=
"bottomLeft"
className=
'ml-3'
>
<
Tooltip
title=
"导出"
>
...
...
@@ -474,7 +479,7 @@ const AssetTree = (props) => {
</
Tooltip
>
</
Dropdown
>
<
Tooltip
title=
"删除"
className=
'ml-3'
>
<
DeleteOutlined
onClick=
{
deleteDir
}
style=
{
{
fontSize
:
16
,
cursor
:(
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
,
color
:
(
currentDirType
===
'custom
'
)?
'#bfbfbf'
:
''
}
}
/>
<
DeleteOutlined
onClick=
{
deleteDir
}
style=
{
{
fontSize
:
16
,
cursor
:(
currentDirType
===
'custom'
||
currentDirType
===
'RecycleBin'
)?
'not-allowed'
:
'pointer'
,
color
:
(
currentDirType
===
'custom'
||
currentDirType
===
'RecycleBin
'
)?
'#bfbfbf'
:
''
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"自定义"
className=
'ml-3'
>
<
SettingOutlined
onClick=
{
customDir
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
...
...
src/view/Manage/AssetManage/index.jsx
View file @
b7e1128f
...
...
@@ -9,11 +9,14 @@ import './index.less';
const
AssetManage
=
(
props
)
=>
{
const
[
nodeId
,
setNodeId
]
=
useState
(
''
);
const
[
nodeId
,
setNodeId
]
=
useState
(
''
);
const
[
nodeType
,
setNodeType
]
=
useState
(
''
);
const
[
expandTree
,
setExpandTree
]
=
useState
(
true
);
const
onTreeSelect
=
(
value
)
=>
{
const
onTreeSelect
=
(
value
,
type
)
=>
{
setNodeId
(
value
||
''
);
setNodeType
(
type
);
}
const
treeToggleClick
=
()
=>
{
...
...
@@ -35,7 +38,7 @@ const AssetManage = (props) => {
</
div
>
</
div
>
<
div
className=
'right'
>
<
AssetTable
nodeId=
{
nodeId
}
{
...
props
}
/>
<
AssetTable
nodeId=
{
nodeId
}
nodeType=
{
nodeType
}
{
...
props
}
/>
</
div
>
</
div
>
)
...
...
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