fix(ui): 補齊 Select 組件的 value 綁定解決表單保存報錯,並使用 parseFloat 剝離編輯狀態下的尾隨零
This commit is contained in:
parent
2395d792db
commit
06e52d58d6
@ -102,9 +102,9 @@ export function UpdateTransactionDialog({
|
|||||||
form.reset({
|
form.reset({
|
||||||
assetId: transaction.assetId,
|
assetId: transaction.assetId,
|
||||||
txType: transaction.txType,
|
txType: transaction.txType,
|
||||||
quantity: transaction.quantity.toString(),
|
quantity: parseFloat(transaction.quantity).toString(),
|
||||||
price: transaction.price.toString(),
|
price: parseFloat(transaction.price).toString(),
|
||||||
fee: transaction.fee.toString(),
|
fee: parseFloat(transaction.fee || 0).toString(),
|
||||||
txCurrency: transaction.txCurrency,
|
txCurrency: transaction.txCurrency,
|
||||||
executedAt: transaction.executedAt
|
executedAt: transaction.executedAt
|
||||||
? new Date(transaction.executedAt).toISOString().slice(0, 16)
|
? new Date(transaction.executedAt).toISOString().slice(0, 16)
|
||||||
@ -150,7 +150,7 @@ export function UpdateTransactionDialog({
|
|||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>标的资产</FormLabel>
|
<FormLabel>标的资产</FormLabel>
|
||||||
<Select disabled>
|
<Select disabled={true} onValueChange={field.onChange} value={field.value} defaultValue={field.value}>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
<SelectValue placeholder="选择资产" />
|
<SelectValue placeholder="选择资产" />
|
||||||
@ -174,7 +174,7 @@ export function UpdateTransactionDialog({
|
|||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>交易类型</FormLabel>
|
<FormLabel>交易类型</FormLabel>
|
||||||
<Select disabled>
|
<Select disabled={true} onValueChange={field.onChange} value={field.value} defaultValue={field.value}>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
<SelectValue placeholder="选择交易类型" />
|
<SelectValue placeholder="选择交易类型" />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user