Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
csbr-daop
/
fe-data-trusted-space
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
fa94c746
authored
2025-03-31 10:51:04 +0800
by
lihua
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复千分位计算以及数字输入限制
1 parent
51140dba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
src/views/data_transaction/valuationModelCreate.vue
src/views/data_transaction/valuationModelCreate.vue
View file @
fa94c74
...
...
@@ -580,7 +580,7 @@ const inputChange = (val, scope, field) => {
/** 输入框输入触发事件 */
const
inputEventChange
=
(
val
,
scope
,
field
,
max
:
any
=
null
)
=>
{
let
row
=
scope
.
row
;
if
(
row
.
indexName
==
'
综合分成率'
||
row
.
indexName
==
'衰减率
'
)
{
//只能输入正数
if
(
row
.
indexName
==
'
数据资产分成率'
||
row
.
indexName
==
'衰减率'
||
formRef
.
value
.
formInline
?.
evaluateMethod
==
'1
'
)
{
//只能输入正数
let
row
=
scope
.
row
;
row
[
field
]
=
row
[
field
].
toString
().
replace
(
/
[^\d
.
]
/g
,
""
)
row
[
field
]
=
row
[
field
].
toString
().
replace
(
/
\.{2,}
/g
,
"."
)
...
...
@@ -597,13 +597,29 @@ const inputEventChange = (val, scope, field, max: any = null) => {
if
(
row
[
field
].
startsWith
(
'-'
))
{
// 对于负数,去掉负号进行处理
let
tempValue
=
row
[
field
].
substring
(
1
);
tempValue
=
tempValue
.
replace
(
/
^0*
(\d
+
(\.\d{0,2})?)
/
,
'$1'
)
;
tempValue
=
tempValue
.
replace
(
/
-/g
,
''
);
;
row
[
field
]
=
'-'
+
tempValue
;
}
else
{
// 对于正数直接处理
row
[
field
]
=
row
[
field
].
replace
(
/
^0*
(\d
+
(\.\d{0,2})?)
/
,
'$1
'
);
row
[
field
]
=
row
[
field
].
replace
(
/
-/g
,
'
'
);
}
row
[
field
]
=
row
[
field
].
toString
().
replace
(
/^
(
-
?\d{0,12})(\.\d{0,2})?
$/
,
'$1$2'
);
let
parts
=
row
[
field
].
split
(
'.'
);
let
integerPart
=
parts
[
0
];
let
decimalPart
=
parts
.
length
>
1
?
parts
[
1
]
:
''
;
// 限制整数部分最多12位
if
(
integerPart
.
length
>
12
)
{
integerPart
=
integerPart
.
substring
(
0
,
12
);
}
// 限制小数部分最多2位
if
(
decimalPart
.
length
>
2
)
{
decimalPart
=
decimalPart
.
substring
(
0
,
2
);
}
row
[
field
]
=
integerPart
+
(
decimalPart
?
'.'
+
decimalPart
:
(
row
[
field
].
includes
(
'.'
)
?
'.'
:
''
))
if
(
max
!==
null
)
{
if
(
row
[
field
]
>
max
)
{
row
[
field
]
=
max
;
...
...
@@ -656,10 +672,10 @@ const incomeCalculateData = computed(() => { //响应式不生效
}
let
C10
=
transfer
(
data
[
9
][
year
.
field
]);
resultInfo
[
'折现因子'
].
push
(
changeNum
(
1
/
Math
.
pow
((
1
+
C10
),
parseFloat
(
resultInfo
[
'折现年期'
][
i
])),
2
,
true
));
resultInfo
[
'折现现值'
].
push
(
changeNum
(
parseFloat
(
resultInfo
[
'折现因子'
][
i
])
*
parseFloat
(
resultInfo
[
'现金流'
][
i
]),
2
,
true
));
resultInfo
[
'折现现值'
].
push
(
changeNum
(
parseFloat
(
resultInfo
[
'折现因子'
][
i
])
*
parseFloat
(
resultInfo
[
'现金流'
][
i
]
.
replace
(
/,/g
,
''
)
),
2
,
true
));
})
resultInfo
[
'数据资产估值'
]
=
changeNum
(
resultInfo
[
'折现现值'
].
reduce
(
function
(
prev
,
curr
,
idx
,
arr
)
{
return
parseFloat
(
prev
)
+
parseFloat
(
curr
);
return
parseFloat
(
prev
.
replace
(
/,/g
,
''
))
+
parseFloat
(
curr
.
replace
(
/,/g
,
''
)
);
}),
2
,
true
);
return
resultInfo
;
})
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment