Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-services
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1fcf7f8d
authored
Sep 12, 2023
by
杨北旺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改输入框
1 parent
e793f7b6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
3 deletions
src/components/FormatInput/index.vue
src/views/beforeSale/editEquity.vue
src/components/FormatInput/index.vue
0 → 100644
View file @
1fcf7f8
<
template
>
<el-input
:value=
"value"
v-bind=
"$attrs"
v-on=
"
{...$listeners}" @blur="blurFn">
</el-input>
</
template
>
<
script
>
export
default
{
name
:
'FormatInput'
,
props
:
[
'value'
,
'precise'
,
'intDigit'
,
'maxVal'
,
'minVal'
],
data
()
{
return
{
}
},
watch
:{
value
:{
handler
(
nVal
,
oVal
){
this
.
inputFn
(
nVal
)
},
deep
:
true
}
},
mounted
(){
},
methods
:{
inputFn
(
e
){
e
=
e
?
String
(
e
)
:
''
this
.
intDigit
=
this
.
intDigit
||
6
this
.
precise
=
this
.
precise
||
2
let
value
=
e
if
(
this
.
maxVal
){
if
(
+
this
.
maxVal
<=
+
e
)
value
=
this
.
maxVal
//加等号是因为 '500' == '500.' 导致多了点
}
else
{
const
intDigitReg
=
this
.
intDigit
==
-
1
?
`(^\\d+)(\\.\\d+)?`
:
`(^\\d{
${
this
.
intDigit
}
})\\d+(\\.\\d+)?`
value
=
e
.
replace
(
/^0
\d
/g
,
'0'
).
replace
(
/
[^\d
.
]
/g
,
''
).
replace
(
/^
\.
/g
,
''
).
replace
(
new
RegExp
(
intDigitReg
,
'g'
),
'$1'
).
replace
(
'.'
,
'$#$'
)
.
replace
(
/
\.
/g
,
''
).
replace
(
'$#$'
,
'.'
).
replace
(
new
RegExp
(
`^(-)*(\\d+)\\.(\\d{
${
this
.
precise
}
}).*$`
),
this
.
intDigit
==
-
1
?
'$1$2'
:
'$1$2.$3'
)
}
this
.
$emit
(
'input'
,
value
)
},
blurFn
(
e
){
let
value
=
e
.
target
.
value
if
(
this
.
minVal
&&
+
this
.
minVal
>=
value
)
value
=
this
.
minVal
+
''
if
(
value
&&
value
.
charAt
(
value
.
length
-
1
)
==
'.'
)
value
=
value
.
substr
(
0
,
value
.
length
-
1
)
this
.
$emit
(
'input'
,
value
)
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
</
style
>
\ No newline at end of file
\ No newline at end of file
src/views/beforeSale/editEquity.vue
View file @
1fcf7f8
...
@@ -141,7 +141,8 @@
...
@@ -141,7 +141,8 @@
</div>
</div>
<div
class=
"arrt_pannel"
>
<div
class=
"arrt_pannel"
>
<template
v-if=
"attr.attributeType == 'input'"
>
<template
v-if=
"attr.attributeType == 'input'"
>
<el-input
class=
"arrt_pannel"
:disabled=
"disabled || attr.disabled || (attr.attributeName == 'compensation_name' && compensationNameDisable)"
@
input=
"getCurChangeInput($event, item, attr, index, attrindex, 2)"
v-model=
"productModal[item.idName][attr.attributeName]"
size=
"small"
:maxlength=
"attr.maxLength"
clearable
:placeholder=
"'请输入' + attr.attributeDesc"
></el-input>
<FormatInput
v-if=
"limitAttrName.includes(attr.attributeName)"
class=
"arrt_pannel"
:disabled=
"disabled || attr.disabled || (attr.attributeName == 'compensation_name' && compensationNameDisable)"
@
input=
"getCurChangeInput($event, item, attr, index, attrindex, 2)"
v-model=
"productModal[item.idName][attr.attributeName]"
size=
"small"
:maxlength=
"attr.maxLength"
clearable
:placeholder=
"'请输入' + attr.attributeDesc"
precise=
"2"
intDigit=
"10"
></FormatInput>
<el-input
v-else
class=
"arrt_pannel"
:disabled=
"disabled || attr.disabled || (attr.attributeName == 'compensation_name' && compensationNameDisable)"
@
input=
"getCurChangeInput($event, item, attr, index, attrindex, 2)"
v-model=
"productModal[item.idName][attr.attributeName]"
size=
"small"
:maxlength=
"attr.maxLength"
clearable
:placeholder=
"'请输入' + attr.attributeDesc"
></el-input>
</
template
>
</
template
>
<
template
v-if=
"attr.attributeType == 'select'"
>
<
template
v-if=
"attr.attributeType == 'select'"
>
<el-select
:allow-create=
"attr.attributeName == 'gearbox'"
:remote=
"attr.attributeName == 'gearbox'"
:filterable=
"attr.attributeName == 'gearbox'"
class=
"arrt_pannel"
:disabled=
"disabled || attr.disabled"
size=
"small"
@
change=
"getCurChangeSelect($event, item, attr)"
v-model=
"productModal[item.idName][attr.attributeName]"
clearable
:placeholder=
"'请选择' + attr.attributeDesc"
>
<el-select
:allow-create=
"attr.attributeName == 'gearbox'"
:remote=
"attr.attributeName == 'gearbox'"
:filterable=
"attr.attributeName == 'gearbox'"
class=
"arrt_pannel"
:disabled=
"disabled || attr.disabled"
size=
"small"
@
change=
"getCurChangeSelect($event, item, attr)"
v-model=
"productModal[item.idName][attr.attributeName]"
clearable
:placeholder=
"'请选择' + attr.attributeDesc"
>
...
@@ -209,6 +210,7 @@ import qrCode from '@/components/qr-code'
...
@@ -209,6 +210,7 @@ import qrCode from '@/components/qr-code'
import
{
fetchConfig
}
from
'@/config'
import
{
fetchConfig
}
from
'@/config'
import
utils
from
'../../util/util'
import
utils
from
'../../util/util'
import
uploadInfo
from
'./uploadInfo.vue'
import
uploadInfo
from
'./uploadInfo.vue'
import
FormatInput
from
'@/components/FormatInput'
export
default
{
export
default
{
name
:
'editEquity'
,
name
:
'editEquity'
,
data
()
{
data
()
{
...
@@ -730,7 +732,8 @@ export default {
...
@@ -730,7 +732,8 @@ export default {
value
:
'0'
,
value
:
'0'
,
label
:
'营运'
label
:
'营运'
}
}
]
],
limitAttrName
:
[
'warranty_km'
,
'vehicle_displacement'
,
'mileage'
,
'warranty_period'
]
}
}
},
},
...
@@ -755,7 +758,8 @@ export default {
...
@@ -755,7 +758,8 @@ export default {
components
:
{
components
:
{
glsxCombiForm
,
glsxCombiForm
,
qrCode
,
qrCode
,
uploadInfo
uploadInfo
,
FormatInput
},
},
async
created
()
{
async
created
()
{
...
...
Write
Preview
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