feat🔫: 单个cls的label pie
This commit is contained in:
parent
d27e2d9aae
commit
c4e66e2e52
|
@ -15,8 +15,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.cards {
|
.cards {
|
||||||
display: flex;
|
display: grid;
|
||||||
flex-direction: row;
|
grid: repeat(2, auto) / auto-flow auto;
|
||||||
justify-content: right;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,10 @@ const Home = () => {
|
||||||
y: number
|
y: number
|
||||||
}[]>([]);
|
}[]>([]);
|
||||||
|
|
||||||
|
// 显示单个cls的饼状图,查看cls内部的label的消费情况,
|
||||||
|
// 这里有一个cls列表
|
||||||
|
const clsesForShow = ["餐饮", "恋爱"]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.home}>
|
<div className={styles.home}>
|
||||||
<div className={styles.total}>
|
<div className={styles.total}>
|
||||||
|
@ -105,6 +109,16 @@ const Home = () => {
|
||||||
data={transformer(billStore.groupByClass(billType))}
|
data={transformer(billStore.groupByClass(billType))}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
|
{
|
||||||
|
clsesForShow.map(cls => {
|
||||||
|
return (<Card>
|
||||||
|
<Pie
|
||||||
|
title={cls}
|
||||||
|
data={transformer(billStore.groupByLabelOfClass(cls))}
|
||||||
|
/>
|
||||||
|
</Card>)
|
||||||
|
})
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<Modal
|
<Modal
|
||||||
visible={isModalOpen}
|
visible={isModalOpen}
|
||||||
|
|
|
@ -43,6 +43,16 @@ export class Bill {
|
||||||
return functions(this._bills)
|
return functions(this._bills)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
groupByLabelOfClass(className: string) {
|
||||||
|
const classFun = R.filter((bill: IBill) => R.of(bill.type).length === 0 || bill.cls === className)
|
||||||
|
const functions = R.compose(
|
||||||
|
R.groupBy((bill: IBill) => bill.label),
|
||||||
|
classFun,
|
||||||
|
)
|
||||||
|
return functions(this._bills)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
get listDailyMoney() {
|
get listDailyMoney() {
|
||||||
return this.groupByDate
|
return this.groupByDate
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user