feat: 添加待确认分类功能,支持获取和确认未分类交易记录;优化相关组件和服务
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 24s
Docker Build & Deploy / Deploy to Production (push) Successful in 10s
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 24s
Docker Build & Deploy / Deploy to Production (push) Successful in 10s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
@@ -295,6 +295,7 @@
|
||||
</template>
|
||||
|
||||
<TransactionList
|
||||
ref="transactionListRef"
|
||||
:transactions="categoryBills"
|
||||
:loading="billListLoading"
|
||||
:finished="billListFinished"
|
||||
@@ -683,6 +684,7 @@ const goToTypeOverviewBills = (type) => {
|
||||
}
|
||||
|
||||
const smartClassifyButtonRef = ref(null)
|
||||
const transactionListRef = ref(null)
|
||||
// 加载分类账单数据
|
||||
const loadCategoryBills = async (customIndex = null, customSize = null) => {
|
||||
if (billListLoading.value || billListFinished.value) return
|
||||
@@ -756,16 +758,26 @@ const handleCategoryBillsDelete = (deletedId) => {
|
||||
}
|
||||
|
||||
// 账单保存后的回调
|
||||
const onBillSave = async () => {
|
||||
const onBillSave = async (updatedTransaction) => {
|
||||
// 刷新统计数据
|
||||
await fetchStatistics()
|
||||
|
||||
// 刷新账单列表
|
||||
categoryBills.value = []
|
||||
billPageIndex.value = 1
|
||||
billListFinished.value = false
|
||||
await loadCategoryBills()
|
||||
|
||||
// 只刷新列表中指定的账单项
|
||||
const item = categoryBills.value.find(t => t.id === updatedTransaction.id)
|
||||
if(!item) return
|
||||
|
||||
// 如果分类发生了变化
|
||||
if(item.classify !== updatedTransaction.classify) {
|
||||
// 从列表中移除该项
|
||||
categoryBills.value = categoryBills.value.filter(t => t.id !== updatedTransaction.id)
|
||||
categoryBillsTotal.value--
|
||||
// 通知智能分类按钮组件移除指定项
|
||||
smartClassifyButtonRef.value?.removeClassifiedTransaction(updatedTransaction.id)
|
||||
return
|
||||
}
|
||||
|
||||
Object.assign(item, updatedTransaction)
|
||||
|
||||
showToast('保存成功')
|
||||
}
|
||||
|
||||
@@ -798,12 +810,15 @@ const onSmartClassifySave = async () => {
|
||||
const handleNotifiedTransactionId = async (transactionId) => {
|
||||
console.log('收到已处理交易ID通知:', transactionId)
|
||||
// 滚动到指定的交易项
|
||||
const index = categoryBills.value.findIndex(item => item.id === transactionId)
|
||||
const index = categoryBills.value.findIndex(item => String(item.id) === String(transactionId))
|
||||
if (index !== -1) {
|
||||
// 等待 DOM 更新
|
||||
await nextTick()
|
||||
|
||||
const listElement = document.querySelector('.transaction-list')
|
||||
// 允许一丁点延迟让浏览器响应渲染
|
||||
await new Promise(resolve => setTimeout(resolve, 0))
|
||||
|
||||
const listElement = transactionListRef.value?.$el
|
||||
if (listElement) {
|
||||
const items = listElement.querySelectorAll('.transaction-item')
|
||||
const itemElement = items[index]
|
||||
|
||||
Reference in New Issue
Block a user