更新了staff接口

main
wuyize 2022-12-30 16:59:38 +08:00
parent 2ad5c124b0
commit 006ce5cf70
1 changed files with 27 additions and 29 deletions

View File

@ -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)