统一组件
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 19s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s

This commit is contained in:
2026-01-03 11:07:33 +08:00
parent f0d332a503
commit 82bb13c385
6 changed files with 45 additions and 704 deletions

View File

@@ -56,7 +56,7 @@
v-model="showTransactionList"
:title="selectedGroup?.reason || '交易记录'"
:subtitle="groupTransactionsTotal ? `共 ${groupTransactionsTotal} 笔交易` : ''"
height="80%"
height="85%"
>
<template #header-actions>
<van-button
@@ -80,10 +80,10 @@
</PopupContainer>
<!-- 账单详情弹窗 -->
<TransactionDetailDialog
v-model="showTransactionDetail"
<TransactionDetail
v-model:show="showTransactionDetail"
:transaction="selectedTransaction"
@saved="handleTransactionSaved"
@save="handleTransactionSaved"
/>
<!-- 批量设置对话框 -->
@@ -112,17 +112,16 @@
input-align="left"
/>
<!-- 交易类型选择 -->
<van-field
v-model="batchForm.typeName"
is-link
readonly
name="type"
label="交易类型"
placeholder="请选择交易类型"
@click="showTypePicker = true"
:rules="[{ required: true, message: '请选择交易类型' }]"
/>
<!-- 交易类型 -->
<van-field name="type" label="交易类型">
<template #input>
<van-radio-group v-model="batchForm.type" direction="horizontal">
<van-radio :name="0">支出</van-radio>
<van-radio :name="1">收入</van-radio>
<van-radio :name="2">不计</van-radio>
</van-radio-group>
</template>
</van-field>
<!-- 分类选择 -->
<van-field name="classify" label="分类">
@@ -166,16 +165,6 @@
</van-form>
</van-dialog>
<!-- 交易类型选择器 -->
<van-popup v-model:show="showTypePicker" position="bottom" round>
<van-picker
show-toolbar
:columns="typeOptions"
@confirm="handleConfirmType"
@cancel="showTypePicker = false"
/>
</van-popup>
<!-- 新增分类对话框 -->
<van-dialog
v-model:show="showAddClassify"
@@ -200,7 +189,7 @@ import {
import { getReasonGroups, batchUpdateByReason, getTransactionList } from '@/api/transactionRecord'
import { getCategoryList, createCategory } from '@/api/transactionCategory'
import TransactionList from './TransactionList.vue'
import TransactionDetailDialog from './TransactionDetailDialog.vue'
import TransactionDetail from './TransactionDetail.vue'
import PopupContainer from './PopupContainer.vue'
const props = defineProps({
@@ -218,13 +207,6 @@ const props = defineProps({
const emit = defineEmits(['long-press', 'data-loaded', 'data-changed'])
// 交易类型选项
const typeOptions = [
{ text: '支出', value: 0 },
{ text: '收入', value: 1 },
{ text: '不计收支', value: 2 }
]
// 数据状态
const groups = ref([])
const loading = ref(false)
@@ -250,7 +232,6 @@ const transactionPageSize = ref(20)
// 批量分类相关状态
const showBatchDialog = ref(false)
const showTypePicker = ref(false)
const showAddClassify = ref(false)
const batchFormRef = ref(null)
const batchGroup = ref(null)
@@ -398,13 +379,6 @@ const selectClassify = (classify) => {
batchForm.value.classify = classify
}
// 确认选择交易类型
const handleConfirmType = ({ selectedOptions }) => {
batchForm.value.type = selectedOptions[0].value
batchForm.value.typeName = selectedOptions[0].text
showTypePicker.value = false
}
// 新增分类
const addNewClassify = async () => {
if (!newClassify.value.trim()) {
@@ -571,7 +545,7 @@ onBeforeUnmount(() => {
})
// 当有交易新增/修改/批量更新时的刷新监听
const onGlobalTransactionsChanged = (e) => {
const onGlobalTransactionsChanged = () => {
if (showTransactionList.value && selectedGroup.value) {
groupTransactions.value = []
transactionPageIndex.value = 1