diff --git a/Web/src/views/StatisticsView.vue b/Web/src/views/StatisticsView.vue
index 87ea9a2..c2dd97c 100644
--- a/Web/src/views/StatisticsView.vue
+++ b/Web/src/views/StatisticsView.vue
@@ -247,7 +247,7 @@
-
-
-
-
@@ -292,7 +284,7 @@
不计收支分类统计
{{ noneCategoriesView.length }}类
@@ -301,7 +293,7 @@
-
-
-
-
@@ -464,8 +448,6 @@ const firstLoading = ref(true)
const refreshing = ref(false)
const showMonthPicker = ref(false)
const showAllExpense = ref(false)
-const showAllIncome = ref(false)
-const showAllNone = ref(false)
const currentYear = ref(new Date().getFullYear())
const currentMonth = ref(new Date().getMonth() + 1)
const selectedDate = ref([
@@ -535,21 +517,6 @@ const expenseCategoriesView = computed(() => {
return list
})
-const incomeCategoriesSimpView = computed(() => {
- const list = incomeCategoriesView.value
-
- if (showAllIncome.value) {
- return list
- }
-
- // 只展示未分类
- const unclassified = list.filter((c) => c.classify === '未分类' || !c.classify)
- if (unclassified.length > 0) {
- return [...unclassified]
- }
- return []
-})
-
const incomeCategoriesView = computed(() => {
const list = [...incomeCategories.value]
const unclassifiedIndex = list.findIndex((c) => !c.classify)
@@ -561,21 +528,6 @@ const incomeCategoriesView = computed(() => {
return list
})
-const noneCategoriesSimpView = computed(() => {
- const list = noneCategoriesView.value
-
- if (showAllNone.value) {
- return list
- }
-
- // 只展示未分类
- const unclassified = list.filter((c) => c.classify === '未分类' || !c.classify)
- if (unclassified.length > 0) {
- return [...unclassified]
- }
- return []
-})
-
const noneCategoriesView = computed(() => {
const list = [...noneCategories.value]
const unclassifiedIndex = list.findIndex((c) => !c.classify)
@@ -698,8 +650,6 @@ const changeMonth = (offset) => {
// 重置展开状态
showAllExpense.value = false
- showAllIncome.value = false
- showAllNone.value = false
fetchStatistics()
}
@@ -725,8 +675,6 @@ const onMonthConfirm = ({ selectedValues }) => {
// 重置展开状态
showAllExpense.value = false
- showAllIncome.value = false
- showAllNone.value = false
fetchStatistics()
}
@@ -950,18 +898,6 @@ const renderChart = (data) => {
return accumulatedBalance
})
- // 计算最大绝对值,用于动态设置Y轴间隔
- const allValues = [...expenses, ...incomes, ...balances]
- const maxValue = Math.max(...allValues.map(Math.abs), 1000)
-
- // 动态计算间隔:目标是大约5-8个刻度
- // 比如最大值是 11k,间隔可以是 2k (11/2 = 5.5)
- // 最大值是 3k,间隔可以是 0.5k 或 1k
- let interval = 1000
- if (maxValue > 8000) {
- interval = Math.ceil(maxValue / 6 / 1000) * 1000
- }
-
const option = {
tooltip: {
trigger: 'axis',
@@ -1083,29 +1019,12 @@ const renderPieChart = () => {
// 按照金额排序
list.sort((a, b) => b.amount - a.amount)
- if (list.length <= 8) {
+ if (list.length > 0) {
chartData = list.map((item, index) => ({
value: item.amount,
name: item.classify || '未分类',
itemStyle: { color: colors[index % colors.length] }
}))
- } else {
- const top = list.slice(0, 7)
- const rest = list.slice(7)
- chartData = top.map((item, index) => ({
- value: item.amount,
- name: item.classify || '未分类',
- itemStyle: { color: colors[index % colors.length] }
- }))
-
- const otherAmount = rest.reduce((s, c) => s + c.amount, 0)
- if (otherAmount > 0) {
- chartData.push({
- value: otherAmount,
- name: '其他',
- itemStyle: { color: '#AAB7B8' }
- })
- }
}
const option = {