Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
template_vue
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_vue
Commits
75f6adf9
Commit
75f6adf9
authored
Sep 21, 2023
by
shifangwuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
9/21测试版
parent
41899b23
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
120 additions
and
48 deletions
+120
-48
index.vue
src/views/production/gfual/index.vue
+120
-48
No files found.
src/views/production/gfual/index.vue
View file @
75f6adf9
...
...
@@ -292,7 +292,42 @@ export default {
pn
:
[{
required
:
true
,
message
:
'请输入pn'
,
trigger
:
'blur'
}],
lot
:
[{
required
:
true
,
message
:
'请输入lot'
,
trigger
:
'blur'
}],
gx
:
[{
required
:
true
,
message
:
'请选择gx'
,
trigger
:
'blur'
}],
machine
:
[{
required
:
true
,
message
:
'请输入machine'
,
trigger
:
'blur'
}]
machine
:
[{
required
:
true
,
message
:
'请输入machine'
,
trigger
:
'blur'
}],
jbcode
:
[
{
validator
:
(
rule
,
value
,
callback
)
=>
{
this
.
validateField
(
value
,
callback
,
'jbcode'
);
},
trigger
:
'blur'
,
},
],
wbcode
:
[
{
validator
:
(
rule
,
value
,
callback
)
=>
{
this
.
validateField
(
value
,
callback
,
'wbcode'
);
},
trigger
:
'blur'
,
},
],
wblot
:
[
{
validator
:
(
rule
,
value
,
callback
)
=>
{
this
.
validateField
(
value
,
callback
,
'wblot'
);
},
trigger
:
'blur'
,
},
],
jlcod
:
[
{
validator
:
(
rule
,
value
,
callback
)
=>
{
this
.
validateField
(
value
,
callback
,
'jlcod'
);
},
trigger
:
'blur'
,
},
],
},
pissbList
:
[],
pgxList
:
[
...
...
@@ -348,6 +383,13 @@ export default {
this
.
init
()
},
methods
:
{
validateField
(
value
,
callback
,
fieldName
)
{
if
(
this
[
fieldName
+
'Enabled'
]
&&
!
value
.
trim
())
{
callback
(
new
Error
(
fieldName
+
'不能为空'
));
}
else
{
callback
();
}
},
handlePgxChange
()
{
if
(
this
.
phdList
.
includes
(
this
.
form
.
pgx
))
{
this
.
isRequired
=
true
...
...
@@ -519,59 +561,89 @@ export default {
this
.
getDict
()
},
// 保存时要调的接口
// 提交表单
submitForm
()
{
this
.
$confirm
(
'是否确认保存?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
this
.
$refs
.
form
.
validate
((
valid
)
=>
{
if
(
valid
)
{
//if(){
// 验证通过,继续处理 jlvalidDate 字段
const
jlcodParts
=
this
.
form
.
jlcod
.
split
(
','
)
const
jlvalidDatePart
=
jlcodParts
[
2
]
||
''
this
.
$refs
.
form
.
validate
((
valid
)
=>
{
if
(
valid
)
{
// 验证通过,继续处理 jlvalidDate 字段
const
jlcodParts
=
this
.
form
.
jlcod
.
split
(
','
);
const
jlvalidDatePart
=
jlcodParts
[
2
]
||
''
;
if
(
jlvalidDatePart
.
trim
()
!==
''
)
{
const
jlvalidDateRegex
=
/^
\d{4}\/\d{2}\/\d{2}
$/
// 正则表达式用于验证 'yyyy/mm/dd' 格式
if
(
jlvalidDateRegex
.
test
(
jlvalidDatePart
))
{
// jlvalidDate 格式正确,可以继续保存操作
addApplication
(
this
.
form
).
then
(
res
=>
{
console
.
log
(
'res'
,
res
)
if
(
res
.
code
===
200
)
{
if
(
res
.
data
!==
null
)
{
this
.
$message
({
showClose
:
true
,
message
:
'保存成功'
,
type
:
'success'
,
duration
:
5000
})
}
this
.
resetForm
()
}
else
if
(
res
.
code
===
null
)
{
this
.
$message
({
showClose
:
true
,
message
:
res
.
message
,
type
:
'error'
,
duration
:
10000
})
}
})
// 校验 jlvalidDate 字段格式
const
jlvalidDateRegex
=
/^
\d{4}\/\d{2}\/\d{2}
$/
;
// yyyy/mm/dd 格式
if
(
jlvalidDatePart
.
trim
()
===
''
||
jlvalidDateRegex
.
test
(
jlvalidDatePart
))
{
// 如果 jlvalidDate 符合格式或为空,执行保存操作
addApplication
(
this
.
form
)
.
then
((
res
)
=>
{
console
.
log
(
'res'
,
res
);
if
(
res
.
code
===
200
)
{
if
(
res
.
data
!==
null
)
{
// 保存成功,重置表单和字段状态
this
.
setFieldEnabledStatus
(
false
);
this
.
form
.
jbcode
=
''
this
.
form
.
wbcode
=
''
this
.
form
.
wblot
=
''
this
.
form
.
jlcod
=
''
this
.
form
.
unlockUsername
=
''
this
.
$message
({
showClose
:
true
,
message
:
'保存成功'
,
type
:
'success'
,
duration
:
5000
,
});
this
.
resetForm
();
}
}
else
{
// jlvalidDate 格式不正确,显示错误提示
this
.
$message
({
showClose
:
true
,
message
:
'jlcod 中的 jlbzq 不符合规范,请输入有效的日期格式(yyyy-mm-dd)'
,
type
:
'error'
,
duration
:
5000
})
// 保存失败,设置字段状态和显示错误消息
this
.
setFieldEnabledStatus
(
false
);
this
.
showErrorMessage
(
res
.
message
);
}
}
//}
})
.
catch
(()
=>
{
// 请求失败,设置字段状态
this
.
setFieldEnabledStatus
(
false
);
this
.
showErrorMessage
(
'保存失败'
);
this
.
jbcodeEnabled
=
false
this
.
wbcodeEnabled
=
false
this
.
wblotEnabled
=
false
this
.
jlcodEnabled
=
false
this
.
queryInputsEnabled
=
true
this
.
lockUserEnabled
=
true
this
.
unlockButtonVisible
=
true
,
this
.
form
.
jbcode
=
''
this
.
form
.
wbcode
=
''
this
.
form
.
wblot
=
''
this
.
form
.
jlcod
=
''
this
.
form
.
lockUser
=
''
});
}
else
{
// jlvalidDate 不符合格式,显示错误消息
this
.
showErrorMessage
(
'jlcod 中的 jlbzq 不符合规范,请输入有效的日期格式(yyyy/mm/dd)'
);
}
})
})
}
});
},
// 设置字段状态
setFieldEnabledStatus
(
enabled
)
{
this
.
jbcodeEnabled
=
enabled
;
this
.
wbcodeEnabled
=
enabled
;
this
.
wblotEnabled
=
enabled
;
this
.
jlcodEnabled
=
enabled
;
this
.
queryInputsEnabled
=
!
enabled
;
this
.
lockUserEnabled
=
enabled
;
this
.
unlockButtonVisible
=
enabled
;
},
// 显示错误消息
showErrorMessage
(
message
)
{
this
.
$message
({
showClose
:
true
,
message
,
type
:
'error'
,
duration
:
5000
,
});
},
// 调数据字典查询
getDict
()
{
...
...
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