fix
Some checks failed
Docker Build & Deploy / Build Docker Image (push) Failing after 6s
Docker Build & Deploy / Deploy to Production (push) Has been skipped

This commit is contained in:
孙诚
2025-12-30 18:49:46 +08:00
parent 1f01d13ed3
commit 4b322494ba
9 changed files with 365 additions and 231 deletions

View File

@@ -29,7 +29,7 @@
:transactions="dateTransactions"
:loading="listLoading"
:finished="true"
:show-delete="false"
:show-delete="true"
@click="viewDetail"
/>
</PopupContainer>
@@ -120,7 +120,7 @@ const fetchDateTransactions = async (date) => {
.data
.sort((a, b) => b.amount - a.amount);
// 重置智能分类按钮
smartClassifyButtonRef.value.reset()
smartClassifyButtonRef.value?.reset()
} else {
dateTransactions.value = [];
showToast(response.message || "获取交易列表失败");

View File

@@ -290,6 +290,7 @@
:transactions="categoryBills"
:onBeforeClassify="beforeSmartClassify"
@save="onSmartClassifySave"
@notify-doned-transaction-id="handleNotifiedTransactionId"
/>
</template>
@@ -313,7 +314,7 @@
</template>
<script setup>
import { ref, computed, onMounted, onActivated } from 'vue'
import { ref, computed, onMounted, onActivated, nextTick } from 'vue'
import { showToast } from 'vant'
import { useRouter } from 'vue-router'
import { getMonthlyStatistics, getCategoryStatistics, getTrendStatistics } from '@/api/statistics'
@@ -684,7 +685,7 @@ const loadCategoryBills = async (customIndex = null, customSize = null) => {
billPageIndex.value++
}
smartClassifyButtonRef.value.reset()
smartClassifyButtonRef.value?.reset()
} else {
showToast(response.message || '加载账单失败')
billListFinished.value = true
@@ -749,6 +750,25 @@ const onSmartClassifySave = async () => {
showToast('智能分类已保存')
}
const handleNotifiedTransactionId = async (transactionId) => {
console.log('收到已处理交易ID通知:', transactionId)
// 滚动到指定的交易项
const index = categoryBills.value.findIndex(item => item.id === transactionId)
if (index !== -1) {
// 等待 DOM 更新
await nextTick()
const listElement = document.querySelector('.transaction-list')
if (listElement) {
const items = listElement.querySelectorAll('.transaction-item')
const itemElement = items[index]
if (itemElement) {
itemElement.scrollIntoView({ behavior: 'smooth', block: 'center' })
}
}
}
}
// 初始化
onMounted(() => {
fetchStatistics()