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
a5bc7ad3
Commit
a5bc7ad3
authored
Jun 25, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产权限
parent
1b3775d3
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
35 deletions
+122
-35
assetmanage.js
src/model/assetmanage.js
+7
-2
dataassetmanager.js
src/service/dataassetmanager.js
+7
-2
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+9
-6
AssetDirectory.jsx
src/view/Manage/AssetManage/Component/AssetDirectory.jsx
+57
-16
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+42
-9
No files found.
src/model/assetmanage.js
View file @
a5bc7ad3
...
@@ -221,6 +221,10 @@ export function* updateResourceState(payload) {
...
@@ -221,6 +221,10 @@ export function* updateResourceState(payload) {
return
yield
call
(
service
.
updateResourceState
,
payload
);
return
yield
call
(
service
.
updateResourceState
,
payload
);
}
}
export
function
*
getPrivilege
(
payload
)
{
export
function
*
getPrivilegeByRange
(
payload
)
{
return
yield
call
(
service
.
getPrivilege
,
payload
);
return
yield
call
(
service
.
getPrivilegeByRange
,
payload
);
}
export
function
*
getPrivilegeByRangeAndDirId
(
payload
)
{
return
yield
call
(
service
.
getPrivilegeByRangeAndDirId
,
payload
);
}
}
\ No newline at end of file
src/service/dataassetmanager.js
View file @
a5bc7ad3
...
@@ -228,6 +228,10 @@ export function updateResourceState(payload) {
...
@@ -228,6 +228,10 @@ export function updateResourceState(payload) {
return
PostJSON
(
"/dataassetmanager/resourceApi/updateResourceState"
,
payload
);
return
PostJSON
(
"/dataassetmanager/resourceApi/updateResourceState"
,
payload
);
}
}
export
function
getPrivilege
(
payload
)
{
export
function
getPrivilegeByRange
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/AuthorityApi/listAllowButtons"
,
payload
);
return
GetJSON
(
"/dataassetmanager/AuthorityApi/listAllowButtonsByRange"
,
payload
);
}
export
function
getPrivilegeByRangeAndDirId
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/AuthorityApi/listAllowButtonsByRangeAndOptionId"
,
payload
);
}
}
\ No newline at end of file
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
a5bc7ad3
...
@@ -10,6 +10,7 @@ import Tag from '../../Tag';
...
@@ -10,6 +10,7 @@ import Tag from '../../Tag';
import
Separate
from
'./Separate'
;
import
Separate
from
'./Separate'
;
import
AssetTagModal
from
'./AssetTagModal'
;
import
AssetTagModal
from
'./AssetTagModal'
;
import
{
AnchorId
,
AnchorDirId
}
from
'../../../../util/constant'
;
import
{
AnchorId
,
AnchorDirId
}
from
'../../../../util/constant'
;
import
PermissionButton
from
'../../../../util/Component/PermissionButton'
;
import
{
CancelSvg
,
EditSvg
,
SaveSvg
,
FullScreenSvg
,
CancelFullScreenSvg
}
from
'./AssetSvg'
;
import
{
CancelSvg
,
EditSvg
,
SaveSvg
,
FullScreenSvg
,
CancelFullScreenSvg
}
from
'./AssetSvg'
;
...
@@ -387,22 +388,24 @@ const AssetAction = (props) => {
...
@@ -387,22 +388,24 @@ const AssetAction = (props) => {
{
{
((id||'')!=='') && <React.Fragment>
((id||'')!=='') && <React.Fragment>
{
{
(currentAction!=='detail') && <Tooltip title='取消编辑'>
(currentAction!=='detail') && <PermissionButton
<Button
onClick={onCancelButtonClick}
onClick={onCancelButtonClick}
icon={<CancelSvg className='greyIcon' style={{ width: 20, height: 20 }} />}
icon={<CancelSvg className='greyIcon' style={{ width: 20, height: 20 }} />}
type='text'
type='text'
permissionKey='update'
permissions={assets?.allowButtons}
tip='取消编辑'
/>
/>
</Tooltip>
}
}
<Tooltip title={(currentAction==='detail')?'编辑':'保存'}>
<PermissionButton
<Button
loading={confirmLoading}
loading={confirmLoading}
onClick={onActionButtonClick}
onClick={onActionButtonClick}
icon={(currentAction==='detail')?<EditSvg className='greyIcon' style={{ width: 20, height: 20 }} />: <SaveSvg className='greyIcon' style={{ width: 20, height: 20 }} />}
icon={(currentAction==='detail')?<EditSvg className='greyIcon' style={{ width: 20, height: 20 }} />: <SaveSvg className='greyIcon' style={{ width: 20, height: 20 }} />}
type='text'
type='text'
permissionKey='update'
permissions={assets?.allowButtons}
tip={(currentAction==='detail')?'编辑':'保存'}
/>
/>
</Tooltip>
</React.Fragment>
</React.Fragment>
}
}
<Tooltip title={fullScreen?'取消全屏':'全屏'}>
<Tooltip title={fullScreen?'取消全屏':'全屏'}>
...
...
src/view/Manage/AssetManage/Component/AssetDirectory.jsx
View file @
a5bc7ad3
...
@@ -6,10 +6,11 @@ import { AssetBrowseReference, AssetManageReference, ResourceBrowseReference } f
...
@@ -6,10 +6,11 @@ import { AssetBrowseReference, AssetManageReference, ResourceBrowseReference } f
import
ImportElement
from
'./ImportElement'
;
import
ImportElement
from
'./ImportElement'
;
import
AttributeRelationModal
from
"./AttributeRelationModal"
;
import
AttributeRelationModal
from
"./AttributeRelationModal"
;
import
FilterElementModal
from
'./FilterElementModal'
;
import
FilterElementModal
from
'./FilterElementModal'
;
import
{
showNotifaction
}
from
'../../../../util'
;
import
{
showNotifaction
,
getAssetRange
}
from
'../../../../util'
;
import
{
MoreSvg
}
from
'./AssetSvg'
;
import
{
MoreSvg
}
from
'./AssetSvg'
;
import
Separate
from
'./Separate'
;
import
Separate
from
'./Separate'
;
import
record
from
'../Assets/record.png'
;
import
record
from
'../Assets/record.png'
;
import
PermissionMenuItem
from
'../../../../util/Component/PermissionMenuItem'
;
import
'./AssetDirectory.less'
;
import
'./AssetDirectory.less'
;
...
@@ -23,17 +24,17 @@ const AssetDirectory = (props) => {
...
@@ -23,17 +24,17 @@ const AssetDirectory = (props) => {
const
[
attributeRelationModalVisible
,
setAttributeRelationModalVisible
]
=
useState
(
false
);
const
[
attributeRelationModalVisible
,
setAttributeRelationModalVisible
]
=
useState
(
false
);
const
[
filterElementVisible
,
setFilterElementVisible
]
=
useState
(
false
);
const
[
filterElementVisible
,
setFilterElementVisible
]
=
useState
(
false
);
const
[
resourceState
,
setResourceState
]
=
useState
(
null
);
const
[
resourceState
,
setResourceState
]
=
useState
(
null
);
const
[
permissions
,
setPermissions
]
=
useState
([]);
useEffect
(()
=>
{
useEffect
(()
=>
{
getPermissions
();
const
storageChange
=
(
e
)
=>
{
const
storageChange
=
(
e
)
=>
{
if
(
e
.
key
===
'assetResourceChange'
)
{
if
(
e
.
key
===
'assetResourceChange'
)
{
getResourceState
();
getResourceState
();
}
}
}
}
window
?.
addEventListener
(
"storage"
,
storageChange
);
window
?.
addEventListener
(
"storage"
,
storageChange
);
return
()
=>
{
return
()
=>
{
window
?.
removeEventListener
(
"storage"
,
storageChange
);
window
?.
removeEventListener
(
"storage"
,
storageChange
);
}
}
...
@@ -48,6 +49,18 @@ const AssetDirectory = (props) => {
...
@@ -48,6 +49,18 @@ const AssetDirectory = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
id
,
directoryChanged
])
},
[
id
,
directoryChanged
])
const
getPermissions
=
()
=>
{
dispatch
({
type
:
'assetmanage.getPrivilegeByRange'
,
payload
:
{
range
:
getAssetRange
(
reference
),
},
callback
:
data
=>
{
setPermissions
(
data
);
}
});
}
const
getDirectory
=
()
=>
{
const
getDirectory
=
()
=>
{
let
url
=
'assetmanage.getDirectoryById'
;
let
url
=
'assetmanage.getDirectoryById'
;
if
((
reference
===
AssetBrowseReference
||
reference
===
ResourceBrowseReference
)
&&
nodeType
===
'custom'
)
{
if
((
reference
===
AssetBrowseReference
||
reference
===
ResourceBrowseReference
)
&&
nodeType
===
'custom'
)
{
...
@@ -126,28 +139,56 @@ const AssetDirectory = (props) => {
...
@@ -126,28 +139,56 @@ const AssetDirectory = (props) => {
setAttributeRelationModalVisible
(
false
);
setAttributeRelationModalVisible
(
false
);
}
}
const
onMenuClick
=
({
key
})
=>
{
if
(
key
===
'importAttribute'
)
{
onImportElementBtnClick
();
}
else
if
(
key
===
'exportAttribute'
)
{
onExportElementBtnClick
();
}
else
if
(
key
===
'attributeManage'
)
{
onFilterElementClick
();
}
else
if
(
key
===
'attributeRelate'
)
{
onAttributeRelationBtnClick
();
}
}
const
elementManageMenu
=
(
const
elementManageMenu
=
(
<
Menu
>
<
Menu
onClick=
{
onMenuClick
}
>
<
Menu
.
Item
>
<
PermissionMenuItem
<
div
className=
'text-center'
onClick=
{
onImportElementBtnClick
}
>
key=
'importAttribute'
permissionKey=
'importAttribute'
permissions=
{
permissions
}
>
<
div
className=
'text-center'
>
导入资产属性
导入资产属性
</
div
>
</
div
>
</
Menu
.
Item
>
</
PermissionMenuItem
>
<
Menu
.
Item
>
<
PermissionMenuItem
<
div
className=
'text-center'
onClick=
{
onExportElementBtnClick
}
>
key=
'exportAttribute'
permissionKey=
'exportAttribute'
permissions=
{
permissions
}
>
<
div
className=
'text-center'
>
导出资产属性
导出资产属性
</
div
>
</
div
>
</
Menu
.
Item
>
</
PermissionMenuItem
>
<
Menu
.
Item
>
<
PermissionMenuItem
<
div
className=
'text-center'
onClick=
{
onFilterElementClick
}
>
key=
'attributeManage'
permissionKey=
'attributeManage'
permissions=
{
permissions
}
>
<
div
className=
'text-center'
>
资产属性管理
资产属性管理
</
div
>
</
div
>
</
Menu
.
Item
>
</
PermissionMenuItem
>
<
Menu
.
Item
>
<
PermissionMenuItem
<
div
className=
'text-center'
onClick=
{
onAttributeRelationBtnClick
}
>
key=
'attributeRelate'
permissionKey=
'attributeRelate'
permissions=
{
permissions
}
>
<
div
className=
'text-center'
>
资产属性关联
资产属性关联
</
div
>
</
div
>
</
Menu
.
Item
>
</
PermissionMenu
Item
>
</
Menu
>
</
Menu
>
);
);
...
...
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
a5bc7ad3
...
@@ -205,10 +205,11 @@ const AssetTable = (props) => {
...
@@ -205,10 +205,11 @@ const AssetTable = (props) => {
}
else
{
}
else
{
setPagination
({
...
pagination
,
pageNum
:
1
});
setPagination
({
...
pagination
,
pageNum
:
1
});
}
}
}
else
if
(
reference
===
AssetRecycleReference
)
{
getRecyclePermissions
();
}
}
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
nodeId
])
},
[
nodeId
,
reference
])
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -308,7 +309,7 @@ const AssetTable = (props) => {
...
@@ -308,7 +309,7 @@ const AssetTable = (props) => {
const
getPermissions
=
()
=>
{
const
getPermissions
=
()
=>
{
dispatch
({
dispatch
({
type
:
'assetmanage.getPrivilege'
,
type
:
'assetmanage.getPrivilege
ByRangeAndDirId
'
,
payload
:
{
payload
:
{
range
:
getAssetRange
(
reference
),
range
:
getAssetRange
(
reference
),
optionId
:
nodeId
optionId
:
nodeId
...
@@ -319,6 +320,18 @@ const AssetTable = (props) => {
...
@@ -319,6 +320,18 @@ const AssetTable = (props) => {
});
});
}
}
const
getRecyclePermissions
=
()
=>
{
dispatch
({
type
:
'assetmanage.getPrivilegeByRange'
,
payload
:
{
range
:
getAssetRange
(
reference
),
},
callback
:
data
=>
{
setPermissions
(
data
);
}
});
}
const
getDataAssetLocationByRelation
=
()
=>
{
const
getDataAssetLocationByRelation
=
()
=>
{
setLoading
(
true
);
setLoading
(
true
);
dispatch
({
dispatch
({
...
@@ -891,7 +904,7 @@ const AssetTable = (props) => {
...
@@ -891,7 +904,7 @@ const AssetTable = (props) => {
tip=
{
(
checkedKeys
||
[]).
length
===
0
?
'请先选择资产'
:
''
}
tip=
{
(
checkedKeys
||
[]).
length
===
0
?
'请先选择资产'
:
''
}
>
>
<
div
className=
'text-center'
>
<
div
className=
'text-center'
>
{
(
reference
===
AssetRecycleReference
)?
'挂载'
:
'变更目录'
}
变更目录
</
div
>
</
div
>
</
PermissionMenuItem
>
</
PermissionMenuItem
>
{
{
...
@@ -969,18 +982,38 @@ const AssetTable = (props) => {
...
@@ -969,18 +982,38 @@ const AssetTable = (props) => {
{
{
(
reference
===
AssetManageReference
||
reference
===
AssetRecycleReference
)
&&
<
React
.
Fragment
>
(
reference
===
AssetManageReference
||
reference
===
AssetRecycleReference
)
&&
<
React
.
Fragment
>
<
PermissionButton
defaultPermission=
{
canExport
}
onClick=
{
exportAsset
}
>
导出
</
PermissionButton
>
<
PermissionButton
defaultPermission=
{
canExport
}
onClick=
{
exportAsset
}
>
导出
</
PermissionButton
>
<
PermissionButton
{
(
reference
===
AssetManageReference
)
&&
<
PermissionButton
defaultPermission=
{
canChangeDir
}
defaultPermission=
{
canChangeDir
}
tip=
{
(
checkedKeys
||
[]).
length
===
0
?
'请先选择资产'
:
''
}
tip=
{
(
checkedKeys
||
[]).
length
===
0
?
'请先选择资产'
:
''
}
onClick=
{
onBatchCatalogChangeBtnClick
}
onClick=
{
onBatchCatalogChangeBtnClick
}
disabled=
{
(
checkedKeys
||
[]).
length
===
0
}
disabled=
{
(
checkedKeys
||
[]).
length
===
0
}
>
>
{
(
reference
===
AssetRecycleReference
)?
'挂载'
:
'变更目录'
}
变更目录
</
PermissionButton
>
</
PermissionButton
>
}
{
{
(
reference
===
AssetRecycleReference
)
&&
<
Tooltip
title=
{
(
checkedKeys
||
[]).
length
===
0
?
'请先选择资产'
:
''
}
>
(
reference
===
AssetRecycleReference
)
&&
<
PermissionButton
<
Button
onClick=
{
recoveryAssets
}
disabled=
{
(
checkedKeys
||
[]).
length
===
0
}
>
恢复
</
Button
>
onClick=
{
onBatchCatalogChangeBtnClick
}
</
Tooltip
>
disabled=
{
(
checkedKeys
||
[]).
length
===
0
}
permissionKey=
'loadDataAsset'
permissions=
{
permissions
}
tip=
{
(
checkedKeys
||
[]).
length
===
0
?
'请先选择资产'
:
''
}
>
挂载
</
PermissionButton
>
}
{
(
reference
===
AssetRecycleReference
)
&&
<
PermissionButton
onClick=
{
recoveryAssets
}
disabled=
{
(
checkedKeys
||
[]).
length
===
0
}
permissionKey=
'resumeDataAsset'
permissions=
{
permissions
}
tip=
{
(
checkedKeys
||
[]).
length
===
0
?
'请先选择资产'
:
''
}
>
恢复
</
PermissionButton
>
}
}
{
{
//自定义目录下的资产不允许删除
//自定义目录下的资产不允许删除
...
...
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