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