|
@@ -1,7 +1,7 @@
|
|
/*
|
|
/*
|
|
* @Author: your name
|
|
* @Author: your name
|
|
* @Date: 2022-01-06 15:25:39
|
|
* @Date: 2022-01-06 15:25:39
|
|
- * @LastEditTime: 2023-02-27 15:43:12
|
|
|
|
|
|
+ * @LastEditTime: 2023-03-07 16:28:14
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
* @FilePath: /KC-MiddlePlatform/src/pages/platform/_layout.tsx
|
|
* @FilePath: /KC-MiddlePlatform/src/pages/platform/_layout.tsx
|
|
@@ -29,7 +29,7 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
//const isShowMenu = localStorage.getItem('isChildShowMenu');
|
|
//const isShowMenu = localStorage.getItem('isChildShowMenu');
|
|
// console.log({ children, location, route, history, match});
|
|
// console.log({ children, location, route, history, match});
|
|
|
|
|
|
- const {pathname} = location;
|
|
|
|
|
|
+ const { pathname } = location;
|
|
|
|
|
|
const setEmptyPageContent = async (menuId: Key) => {
|
|
const setEmptyPageContent = async (menuId: Key) => {
|
|
const menuItem = await getSpecifyMenuDetail(menuId);
|
|
const menuItem = await getSpecifyMenuDetail(menuId);
|
|
@@ -47,9 +47,6 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
|
|
|
- // console.log({location});
|
|
|
|
- // console.log(location.query.isEmpty == 'true');
|
|
|
|
-
|
|
|
|
if (location.query.menuId) {
|
|
if (location.query.menuId) {
|
|
setEmptyPageContent(location.query.menuId as string);
|
|
setEmptyPageContent(location.query.menuId as string);
|
|
}
|
|
}
|
|
@@ -57,8 +54,8 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
set_isEmpty(location.query.isEmpty == 'true');
|
|
set_isEmpty(location.query.isEmpty == 'true');
|
|
}, [location]);
|
|
}, [location]);
|
|
|
|
|
|
-
|
|
|
|
- const adjustIframe = ()=>{
|
|
|
|
|
|
+
|
|
|
|
+ const adjustIframe = () => {
|
|
// var ifm:any = document.getElementById("bi_iframe");
|
|
// var ifm:any = document.getElementById("bi_iframe");
|
|
// if(ifm){
|
|
// if(ifm){
|
|
// ifm.height=document.documentElement.clientHeight;
|
|
// ifm.height=document.documentElement.clientHeight;
|
|
@@ -69,7 +66,7 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
//临时演示处理
|
|
//临时演示处理
|
|
|
|
|
|
if (location.pathname == '/platform/costMana') {
|
|
if (location.pathname == '/platform/costMana') {
|
|
- return <iframe id={'bi_iframe'} style={{ width: '100%', height: '100%', border: 'none' }} src="http://112.124.59.133:4000/platformMana/roleManage?hospSign=dOBHdoPmJgPGnMSH" onLoad={()=>adjustIframe()} ></iframe>;
|
|
|
|
|
|
+ return <iframe id={'bi_iframe'} style={{ width: '100%', height: '100%', border: 'none' }} src="http://112.124.59.133:4000/platformMana/roleManage?hospSign=dOBHdoPmJgPGnMSH" onLoad={() => adjustIframe()} ></iframe>;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -86,6 +83,8 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
location={{
|
|
location={{
|
|
|
|
|
|
}}
|
|
}}
|
|
|
|
+ headerContentRender={false}
|
|
|
|
+ headerRender={false}
|
|
siderWidth={isShowPageMenu ? 220 : 0}
|
|
siderWidth={isShowPageMenu ? 220 : 0}
|
|
pageTitleRender={false}
|
|
pageTitleRender={false}
|
|
disableContentMargin
|
|
disableContentMargin
|
|
@@ -105,10 +104,12 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
openKeys: [...openKeys],
|
|
openKeys: [...openKeys],
|
|
selectedKeys: [...selectedKeys],
|
|
selectedKeys: [...selectedKeys],
|
|
onSelect: ({ key, keyPath, selectedKeys, domEvent }) => {
|
|
onSelect: ({ key, keyPath, selectedKeys, domEvent }) => {
|
|
- set_selectedKeys(selectedKeys)
|
|
|
|
|
|
+ set_selectedKeys(selectedKeys);
|
|
|
|
+ localStorage.setItem('selectedKeys', JSON.stringify(selectedKeys));
|
|
},
|
|
},
|
|
onOpenChange: (keys: string[]) => {
|
|
onOpenChange: (keys: string[]) => {
|
|
set_openKeys([...keys]);
|
|
set_openKeys([...keys]);
|
|
|
|
+ localStorage.setItem('openKeys', JSON.stringify(keys));
|
|
},
|
|
},
|
|
}}
|
|
}}
|
|
menu={{
|
|
menu={{
|
|
@@ -118,6 +119,7 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
},
|
|
},
|
|
request: async () => {
|
|
request: async () => {
|
|
|
|
|
|
|
|
+
|
|
if (initialState && initialState.currentSelectedSys) {
|
|
if (initialState && initialState.currentSelectedSys) {
|
|
const { systemId, menuId, path } = initialState.currentSelectedSys;
|
|
const { systemId, menuId, path } = initialState.currentSelectedSys;
|
|
if (systemId || menuId) {
|
|
if (systemId || menuId) {
|
|
@@ -125,7 +127,6 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
const menuData = await getPlatformMenu(systemId || menuId);
|
|
const menuData = await getPlatformMenu(systemId || menuId);
|
|
let homePage: TreeItemType | undefined;
|
|
let homePage: TreeItemType | undefined;
|
|
|
|
|
|
-
|
|
|
|
const getVFromTree = (data: TreeItemType[], key: string) => {
|
|
const getVFromTree = (data: TreeItemType[], key: string) => {
|
|
let result: SpacicalPageParamsType[] = [];
|
|
let result: SpacicalPageParamsType[] = [];
|
|
function looper(data: TreeItemType[], key: string) {
|
|
function looper(data: TreeItemType[], key: string) {
|
|
@@ -151,9 +152,12 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
return result;
|
|
return result;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+
|
|
const _menu = getVFromTree(menuData, 'contentType');
|
|
const _menu = getVFromTree(menuData, 'contentType');
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
setInitialState((t) => ({ ...t, spacicalPageParamsType: _menu }));
|
|
setInitialState((t) => ({ ...t, spacicalPageParamsType: _menu }));
|
|
|
|
|
|
if (homePage) {
|
|
if (homePage) {
|
|
@@ -163,15 +167,30 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
history.push(homePage.path);
|
|
history.push(homePage.path);
|
|
|
|
|
|
} else {
|
|
} else {
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
if (path == '/platform') {
|
|
if (path == '/platform') {
|
|
- if(menuData[0].children&&menuData[0].children.length>0){
|
|
|
|
|
|
|
|
- const childs = menuData[0].children;
|
|
|
|
- set_openKeys([menuData[0].key]);
|
|
|
|
- set_selectedKeys([childs[0].key]);
|
|
|
|
- history.push(`${childs[0].path}`);
|
|
|
|
-
|
|
|
|
|
|
+ const selectedKeys = localStorage.getItem('selectedKeys');
|
|
|
|
+ const openKeys = localStorage.getItem('openKeys');
|
|
|
|
+
|
|
|
|
+ if (selectedKeys&&openKeys) {
|
|
|
|
+ const _selectedKeys = JSON.parse(selectedKeys);
|
|
|
|
+ const _openKeys = JSON.parse(openKeys);
|
|
|
|
+ set_openKeys(_openKeys);
|
|
|
|
+ set_selectedKeys(_selectedKeys);
|
|
|
|
+ } else {
|
|
|
|
+ if (menuData[0].children && menuData[0].children.length > 0) {
|
|
|
|
+
|
|
|
|
+ const childs = menuData[0].children;
|
|
|
|
+ set_openKeys([menuData[0].key]);
|
|
|
|
+ set_selectedKeys([childs[0].key]);
|
|
|
|
+ localStorage.setItem('openKeys',JSON.stringify([menuData[0].key]));
|
|
|
|
+ localStorage.setItem('selectedKeys',JSON.stringify([childs[0].key]));
|
|
|
|
+ history.push(`${childs[0].path}`);
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -194,9 +213,11 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
|
|
|
|
const result = addIcon(menuData);
|
|
const result = addIcon(menuData);
|
|
|
|
|
|
|
|
+
|
|
return [...result];
|
|
return [...result];
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
return [];
|
|
return [];
|
|
}
|
|
}
|
|
@@ -205,7 +226,6 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
}}
|
|
}}
|
|
onPageChange={(location) => { }}
|
|
onPageChange={(location) => { }}
|
|
layout="side"
|
|
layout="side"
|
|
- headerRender={false}
|
|
|
|
navTheme="light"
|
|
navTheme="light"
|
|
>
|
|
>
|
|
{
|
|
{
|
|
@@ -231,7 +251,7 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
<title>精益管理中台</title>
|
|
<title>精益管理中台</title>
|
|
</Helmet>
|
|
</Helmet>
|
|
|
|
|
|
- <div className="page" style={{ height: 'calc(100vh - 98px)', overflowY: 'scroll' }}>
|
|
|
|
|
|
+ <div className="page" style={{ height: 'calc(100vh - 80px)', overflowY: 'scroll' }}>
|
|
{children}
|
|
{children}
|
|
</div>
|
|
</div>
|
|
</PageContainer>
|
|
</PageContainer>
|