feat: 更新确认待确认分类的接口,支持批量确认功能;调整前端逻辑以处理选中的交易记录
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 20s
Docker Build & Deploy / Deploy to Production (push) Successful in 6s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 20s
Docker Build & Deploy / Deploy to Production (push) Successful in 6s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
This commit is contained in:
@@ -8,13 +8,13 @@
|
||||
>
|
||||
<template #right>
|
||||
<van-button
|
||||
v-if="transactions.length > 0"
|
||||
v-if="selectedIds.size > 0"
|
||||
type="primary"
|
||||
size="small"
|
||||
:loading="confirming"
|
||||
@click="handleConfirmAll"
|
||||
@click="handleConfirmSelected"
|
||||
>
|
||||
全部确认
|
||||
确认所选 ({{ selectedIds.size }})
|
||||
</van-button>
|
||||
</template>
|
||||
</van-nav-bar>
|
||||
@@ -29,8 +29,11 @@
|
||||
:transactions="displayTransactions"
|
||||
:loading="loading"
|
||||
:finished="true"
|
||||
show-checkbox
|
||||
:selected-ids="selectedIds"
|
||||
@click="handleTransactionClick"
|
||||
@delete="handleTransactionDeleted"
|
||||
@update:selected-ids="updateSelectedIds"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -57,12 +60,13 @@ const confirming = ref(false)
|
||||
const transactions = ref([])
|
||||
const showDetail = ref(false)
|
||||
const currentTransaction = ref(null)
|
||||
const selectedIds = ref(new Set())
|
||||
|
||||
const onClickLeft = () => {
|
||||
router.back()
|
||||
}
|
||||
|
||||
const handleConfirmAll = async () => {
|
||||
const handleConfirmSelected = async () => {
|
||||
try {
|
||||
await showConfirmDialog({
|
||||
title: '提示',
|
||||
@@ -70,7 +74,7 @@ const handleConfirmAll = async () => {
|
||||
})
|
||||
|
||||
confirming.value = true
|
||||
const response = await confirmAllUnconfirmed()
|
||||
const response = await confirmAllUnconfirmed(Array.from(selectedIds.value))
|
||||
if (response && response.success) {
|
||||
showToast(`成功确认 ${response.data} 条记录`)
|
||||
loadData()
|
||||
@@ -100,7 +104,13 @@ const loadData = async () => {
|
||||
try {
|
||||
const response = await getUnconfirmedTransactionList()
|
||||
if (response && response.success) {
|
||||
transactions.value = response.data || []
|
||||
transactions.value = (response.data || [])
|
||||
.map(t => ({
|
||||
...t,
|
||||
upsetedClassify: t.unconfirmedClassify,
|
||||
upsetedType: t.unconfirmedType
|
||||
}))
|
||||
selectedIds.value = new Set(response.data.map(t => t.id))
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取待确认列表失败:', error)
|
||||
@@ -118,6 +128,10 @@ const handleTransactionDeleted = (id) => {
|
||||
transactions.value = transactions.value.filter(t => t.id !== id)
|
||||
}
|
||||
|
||||
const updateSelectedIds = (ids) => {
|
||||
selectedIds.value = new Set(ids)
|
||||
}
|
||||
|
||||
const handleDetailSave = () => {
|
||||
loadData()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user