Commit 507cedfc authored by 邓晓峰's avatar 邓晓峰

feat: 集成报表菜单

parent 0443c331
......@@ -400,6 +400,7 @@ const BasicLayout = props => {
}, []);
const handlerSecond = (item, index) => {
let current = void 0;
if(item && item.routes) {
setChildrenRoutes(item.routes);
......@@ -415,7 +416,15 @@ const BasicLayout = props => {
window.history.pushState(null, '', `/civbase${current.routes[0].path}`);
} else {
window.history.pushState(null, '', `/civbase${current.path}`);
if(/iframe/.test(current.path)) {
history.push({
pathname:'/iframe',
state: current.params
})
} else {
window.history.pushState(null, '', `/civbase${current.path}`);
}
}
......@@ -434,6 +443,7 @@ const BasicLayout = props => {
}
const handleSelectMenuItem = (item) => {
debugger
setTabActiveKey(item);
if(item.indexOf('web_console') === -1) {
window.history.pushState(null, '', `/civbase${item}`);
......@@ -441,6 +451,7 @@ const BasicLayout = props => {
}
const handlerSelectMenu = ({ item, key, keyPath, domEvent }) => {
debugger
setSelectedKeys([key]);
window.history.pushState(null, '', `/civbase${key}`);
}
......@@ -498,7 +509,7 @@ const BasicLayout = props => {
}
// const logo = props.global && props.global.get('bannerLogo')? window.globalConfig.transformDevAssetsBaseURL(props.global.get('bannerLogo')): defaultSetting.logo;
console.log("children", props.children, props);
return (
<SecurityLayout loading>
{
......@@ -654,6 +665,7 @@ const BasicLayout = props => {
{/*<CreateBaseMap/>*/}
{props.children}
</div>
{props.children}
</PageContainer>
</div>
</div>
......
import React from 'react';
import Iframe from 'react-iframe';
export default props => {
const state = props.location.state || {};
if(!state.linkUrl) {
return null;
}
return (
<Iframe url={`${state.linkUrl}?token=${window.globalConfig.token}`}
width="100%"
height="100%"
id="myId"
frameBorder="0"
className="myClassname"
display="initial"
position="relative"/>
)
}
......@@ -4,6 +4,7 @@ import { dynamic } from '@wisdom-utils/runtime';
import BasicLayout from '../layouts/BasicLayout1';
import UserLayout from '../layouts/UserLayout';
import BootPage from '../pages/bootpage';
import Iframe from '../pages/iframe';
import Login from '../pages/user/login';
import CommonMenu from '../pages/commonMenu';
import NoSecret from '../pages/user/login/noSecret';
......@@ -43,6 +44,10 @@ export const dyRoutes = (routes, layout) => {
component: CommonMenu,
name: '菜单收藏'
},
{
path: '/iframe',
component: Iframe
},
{
path: '/404',
component: dynamic({
......
import { transformURL } from './utils';
import LoadingComponent from '@ant-design/pro-layout/es/PageLoading';
import {
dynamic
} from '@wisdom-utils/runtime';
import { matchPath, Route, Switch} from 'react-router';
import React, { Suspense, Fragment } from 'react';
export const isURL = function(url) {
......@@ -24,6 +27,19 @@ export const guid = function(prefix) {
return prefix + uuid.replace(/-/g, '.') + new Date().getTime();
};
function getParams(pathname) {
let ret = {};
const url = pathname ? pathname : decodeURIComponent(window.location.pathname);
if (url.indexOf('|') > -1) {
const params = url.split('|')[1];
params.split('&').map(item => ret[item.split("=")[0]] = item.split("=")[1])
return ret;
}
return ret;
}
function isAbsoluteURL(url) {
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
};
......@@ -111,6 +127,29 @@ const generRotes = (widgets, parent, level = 0) => {
},
parent,
};
if(/iframe/.test(url)) {
url = url.replace(/\/report/, '');
console.log("url", url);
ret.push({
name: item.label,
level: l,
component: dynamic({ loader: () =>
import ( /* webpackChunkName: "p__[request]" */ `@/pages/${component}.js`), loading: LoadingComponent }),
path: baseURL !== '' ? transformURL(url) : '',
href: url,
target: isURL(url) ? '_blank' : '',
key: guid('panda'),
hideInMenu: item.label === '系统菜单组' ? true: item.hideInMenu,
//l > 3 ? true: item.hideInMenu || false,
alias: item.product || DEFAULT_APPLICATION,
extData: {
...item,
icon,
},
params: getParams(url),
parent,
})
}
ret.push(common);
}
});
......
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