fix: 投资记账和记录,新增默认选中第一条。

This commit is contained in:
tianyongbao
2026-03-04 13:40:02 +08:00
parent 2f4b581bbd
commit 9d8cfa4127
2 changed files with 26 additions and 0 deletions

View File

@@ -169,6 +169,27 @@ onLoad((option) => {
}
})
}
} else if (!form.value.id && response.rows.length > 0) {
// 新增时,默认选中第一条数据
const firstAccount = response.rows[0]
form.value.accountName = firstAccount.nameCodeAvailableLimit
form.value.accountId = firstAccount.id
// 触发账户选择逻辑
getFutureStocks(firstAccount.id).then((accountRes) => {
const account = accountRes.data
accountType.value = account.type
if (account.type == '1') {
futuresShow.value = true
form.value.amount = 0
form.value.closedPosition = null
form.value.commission = null
} else {
futuresShow.value = false
form.value.amount = null
form.value.closedPosition = 0
form.value.commission = 0
}
})
}
})
if(form.value.id!=null){

View File

@@ -145,6 +145,11 @@ onLoad((option) => {
if (selectedAccount) {
form.value.inAccountName = selectedAccount.nameDebitNameCode
}
} else if (!form.value.id && response.rows.length > 0) {
// 新增时,默认选中第一条投资账户
const firstAccount = response.rows[0]
form.value.inAccountName = firstAccount.nameDebitNameCode
form.value.inAccountId = firstAccount.id
}
})
// 类型