feat: 优化多个组件的高度设置,确保更好的用户体验;更新交易记录控制器以处理智能分类结果
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 28s
Docker Build & Deploy / Deploy to Production (push) Successful in 9s
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 28s
Docker Build & Deploy / Deploy to Production (push) Successful in 9s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
<!-- 展开状态 -->
|
||||
<Transition v-else :name="transitionName">
|
||||
<div :key="budget.period" class="budget-inner-card">
|
||||
<div class="card-header">
|
||||
<div class="card-header" style="margin-bottom: 0;">
|
||||
<div class="budget-info">
|
||||
<slot name="tag">
|
||||
<van-tag
|
||||
@@ -55,7 +55,7 @@
|
||||
{{ budget.type === BudgetPeriodType.Year ? '年度' : '月度' }}
|
||||
</van-tag>
|
||||
</slot>
|
||||
<h3 class="card-title">{{ budget.name }}</h3>
|
||||
<h3 class="card-title" style="max-width: 120px;">{{ budget.name }}</h3>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<slot name="actions">
|
||||
@@ -164,7 +164,7 @@
|
||||
<PopupContainer
|
||||
v-model="showBillListModal"
|
||||
title="关联账单列表"
|
||||
height="80%"
|
||||
height="75%"
|
||||
>
|
||||
<TransactionList
|
||||
:transactions="billList"
|
||||
@@ -452,7 +452,6 @@ const timePercentage = computed(() => {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
flex-shrink: 0;
|
||||
max-width: 120px;
|
||||
}
|
||||
|
||||
.card-subtitle {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<PopupContainer
|
||||
v-model="showAddBill"
|
||||
title="记一笔"
|
||||
height="85%"
|
||||
height="75%"
|
||||
>
|
||||
<van-tabs v-model:active="activeTab" shrink>
|
||||
<van-tab title="一句话录账" name="one">
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
v-model="showTransactionList"
|
||||
:title="selectedGroup?.reason || '交易记录'"
|
||||
:subtitle="groupTransactionsTotal ? `共 ${groupTransactionsTotal} 笔交易` : ''"
|
||||
height="85%"
|
||||
height="75%"
|
||||
>
|
||||
<template #header-actions>
|
||||
<van-button
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
:type="buttonType"
|
||||
size="small"
|
||||
:loading="loading || saving"
|
||||
:loading-text="loadingText"
|
||||
:disabled="loading || saving"
|
||||
class="smart-classify-btn"
|
||||
@click="handleClick"
|
||||
@@ -12,9 +13,6 @@
|
||||
<van-icon :name="buttonIcon" />
|
||||
<span style="margin-left: 4px;">{{ buttonText }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span>{{ loadingText }}</span>
|
||||
</template>
|
||||
</van-button>
|
||||
</template>
|
||||
|
||||
@@ -39,6 +37,7 @@ const emit = defineEmits(['update', 'save', 'notifyDonedTransactionId'])
|
||||
const loading = ref(false)
|
||||
const saving = ref(false)
|
||||
const classifiedResults = ref([])
|
||||
const lockClassifiedResults = ref(false)
|
||||
const isAllCompleted = ref(false)
|
||||
let toastInstance = null
|
||||
|
||||
@@ -47,7 +46,8 @@ const hasTransactions = computed(() => {
|
||||
})
|
||||
|
||||
const hasClassifiedResults = computed(() => {
|
||||
return isAllCompleted.value && classifiedResults.value.length > 0
|
||||
// Show save state once we have any classified result, even if not all batches finished
|
||||
return classifiedResults.value.length > 0 && lockClassifiedResults.value === false
|
||||
})
|
||||
|
||||
// 按钮类型
|
||||
@@ -92,6 +92,8 @@ const handleClick = () => {
|
||||
* 保存分类结果
|
||||
*/
|
||||
const handleSaveClassify = async () => {
|
||||
if (saving.value || loading.value) return
|
||||
|
||||
try {
|
||||
saving.value = true
|
||||
showToast({
|
||||
@@ -145,12 +147,23 @@ const handleSaveClassify = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理智能分类
|
||||
*/
|
||||
const handleSmartClassify = async () => {
|
||||
if (loading.value || saving.value) {
|
||||
showToast('当前有任务正在进行,请稍后再试')
|
||||
return
|
||||
}
|
||||
|
||||
loading.value = true
|
||||
|
||||
if (!props.transactions || props.transactions.length === 0) {
|
||||
showToast('没有可分类的交易记录')
|
||||
loading.value = false
|
||||
return
|
||||
}
|
||||
|
||||
if(lockClassifiedResults.value) {
|
||||
showToast('当前有分类任务正在进行,请稍后再试')
|
||||
loading.value = false
|
||||
return
|
||||
}
|
||||
|
||||
@@ -158,17 +171,12 @@ const handleSmartClassify = async () => {
|
||||
isAllCompleted.value = false
|
||||
classifiedResults.value = []
|
||||
|
||||
const batchSize = 30
|
||||
const batchSize = 3
|
||||
let processedCount = 0
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
// 清除之前的Toast
|
||||
if (toastInstance) {
|
||||
closeToast()
|
||||
}
|
||||
|
||||
// 等待父组件的 beforeClassify 事件处理完成(如果有返回 Promise) TODO 没有生效
|
||||
lockClassifiedResults.value = true
|
||||
// 等待父组件的 beforeClassify 事件处理完成(如果有返回 Promise)
|
||||
if (props.onBeforeClassify) {
|
||||
const shouldContinue = await props.onBeforeClassify()
|
||||
if (shouldContinue === false) {
|
||||
@@ -323,6 +331,7 @@ const handleSmartClassify = async () => {
|
||||
})
|
||||
} finally {
|
||||
loading.value = false
|
||||
lockClassifiedResults.value = false
|
||||
// 确保Toast被清除
|
||||
if (toastInstance) {
|
||||
setTimeout(() => {
|
||||
@@ -342,6 +351,11 @@ const removeClassifiedTransaction = (transactionId) => {
|
||||
* 重置组件状态
|
||||
*/
|
||||
const reset = () => {
|
||||
if(lockClassifiedResults.value) {
|
||||
showToast('当前有分类任务正在进行,无法重置')
|
||||
return
|
||||
}
|
||||
|
||||
isAllCompleted.value = false
|
||||
classifiedResults.value = []
|
||||
loading.value = false
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<PopupContainer
|
||||
v-model="visible"
|
||||
title="交易详情"
|
||||
height="85%"
|
||||
height="75%"
|
||||
:closeable="false"
|
||||
>
|
||||
<template #header-actions>
|
||||
@@ -111,7 +111,7 @@
|
||||
<PopupContainer
|
||||
v-model="showOffsetPopup"
|
||||
title="选择抵账交易"
|
||||
height="70%"
|
||||
height="75%"
|
||||
>
|
||||
<van-list>
|
||||
<van-cell
|
||||
|
||||
Reference in New Issue
Block a user