fix
This commit is contained in:
@@ -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 || "获取交易列表失败");
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user