测试覆盖率
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 27s
Docker Build & Deploy / Deploy to Production (push) Successful in 9s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 2s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 27s
Docker Build & Deploy / Deploy to Production (push) Successful in 9s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 2s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
This commit is contained in:
@@ -439,7 +439,7 @@ const updateVarianceChart = (chart, budgets) => {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
formatter: (params) => {
|
||||
const item = data[params[0].dataIndex]
|
||||
const item = sortedData[params[0].dataIndex]
|
||||
let html = `${item.name}<br/>`
|
||||
html += `预算: ¥${formatMoney(item.limit)}<br/>`
|
||||
html += `实际: ¥${formatMoney(item.current)}<br/>`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<template>
|
||||
<div class="page-container-flex">
|
||||
<!-- 顶部导航栏 -->
|
||||
<van-nav-bar
|
||||
@@ -9,7 +9,7 @@
|
||||
class="nav-date-picker"
|
||||
@click="showMonthPicker = true"
|
||||
>
|
||||
<span>{{ currentYear }}年{{ currentMonth }}月</span>
|
||||
<span>{{ currentMonth === 0 ? `${currentYear}年` : `${currentYear}年${currentMonth}月` }}</span>
|
||||
<van-icon name="arrow-down" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -265,19 +265,29 @@
|
||||
</div>
|
||||
</van-pull-refresh>
|
||||
|
||||
<!-- 月份选择器 -->
|
||||
<!-- 日期选择器 -->
|
||||
<van-popup
|
||||
v-model:show="showMonthPicker"
|
||||
position="bottom"
|
||||
round
|
||||
teleport="body"
|
||||
>
|
||||
<div class="date-picker-header">
|
||||
<van-tabs
|
||||
v-model:active="dateSelectionMode"
|
||||
line-width="20px"
|
||||
:ellipsis="false"
|
||||
>
|
||||
<van-tab title="按月" name="month" />
|
||||
<van-tab title="按年" name="year" />
|
||||
</van-tabs>
|
||||
</div>
|
||||
<van-date-picker
|
||||
v-model="selectedDate"
|
||||
title="选择月份"
|
||||
:title="dateSelectionMode === 'year' ? '选择年份' : '选择月份'"
|
||||
:min-date="minDate"
|
||||
:max-date="maxDate"
|
||||
:columns-type="['year', 'month']"
|
||||
:columns-type="dateSelectionMode === 'year' ? ['year'] : ['year', 'month']"
|
||||
@confirm="onMonthConfirm"
|
||||
@cancel="showMonthPicker = false"
|
||||
/>
|
||||
@@ -344,6 +354,7 @@ const firstLoading = ref(true)
|
||||
const refreshing = ref(false)
|
||||
const showMonthPicker = ref(false)
|
||||
const showAllExpense = ref(false)
|
||||
const dateSelectionMode = ref('month')
|
||||
const currentYear = ref(new Date().getFullYear())
|
||||
const currentMonth = ref(new Date().getMonth() + 1)
|
||||
const selectedDate = ref([
|
||||
@@ -531,7 +542,7 @@ const onRefresh = async () => {
|
||||
// 确认月份选择
|
||||
const onMonthConfirm = ({ selectedValues }) => {
|
||||
const newYear = parseInt(selectedValues[0])
|
||||
const newMonth = parseInt(selectedValues[1])
|
||||
const newMonth = dateSelectionMode.value === 'year' ? 0 : parseInt(selectedValues[1])
|
||||
|
||||
currentYear.value = newYear
|
||||
currentMonth.value = newMonth
|
||||
@@ -571,7 +582,7 @@ const fetchMonthlyData = async () => {
|
||||
try {
|
||||
const response = await getMonthlyStatistics({
|
||||
year: currentYear.value,
|
||||
month: currentMonth.value
|
||||
month: currentMonth.value || 0
|
||||
})
|
||||
|
||||
if (response.success && response.data) {
|
||||
@@ -589,7 +600,7 @@ const fetchCategoryData = async () => {
|
||||
// 获取支出分类
|
||||
const expenseResponse = await getCategoryStatistics({
|
||||
year: currentYear.value,
|
||||
month: currentMonth.value,
|
||||
month: currentMonth.value || 0,
|
||||
type: 0 // 支出
|
||||
})
|
||||
|
||||
@@ -607,7 +618,7 @@ const fetchCategoryData = async () => {
|
||||
// 获取收入分类
|
||||
const incomeResponse = await getCategoryStatistics({
|
||||
year: currentYear.value,
|
||||
month: currentMonth.value,
|
||||
month: currentMonth.value || 0,
|
||||
type: 1 // 收入
|
||||
})
|
||||
|
||||
@@ -623,7 +634,7 @@ const fetchCategoryData = async () => {
|
||||
// 获取不计收支分类
|
||||
const noneResponse = await getCategoryStatistics({
|
||||
year: currentYear.value,
|
||||
month: currentMonth.value,
|
||||
month: currentMonth.value || 0,
|
||||
type: 2 // 不计收支
|
||||
})
|
||||
|
||||
@@ -646,7 +657,7 @@ const fetchDailyData = async () => {
|
||||
try {
|
||||
const response = await getDailyStatistics({
|
||||
year: currentYear.value,
|
||||
month: currentMonth.value
|
||||
month: currentMonth.value || 0
|
||||
})
|
||||
|
||||
if (response.success && response.data) {
|
||||
@@ -669,7 +680,7 @@ const fetchBalanceData = async () => {
|
||||
try {
|
||||
const response = await getBalanceStatistics({
|
||||
year: currentYear.value,
|
||||
month: currentMonth.value
|
||||
month: currentMonth.value || 0
|
||||
})
|
||||
|
||||
if (response.success && response.data) {
|
||||
@@ -1143,7 +1154,7 @@ const loadCategoryBills = async (customIndex = null, customSize = null) => {
|
||||
pageSize: customSize || billPageSize,
|
||||
type: selectedType.value,
|
||||
year: currentYear.value,
|
||||
month: currentMonth.value,
|
||||
month: currentMonth.value || 0,
|
||||
sortByAmount: true
|
||||
}
|
||||
|
||||
@@ -1359,6 +1370,20 @@ onBeforeUnmount(() => {
|
||||
window.removeEventListener &&
|
||||
window.removeEventListener('transactions-changed', onGlobalTransactionsChanged)
|
||||
})
|
||||
|
||||
// 监听日期选择模式变化,更新selectedDate数组
|
||||
watch(dateSelectionMode, (newMode) => {
|
||||
if (newMode === 'year') {
|
||||
// 切换到年份模式:只保留年份
|
||||
selectedDate.value = [currentYear.value.toString()]
|
||||
} else {
|
||||
// 切换到月份模式:添加当前月份
|
||||
selectedDate.value = [
|
||||
currentYear.value.toString(),
|
||||
(currentMonth.value || new Date().getMonth() + 1).toString().padStart(2, '0')
|
||||
]
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -1693,4 +1718,25 @@ onBeforeUnmount(() => {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* 日期选择器头部 */
|
||||
.date-picker-header {
|
||||
padding: 12px 16px 0;
|
||||
background: var(--van-background-2);
|
||||
border-bottom: 1px solid var(--van-border-color);
|
||||
}
|
||||
|
||||
.date-picker-header :deep(.van-tabs) {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.date-picker-header :deep(.van-tabs__nav) {
|
||||
background: transparent;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.date-picker-header :deep(.van-tab) {
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user