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
e3f1510c
Commit
e3f1510c
authored
Jun 25, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产管理权限
parent
a5bc7ad3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
57 deletions
+100
-57
AssetManageTree.jsx
src/view/Manage/AssetManage/Component/AssetManageTree.jsx
+58
-21
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+42
-36
No files found.
src/view/Manage/AssetManage/Component/AssetManageTree.jsx
View file @
e3f1510c
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
React
,
{
useEffect
,
useState
,
useRef
,
useMemo
}
from
'react'
;
import
{
Card
,
Spin
,
Tooltip
,
Tree
,
Dropdown
,
Menu
,
Modal
,
AutoComplete
}
from
'antd'
;
import
{
Card
,
Spin
,
Tooltip
,
Tree
,
Dropdown
,
Menu
,
Modal
,
AutoComplete
}
from
'antd'
;
import
{
PlusOutlined
,
ImportOutlined
,
ExportOutlined
,
ReloadOutlined
,
SettingOutlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
,
ImportOutlined
,
ExportOutlined
,
ReloadOutlined
,
SettingOutlined
}
from
'@ant-design/icons'
;
import
classNames
from
'classnames'
;
import
classNames
from
'classnames'
;
...
@@ -8,9 +8,10 @@ import { dispatch } from '../../../../model';
...
@@ -8,9 +8,10 @@ import { dispatch } from '../../../../model';
import
ImportDirectory
from
'./ImportDirectory'
;
import
ImportDirectory
from
'./ImportDirectory'
;
import
UpdateDirectoryModal
from
'./UpdateDirectoryModal'
;
import
UpdateDirectoryModal
from
'./UpdateDirectoryModal'
;
import
CustomDirectoryModal
from
'./CustomDirectoryModal'
;
import
CustomDirectoryModal
from
'./CustomDirectoryModal'
;
import
{
showMessage
,
getQueryParam
}
from
'../../../../util'
;
import
{
showMessage
,
getQueryParam
,
getAssetRange
}
from
'../../../../util'
;
import
{
AnchorTimestamp
,
AnchorId
,
AssetManageReference
,
AssetBrowseReference
,
ResourceBrowseReference
,
AssetMountReference
,
AnchorDirId
}
from
'../../../../util/constant'
;
import
{
AnchorTimestamp
,
AnchorId
,
AssetManageReference
,
AssetBrowseReference
,
ResourceBrowseReference
,
AssetMountReference
,
AnchorDirId
}
from
'../../../../util/constant'
;
import
{
highlightSearchContentByTerms
}
from
'../../../../util'
;
import
{
highlightSearchContentByTerms
}
from
'../../../../util'
;
import
PermissionRcItem
from
'../../../../util/Component/PermissionRcItem'
;
import
'./AssetManageTree.less'
;
import
'./AssetManageTree.less'
;
import
'react-contexify/dist/ReactContexify.css'
;
import
'react-contexify/dist/ReactContexify.css'
;
...
@@ -61,6 +62,7 @@ const AssetManageTree = (props) => {
...
@@ -61,6 +62,7 @@ const AssetManageTree = (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
();
...
@@ -72,6 +74,7 @@ const AssetManageTree = (props) => {
...
@@ -72,6 +74,7 @@ const AssetManageTree = (props) => {
const
dataListRef
=
useRef
([]);
const
dataListRef
=
useRef
([]);
useEffect
(()
=>
{
useEffect
(()
=>
{
getPermissions
();
window
?.
addEventListener
(
"storage"
,
storageChange
);
window
?.
addEventListener
(
"storage"
,
storageChange
);
return
()
=>
{
return
()
=>
{
...
@@ -106,6 +109,10 @@ const AssetManageTree = (props) => {
...
@@ -106,6 +109,10 @@ const AssetManageTree = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
centerId
])
},
[
centerId
])
const
havePermission
=
useMemo
(()
=>
{
return
(
permissions
||
[]).
findIndex
(
item
=>
item
===
'dirManage'
)
!==
-
1
},
[
permissions
])
const
storageChange
=
(
e
)
=>
{
const
storageChange
=
(
e
)
=>
{
if
(
e
.
key
===
'assetDirChangeEvent'
||
e
.
key
===
'assetPathOnClickEvent'
)
{
if
(
e
.
key
===
'assetDirChangeEvent'
||
e
.
key
===
'assetPathOnClickEvent'
)
{
if
((
e
.
dirId
||
''
)
!==
''
)
{
if
((
e
.
dirId
||
''
)
!==
''
)
{
...
@@ -116,6 +123,18 @@ const AssetManageTree = (props) => {
...
@@ -116,6 +123,18 @@ const AssetManageTree = (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
({
...
@@ -362,7 +381,7 @@ const AssetManageTree = (props) => {
...
@@ -362,7 +381,7 @@ const AssetManageTree = (props) => {
}
}
const
addDir
=
()
=>
{
const
addDir
=
()
=>
{
if
(
currentDirType
===
'custom'
)
return
;
if
(
!
havePermission
||
currentDirType
===
'custom'
)
return
;
setUpdateDirectoryAction
(
'add'
);
setUpdateDirectoryAction
(
'add'
);
setUpdateDirectoryModalVisible
(
true
);
setUpdateDirectoryModalVisible
(
true
);
...
@@ -388,7 +407,7 @@ const AssetManageTree = (props) => {
...
@@ -388,7 +407,7 @@ const AssetManageTree = (props) => {
}
}
const
importDir
=
()
=>
{
const
importDir
=
()
=>
{
if
(
currentDirType
===
'custom'
)
return
;
if
(
!
havePermission
||
currentDirType
===
'custom'
)
return
;
setImportDirectoryVisible
(
true
);
setImportDirectoryVisible
(
true
);
}
}
...
@@ -461,6 +480,8 @@ const AssetManageTree = (props) => {
...
@@ -461,6 +480,8 @@ const AssetManageTree = (props) => {
}
}
const
customDir
=
()
=>
{
const
customDir
=
()
=>
{
if
(
!
havePermission
)
return
;
setCustomDirectoryAction
(
'add'
);
setCustomDirectoryAction
(
'add'
);
setCustomDirectoryModalVisible
(
true
);
setCustomDirectoryModalVisible
(
true
);
}
}
...
@@ -684,22 +705,22 @@ const AssetManageTree = (props) => {
...
@@ -684,22 +705,22 @@ const AssetManageTree = (props) => {
justifyContent
:
'space-around'
,
justifyContent
:
'space-around'
,
}
}
}
}
>
>
<
Tooltip
title=
"新增目录"
>
<
Tooltip
title=
{
havePermission
?
"新增目录"
:
"暂无权限"
}
>
<
PlusOutlined
className=
{
(
currentDirType
===
'custom'
)?
'disable'
:
'default'
}
onClick=
{
addDir
}
style=
{
{
fontSize
:
16
,
cursor
:
(
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
<
PlusOutlined
className=
{
(
!
havePermission
||
currentDirType
===
'custom'
)?
'disable'
:
'default'
}
onClick=
{
addDir
}
style=
{
{
fontSize
:
16
,
cursor
:
(
!
havePermission
||
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
</
Tooltip
>
</
Tooltip
>
<
Tooltip
title=
"刷新目录"
>
<
Tooltip
title=
"刷新目录"
>
<
ReloadOutlined
className=
'default'
onClick=
{
refreshTree
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
<
ReloadOutlined
className=
'default'
onClick=
{
refreshTree
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
</
Tooltip
>
<
Tooltip
title=
"导入目录"
>
<
Tooltip
title=
{
havePermission
?
"导入目录"
:
"暂无权限"
}
>
<
ImportOutlined
className=
{
(
currentDirType
===
'custom'
)?
'disable'
:
'default'
}
onClick=
{
importDir
}
style=
{
{
fontSize
:
16
,
cursor
:(
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
<
ImportOutlined
className=
{
(
!
havePermission
||
currentDirType
===
'custom'
)?
'disable'
:
'default'
}
onClick=
{
importDir
}
style=
{
{
fontSize
:
16
,
cursor
:(
!
havePermission
||
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
</
Tooltip
>
</
Tooltip
>
<
Dropdown
overlay=
{
exportMenu
}
placement=
"bottomCenter"
>
<
Dropdown
overlay=
{
havePermission
?
exportMenu
:<></>
}
placement=
"bottomCenter"
>
<
Tooltip
title=
"导出目录"
>
<
Tooltip
title=
{
havePermission
?
"导出目录"
:
"暂无权限"
}
>
<
ExportOutlined
className=
'default'
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
<
ExportOutlined
className=
{
(
!
havePermission
)?
'disable'
:
'default'
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
,
cursor
:(
!
havePermission
)?
'not-allowed'
:
'pointer'
}
}
/>
</
Tooltip
>
</
Tooltip
>
</
Dropdown
>
</
Dropdown
>
<
Tooltip
title=
"自定义目录"
>
<
Tooltip
title=
{
havePermission
?
"自定义目录"
:
"暂无权限"
}
>
<
SettingOutlined
className=
'default'
onClick=
{
customDir
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
<
SettingOutlined
className=
{
(
!
havePermission
)?
'disable'
:
'default'
}
onClick=
{
customDir
}
style=
{
{
fontSize
:
16
,
cursor
:(
!
havePermission
)?
'not-allowed'
:
'pointer'
}
}
/>
</
Tooltip
>
</
Tooltip
>
</
div
>
</
div
>
)
}
)
}
...
@@ -774,20 +795,36 @@ const AssetManageTree = (props) => {
...
@@ -774,20 +795,36 @@ const AssetManageTree = (props) => {
{
{
(
reference
!==
AssetMountReference
)
&&
<
RcMenu
id=
{
MENU_ID
}
>
(
reference
!==
AssetMountReference
)
&&
<
RcMenu
id=
{
MENU_ID
}
>
{
{
currentRightClickDir
&&
(
currentRightClickDir
.
type
!==
'custom'
)
&&
<
RcItem
id=
"edit"
onClick=
{
editDir
}
>
currentRightClickDir
&&
(
currentRightClickDir
.
type
!==
'custom'
)
&&
<
PermissionRcItem
id=
"edit"
onClick=
{
editDir
}
defaultPermission=
{
havePermission
}
>
{
(
currentRightClickDir
.
level
===
1
)?
'修改栏目'
:
'修改目录'
}
{
(
currentRightClickDir
.
level
===
1
)?
'修改栏目'
:
'修改目录'
}
</
RcItem
>
</
Permission
RcItem
>
}
}
<
RcItem
id=
"up"
onClick=
{
()
=>
{
moveNode
(
1
);
}
}
>
<
PermissionRcItem
id=
"up"
onClick=
{
()
=>
{
moveNode
(
1
);
}
}
defaultPermission=
{
havePermission
}
>
{
(
currentRightClickDir
.
level
===
1
)?
'上移栏目'
:
'上移目录'
}
{
(
currentRightClickDir
.
level
===
1
)?
'上移栏目'
:
'上移目录'
}
</
RcItem
>
</
PermissionRcItem
>
<
RcItem
id=
"down"
onClick=
{
()
=>
{
moveNode
(
-
1
);
}
}
>
<
PermissionRcItem
id=
"down"
onClick=
{
()
=>
{
moveNode
(
-
1
);
}
}
defaultPermission=
{
havePermission
}
>
{
(
currentRightClickDir
.
level
===
1
)?
'下移栏目'
:
'下移目录'
}
{
(
currentRightClickDir
.
level
===
1
)?
'下移栏目'
:
'下移目录'
}
</
RcItem
>
</
Permission
RcItem
>
{
{
currentRightClickDir
&&
(
currentRightClickDir
.
type
!==
'custom'
||
(
currentRightClickDir
.
type
===
'custom'
&&
currentRightClickDir
.
level
===
2
))
&&
<
RcItem
id=
"delete"
onClick=
{
deleteDir
}
>
currentRightClickDir
&&
(
currentRightClickDir
.
type
!==
'custom'
||
(
currentRightClickDir
.
type
===
'custom'
&&
currentRightClickDir
.
level
===
2
))
&&
<
PermissionRcItem
id=
"delete"
onClick=
{
deleteDir
}
defaultPermission=
{
havePermission
}
>
{
(
currentRightClickDir
.
level
===
1
)?
'删除栏目'
:
'删除目录'
}
{
(
currentRightClickDir
.
level
===
1
)?
'删除栏目'
:
'删除目录'
}
</
RcItem
>
</
Permission
RcItem
>
}
}
</
RcMenu
>
</
RcMenu
>
}
}
...
...
src/view/Manage/Model/Component/ImportAction.jsx
View file @
e3f1510c
...
@@ -541,42 +541,48 @@ const ImportAction = React.forwardRef((props, ref) => {
...
@@ -541,42 +541,48 @@ const ImportAction = React.forwardRef((props, ref) => {
return (
return (
<Spin spinning={loading}>
<Spin spinning={loading}>
<ImportActionHeader
{
form={form}
(action==='detail' && ((modelerData||{}).optionList||[]).findIndex(item => item.enabled && item.name==='查看') === -1) ? <span>
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherited'}
暂无权限
modelerData={modelerData||{}}
</span> : <React.Fragment>
constraints={constraints}
<ImportActionHeader
templates={templates}
form={form}
validateReports={validateReports}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherited'}
onTemplateChange={onTemplateChange}
modelerData={modelerData||{}}
onConstraintChange={onConstraintChange}
constraints={constraints}
onChange={onHeaderChange}
templates={templates}
terms={terms}
validateReports={validateReports}
supportedPartitionTypes={supportedPartitionTypes}
onTemplateChange={onTemplateChange}
/>
onConstraintChange={onConstraintChange}
<ImportActionInherited modelerData={modelerData} action={action} />
onChange={onHeaderChange}
<ImportActionTable
terms={terms}
modelerData={modelerData||{}}
supportedPartitionTypes={supportedPartitionTypes}
constraint={constraint}
/>
template={template}
<ImportActionInherited modelerData={modelerData} action={action} />
validateReports={validateReports}
<ImportActionTable
supportedDatatypes={supportedDatatypes}
modelerData={modelerData||{}}
onChange={onTableChange}
constraint={constraint}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherited'}
template={template}
action={action}
validateReports={validateReports}
originAction={getQueryParam(Action, props?.location?.search)}
supportedDatatypes={supportedDatatypes}
terms={terms}
onChange={onTableChange}
/>
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherited'}
<ImportActionIndex
action={action}
modelerData={modelerData||{}}
originAction={getQueryParam(Action, props?.location?.search)}
constraint={constraint}
terms={terms}
template={template}
/>
types={supportedIndextypes}
<ImportActionIndex
validateReports={validateReports}
modelerData={modelerData||{}}
onChange={onIndexChange}
constraint={constraint}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherited'}
template={template}
terms={terms}
types={supportedIndextypes}
/>
validateReports={validateReports}
onChange={onIndexChange}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherited'}
terms={terms}
/>
</React.Fragment>
}
</Spin>
</Spin>
);
);
});
});
...
...
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