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
1be5186c
Commit
1be5186c
authored
May 12, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除资产
parent
68e00aaf
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
128 additions
and
18 deletions
+128
-18
AssetDeleteModal.jsx
src/view/Manage/AssetManage/Component/AssetDeleteModal.jsx
+61
-0
AssetManageTree.jsx
src/view/Manage/AssetManage/Component/AssetManageTree.jsx
+4
-0
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+63
-18
No files found.
src/view/Manage/AssetManage/Component/AssetDeleteModal.jsx
0 → 100644
View file @
1be5186c
import
{
useState
}
from
"react"
;
import
{
Modal
,
Radio
,
Popover
}
from
"antd"
;
import
{
QuestionCircleOutlined
}
from
'@ant-design/icons'
;
const
AssetDeleteModal
=
(
props
)
=>
{
const
{
visible
,
onCancel
,
onDelete
,
onDeleteAll
}
=
props
;
const
[
value
,
setValue
]
=
useState
(
1
);
const
onChange
=
(
e
)
=>
{
setValue
(
e
.
target
.
value
);
};
return
(
<
Modal
title=
"删除资产"
visible=
{
visible
}
onCancel=
{
()
=>
{
onCancel
&&
onCancel
();
}
}
onOk=
{
()
=>
{
if
(
value
===
1
)
{
onDelete
&&
onDelete
();
}
else
{
onDeleteAll
&&
onDeleteAll
();
}
}
}
>
<
div
>
<
Radio
.
Group
onChange=
{
onChange
}
value=
{
value
}
>
<
Radio
value=
{
1
}
>
<
span
style=
{
{
paddingRight
:
3
}
}
>
删除本目录下的资产
</
span
>
<
Popover
content=
{
<
span
>
当要删除的资产,只存在一个目录时,删除该资产并且设置为未分类资产;
<
br
/>
存在多个目录时,只删除该目录下的这项资产,不会设置为未分类资产
</
span
>
}
style=
{
{
marginLeft
:
3
}
}
>
<
QuestionCircleOutlined
className=
'pointer'
/>
</
Popover
>
</
Radio
>
<
Radio
value=
{
2
}
>
<
span
>
删除该资产(所有目录下的资产均删除)
</
span
>
<
Popover
content=
'该资产所在的目录内,均删除该项资产,并设置为未分类资产'
style=
{
{
marginLeft
:
3
}
}
>
<
QuestionCircleOutlined
className=
'pointer'
/>
</
Popover
>
</
Radio
>
</
Radio
.
Group
>
</
div
>
</
Modal
>
);
}
export
default
AssetDeleteModal
;
\ No newline at end of file
src/view/Manage/AssetManage/Component/AssetManageTree.jsx
View file @
1be5186c
...
...
@@ -288,7 +288,11 @@ const AssetManageTree = (props) => {
const
{
nodeId
,
text
}
=
node
;
const
currentPath
=
path
?
`
${
path
}
/
${
text
}
`
:
text
;
if
(
node
.
level
!==
1
)
{
list
.
push
({
key
:
nodeId
,
title
:
text
,
value
:
currentPath
,
level
:
node
.
level
});
}
if
(
node
.
children
)
{
generateList
(
node
.
children
,
list
,
currentPath
);
}
...
...
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
1be5186c
...
...
@@ -16,6 +16,7 @@ import { dispatch, dispatchLatestHomepage } from '../../../../model';
import
{
showMessage
,
showNotifaction
,
getQueryParam
,
inputWidth
,
isSzseEnv
}
from
'../../../../util'
;
import
{
AnchorId
,
AnchorDirId
,
AnchorTimestamp
,
AssetBrowseReference
,
AssetManageReference
,
AssetRecycleReference
,
ResourceBrowseReference
}
from
'../../../../util/constant'
;
import
{
FullScreenSvg
,
CancelFullScreenSvg
}
from
'./AssetSvg'
;
import
AssetDeleteModal
from
'./AssetDeleteModal'
;
import
"./AssetTable.less"
;
import
'react-contexify/dist/ReactContexify.css'
;
...
...
@@ -145,6 +146,7 @@ const AssetTable = (props) => {
const
[
recursive
,
setRecursive
]
=
useState
(
true
);
const
[
fullSearch
,
setFullSearch
]
=
useState
(
false
);
const
[
compact
,
setCompact
]
=
useState
(
false
);
const
[
assetDeleteModalVisible
,
setAssetDeleteModalVisible
]
=
useState
(
false
);
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
anchorId
=
getQueryParam
(
AnchorId
,
props
?.
location
?.
search
);
...
...
@@ -496,31 +498,19 @@ const AssetTable = (props) => {
const
deleteAssets
=
()
=>
{
if
((
checkedKeys
||
[]).
length
>
0
)
{
if
(
reference
===
AssetManageReference
)
{
setAssetDeleteModalVisible
(
true
);
}
else
{
modal
.
confirm
({
title
:
'提示'
,
content
:
(
reference
!==
AssetRecycleReference
)?
'这些资产在所有目录上唯一存在,移除后,你可以前往“未挂载资产”重新挂载。'
:
'您确定要永久删除这些资产吗?'
,
content
:
'您确定要永久删除这些资产吗?'
,
onOk
:
()
=>
{
let
payload
=
{
data
:
checkedKeys
}
if
(
reference
!==
AssetRecycleReference
)
{
const
asssetIdsAndDirIds
=
[];
(
assets
||
[]).
forEach
(
asset
=>
{
if
(
checkedKeys
.
indexOf
(
asset
.
id
)
!==
-
1
)
{
asssetIdsAndDirIds
.
push
({
dataAssetId
:
asset
.
id
||
''
,
dirId
:
asset
.
dirId
||
''
});
}
})
payload
=
{
data
:
asssetIdsAndDirIds
}
}
dispatch
({
type
:
(
reference
!==
AssetRecycleReference
)?
'assetmanage.unloadDataAssets'
:
'assetmanage.deleteDataAssets'
,
type
:
'assetmanage.deleteDataAssets'
,
payload
,
callback
:
()
=>
{
showMessage
(
"success"
,
"删除成功"
);
...
...
@@ -532,8 +522,9 @@ const AssetTable = (props) => {
})
}
})
}
}
else
{
showMessage
(
"warn"
,
"请
选择删除项
"
)
showMessage
(
"warn"
,
"请
先选择资产
"
)
}
}
...
...
@@ -563,6 +554,54 @@ const AssetTable = (props) => {
setAssetMountVisible
(
true
);
}
const
onAssetDeleteModalCancel
=
()
=>
{
setAssetDeleteModalVisible
(
false
);
}
const
onAssetDeleteModalDelete
=
()
=>
{
setAssetDeleteModalVisible
(
false
);
const
asssetIdsAndDirIds
=
[];
(
assets
||
[]).
forEach
(
asset
=>
{
if
(
checkedKeys
.
indexOf
(
asset
.
id
)
!==
-
1
)
{
asssetIdsAndDirIds
.
push
({
dataAssetId
:
asset
.
id
||
''
,
dirId
:
asset
.
dirId
||
''
});
}
})
let
payload
=
{
data
:
asssetIdsAndDirIds
};
dispatch
({
type
:
'assetmanage.unloadDataAssets'
,
payload
,
callback
:
()
=>
{
showMessage
(
"success"
,
"删除成功"
);
getDataAssets
();
setCheckedKeys
([]);
}
})
}
const
onAssetDeleteModalDeleteAll
=
()
=>
{
setAssetDeleteModalVisible
(
false
);
let
payload
=
{
data
:
checkedKeys
};
dispatch
({
type
:
'assetmanage.unloadDataAssetsFromAllDirs'
,
payload
,
callback
:
()
=>
{
showMessage
(
"success"
,
"删除成功"
);
getDataAssets
();
setCheckedKeys
([]);
}
})
}
const
recoveryAssets
=
()
=>
{
if
((
checkedKeys
||
[]).
length
>
0
)
{
modal
.
confirm
({
...
...
@@ -902,6 +941,12 @@ const AssetTable = (props) => {
visible=
{
assetDetailDrawerVisible
}
onCancel=
{
onAssetDetailDrawerCancel
}
/>
<
AssetDeleteModal
visible=
{
assetDeleteModalVisible
}
onCancel=
{
onAssetDeleteModalCancel
}
onDelete=
{
onAssetDeleteModalDelete
}
onDeleteAll=
{
onAssetDeleteModalDeleteAll
}
/>
<
RcMenu
id=
{
MENU_ID
}
>
{
(
contextMenuItem
.
resourceState
===
'notRelatedAsset'
)
&&
<
RcItem
id=
"uncombed"
onClick=
{
handleItemClick
}
>
...
...
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