fix
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 25s
Docker Build & Deploy / Deploy to Production (push) Successful in 18s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 25s
Docker Build & Deploy / Deploy to Production (push) Successful in 18s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
@@ -247,7 +247,7 @@
|
|||||||
|
|
||||||
<div class="category-list">
|
<div class="category-list">
|
||||||
<div
|
<div
|
||||||
v-for="category in incomeCategoriesSimpView"
|
v-for="category in incomeCategoriesView"
|
||||||
:key="category.classify"
|
:key="category.classify"
|
||||||
class="category-item clickable"
|
class="category-item clickable"
|
||||||
@click="goToCategoryBills(category.classify, 1)"
|
@click="goToCategoryBills(category.classify, 1)"
|
||||||
@@ -272,14 +272,6 @@
|
|||||||
class="category-arrow"
|
class="category-arrow"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 展开/收起按钮 -->
|
|
||||||
<div
|
|
||||||
v-if="incomeCategoriesView.length > 1"
|
|
||||||
class="expand-toggle"
|
|
||||||
@click="showAllIncome = !showAllIncome"
|
|
||||||
>
|
|
||||||
<van-icon :name="showAllIncome ? 'arrow-up' : 'arrow-down'" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 不计收支分类统计 -->
|
<!-- 不计收支分类统计 -->
|
||||||
@@ -292,7 +284,7 @@
|
|||||||
不计收支分类统计
|
不计收支分类统计
|
||||||
</h3>
|
</h3>
|
||||||
<van-tag
|
<van-tag
|
||||||
type="info"
|
type="warning"
|
||||||
size="medium"
|
size="medium"
|
||||||
>
|
>
|
||||||
{{ noneCategoriesView.length }}类
|
{{ noneCategoriesView.length }}类
|
||||||
@@ -301,7 +293,7 @@
|
|||||||
|
|
||||||
<div class="category-list">
|
<div class="category-list">
|
||||||
<div
|
<div
|
||||||
v-for="category in noneCategoriesSimpView"
|
v-for="category in noneCategoriesView"
|
||||||
:key="category.classify"
|
:key="category.classify"
|
||||||
class="category-item clickable"
|
class="category-item clickable"
|
||||||
@click="goToCategoryBills(category.classify, 2)"
|
@click="goToCategoryBills(category.classify, 2)"
|
||||||
@@ -326,14 +318,6 @@
|
|||||||
class="category-arrow"
|
class="category-arrow"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 展开/收起按钮 -->
|
|
||||||
<div
|
|
||||||
v-if="noneCategoriesView.length > 1"
|
|
||||||
class="expand-toggle"
|
|
||||||
@click="showAllNone = !showAllNone"
|
|
||||||
>
|
|
||||||
<van-icon :name="showAllNone ? 'arrow-up' : 'arrow-down'" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 其他统计 -->
|
<!-- 其他统计 -->
|
||||||
@@ -464,8 +448,6 @@ const firstLoading = ref(true)
|
|||||||
const refreshing = ref(false)
|
const refreshing = ref(false)
|
||||||
const showMonthPicker = ref(false)
|
const showMonthPicker = ref(false)
|
||||||
const showAllExpense = ref(false)
|
const showAllExpense = ref(false)
|
||||||
const showAllIncome = ref(false)
|
|
||||||
const showAllNone = ref(false)
|
|
||||||
const currentYear = ref(new Date().getFullYear())
|
const currentYear = ref(new Date().getFullYear())
|
||||||
const currentMonth = ref(new Date().getMonth() + 1)
|
const currentMonth = ref(new Date().getMonth() + 1)
|
||||||
const selectedDate = ref([
|
const selectedDate = ref([
|
||||||
@@ -535,21 +517,6 @@ const expenseCategoriesView = computed(() => {
|
|||||||
return list
|
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 incomeCategoriesView = computed(() => {
|
||||||
const list = [...incomeCategories.value]
|
const list = [...incomeCategories.value]
|
||||||
const unclassifiedIndex = list.findIndex((c) => !c.classify)
|
const unclassifiedIndex = list.findIndex((c) => !c.classify)
|
||||||
@@ -561,21 +528,6 @@ const incomeCategoriesView = computed(() => {
|
|||||||
return list
|
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 noneCategoriesView = computed(() => {
|
||||||
const list = [...noneCategories.value]
|
const list = [...noneCategories.value]
|
||||||
const unclassifiedIndex = list.findIndex((c) => !c.classify)
|
const unclassifiedIndex = list.findIndex((c) => !c.classify)
|
||||||
@@ -698,8 +650,6 @@ const changeMonth = (offset) => {
|
|||||||
|
|
||||||
// 重置展开状态
|
// 重置展开状态
|
||||||
showAllExpense.value = false
|
showAllExpense.value = false
|
||||||
showAllIncome.value = false
|
|
||||||
showAllNone.value = false
|
|
||||||
|
|
||||||
fetchStatistics()
|
fetchStatistics()
|
||||||
}
|
}
|
||||||
@@ -725,8 +675,6 @@ const onMonthConfirm = ({ selectedValues }) => {
|
|||||||
|
|
||||||
// 重置展开状态
|
// 重置展开状态
|
||||||
showAllExpense.value = false
|
showAllExpense.value = false
|
||||||
showAllIncome.value = false
|
|
||||||
showAllNone.value = false
|
|
||||||
|
|
||||||
fetchStatistics()
|
fetchStatistics()
|
||||||
}
|
}
|
||||||
@@ -950,18 +898,6 @@ const renderChart = (data) => {
|
|||||||
return accumulatedBalance
|
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 = {
|
const option = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
@@ -1083,29 +1019,12 @@ const renderPieChart = () => {
|
|||||||
// 按照金额排序
|
// 按照金额排序
|
||||||
list.sort((a, b) => b.amount - a.amount)
|
list.sort((a, b) => b.amount - a.amount)
|
||||||
|
|
||||||
if (list.length <= 8) {
|
if (list.length > 0) {
|
||||||
chartData = list.map((item, index) => ({
|
chartData = list.map((item, index) => ({
|
||||||
value: item.amount,
|
value: item.amount,
|
||||||
name: item.classify || '未分类',
|
name: item.classify || '未分类',
|
||||||
itemStyle: { color: colors[index % colors.length] }
|
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 = {
|
const option = {
|
||||||
|
|||||||
Reference in New Issue
Block a user