feat: 添加分类名称更新功能,支持在交易记录中同步更新分类名称
This commit is contained in:
@@ -57,18 +57,23 @@
|
||||
</van-pull-refresh>
|
||||
|
||||
<!-- 详情弹出层 -->
|
||||
<van-popup
|
||||
v-model:show="detailVisible"
|
||||
position="bottom"
|
||||
:style="{ height: '80%' }"
|
||||
round
|
||||
closeable
|
||||
<PopupContainer
|
||||
v-model="detailVisible"
|
||||
:title="currentEmail ? (currentEmail.Subject || currentEmail.subject || '(无主题)') : ''"
|
||||
height="80%"
|
||||
>
|
||||
<div class="popup-container" v-if="currentEmail">
|
||||
<div class="popup-header-fixed">
|
||||
<h3>{{ currentEmail.Subject || currentEmail.subject || '(无主题)' }}</h3>
|
||||
</div>
|
||||
<div class="popup-scroll-content">
|
||||
<template #header-actions>
|
||||
<van-button
|
||||
size="small"
|
||||
type="primary"
|
||||
:loading="refreshingAnalysis"
|
||||
@click="handleRefreshAnalysis"
|
||||
>
|
||||
重新分析
|
||||
</van-button>
|
||||
</template>
|
||||
|
||||
<div v-if="currentEmail">
|
||||
<van-cell-group inset style="margin-top: 12px;">
|
||||
<van-cell title="发件人" :value="currentEmail.From || currentEmail.from || '未知'" />
|
||||
<van-cell title="接收时间" :value="formatDate(currentEmail.ReceivedDate || currentEmail.receivedDate)" />
|
||||
@@ -101,21 +106,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin: 16px;">
|
||||
<van-button
|
||||
round
|
||||
block
|
||||
type="primary"
|
||||
:loading="refreshingAnalysis"
|
||||
@click="handleRefreshAnalysis"
|
||||
>
|
||||
重新分析
|
||||
</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</van-popup>
|
||||
</PopupContainer>
|
||||
|
||||
<!-- 账单列表弹出层 -->
|
||||
<PopupContainer
|
||||
@@ -343,6 +335,7 @@ const viewTransactions = async () => {
|
||||
|
||||
// 监听全局删除事件,保持弹窗内交易列表一致
|
||||
const onGlobalTransactionDeleted = (e) => {
|
||||
console.log('收到全局交易删除事件:', e)
|
||||
// 如果交易列表弹窗打开,尝试重新加载邮箱的交易列表
|
||||
if (transactionListVisible.value && currentEmail.value) {
|
||||
const emailId = currentEmail.value.id || currentEmail.value.Id
|
||||
@@ -362,6 +355,7 @@ onBeforeUnmount(() => {
|
||||
|
||||
// 监听新增/修改/批量更新事件,刷新弹窗内交易或邮件列表
|
||||
const onGlobalTransactionsChanged = (e) => {
|
||||
console.log('收到全局交易变更事件:', e)
|
||||
if (transactionListVisible.value && currentEmail.value) {
|
||||
const emailId = currentEmail.value.id || currentEmail.value.Id
|
||||
getEmailTransactions(emailId).then(response => {
|
||||
@@ -413,7 +407,12 @@ const handleTransactionDelete = (transactionId) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
try { window.dispatchEvent(new CustomEvent('transaction-deleted', { detail: transactionId })) } catch(e) {}
|
||||
try {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('transaction-deleted', { detail: transactionId }))
|
||||
} catch(e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
// 账单保存后刷新列表
|
||||
@@ -426,7 +425,18 @@ const handleTransactionSave = async () => {
|
||||
transactionList.value = response.data || []
|
||||
}
|
||||
}
|
||||
try { window.dispatchEvent(new CustomEvent('transactions-changed', { detail: { emailId: currentEmail.value?.id } })) } catch(e) {}
|
||||
try {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent(
|
||||
'transactions-changed',
|
||||
{
|
||||
detail: {
|
||||
emailId: currentEmail.value?.id
|
||||
}
|
||||
}))
|
||||
} catch(e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化日期
|
||||
|
||||
Reference in New Issue
Block a user