Merge remote-tracking branch 'origin/main'

main
白封羽 2023-01-06 15:32:26 +08:00
commit 306736c42f
2 changed files with 171 additions and 161 deletions

View File

@ -246,6 +246,9 @@ function HomeView() {
setMenuItems(items.slice(0, 4))
}
} else {
if (staff.staffDepartments && staff.staffDepartments.find((value, index, obj) => value.departmentId === 1))
setMenuItems(items.slice(0, 5))
else
setMenuItems(items.slice(0, 2))
}

View File

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