Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-app-operator-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanbaoming
jiedao-app-operator-master
Commits
e57c9d09
Commit
e57c9d09
authored
Oct 18, 2023
by
邓春圆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表单验证
parent
291a052e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
13 deletions
+42
-13
edit.vue
src/views/ecw/customer/edit.vue
+42
-13
No files found.
src/views/ecw/customer/edit.vue
View file @
e57c9d09
...
@@ -690,7 +690,11 @@ export default {
...
@@ -690,7 +690,11 @@ export default {
},
},
contactRules
:
{
contactRules
:
{
name
:
[{
required
:
true
,
message
:
this
.
$t
(
'
请输入联系人
'
),
trigger
:
"
blur
"
}],
name
:
[{
required
:
true
,
message
:
this
.
$t
(
'
请输入联系人
'
),
trigger
:
"
blur
"
}],
areaCode
:
[{
required
:
true
,
message
:
this
.
$t
(
'
请选择区号
'
),
trigger
:
"
change
"
}],
areaCode
:
[{
required
:
true
,
message
:
this
.
$t
(
'
请选择区号
'
),
trigger
:
"
change
"
},{
required
:
true
,
trigger
:
'
change
'
,
validator
:
this
.
codeValidator
}],
phoneNew
:
[{
phoneNew
:
[{
required
:
true
,
required
:
true
,
trigger
:
"
blur
"
,
trigger
:
"
blur
"
,
...
@@ -772,20 +776,45 @@ export default {
...
@@ -772,20 +776,45 @@ export default {
phoneValidator
(
rule
,
value
,
callback
){
phoneValidator
(
rule
,
value
,
callback
){
if
(
!
value
)
{
if
(
!
value
)
{
return
callback
(
new
Error
(
this
.
$t
(
'
请输入联系方式
'
)));
return
callback
(
new
Error
(
this
.
$t
(
'
请输入联系方式
'
)));
}
}
validatorMobile
({
let
areaCode
=
this
.
form
.
customerContacts
.
find
(
e
=>
e
.
phoneNew
===
value
).
areaCode
code
:
this
.
form
.
customerContacts
.
find
(
e
=>
e
.
phoneNew
===
value
).
areaCode
,
if
(
areaCode
){
mobile
:
value
validatorMobile
({
}).
then
(
r
=>
{
code
:
areaCode
,
if
(
r
.
data
){
mobile
:
value
}).
then
(
r
=>
{
if
(
r
.
data
){
callback
()
}
else
{
callback
(
new
Error
(
r
.
msg
||
this
.
$t
(
'
手机号验证失败
'
)))
}
}).
catch
(
e
=>
{
console
.
error
(
e
)
callback
(
new
Error
(
this
.
$t
(
'
手机号验证失败
'
)))
})
}
},
codeValidator
(
rule
,
value
,
callback
){
let
index
=
+
(
rule
.
field
.
split
(
'
.
'
)[
1
])
let
phone
=
this
.
form
.
customerContacts
[
index
].
phoneNew
if
(
phone
){
validatorMobile
({
code
:
value
,
mobile
:
phone
}).
then
(
r
=>
{
if
(
r
.
data
){
callback
()
}
else
{
callback
()
this
.
$message
.
error
(
r
.
msg
||
this
.
$t
(
'
手机号验证失败
'
))
}
}).
catch
(
e
=>
{
console
.
error
(
e
)
callback
()
callback
()
}
else
{
this
.
$message
.
error
(
this
.
$t
(
'
手机号验证失败
'
))
callback
(
new
Error
(
r
.
msg
||
this
.
$t
(
'
手机号验证失败
'
)))
})
}
}
}).
catch
(
e
=>
{
console
.
error
(
e
)
callback
(
new
Error
(
this
.
$t
(
'
手机号验证失败
'
)))
})
},
},
handleDefaultChange
(
$index
){
handleDefaultChange
(
$index
){
// 只有一个联系人,设置成非默认
// 只有一个联系人,设置成非默认
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment