|
|
@@ -1,11 +1,12 @@
|
|
|
-import React, { useState, useEffect } from 'react';
|
|
|
+import React, { useState, useEffect, useMemo } from 'react';
|
|
|
import { useModel, useLocation, useIntl, history } from 'umi';
|
|
|
import styles from './index.less';
|
|
|
import { MenuFoldOutlined, SmileOutlined } from '@ant-design/icons';
|
|
|
import Icon from '@/tenants-ui/SgIcon';
|
|
|
|
|
|
-import { Drawer, notification, Dropdown, Menu } from 'antd';
|
|
|
+import { Drawer, notification, Dropdown, Menu, Select } from 'antd';
|
|
|
import NavMenu from '@/sagacare_components/navMenu';
|
|
|
+import { projectObj } from '@/config/api.js';
|
|
|
|
|
|
export default (props) => {
|
|
|
const { menuVisible, closeMenu, toggleMenu } = useModel('controller');
|
|
|
@@ -105,15 +106,47 @@ export default (props) => {
|
|
|
console.log('location', location);
|
|
|
}, [location]);
|
|
|
|
|
|
+ const [selProject, setSelProject] = useState('');
|
|
|
+
|
|
|
+ const changProjectHandle = (item) => {
|
|
|
+ //debugger;
|
|
|
+ setSelProject(item);
|
|
|
+ setInitialState((s) => {
|
|
|
+ return { ...s, projectId: item };
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const projectList = useMemo(() => {
|
|
|
+ //debugger;
|
|
|
+ setSelProject(initialState?.projectId || '');
|
|
|
+ var projects = initialState?.currentUser?.projects || [];
|
|
|
+ var projects2 = projects.map((item) => {
|
|
|
+ return { label: item.localName, value: item.id };
|
|
|
+ });
|
|
|
+
|
|
|
+ return projects2;
|
|
|
+ }, [initialState?.currentUser]);
|
|
|
+
|
|
|
return (
|
|
|
<div className={styles.layout}>
|
|
|
<div className={styles.header}>
|
|
|
- <div className={styles.title}>之江项目</div>
|
|
|
+ <div className={styles.title}>
|
|
|
+ <Select
|
|
|
+ options={projectList}
|
|
|
+ placeholder="项目"
|
|
|
+ value={selProject}
|
|
|
+ onChange={changProjectHandle}
|
|
|
+ size="large"
|
|
|
+ dropdownMatchSelectWidth={true}
|
|
|
+ style={{ width: '100%' }}
|
|
|
+ bordered={false}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
<div className={styles.right}>
|
|
|
<div className={styles.picture}>
|
|
|
<Dropdown
|
|
|
trigger="click"
|
|
|
- overlay={
|
|
|
+ menu={
|
|
|
<Menu
|
|
|
style={{ width: 80 }}
|
|
|
onClick={({ key }) => {
|
|
|
@@ -151,7 +184,7 @@ export default (props) => {
|
|
|
placement="right"
|
|
|
closable={false}
|
|
|
onClose={closeMenu}
|
|
|
- visible={menuVisible}
|
|
|
+ open={menuVisible}
|
|
|
drawerStyle={
|
|
|
{
|
|
|
// height: 340,
|