解决财务员工导航菜单不匹配问题
parent
25f5cf453b
commit
df5ee3a3c6
|
@ -98,7 +98,7 @@ function HeaderBar(props: any) {
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
}}>
|
}}>
|
||||||
<Button type="text" shape="circle">
|
<Button type="text" shape="circle">
|
||||||
<BellOutlined />
|
<BellOutlined/>
|
||||||
</Button>
|
</Button>
|
||||||
<Dropdown overlayStyle={{minWidth: '150px'}} menu={{items, onClick}} placement="bottomRight" arrow>
|
<Dropdown overlayStyle={{minWidth: '150px'}} menu={{items, onClick}} placement="bottomRight" arrow>
|
||||||
<Button type="text" style={{
|
<Button type="text" style={{
|
||||||
|
@ -246,6 +246,9 @@ function HomeView() {
|
||||||
setMenuItems(items.slice(0, 4))
|
setMenuItems(items.slice(0, 4))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (staff.staffDepartments && staff.staffDepartments.find((value, index, obj) => value.departmentId === 1))
|
||||||
|
setMenuItems(items.slice(0, 5))
|
||||||
|
else
|
||||||
setMenuItems(items.slice(0, 2))
|
setMenuItems(items.slice(0, 2))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ function StatView() {
|
||||||
token: {colorBgContainer, colorPrimary, colorSuccess, colorBorder},
|
token: {colorBgContainer, colorPrimary, colorSuccess, colorBorder},
|
||||||
} = theme.useToken();
|
} = theme.useToken();
|
||||||
|
|
||||||
const [selectedTime, setSelectedTime] = useState<Dayjs|null>(null);
|
const [selectedTime, setSelectedTime] = useState<Dayjs | null>(null);
|
||||||
const [type, setType] = useState<StatType>('month');
|
const [type, setType] = useState<StatType>('month');
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const [reimbursementAmount, setReimbursementAmount] = useState(0)
|
const [reimbursementAmount, setReimbursementAmount] = useState(0)
|
||||||
|
@ -151,15 +151,15 @@ function StatView() {
|
||||||
url: 'financial/stats',
|
url: 'financial/stats',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: {
|
||||||
yearly: type==='year',
|
yearly: type === 'year',
|
||||||
target: time.format('YYYY-MM-DD')
|
target: time.format('YYYY-MM-DD')
|
||||||
}
|
}
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
const statResponse: StatResponse = response.data
|
const statResponse: StatResponse = response.data
|
||||||
setReimbursementAmount(statResponse.reimbursementAllTotalAmount/100.)
|
setReimbursementAmount(statResponse.reimbursementAllTotalAmount / 100.)
|
||||||
setReimbursementAmountTrend(
|
setReimbursementAmountTrend(
|
||||||
(statResponse.reimbursementAllTotalAmount - statResponse.lastAllTotalAmount) / statResponse.lastAllTotalAmount)
|
(statResponse.reimbursementAllTotalAmount - statResponse.lastAllTotalAmount) / statResponse.lastAllTotalAmount)
|
||||||
setReimbursementAdditionalAmount(statResponse.reimbursementAdditionalTotalAmount/100.)
|
setReimbursementAdditionalAmount(statResponse.reimbursementAdditionalTotalAmount / 100.)
|
||||||
setReimbursementAdditionalAmountTrend(
|
setReimbursementAdditionalAmountTrend(
|
||||||
(statResponse.reimbursementAdditionalTotalAmount - statResponse.lastAdditionalTotalAmount) / statResponse.lastAdditionalTotalAmount)
|
(statResponse.reimbursementAdditionalTotalAmount - statResponse.lastAdditionalTotalAmount) / statResponse.lastAdditionalTotalAmount)
|
||||||
|
|
||||||
|
@ -174,7 +174,9 @@ function StatView() {
|
||||||
departmentAmountMap.set(key, new Map<number, number>())
|
departmentAmountMap.set(key, new Map<number, number>())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let maxTime = 0
|
||||||
for (const temporalDepartmentStat of statResponse.temporalDepartmentStats) {
|
for (const temporalDepartmentStat of statResponse.temporalDepartmentStats) {
|
||||||
|
maxTime = Math.max(maxTime, temporalDepartmentStat.value)
|
||||||
for (const departmentStat of temporalDepartmentStat.departmentStats) {
|
for (const departmentStat of temporalDepartmentStat.departmentStats) {
|
||||||
let valueMap = departmentAmountMap.get(departmentStat.departmentId)
|
let valueMap = departmentAmountMap.get(departmentStat.departmentId)
|
||||||
if (valueMap) {
|
if (valueMap) {
|
||||||
|
@ -195,10 +197,17 @@ function StatView() {
|
||||||
})
|
})
|
||||||
data.push({value: total, name: departmentName})
|
data.push({value: total, name: departmentName})
|
||||||
|
|
||||||
let valueMapArray = Array.from(valueMap);
|
let values = []
|
||||||
|
/* let valueMapArray = Array.from(valueMap);
|
||||||
valueMapArray.sort(function (a, b) {
|
valueMapArray.sort(function (a, b) {
|
||||||
return a[0] - b[0]
|
return a[0] - b[0]
|
||||||
})
|
})*/
|
||||||
|
|
||||||
|
for (let i = 1; i <= maxTime; i++) {
|
||||||
|
let val = valueMap.get(i)
|
||||||
|
values.push(val ? val : 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
series.push({
|
series.push({
|
||||||
name: departmentName,
|
name: departmentName,
|
||||||
|
@ -208,9 +217,7 @@ function StatView() {
|
||||||
emphasis: {
|
emphasis: {
|
||||||
focus: 'series'
|
focus: 'series'
|
||||||
},
|
},
|
||||||
data: valueMapArray.map(function ([key, value]) {
|
data: values
|
||||||
return value
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
setDepartmentPieData(data)
|
setDepartmentPieData(data)
|
||||||
|
|
Loading…
Reference in New Issue