Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
template_pda_Web
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
胡宝山
template_pda_Web
Commits
2d3a8ec9
Commit
2d3a8ec9
authored
Mar 25, 2024
by
Hagsn3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改表单验证问题
parent
64467e44
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
85 deletions
+73
-85
enterbound.vue
src/views/setup/enterbound.vue
+73
-85
No files found.
src/views/setup/enterbound.vue
View file @
2d3a8ec9
...
...
@@ -66,10 +66,11 @@
<
script
>
import
{
batchAddIncomeWmsBox
,
getJcCode
,
queryPass
batchAddIncomeWmsBox
,
getJcCode
,
queryPass
}
from
'@/api/incomeWmsBox'
import
{
findByLocation
,
updateIncomeWmsLabel
}
from
'@/api/incomeWmsLabel'
import
{
getInfo
}
from
'@/api/login'
import
{
error
}
from
'autoprefixer/lib/utils'
export
default
{
name
:
'EnterBound'
,
data
()
{
...
...
@@ -98,7 +99,7 @@ export default {
rules
:
{
value1
:
[
{
required
:
true
,
message
:
'请输入barcode的值'
,
trigger
:
'blur'
},
{
pattern
:
/^
[
a-zA-Z0-9
]
+,
[
a-zA-Z0-9
]
+$/
|
/^
[
a-zA-Z0-9
]
+
$/
,
message
:
'输入值不符合格式要求,请重新输入'
,
trigger
:
'blur'
}
{
pattern
:
/^
.*,.*/
|
/^.*
$/
,
message
:
'输入值不符合格式要求,请重新输入'
,
trigger
:
'blur'
}
],
value2
:
[
{
pattern
:
/^
[^
:
]
+:
[^
:
]
+:
[^
:
]
+:
\d
+$/
,
message
:
'输入值不符合格式要求,请重新输入'
,
trigger
:
'blur'
}
...
...
@@ -167,12 +168,11 @@ export default {
}).
then
(()
=>
{
this
.
$refs
.
queryForm
.
validate
(
valid
=>
{
if
(
valid
&&
this
.
enterTable
.
length
>
0
)
{
const
obj
=
{
boxList
:
this
.
enterTable
}
batchAddIncomeWmsBox
(
obj
).
then
(
res
=>
{
console
.
log
(
'res'
,
res
)
console
.
log
(
'res'
,
res
)
if
(
res
.
code
===
200
)
{
this
.
msgSuccess
(
'新增成功'
)
this
.
clearForm
()
...
...
@@ -220,72 +220,27 @@ export default {
if
(
!
that
.
$refs
[
'input'
+
i
])
{
return
}
const
inputValues
=
this
.
queryForm
.
value1
.
split
(
','
)
if
(
inputValues
.
length
===
2
)
{
// 输入值必须是两个值以逗号分隔
// 允许字母和数字的组合
const
isValidFormat
=
/^
[
a-zA-Z0-9
]
+$/
.
test
(
inputValues
[
0
].
trim
())
&&
/^
[
a-zA-Z0-9
]
+$/
.
test
(
inputValues
[
1
].
trim
())
if
(
isValidFormat
)
{
this
.
queryForm
.
location
=
inputValues
[
0
].
trim
()
this
.
queryForm
.
pn
=
inputValues
[
1
].
trim
()
console
.
log
(
'location'
,
this
.
queryForm
.
location
)
findByLocation
(
this
.
queryForm
.
location
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
console
.
log
(
'resDate'
,
res
.
data
)
if
(
res
.
data
!=
null
)
{
if
(
res
.
data
.
pn
!==
null
&&
res
.
data
.
pn
!==
''
)
{
this
.
incomeWmsLabelList
=
res
.
data
// this.getOrderCode()
that
.
$nextTick
(()
=>
{
e
.
target
.
blur
()
const
index
=
i
+
1
that
.
$refs
[
'input'
+
index
].
focus
()
})
}
else
{
this
.
incomeWmsLabelList
=
res
.
data
that
.
$nextTick
(()
=>
{
e
.
target
.
blur
()
const
index
=
i
+
1
that
.
$refs
[
'input'
+
index
].
focus
()
})
}
}
else
{
this
.
$message
.
error
(
'数据库中无对应数据'
)
}
}
})
// 输入值符合格式要求,执行相应的逻辑
}
else
{
// 输入值不符合格式要求,进行报错处理
this
.
$refs
.
queryForm
.
validateField
(
'value1'
,
(
error
)
=>
{
if
(
error
)
{
this
.
$message
.
error
(
'输入值不符合格式要求,请重新输入'
)
}
}
else
{
if
(
inputValues
.
length
===
1
)
{
const
isValidFormat
=
/^
[
a-zA-Z0-9
]
+$/
.
test
(
inputValues
[
0
].
trim
())
if
(
isValidFormat
)
{
}
else
{
const
inputValues
=
this
.
queryForm
.
value1
.
split
(
','
)
if
(
inputValues
.
length
===
2
)
{
this
.
queryForm
.
location
=
inputValues
[
0
].
trim
()
this
.
queryForm
.
pn
=
inputValues
[
1
].
trim
()
console
.
log
(
'location'
,
this
.
queryForm
.
location
)
findByLocation
(
this
.
queryForm
.
location
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
console
.
log
(
'resDate'
,
res
.
data
)
if
(
res
.
data
!=
null
)
{
if
(
res
.
data
.
pn
!==
null
&&
res
.
data
.
pn
!==
''
)
{
if
(
res
.
data
.
pn
!==
this
.
queryForm
.
pn
)
{
this
.
incomeWmsLabelList
=
res
.
data
that
.
$nextTick
(()
=>
{
e
.
target
.
blur
()
const
index
=
i
+
1
that
.
$refs
[
'input'
+
index
].
focus
()
})
}
else
{
this
.
incomeWmsLabelList
=
res
.
data
// this.getOrderCode()
that
.
$nextTick
(()
=>
{
e
.
target
.
blur
()
const
index
=
i
+
1
that
.
$refs
[
'input'
+
index
].
focus
()
})
}
this
.
incomeWmsLabelList
=
res
.
data
// this.getOrderCode()
that
.
$nextTick
(()
=>
{
e
.
target
.
blur
()
const
index
=
i
+
1
that
.
$refs
[
'input'
+
index
].
focus
()
})
}
else
{
this
.
incomeWmsLabelList
=
res
.
data
that
.
$nextTick
(()
=>
{
...
...
@@ -299,16 +254,51 @@ export default {
}
}
})
// 输入值符合格式要求,执行相应的逻辑
}
else
{
// 输入值不符合格式要求,进行报错处理
this
.
$message
.
error
(
'输入值不符合格式要求,请重新输入'
)
if
(
inputValues
.
length
===
1
)
{
this
.
queryForm
.
location
=
inputValues
[
0
].
trim
()
console
.
log
(
'location'
,
this
.
queryForm
.
location
)
findByLocation
(
this
.
queryForm
.
location
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
console
.
log
(
'resDate'
,
res
.
data
)
if
(
res
.
data
!=
null
)
{
if
(
res
.
data
.
pn
!==
null
&&
res
.
data
.
pn
!==
''
)
{
if
(
res
.
data
.
pn
!==
this
.
queryForm
.
pn
)
{
this
.
incomeWmsLabelList
=
res
.
data
that
.
$nextTick
(()
=>
{
e
.
target
.
blur
()
const
index
=
i
+
1
that
.
$refs
[
'input'
+
index
].
focus
()
})
}
else
{
this
.
incomeWmsLabelList
=
res
.
data
// this.getOrderCode()
that
.
$nextTick
(()
=>
{
e
.
target
.
blur
()
const
index
=
i
+
1
that
.
$refs
[
'input'
+
index
].
focus
()
})
}
}
else
{
this
.
incomeWmsLabelList
=
res
.
data
that
.
$nextTick
(()
=>
{
e
.
target
.
blur
()
const
index
=
i
+
1
that
.
$refs
[
'input'
+
index
].
focus
()
})
}
}
else
{
this
.
$message
.
error
(
'数据库中无对应数据'
)
}
}
})
}
else
{
// 输入值不符合格式要求,进行报错处理
this
.
$message
.
error
(
'输入值不符合格式要求,请重新输入'
)
}
}
}
else
{
// 输入值不符合格式要求,进行报错处理
this
.
$message
.
error
(
'输入值不符合格式要求,请重新输入'
)
}
}
}
)
},
/**
* @description: 一开始将焦点聚焦到第一个输入框下
...
...
@@ -328,23 +318,25 @@ export default {
* @return:
**/
addList
()
{
const
inputPattern
=
/.+:.+:.+:
\d
+/
if
(
inputPattern
.
test
(
this
.
queryForm
.
value2
))
{
const
values
=
this
.
queryForm
.
value2
.
split
(
':'
)
// 校验第三个值是否为整数
if
(
/^
\d
+$/
.
test
(
values
[
3
]))
{
this
.
$refs
.
queryForm
.
validateField
(
'value2'
,
(
error
)
=>
{
if
(
error
)
{
this
.
$message
.
error
(
'输入值不符合格式要求,请重新输入'
)
}
else
{
const
values
=
this
.
queryForm
.
value2
.
split
(
':'
)
// 校验第三个值是否为整数
// if (/^\d+$/.test(values[3])) {
const
obj
=
{
lot
:
values
[
0
],
pn
:
values
[
1
],
qty
:
parseInt
(
values
[
3
]),
rank
:
values
[
2
],
labelId
:
this
.
incomeWmsLabelList
.
businessId
,
orderCode
:
this
.
incomeWmsBoxList
.
order_code
,
orderCode
:
this
.
incomeWmsBoxList
.
order_code
}
// this.incomeWmsBoxList.pn = values[1]
console
.
log
(
obj
)
if
(
obj
.
labelId
!==
null
&&
obj
.
labelId
!==
''
&&
obj
.
labelId
!==
undefined
)
{
if
(
this
.
incomeWmsLabelList
.
pn
&&
this
.
incomeWmsLabelList
.
pn
!==
''
&&
this
.
incomeWmsLabelList
.
pn
!==
undefined
)
{
if
(
this
.
incomeWmsLabelList
.
pn
&&
this
.
incomeWmsLabelList
.
pn
!==
''
&&
this
.
incomeWmsLabelList
.
pn
!==
undefined
)
{
if
(
obj
.
pn
!==
this
.
incomeWmsLabelList
.
pn
)
{
this
.
$message
.
error
(
'输入的pn值与数据库中不匹配,请重新输入'
)
// this.incomeWmsBoxList.pn = obj.pn
...
...
@@ -425,16 +417,12 @@ export default {
}
else
{
this
.
$message
.
error
(
'输入格式不符合要求,请重新输入'
)
}
}
else
{
this
.
$message
.
error
(
'qty的值必须为整数!'
)
// }
// else {
// this.$message.error('qty的值必须为整数!')
// }
}
}
else
{
// 输入格式不符合要求,进行相应处理1
this
.
$message
.
error
(
'输入格式不符合要求,请重新输入'
)
}
console
.
log
(
'this.queryForm.lot'
,
this
.
queryForm
.
lot
)
console
.
log
(
'this.queryForm.rank'
,
this
.
queryForm
.
rank
)
console
.
log
(
'this.queryForm.qty'
,
this
.
queryForm
.
qty
)
})
},
/**
* @description: 删除数据中元素
...
...
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