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
{
PlusOutlined
,
ImportOutlined
,
ExportOutlined
,
ReloadOutlined
,
SettingOutlined
}
from
'@ant-design/icons'
;
import
classNames
from
'classnames'
;
...
...
@@ -8,9 +8,10 @@ import { dispatch } from '../../../../model';
import
ImportDirectory
from
'./ImportDirectory'
;
import
UpdateDirectoryModal
from
'./UpdateDirectoryModal'
;
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
{
highlightSearchContentByTerms
}
from
'../../../../util'
;
import
PermissionRcItem
from
'../../../../util/Component/PermissionRcItem'
;
import
'./AssetManageTree.less'
;
import
'react-contexify/dist/ReactContexify.css'
;
...
...
@@ -61,6 +62,7 @@ const AssetManageTree = (props) => {
const
[
customDirectoryAction
,
setCustomDirectoryAction
]
=
useState
(
''
);
const
[
options
,
setOptions
]
=
useState
([]);
const
[
loadedKeys
,
setLoadedKeys
]
=
useState
([]);
const
[
permissions
,
setPermissions
]
=
useState
([]);
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
...
...
@@ -72,6 +74,7 @@ const AssetManageTree = (props) => {
const
dataListRef
=
useRef
([]);
useEffect
(()
=>
{
getPermissions
();
window
?.
addEventListener
(
"storage"
,
storageChange
);
return
()
=>
{
...
...
@@ -106,6 +109,10 @@ const AssetManageTree = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
centerId
])
const
havePermission
=
useMemo
(()
=>
{
return
(
permissions
||
[]).
findIndex
(
item
=>
item
===
'dirManage'
)
!==
-
1
},
[
permissions
])
const
storageChange
=
(
e
)
=>
{
if
(
e
.
key
===
'assetDirChangeEvent'
||
e
.
key
===
'assetPathOnClickEvent'
)
{
if
((
e
.
dirId
||
''
)
!==
''
)
{
...
...
@@ -116,6 +123,18 @@ const AssetManageTree = (props) => {
}
}
const
getPermissions
=
()
=>
{
dispatch
({
type
:
'assetmanage.getPrivilegeByRange'
,
payload
:
{
range
:
getAssetRange
(
reference
),
},
callback
:
data
=>
{
setPermissions
(
data
);
}
});
}
const
getDataAssetLocationThenGetTreeData
=
()
=>
{
setLoading
(
true
);
dispatch
({
...
...
@@ -362,7 +381,7 @@ const AssetManageTree = (props) => {
}
const
addDir
=
()
=>
{
if
(
currentDirType
===
'custom'
)
return
;
if
(
!
havePermission
||
currentDirType
===
'custom'
)
return
;
setUpdateDirectoryAction
(
'add'
);
setUpdateDirectoryModalVisible
(
true
);
...
...
@@ -388,7 +407,7 @@ const AssetManageTree = (props) => {
}
const
importDir
=
()
=>
{
if
(
currentDirType
===
'custom'
)
return
;
if
(
!
havePermission
||
currentDirType
===
'custom'
)
return
;
setImportDirectoryVisible
(
true
);
}
...
...
@@ -461,6 +480,8 @@ const AssetManageTree = (props) => {
}
const
customDir
=
()
=>
{
if
(
!
havePermission
)
return
;
setCustomDirectoryAction
(
'add'
);
setCustomDirectoryModalVisible
(
true
);
}
...
...
@@ -684,22 +705,22 @@ const AssetManageTree = (props) => {
justifyContent
:
'space-around'
,
}
}
>
<
Tooltip
title=
"新增目录"
>
<
PlusOutlined
className=
{
(
currentDirType
===
'custom'
)?
'disable'
:
'default'
}
onClick=
{
addDir
}
style=
{
{
fontSize
:
16
,
cursor
:
(
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
<
Tooltip
title=
{
havePermission
?
"新增目录"
:
"暂无权限"
}
>
<
PlusOutlined
className=
{
(
!
havePermission
||
currentDirType
===
'custom'
)?
'disable'
:
'default'
}
onClick=
{
addDir
}
style=
{
{
fontSize
:
16
,
cursor
:
(
!
havePermission
||
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"刷新目录"
>
<
ReloadOutlined
className=
'default'
onClick=
{
refreshTree
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
</
Tooltip
>
<
Tooltip
title=
"导入目录"
>
<
ImportOutlined
className=
{
(
currentDirType
===
'custom'
)?
'disable'
:
'default'
}
onClick=
{
importDir
}
style=
{
{
fontSize
:
16
,
cursor
:(
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
<
Tooltip
title=
{
havePermission
?
"导入目录"
:
"暂无权限"
}
>
<
ImportOutlined
className=
{
(
!
havePermission
||
currentDirType
===
'custom'
)?
'disable'
:
'default'
}
onClick=
{
importDir
}
style=
{
{
fontSize
:
16
,
cursor
:(
!
havePermission
||
currentDirType
===
'custom'
)?
'not-allowed'
:
'pointer'
}
}
/>
</
Tooltip
>
<
Dropdown
overlay=
{
exportMenu
}
placement=
"bottomCenter"
>
<
Tooltip
title=
"导出目录"
>
<
ExportOutlined
className=
'default'
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
<
Dropdown
overlay=
{
havePermission
?
exportMenu
:<></>
}
placement=
"bottomCenter"
>
<
Tooltip
title=
{
havePermission
?
"导出目录"
:
"暂无权限"
}
>
<
ExportOutlined
className=
{
(
!
havePermission
)?
'disable'
:
'default'
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
,
cursor
:(
!
havePermission
)?
'not-allowed'
:
'pointer'
}
}
/>
</
Tooltip
>
</
Dropdown
>
<
Tooltip
title=
"自定义目录"
>
<
SettingOutlined
className=
'default'
onClick=
{
customDir
}
style=
{
{
fontSize
:
16
,
cursor
:
'pointer'
}
}
/>
<
Tooltip
title=
{
havePermission
?
"自定义目录"
:
"暂无权限"
}
>
<
SettingOutlined
className=
{
(
!
havePermission
)?
'disable'
:
'default'
}
onClick=
{
customDir
}
style=
{
{
fontSize
:
16
,
cursor
:(
!
havePermission
)?
'not-allowed'
:
'pointer'
}
}
/>
</
Tooltip
>
</
div
>
)
}
...
...
@@ -774,20 +795,36 @@ const AssetManageTree = (props) => {
{
(
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
)?
'修改栏目'
:
'修改目录'
}
</
RcItem
>
</
Permission
RcItem
>
}
<
RcItem
id=
"up"
onClick=
{
()
=>
{
moveNode
(
1
);
}
}
>
<
PermissionRcItem
id=
"up"
onClick=
{
()
=>
{
moveNode
(
1
);
}
}
defaultPermission=
{
havePermission
}
>
{
(
currentRightClickDir
.
level
===
1
)?
'上移栏目'
:
'上移目录'
}
</
RcItem
>
<
RcItem
id=
"down"
onClick=
{
()
=>
{
moveNode
(
-
1
);
}
}
>
</
PermissionRcItem
>
<
PermissionRcItem
id=
"down"
onClick=
{
()
=>
{
moveNode
(
-
1
);
}
}
defaultPermission=
{
havePermission
}
>
{
(
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
)?
'删除栏目'
:
'删除目录'
}
</
RcItem
>
</
Permission
RcItem
>
}
</
RcMenu
>
}
...
...
src/view/Manage/Model/Component/ImportAction.jsx
View file @
e3f1510c
...
...
@@ -541,42 +541,48 @@ const ImportAction = React.forwardRef((props, ref) => {
return (
<Spin spinning={loading}>
<ImportActionHeader
form={form}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherited'}
modelerData={modelerData||{}}
constraints={constraints}
templates={templates}
validateReports={validateReports}
onTemplateChange={onTemplateChange}
onConstraintChange={onConstraintChange}
onChange={onHeaderChange}
terms={terms}
supportedPartitionTypes={supportedPartitionTypes}
/>
<ImportActionInherited modelerData={modelerData} action={action} />
<ImportActionTable
modelerData={modelerData||{}}
constraint={constraint}
template={template}
validateReports={validateReports}
supportedDatatypes={supportedDatatypes}
onChange={onTableChange}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherited'}
action={action}
originAction={getQueryParam(Action, props?.location?.search)}
terms={terms}
/>
<ImportActionIndex
modelerData={modelerData||{}}
constraint={constraint}
template={template}
types={supportedIndextypes}
validateReports={validateReports}
onChange={onIndexChange}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherited'}
terms={terms}
/>
{
(action==='detail' && ((modelerData||{}).optionList||[]).findIndex(item => item.enabled && item.name==='查看') === -1) ? <span>
暂无权限
</span> : <React.Fragment>
<ImportActionHeader
form={form}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherited'}
modelerData={modelerData||{}}
constraints={constraints}
templates={templates}
validateReports={validateReports}
onTemplateChange={onTemplateChange}
onConstraintChange={onConstraintChange}
onChange={onHeaderChange}
terms={terms}
supportedPartitionTypes={supportedPartitionTypes}
/>
<ImportActionInherited modelerData={modelerData} action={action} />
<ImportActionTable
modelerData={modelerData||{}}
constraint={constraint}
template={template}
validateReports={validateReports}
supportedDatatypes={supportedDatatypes}
onChange={onTableChange}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherited'}
action={action}
originAction={getQueryParam(Action, props?.location?.search)}
terms={terms}
/>
<ImportActionIndex
modelerData={modelerData||{}}
constraint={constraint}
template={template}
types={supportedIndextypes}
validateReports={validateReports}
onChange={onIndexChange}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherited'}
terms={terms}
/>
</React.Fragment>
}
</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