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
9661257b
Commit
9661257b
authored
Jul 17, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
链接跳转菜单权限判断
parent
f7ba234c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
7 deletions
+66
-7
index.js
src/util/index.js
+48
-0
RelationContainer.jsx
src/view/Manage/AssetBrowse/Component/RelationContainer.jsx
+4
-1
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+10
-4
SuggestTable.jsx
src/view/Manage/Model/Component/SuggestTable.jsx
+4
-2
No files found.
src/util/index.js
View file @
9661257b
...
...
@@ -3,6 +3,7 @@ import { message, notification, Modal, Space, Button } from 'antd';
import
{
Redirect
}
from
'react-router-dom'
;
import
{
ExclamationCircleOutlined
}
from
'@ant-design/icons'
;
import
{
Subject
}
from
'rxjs'
;
import
LocalStorage
from
'local-storage'
;
import
{
dispatchLatest
,
action
}
from
'../model'
;
import
{
set_sess_state
}
from
"../model/reducer"
;
...
...
@@ -410,4 +411,50 @@ export function getAssetRange(menuName) {
return
'dataAsset_unloadDataAsset'
;
}
return
''
;
}
export
function
checkMenuAdmit
(
menuinfo
)
{
const
menu
=
LocalStorage
.
get
(
'menu'
);
const
menuadmit
=
LocalStorage
.
get
(
'menuadmit'
);
if
(
!
menu
||
!
menuadmit
)
{
return
false
;
}
let
queryurl
=
`/view/
${
menuinfo
}
`
let
menumessage
=
menu
.
mapurl
[
queryurl
]
if
(
menumessage
)
{
let
type
=
menumessage
.
id
.
split
(
"-"
)
let
key
=
""
if
(
type
[
0
]
!==
"item"
)
{
key
=
"sub-"
+
type
[
0
]
}
if
(
key
)
{
try
{
let
parent
=
menu
.
parentIdMap
[
key
]
||
''
let
totalbit
=
menuadmit
[
parent
.
name
];
if
(
!
parent
.
hidden
){
if
((
menumessage
.
bit
&
totalbit
)
===
menumessage
.
bit
){
return
true
}
else
{
showNotifaction
(
'提示'
,
`暂无访问路由
${
menuinfo
}
的权限`
);
return
false
}
}
else
{
showNotifaction
(
'提示'
,
`暂无访问路由
${
menuinfo
}
的权限`
);
return
false
;
}
}
catch
(
error
)
{
showNotifaction
(
'提示'
,
`暂无访问路由
${
menuinfo
}
的权限`
);
return
false
;
}
}
else
{
showNotifaction
(
'提示'
,
`暂无访问路由
${
menuinfo
}
的权限`
);
return
false
}
}
return
false
;
}
\ No newline at end of file
src/view/Manage/AssetBrowse/Component/RelationContainer.jsx
View file @
9661257b
...
...
@@ -5,6 +5,7 @@ import { dispatch } from '../../../../model';
import
Relation
from
'./Relation'
;
import
Thermodynamic
from
'./Thermodynamic'
;
import
{
AssetBrowseReference
,
ResourceBrowseReference
}
from
'../../../../util/constant'
;
import
{
checkMenuAdmit
}
from
'../../../../util'
;
const
relationTypes
=
[
{
...
...
@@ -263,7 +264,9 @@ const RelationContainer = (props) => {
const
onTypeChange
=
(
e
)
=>
{
if
(
e
.
target
.
value
===
'map'
)
{
window
?.
open
(
'/center-home/menu/asset-map'
);
if
(
checkMenuAdmit
(
'asset-map'
))
{
window
?.
open
(
'/center-home/menu/asset-map'
);
}
}
else
{
setType
(
e
.
target
.
value
);
}
...
...
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
9661257b
...
...
@@ -4,7 +4,7 @@ import { DownOutlined, UpOutlined } from '@ant-design/icons';
import
MetadataInfo
from
'./MetadataInfo'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
highlightSearchContentByTerms
,
showMessage
,
getAssetRange
}
from
'../../../../util'
;
import
{
highlightSearchContentByTerms
,
showMessage
,
getAssetRange
,
checkMenuAdmit
}
from
'../../../../util'
;
import
{
AppContext
}
from
'../../../../App'
;
import
Tag
from
'../../Tag'
;
import
Separate
from
'./Separate'
;
...
...
@@ -230,9 +230,13 @@ const AssetAction = (props) => {
const timestamp = new Date().getTime();
if (relation.resourceType==='innerSource'||relation.resourceType==='outerSource') {
window.open(`
/
center
-
home
/
menu
/
asset
-
resource
-
browse
?
$
{
AnchorId
}
=
$
{
relation
?.
dataAssetId
}
&
$
{
AnchorDirId
}
=
$
{
relation
?.
dirId
}
&
timestamp
=
$
{
timestamp
}
`);
if (checkMenuAdmit('asset-resource-browse')) {
window.open(`
/
center
-
home
/
menu
/
asset
-
resource
-
browse
?
$
{
AnchorId
}
=
$
{
relation
?.
dataAssetId
}
&
$
{
AnchorDirId
}
=
$
{
relation
?.
dirId
}
&
timestamp
=
$
{
timestamp
}
`);
}
} else if (relation.resourceType==='dataAsset') {
window.open(`
/
center
-
home
/
menu
/
asset
-
browse
?
$
{
AnchorId
}
=
$
{
relation
?.
dataAssetId
}
&
$
{
AnchorDirId
}
=
$
{
relation
?.
dirId
}
&
timestamp
=
$
{
timestamp
}
`);
if (checkMenuAdmit('asset-browse')) {
window.open(`
/
center
-
home
/
menu
/
asset
-
browse
?
$
{
AnchorId
}
=
$
{
relation
?.
dataAssetId
}
&
$
{
AnchorDirId
}
=
$
{
relation
?.
dirId
}
&
timestamp
=
$
{
timestamp
}
`);
}
} else {
showMessage('warn', '资产类型不是资源也不是资产!');
}
...
...
@@ -433,7 +437,9 @@ const AssetAction = (props) => {
{
(assetPaths||[]).map((item, key) => {
return (
<a key={key} onClick={() => { jumpToPath(item); }}>
<a key={key} onClick={() => {
jumpToPath(item);
}}>
<span style={{ color: (item?.dataAssetName===assets.currentPath)?'#f50':'' }}>{item?.dataAssetName||''}</span>
</a>
);
...
...
src/view/Manage/Model/Component/SuggestTable.jsx
View file @
9661257b
...
...
@@ -3,7 +3,7 @@ import { Table, Tooltip, Typography } from 'antd';
import
{
Resizable
}
from
'react-resizable'
;
import
ResizeObserver
from
'rc-resize-observer'
;
import
{
isSzseEnv
}
from
'../../../../util'
;
import
{
checkMenuAdmit
,
isSzseEnv
}
from
'../../../../util'
;
import
{
dispatch
}
from
'../../../../model'
;
import
'./SuggestTable.less'
;
...
...
@@ -183,7 +183,9 @@ const SuggestTable = (props) => {
}
})
}
else
{
window
.
open
(
`/center-home/menu/datastandard?id=
${
id
}
×tamp=
${
timestamp
}
`
);
if
(
checkMenuAdmit
(
'datastandard'
))
{
window
.
open
(
`/center-home/menu/datastandard?id=
${
id
}
×tamp=
${
timestamp
}
`
);
}
}
}
...
...
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