fix: 投资记账和记录,新增默认选中第一条。
This commit is contained in:
@@ -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){
|
||||
|
||||
@@ -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
|
||||
}
|
||||
})
|
||||
// 类型
|
||||
|
||||
Reference in New Issue
Block a user