解决财务员工导航菜单不匹配问题

main
wuyize 2023-01-06 15:30:30 +08:00
parent 25f5cf453b
commit df5ee3a3c6
2 changed files with 171 additions and 161 deletions

View File

@ -98,7 +98,7 @@ function HeaderBar(props: any) {
alignItems: 'center',
}}>
<Button type="text" shape="circle">
<BellOutlined />
<BellOutlined/>
</Button>
<Dropdown overlayStyle={{minWidth: '150px'}} menu={{items, onClick}} placement="bottomRight" arrow>
<Button type="text" style={{
@ -246,7 +246,10 @@ function HomeView() {
setMenuItems(items.slice(0, 4))
}
} else {
setMenuItems(items.slice(0, 2))
if (staff.staffDepartments && staff.staffDepartments.find((value, index, obj) => value.departmentId === 1))
setMenuItems(items.slice(0, 5))
else
setMenuItems(items.slice(0, 2))
}
}).catch(function (error) {

View File

@ -100,7 +100,7 @@ function StatView() {
token: {colorBgContainer, colorPrimary, colorSuccess, colorBorder},
} = theme.useToken();
const [selectedTime, setSelectedTime] = useState<Dayjs|null>(null);
const [selectedTime, setSelectedTime] = useState<Dayjs | null>(null);
const [type, setType] = useState<StatType>('month');
const [loading, setLoading] = useState(true)
const [reimbursementAmount, setReimbursementAmount] = useState(0)
@ -151,15 +151,15 @@ function StatView() {
url: 'financial/stats',
method: 'get',
params: {
yearly: type==='year',
yearly: type === 'year',
target: time.format('YYYY-MM-DD')
}
}).then(response => {
const statResponse: StatResponse = response.data
setReimbursementAmount(statResponse.reimbursementAllTotalAmount/100.)
setReimbursementAmount(statResponse.reimbursementAllTotalAmount / 100.)
setReimbursementAmountTrend(
(statResponse.reimbursementAllTotalAmount - statResponse.lastAllTotalAmount) / statResponse.lastAllTotalAmount)
setReimbursementAdditionalAmount(statResponse.reimbursementAdditionalTotalAmount/100.)
setReimbursementAdditionalAmount(statResponse.reimbursementAdditionalTotalAmount / 100.)
setReimbursementAdditionalAmountTrend(
(statResponse.reimbursementAdditionalTotalAmount - statResponse.lastAdditionalTotalAmount) / statResponse.lastAdditionalTotalAmount)
@ -174,7 +174,9 @@ function StatView() {
departmentAmountMap.set(key, new Map<number, number>())
})
let maxTime = 0
for (const temporalDepartmentStat of statResponse.temporalDepartmentStats) {
maxTime = Math.max(maxTime, temporalDepartmentStat.value)
for (const departmentStat of temporalDepartmentStat.departmentStats) {
let valueMap = departmentAmountMap.get(departmentStat.departmentId)
if (valueMap) {
@ -195,10 +197,17 @@ function StatView() {
})
data.push({value: total, name: departmentName})
let valueMapArray = Array.from(valueMap);
let values = []
/* let valueMapArray = Array.from(valueMap);
valueMapArray.sort(function (a, b) {
return a[0] - b[0]
})
})*/
for (let i = 1; i <= maxTime; i++) {
let val = valueMap.get(i)
values.push(val ? val : 0)
}
series.push({
name: departmentName,
@ -208,9 +217,7 @@ function StatView() {
emphasis: {
focus: 'series'
},
data: valueMapArray.map(function ([key, value]) {
return value
})
data: values
})
})
setDepartmentPieData(data)
@ -283,158 +290,158 @@ function StatView() {
}).catch(function (error) {
console.log(error)
})
/* setTimeout(() => {
let statResponse: StatResponse = {
"temporalDepartmentStats": [
{
"value": 4,
"departmentStats": [
{
"departmentId": 1,
"reimbursementAmount": 79
},
{
"departmentId": 2,
"reimbursementAmount": 9
},
{
"departmentId": 3,
"reimbursementAmount": 29
},
{
"departmentId": 4,
"reimbursementAmount": 46
},
{
"departmentId": 5,
"reimbursementAmount": 66
}
]
},
{
"value": 3,
"departmentStats": [
{
"departmentId": 1,
"reimbursementAmount": 79
},
{
"departmentId": 2,
"reimbursementAmount": 9
},
{
"departmentId": 3,
"reimbursementAmount": 29
},
{
"departmentId": 4,
"reimbursementAmount": 46
},
{
"departmentId": 5,
"reimbursementAmount": 66
}
]
},
{
"value": 6,
"departmentStats": [
{
"departmentId": 1,
"reimbursementAmount": 79
},
{
"departmentId": 2,
"reimbursementAmount": 9
},
{
"departmentId": 3,
"reimbursementAmount": 29
},
{
"departmentId": 4,
"reimbursementAmount": 46
},
{
"departmentId": 5,
"reimbursementAmount": 66
}
]
},
{
"value": 13,
"departmentStats": [
{
"departmentId": 1,
"reimbursementAmount": 79
},
{
"departmentId": 2,
"reimbursementAmount": 9
},
{
"departmentId": 3,
"reimbursementAmount": 29
},
{
"departmentId": 4,
"reimbursementAmount": 46
},
{
"departmentId": 5,
"reimbursementAmount": 66
}
]
}
],
"reimbursementAllTotalAmount": 79,
"reimbursementAdditionalTotalAmount": 25,
"lastAllTotalAmount": 7,
"lastAdditionalTotalAmount": 19,
"reimbursementLaunchCount": 86,
"invoiceLaunchCount": 26,
"invoiceKindsStats": [
{
"invoiceKind": 1,
"invoiceLaunchCount": 39
},
{
"invoiceKind": 2,
"invoiceLaunchCount": 39
},
{
"invoiceKind": 3,
"invoiceLaunchCount": 39
},
{
"invoiceKind": 5,
"invoiceLaunchCount": 39
},
{
"invoiceKind": 6,
"invoiceLaunchCount": 39
},
{
"invoiceKind": 7,
"invoiceLaunchCount": 39
},
/* setTimeout(() => {
let statResponse: StatResponse = {
"temporalDepartmentStats": [
{
"value": 4,
"departmentStats": [
{
"departmentId": 1,
"reimbursementAmount": 79
},
{
"departmentId": 2,
"reimbursementAmount": 9
},
{
"departmentId": 3,
"reimbursementAmount": 29
},
{
"departmentId": 4,
"reimbursementAmount": 46
},
{
"departmentId": 5,
"reimbursementAmount": 66
}
]
},
{
"value": 3,
"departmentStats": [
{
"departmentId": 1,
"reimbursementAmount": 79
},
{
"departmentId": 2,
"reimbursementAmount": 9
},
{
"departmentId": 3,
"reimbursementAmount": 29
},
{
"departmentId": 4,
"reimbursementAmount": 46
},
{
"departmentId": 5,
"reimbursementAmount": 66
}
]
},
{
"value": 6,
"departmentStats": [
{
"departmentId": 1,
"reimbursementAmount": 79
},
{
"departmentId": 2,
"reimbursementAmount": 9
},
{
"departmentId": 3,
"reimbursementAmount": 29
},
{
"departmentId": 4,
"reimbursementAmount": 46
},
{
"departmentId": 5,
"reimbursementAmount": 66
}
]
},
{
"value": 13,
"departmentStats": [
{
"departmentId": 1,
"reimbursementAmount": 79
},
{
"departmentId": 2,
"reimbursementAmount": 9
},
{
"departmentId": 3,
"reimbursementAmount": 29
},
{
"departmentId": 4,
"reimbursementAmount": 46
},
{
"departmentId": 5,
"reimbursementAmount": 66
}
]
}
],
"reimbursementAllTotalAmount": 79,
"reimbursementAdditionalTotalAmount": 25,
"lastAllTotalAmount": 7,
"lastAdditionalTotalAmount": 19,
"reimbursementLaunchCount": 86,
"invoiceLaunchCount": 26,
"invoiceKindsStats": [
{
"invoiceKind": 1,
"invoiceLaunchCount": 39
},
{
"invoiceKind": 2,
"invoiceLaunchCount": 39
},
{
"invoiceKind": 3,
"invoiceLaunchCount": 39
},
{
"invoiceKind": 5,
"invoiceLaunchCount": 39
},
{
"invoiceKind": 6,
"invoiceLaunchCount": 39
},
{
"invoiceKind": 7,
"invoiceLaunchCount": 39
},
],
"reimbursementPlaceStats": [
{
"departureName": "青海",
"reimbursementLaunchCount": 80,
"destinationName": "安徽"
},
{
"departureName": "青海",
"reimbursementLaunchCount": 70,
"destinationName": "甘肃"
}
]
}
],
"reimbursementPlaceStats": [
{
"departureName": "青海",
"reimbursementLaunchCount": 80,
"destinationName": "安徽"
},
{
"departureName": "青海",
"reimbursementLaunchCount": 70,
"destinationName": "甘肃"
}
]
}
}, 1000);*/
}, 1000);*/
}).catch(function (error) {
console.log(error)