更新版本库
This commit is contained in:
116
src/components/Promenu/index.tsx
Normal file
116
src/components/Promenu/index.tsx
Normal file
@ -0,0 +1,116 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||
import AppBar from '@material-ui/core/AppBar';
|
||||
import Tabs from '@material-ui/core/Tabs';
|
||||
import { PageHeader, Button, message } from 'antd';
|
||||
import { Link,history } from 'umi';
|
||||
import './index.less';
|
||||
import { menuList } from './service/service';
|
||||
import { getSessionUserData } from '@/utils/session';
|
||||
|
||||
let getRandomColor = function(){
|
||||
return '#'+Math.floor(Math.random()*16777215).toString(16);
|
||||
}
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
root: {
|
||||
flexGrow: 1,
|
||||
width: '100%',
|
||||
backgroundColor: theme.palette.background.paper,
|
||||
},
|
||||
}));
|
||||
const Promenu: React.FC<{}> = () => {
|
||||
const classes = useStyles();
|
||||
const [value, setValue] = React.useState(0);
|
||||
const [data, setData] = React.useState<any>([]);
|
||||
const [randerRole, setRanderRole] = React.useState<any>();//角色
|
||||
|
||||
const projectData = sessionStorage.getItem('projectData');
|
||||
const proName = JSON.parse(projectData).projectName;
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
let role = '';
|
||||
setRanderRole(getSessionUserData().roleIds)
|
||||
if(getSessionUserData().roleIds == 'daili') {
|
||||
role ='manager'
|
||||
} else if(getSessionUserData().roleIds == 'gys'){
|
||||
role ='supplier'
|
||||
} else if(getSessionUserData().roleIds == 'zhuanjia') {
|
||||
role ='jury'
|
||||
}
|
||||
|
||||
let projectData = sessionStorage.getItem('projectData');
|
||||
if (projectData != null) {
|
||||
let proId = JSON.parse(projectData).id;
|
||||
const menuListData = { id: proId };
|
||||
menuList(menuListData, role).then(res => {//supplier 供应商 manager 项目经理 jury 评委
|
||||
if(res.code == 200 && res.data != null) {
|
||||
setData(res.data)
|
||||
} else {
|
||||
message.error('无返回数据请联系管理员');
|
||||
}
|
||||
})
|
||||
} else {
|
||||
history.push("/BidManage/Project");
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleChange = (event: React.ChangeEvent<{}>, newValue: number) => {
|
||||
setValue(newValue);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="site-page-header-ghost-wrapper" style={{ background: '#ffffff' }}>
|
||||
<PageHeader
|
||||
title="项目名称"
|
||||
subTitle= {proName}
|
||||
extra={[
|
||||
randerRole == 'gys'? null : <Button onClick={() => sessionStorage.setItem('projectDocumentationData', projectData)}><Link to="/Project/ProjectManage/ProjectManager/ProjectInformationManagement">项目建档</Link></Button>,
|
||||
randerRole == 'gys'? null: <Button key="2"><Link to="/ProjectLayout/Archive/projectArchive">项目归档</Link></Button>,
|
||||
<Button key="1" type="primary">
|
||||
<Link to="/BidManage/Project">返回</Link>
|
||||
</Button>
|
||||
]}
|
||||
>
|
||||
</PageHeader>
|
||||
</div>
|
||||
<div className={classes.root} >
|
||||
<AppBar position="static" color="default" style={{ background: '#ffffff', borderTop: '1px solid #e0e0e0', boxShadow: 'none' }}>
|
||||
<Tabs
|
||||
value={value}
|
||||
onChange={handleChange}
|
||||
variant="scrollable"
|
||||
scrollButtons="on"
|
||||
indicatorColor="primary"
|
||||
textColor="primary"
|
||||
aria-label="scrollable force tabs example"
|
||||
>
|
||||
<div className="bar-base">
|
||||
<p className="link-title"><span></span>首页</p>
|
||||
<div className="link-style">
|
||||
{randerRole=="daili" ? <Link to='/ProjectLayout/Manager/HomePageSectionList'>首页</Link> : null }
|
||||
{randerRole=="gys" ? <Link to='/ProjectLayout/Supplier/HomePageSectionList'>首页</Link> : null }
|
||||
</div>
|
||||
</div>
|
||||
{data != undefined ?
|
||||
data.map((item: any) => (
|
||||
<div className="bar-base" key={item.id}>
|
||||
<p className="link-title"><span style={{backgroundColor: getRandomColor()}}></span>{item.taskName}</p>
|
||||
<div className="link-style" style={{ width: item.funcList.length == 1 ? "100px" : "260px" }}>
|
||||
{item.funcList != undefined ?
|
||||
item.funcList.map((item2: any) => (
|
||||
<a onClick={()=>{history.push(item2.funcUrl)}} key={item2.id}>{item2.funcName}</a>
|
||||
)) : null}
|
||||
</div>
|
||||
</div>
|
||||
)) : null}
|
||||
</Tabs>
|
||||
</AppBar>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Promenu;
|
Reference in New Issue
Block a user