Merge remote-tracking branch 'origin/main'
commit
2e9d9f6b43
|
@ -13,7 +13,6 @@ const {Title} = Typography;
|
|||
const {Header, Content, Footer, Sider} = Layout;
|
||||
|
||||
|
||||
|
||||
function HeaderBar(props: any) {
|
||||
const {
|
||||
token: {colorBgContainer, colorPrimary},
|
||||
|
@ -69,8 +68,7 @@ function HeaderBar(props: any) {
|
|||
|
||||
const departmentToString = (staff: Staff) => {
|
||||
let result = staff.managingDepartment === null ? '' : staff.managingDepartment.departmentName + '主管'
|
||||
for(const department of staff.staffDepartments)
|
||||
{
|
||||
for (const department of staff.staffDepartments) {
|
||||
result += ' ' + department.departmentName
|
||||
}
|
||||
return result
|
||||
|
@ -106,6 +104,9 @@ function HeaderBar(props: any) {
|
|||
|
||||
function MyMenu(props: any) {
|
||||
console.log(props)
|
||||
if (props.defaultSelectedKeys[0] === '')
|
||||
return null
|
||||
else
|
||||
return (
|
||||
<Menu
|
||||
mode="inline"
|
||||
|
@ -155,11 +156,11 @@ function HomeView() {
|
|||
})
|
||||
|
||||
const [menuItems, setMenuItems] = useState(items.slice(0, 2))
|
||||
const [defaultSelectedKeys, setDefaultSelectedKeys] = useState(['/invoice/mine'])
|
||||
const [defaultSelectedKeys, setDefaultSelectedKeys] = useState([''])
|
||||
|
||||
const getStaffInfo = () => {
|
||||
axiosInstance({
|
||||
url: 'staff',
|
||||
url: 'common/staff',
|
||||
method: 'get'
|
||||
}).then(response => {
|
||||
console.log(response.data)
|
||||
|
@ -167,21 +168,18 @@ function HomeView() {
|
|||
setStaff(response.data)
|
||||
if (location.pathname === '/')
|
||||
navigate('/invoice/mine')
|
||||
setDefaultSelectedKeys([location.pathname])
|
||||
if(staff.managingDepartment)
|
||||
{
|
||||
|
||||
if (staff.managingDepartment) {
|
||||
// @ts-ignore
|
||||
if(staff.managingDepartment.departmentId===1)
|
||||
{
|
||||
if (staff.managingDepartment.departmentId === 1) {
|
||||
setMenuItems(items)
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
setMenuItems(items.slice(0, 4))
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setMenuItems(items.slice(0, 2))
|
||||
}
|
||||
setDefaultSelectedKeys([location.pathname])
|
||||
|
||||
}).catch(function (error) {
|
||||
console.log(error)
|
||||
|
|
Loading…
Reference in New Issue