|
@@ -1,13 +1,13 @@
|
|
|
/*
|
|
|
* @Author: your name
|
|
|
* @Date: 2022-01-06 15:25:39
|
|
|
- * @LastEditTime: 2022-03-29 16:31:14
|
|
|
+ * @LastEditTime: 2022-03-30 11:15:54
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
|
* @FilePath: /KC-MiddlePlatform/src/pages/platform/_layout.tsx
|
|
|
*/
|
|
|
|
|
|
-import { IRouteComponentProps, useModel } from 'umi';
|
|
|
+import { IRouteComponentProps, useModel, Helmet } from 'umi';
|
|
|
// import { CrownOutlined, UserOutlined, SmileOutlined } from '@ant-design/icons';
|
|
|
import ProLayout, { PageContainer } from '@ant-design/pro-layout';
|
|
|
import { getPlatformMenu } from '@/service/menu';
|
|
@@ -19,7 +19,8 @@ import { useState } from 'react';
|
|
|
export default function Layout({ children, location, route, history, match, ...rest }: IRouteComponentProps) {
|
|
|
const { initialState, setInitialState } = useModel('@@initialState');
|
|
|
const [openKeys, set_openKeys] = useState<string[]>([]);
|
|
|
-
|
|
|
+ const [selectedKeys, set_selectedKeys] = useState<string[]>([]);
|
|
|
+ // console.log({ children, location, route, history, match});
|
|
|
return (
|
|
|
<ProLayout
|
|
|
style={{
|
|
@@ -28,9 +29,9 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
|
logoStyle={{
|
|
|
display: 'none',
|
|
|
}}
|
|
|
- // location={{
|
|
|
- // pathname: '/platform/setting',
|
|
|
- // }}
|
|
|
+ location={{
|
|
|
+
|
|
|
+ }}
|
|
|
disableContentMargin
|
|
|
menuItemRender={(item, dom) => (
|
|
|
<a
|
|
@@ -43,8 +44,12 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
|
)}
|
|
|
menuProps={{
|
|
|
openKeys: [...openKeys],
|
|
|
- onOpenChange: (openKeys: string[]) => {
|
|
|
- set_openKeys([...openKeys]);
|
|
|
+ selectedKeys: [...selectedKeys],
|
|
|
+ onSelect: ({ key, keyPath, selectedKeys, domEvent }) => {
|
|
|
+ set_selectedKeys(selectedKeys)
|
|
|
+ },
|
|
|
+ onOpenChange: (keys: string[]) => {
|
|
|
+ set_openKeys([...keys]);
|
|
|
},
|
|
|
}}
|
|
|
menu={{
|
|
@@ -58,6 +63,7 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
|
|
|
|
if (menuData.length > 0) {
|
|
|
set_openKeys([menuData[0].key]);
|
|
|
+ set_selectedKeys([menuData[0].key]);
|
|
|
}
|
|
|
|
|
|
const getVFromTree = (data: TreeItemType[], key: string) => {
|
|
@@ -90,7 +96,7 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
|
|
|
|
// return [
|
|
|
// {
|
|
|
- // "path":"/platform/setting",
|
|
|
+ // "path":"/platform",
|
|
|
// "name":"系统设置",
|
|
|
// "softUrl":"/","icon":"",
|
|
|
// "children":[
|
|
@@ -108,20 +114,24 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
|
return [];
|
|
|
},
|
|
|
}}
|
|
|
- onPageChange={(location) => {}}
|
|
|
+ onPageChange={(location) => { }}
|
|
|
layout="side"
|
|
|
headerRender={false}
|
|
|
navTheme="light"
|
|
|
>
|
|
|
+ <Helmet>
|
|
|
+ <title>精益管理中台</title>
|
|
|
+ </Helmet>
|
|
|
<PageContainer
|
|
|
className="kcmpPageContainer"
|
|
|
header={{
|
|
|
- title: '',
|
|
|
+ title:false,
|
|
|
}}
|
|
|
style={{
|
|
|
margin: 0,
|
|
|
}}
|
|
|
>
|
|
|
+
|
|
|
<div className="page" style={{ height: 'calc(100vh - 98px)', overflowY: 'scroll' }}>
|
|
|
{children}
|
|
|
</div>
|