From c8b9aed6dcc823f477bdcfeab5aac7c2ebd457df Mon Sep 17 00:00:00 2001 From: tianyongbao Date: Fri, 31 Oct 2025 12:40:19 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20=E4=BC=98=E5=8C=96=E4=BA=A4?= =?UTF-8?q?=E6=98=93=E8=AE=B0=E5=BD=95=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=82=A8?= =?UTF-8?q?=E8=93=84=E8=B4=A6=E6=88=B7=E7=B1=BB=E5=9E=8B=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../accounts/accountDealRecord/addEdit.vue | 90 +++++++++++++++++-- .../work/accounts/accountDealRecord/list.vue | 17 ++++ 2 files changed, 102 insertions(+), 5 deletions(-) diff --git a/src/pages/work/accounts/accountDealRecord/addEdit.vue b/src/pages/work/accounts/accountDealRecord/addEdit.vue index c7dd2bf..7427d02 100644 --- a/src/pages/work/accounts/accountDealRecord/addEdit.vue +++ b/src/pages/work/accounts/accountDealRecord/addEdit.vue @@ -16,6 +16,11 @@ inputAlign="right" border="none"> + + + + @@ -57,6 +62,8 @@ + { }) onReady(() => { form.value.createTime = dayjs(new Date().getTime()).format("YYYY-MM-DD HH:mm:ss") + // 新增时默认显示储蓄账户类型筛选(因为默认就是储蓄卡) + if(form.value.id == null && flag.value == null) { + debitTypeShow.value = true + } getData() }) function getData() { @@ -161,6 +180,10 @@ onLoad((option) => { // 类型 getDicts('account_type').then(res => { accountTypeList.value =[res.data] + }) + // 储蓄账户类型 + getDicts('debit_type').then(res => { + debitTypeList.value =[res.data] }) // 类型 getDicts('deal_type').then(res => { @@ -198,6 +221,7 @@ onLoad((option) => { if(form.value.id!=null){ getAccountDealRecord(form.value.id).then(res => { form.value = res.data + if (form.value.dealCategory === '1') { childCategoryShow.value = true // 交易类别 @@ -229,9 +253,28 @@ getDicts('deal_category').then(result => { queryAccountParams.value.type = null } + // 编辑和复制时,如果是储蓄账户,自动回填储蓄账户类型并显示筛选框 + if(form.value.type === '1' && form.value.accountId) { + debitTypeShow.value = true + // 从账户列表中查找当前账户的储蓄账户类型 + listAccounts({pageNum: 1, pageSize: 1000, type: '1', status: '1'}).then((response) => { + const currentAccount = response.rows.find(item => item.id === form.value.accountId) + if(currentAccount && currentAccount.debitType) { + tempDebitType.value = currentAccount.debitType + getDicts('debit_type').then(result => { + tempDebitTypeName.value = dictStr(currentAccount.debitType, result.data) + }) + queryAccountParams.value.debitType = currentAccount.debitType + } + accountNameList.value = [response.rows.filter(item => item.debitType === tempDebitType.value)] + }) + } + + // 如果是复制模式,重置交易时间 if(flag.value!=null){ - form.value.createTime = dayjs(new Date().getTime()).format("YYYY-MM-DD HH:mm:ss") - } + form.value.createTime = dayjs(new Date().getTime()).format("YYYY-MM-DD HH:mm:ss") + } + listAccounts(queryAccountParams.value).then((response) => { accountNameList.value = [response.rows] }) @@ -264,15 +307,52 @@ getDicts('deal_category').then(result => { queryAccountParams.value.type = form.value.type form.value.accountId = null form.value.accountName = null - listAccounts(queryAccountParams.value).then((response) => { - accountNameList.value = [response.rows] - }) + tempDebitType.value = null + tempDebitTypeName.value = null + queryAccountParams.value.debitType = null + + // 如果是储蓄账户(type='1')且不是修改模式,显示储蓄账户类型选择 + if (form.value.type === '1' && form.value.id == null) { + debitTypeShow.value = true + } else { + debitTypeShow.value = false + listAccounts(queryAccountParams.value).then((response) => { + accountNameList.value = [response.rows] + }) + } showAccountType.value = false } function handleAccountTypeCancel() { showAccountType.value = false } + + function handleDebitType() { + if (debitTypeList.value[0].length === 0) { + proxy.$refs['uToast'].show({ + message: '储蓄账户类型为空', type: 'warning' + }) + } else { + showDebitType.value = true + } + } + + function handleDebitTypeConfirm(e) { + tempDebitTypeName.value = e.value[0].dictLabel + tempDebitType.value = e.value[0].dictValue + queryAccountParams.value.debitType = tempDebitType.value + form.value.accountId = null + form.value.accountName = null + listAccounts(queryAccountParams.value).then((response) => { + accountNameList.value = [response.rows] + }) + showDebitType.value = false + } + + function handleDebitTypeCancel() { + showDebitType.value = false + } + function handleAccountName() { if (accountNameList.value[0].length === 0) { proxy.$refs['uToast'].show({ diff --git a/src/pages/work/accounts/accountDealRecord/list.vue b/src/pages/work/accounts/accountDealRecord/list.vue index 70b18b8..0c615b1 100644 --- a/src/pages/work/accounts/accountDealRecord/list.vue +++ b/src/pages/work/accounts/accountDealRecord/list.vue @@ -92,6 +92,10 @@ 记账类型: {{ dictStr(item.type, accountTypeList) }} + + 储蓄账户类型: + {{ dictStr(getAccountDebitType(item.accountId), debitTypeList) }} + 交易时间: {{ item.createTime }} @@ -161,6 +165,7 @@ const status = ref('loadmore') const accountTypeList = ref([]) const dealTypeList = ref([]) const dealCategoryList = ref([]) +const debitTypeList = ref([]) const settingPickShow = ref(false) const settingColumns = ref([]) const showAccount = ref(false) @@ -250,6 +255,10 @@ function getDict() { getDicts('deal_category').then(res => { dealCategoryList.value = res.data }) + // 储蓄账户类型 + getDicts('debit_type').then(res => { + debitTypeList.value = res.data + }) } function settingConfirm(e) { queryParams.value.settingId = e.value[0].settingId @@ -268,6 +277,14 @@ function dictStr(val, arr) { }) return str } + + // 根据账户ID获取储蓄账户类型 + function getAccountDebitType(accountId) { + if (!accountId || !accountList.value[0]) return null + const account = accountList.value[0].find(item => item.id === accountId) + return account ? account.debitType : null + } + function handleAccount() { if (accountList.value[0].length === 0) { proxy.$refs['uToast'].show({