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
ed86c059
Commit
ed86c059
authored
Jun 25, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产权限
parent
e3f1510c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
17 deletions
+51
-17
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+3
-2
AssetDetailDrawer.jsx
src/view/Manage/AssetManage/Component/AssetDetailDrawer.jsx
+2
-2
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+1
-0
AssetTree.jsx
src/view/Manage/AssetManage/Component/AssetTree.jsx
+44
-12
index.jsx
src/view/Manage/AssetManage/index.jsx
+1
-1
No files found.
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
ed86c059
...
@@ -4,7 +4,7 @@ import { DownOutlined, UpOutlined } from '@ant-design/icons';
...
@@ -4,7 +4,7 @@ import { DownOutlined, UpOutlined } from '@ant-design/icons';
import
MetadataInfo
from
'./MetadataInfo'
;
import
MetadataInfo
from
'./MetadataInfo'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
highlightSearchContentByTerms
,
showMessage
}
from
'../../../../util'
;
import
{
highlightSearchContentByTerms
,
showMessage
,
getAssetRange
}
from
'../../../../util'
;
import
{
AppContext
}
from
'../../../../App'
;
import
{
AppContext
}
from
'../../../../App'
;
import
Tag
from
'../../Tag'
;
import
Tag
from
'../../Tag'
;
import
Separate
from
'./Separate'
;
import
Separate
from
'./Separate'
;
...
@@ -15,7 +15,7 @@ import PermissionButton from '../../../../util/Component/PermissionButton';
...
@@ -15,7 +15,7 @@ import PermissionButton from '../../../../util/Component/PermissionButton';
import
{
CancelSvg
,
EditSvg
,
SaveSvg
,
FullScreenSvg
,
CancelFullScreenSvg
}
from
'./AssetSvg'
;
import
{
CancelSvg
,
EditSvg
,
SaveSvg
,
FullScreenSvg
,
CancelFullScreenSvg
}
from
'./AssetSvg'
;
const
AssetAction
=
(
props
)
=>
{
const
AssetAction
=
(
props
)
=>
{
const
{
id
,
dirId
,
action
,
terms
,
onChange
,
readOnly
=
false
,
form
,
onMetadataChange
,
onElementsChange
}
=
props
;
const
{
id
,
dirId
,
action
,
terms
,
onChange
,
readOnly
=
false
,
form
,
onMetadataChange
,
onElementsChange
,
reference
}
=
props
;
const
[
currentAction
,
setCurrentAction
]
=
useState
(
action
);
const
[
currentAction
,
setCurrentAction
]
=
useState
(
action
);
const
[
assetParams
,
setAssetParams
]
=
useState
({
assets
:
{},
attributes
:
[],
attributesFoldMap
:
{}
});
const
[
assetParams
,
setAssetParams
]
=
useState
({
assets
:
{},
attributes
:
[],
attributesFoldMap
:
{}
});
...
@@ -131,6 +131,7 @@ const AssetAction = (props) => {
...
@@ -131,6 +131,7 @@ const AssetAction = (props) => {
dispatch
({
dispatch
({
type
:
'assetmanage.getDataAssetDetail'
,
type
:
'assetmanage.getDataAssetDetail'
,
payload
:
{
payload
:
{
range
:
getAssetRange
(
reference
),
dataAssetId
:
id
,
dataAssetId
:
id
,
dirId
:
dirId
,
dirId
:
dirId
,
checkPermission
:
readOnly
checkPermission
:
readOnly
...
...
src/view/Manage/AssetManage/Component/AssetDetailDrawer.jsx
View file @
ed86c059
...
@@ -4,7 +4,7 @@ import { Drawer, Form } from 'antd';
...
@@ -4,7 +4,7 @@ import { Drawer, Form } from 'antd';
import
AssetAction
from
'./AssetAction'
;
import
AssetAction
from
'./AssetAction'
;
const
AssetDetailDrawer
=
(
props
)
=>
{
const
AssetDetailDrawer
=
(
props
)
=>
{
const
{
onCancel
,
visible
,
id
,
dirId
}
=
props
;
const
{
onCancel
,
visible
,
id
,
dirId
,
reference
}
=
props
;
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
...
@@ -21,7 +21,7 @@ const AssetDetailDrawer = (props) => {
...
@@ -21,7 +21,7 @@ const AssetDetailDrawer = (props) => {
}
}
}
}
>
>
{
{
visible
&&
<
AssetAction
form=
{
form
}
id=
{
id
}
dirId=
{
dirId
}
action=
'detail'
readOnly
/>
visible
&&
<
AssetAction
form=
{
form
}
id=
{
id
}
dirId=
{
dirId
}
action=
'detail'
re
ference=
{
reference
}
re
adOnly
/>
}
}
</
Drawer
>
</
Drawer
>
)
)
...
...
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
ed86c059
...
@@ -1161,6 +1161,7 @@ const AssetTable = (props) => {
...
@@ -1161,6 +1161,7 @@ const AssetTable = (props) => {
<
AssetDetailDrawer
<
AssetDetailDrawer
id=
{
selectItem
?.
id
}
id=
{
selectItem
?.
id
}
dirId=
{
selectItem
?.
dirId
}
dirId=
{
selectItem
?.
dirId
}
reference=
{
reference
}
visible=
{
assetDetailDrawerVisible
}
visible=
{
assetDetailDrawerVisible
}
onCancel=
{
onAssetDetailDrawerCancel
}
onCancel=
{
onAssetDetailDrawerCancel
}
/>
/>
...
...
src/view/Manage/AssetManage/Component/AssetTree.jsx
View file @
ed86c059
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
React
,
{
useEffect
,
useState
,
useRef
,
useMemo
}
from
'react'
;
import
{
Card
,
Spin
,
Tooltip
,
Tree
,
Modal
,
AutoComplete
}
from
'antd'
;
import
{
Card
,
Spin
,
Tooltip
,
Tree
,
Modal
,
AutoComplete
}
from
'antd'
;
import
{
ReloadOutlined
,
SettingOutlined
}
from
'@ant-design/icons'
;
import
{
ReloadOutlined
,
SettingOutlined
}
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
{
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
import
CustomDirectoryModal
from
'./CustomDirectoryModal'
;
import
CustomDirectoryModal
from
'./CustomDirectoryModal'
;
import
{
showMessage
,
getQueryParam
}
from
'../../../../util'
;
import
{
showMessage
,
getQueryParam
,
getAssetRange
}
from
'../../../../util'
;
import
{
AnchorTimestamp
,
AnchorId
,
AssetBrowseReference
,
ResourceBrowseReference
,
AnchorDirId
}
from
'../../../../util/constant'
;
import
{
AnchorTimestamp
,
AnchorId
,
AssetBrowseReference
,
ResourceBrowseReference
,
AnchorDirId
}
from
'../../../../util/constant'
;
import
{
highlightSearchContentByTerms
}
from
'../../../../util'
;
import
{
highlightSearchContentByTerms
}
from
'../../../../util'
;
import
PermissionRcItem
from
'../../../../util/Component/PermissionRcItem'
;
import
'./AssetTree.less'
;
import
'./AssetTree.less'
;
import
'react-contexify/dist/ReactContexify.css'
;
import
'react-contexify/dist/ReactContexify.css'
;
...
@@ -52,6 +53,7 @@ const AssetTree = (props) => {
...
@@ -52,6 +53,7 @@ const AssetTree = (props) => {
const
[
customDirectoryAction
,
setCustomDirectoryAction
]
=
useState
(
''
);
const
[
customDirectoryAction
,
setCustomDirectoryAction
]
=
useState
(
''
);
const
[
options
,
setOptions
]
=
useState
([]);
const
[
options
,
setOptions
]
=
useState
([]);
const
[
loadedKeys
,
setLoadedKeys
]
=
useState
([]);
const
[
loadedKeys
,
setLoadedKeys
]
=
useState
([]);
const
[
permissions
,
setPermissions
]
=
useState
([]);
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
...
@@ -63,12 +65,12 @@ const AssetTree = (props) => {
...
@@ -63,12 +65,12 @@ const AssetTree = (props) => {
const
dataListRef
=
useRef
([]);
const
dataListRef
=
useRef
([]);
useEffect
(()
=>
{
useEffect
(()
=>
{
window
?.
addEventListener
(
"storage"
,
storageChange
);
getPermissions
(
);
window
?.
addEventListener
(
"storage"
,
storageChange
);
return
()
=>
{
return
()
=>
{
window
?.
removeEventListener
(
"storage"
,
storageChange
);
window
?.
removeEventListener
(
"storage"
,
storageChange
);
}
}
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[])
},
[])
...
@@ -97,6 +99,10 @@ const AssetTree = (props) => {
...
@@ -97,6 +99,10 @@ const AssetTree = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
centerId
])
},
[
centerId
])
const
haveCustomPermission
=
useMemo
(()
=>
{
return
(
permissions
||
[]).
findIndex
(
item
=>
item
===
'customDirectory'
)
!==
-
1
},
[
permissions
])
const
storageChange
=
(
e
)
=>
{
const
storageChange
=
(
e
)
=>
{
if
(
e
.
key
===
'assetDirChangeEvent'
)
{
if
(
e
.
key
===
'assetDirChangeEvent'
)
{
if
((
e
.
dirId
||
''
)
!==
''
)
{
if
((
e
.
dirId
||
''
)
!==
''
)
{
...
@@ -107,6 +113,18 @@ const AssetTree = (props) => {
...
@@ -107,6 +113,18 @@ const AssetTree = (props) => {
}
}
}
}
const
getPermissions
=
()
=>
{
dispatch
({
type
:
'assetmanage.getPrivilegeByRange'
,
payload
:
{
range
:
getAssetRange
(
reference
),
},
callback
:
data
=>
{
setPermissions
(
data
);
}
});
}
const
getDataAssetLocationThenGetTreeData
=
()
=>
{
const
getDataAssetLocationThenGetTreeData
=
()
=>
{
setLoading
(
true
);
setLoading
(
true
);
dispatch
({
dispatch
({
...
@@ -392,6 +410,8 @@ const AssetTree = (props) => {
...
@@ -392,6 +410,8 @@ const AssetTree = (props) => {
}
}
const
customDir
=
()
=>
{
const
customDir
=
()
=>
{
if
(
!
haveCustomPermission
)
return
;
setCustomDirectoryAction
(
'add'
);
setCustomDirectoryAction
(
'add'
);
setCustomDirectoryModalVisible
(
true
);
setCustomDirectoryModalVisible
(
true
);
}
}
...
@@ -518,8 +538,8 @@ const AssetTree = (props) => {
...
@@ -518,8 +538,8 @@ const AssetTree = (props) => {
<
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
>
<
Tooltip
title=
"自定义目录"
>
<
Tooltip
title=
{
haveCustomPermission
?
"自定义目录"
:
"暂无权限"
}
>
<
SettingOutlined
className=
'default'
onClick=
{
customDir
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
,
flex
:
1
}
}
/>
<
SettingOutlined
className=
{
(
!
haveCustomPermission
)?
'disable'
:
'default'
}
onClick=
{
customDir
}
style=
{
{
fontSize
:
16
,
cursor
:(
!
haveCustomPermission
)?
'not-allowed'
:
'pointer'
,
flex
:
1
}
}
/>
</
Tooltip
>
</
Tooltip
>
<
div
style=
{
{
flex
:
3
}
}
></
div
>
<
div
style=
{
{
flex
:
3
}
}
></
div
>
</
div
>
</
div
>
...
@@ -581,19 +601,31 @@ const AssetTree = (props) => {
...
@@ -581,19 +601,31 @@ const AssetTree = (props) => {
{
{
<
RcMenu
id=
{
MENU_ID
}
>
<
RcMenu
id=
{
MENU_ID
}
>
{
{
currentRightClickDir
&&
currentRightClickDir
.
level
>
1
&&
currentRightClickDir
.
type
===
'custom'
&&
<
RcItem
id=
"up"
onClick=
{
()
=>
{
moveNode
(
1
);
}
}
>
currentRightClickDir
&&
currentRightClickDir
.
level
>
1
&&
currentRightClickDir
.
type
===
'custom'
&&
<
PermissionRcItem
id=
"up"
onClick=
{
()
=>
{
moveNode
(
1
);
}
}
defaultPermission=
{
haveCustomPermission
}
>
上移目录
上移目录
</
RcItem
>
</
Permission
RcItem
>
}
}
{
{
currentRightClickDir
&&
currentRightClickDir
.
level
>
1
&&
currentRightClickDir
.
type
===
'custom'
&&
<
RcItem
id=
"up"
onClick=
{
()
=>
{
moveNode
(
-
1
);
}
}
>
currentRightClickDir
&&
currentRightClickDir
.
level
>
1
&&
currentRightClickDir
.
type
===
'custom'
&&
<
PermissionRcItem
id=
"up"
onClick=
{
()
=>
{
moveNode
(
-
1
);
}
}
defaultPermission=
{
haveCustomPermission
}
>
下移目录
下移目录
</
RcItem
>
</
Permission
RcItem
>
}
}
{
{
currentRightClickDir
&&
currentRightClickDir
.
level
===
2
&&
currentRightClickDir
.
type
===
'custom'
&&
!
currentRightClickDir
.
adminCreate
&&
<
RcItem
id=
"up"
onClick=
{
deleteDir
}
>
currentRightClickDir
&&
currentRightClickDir
.
level
===
2
&&
currentRightClickDir
.
type
===
'custom'
&&
!
currentRightClickDir
.
adminCreate
&&
<
PermissionRcItem
id=
"up"
onClick=
{
deleteDir
}
defaultPermission=
{
haveCustomPermission
}
>
删除目录
删除目录
</
RcItem
>
</
Permission
RcItem
>
}
}
</
RcMenu
>
</
RcMenu
>
}
}
...
...
src/view/Manage/AssetManage/index.jsx
View file @
ed86c059
...
@@ -98,7 +98,7 @@ const AssetManage = (props) => {
...
@@ -98,7 +98,7 @@ const AssetManage = (props) => {
</
div
>
</
div
>
<
Separate
width=
'15px'
/>
<
Separate
width=
'15px'
/>
<
div
className=
'right'
>
<
div
className=
'right'
>
<
AssetAction
form=
{
form
}
id=
{
assetId
}
dirId=
{
assetDirId
}
action=
'detail'
onChange=
{
onAssetActionChange
}
/>
<
AssetAction
form=
{
form
}
id=
{
assetId
}
dirId=
{
assetDirId
}
action=
'detail'
reference=
{
AssetManageReference
}
onChange=
{
onAssetActionChange
}
/>
</
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