Commit 9661257b by zhaochengxiang

链接跳转菜单权限判断

parent f7ba234c
......@@ -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
......@@ -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);
}
......
......@@ -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>
);
......
......@@ -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}&timestamp=${timestamp}`);
if (checkMenuAdmit('datastandard')) {
window.open(`/center-home/menu/datastandard?id=${id}&timestamp=${timestamp}`);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment