Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6f7a785c
authored
Mar 09, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 优化配置管理的 loading 设置
parent
d24d9e69
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
src/views/infra/config/form.vue
+9
-5
No files found.
src/views/infra/config/form.vue
View file @
6f7a785c
...
...
@@ -32,7 +32,7 @@
</el-form>
<template
#
footer
>
<div
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm
"
>
确 定
</el-button>
<el-button
@
click=
"submitForm"
type=
"primary"
:disabled=
"formLoading
"
>
确 定
</el-button>
<el-button
@
click=
"colseForm(ruleFormRef)"
>
取 消
</el-button>
</div>
</
template
>
...
...
@@ -48,9 +48,8 @@ const message = useMessage() // 消息弹窗
const
modelVisible
=
ref
(
false
)
// 弹窗的是否展示
const
modelTitle
=
ref
(
''
)
// 弹窗的标题
const
formLoading
=
ref
(
false
)
// 表单的
数据 Loading 加载
const
formLoading
=
ref
(
false
)
// 表单的
Loading 加载:1)修改时的数据加载;2)提交的按钮禁用
const
formType
=
ref
(
''
)
// 表单的类型:create - 新增;update - 修改
const
submitLoading
=
ref
(
false
)
// 操作按钮的 Loading 加载:避免重复提交
// let formRef = ref() // 表单的 Ref
const
formData
=
reactive
({
id
:
undefined
,
...
...
@@ -95,13 +94,18 @@ defineExpose({ openModal }) // 提供 openModal 方法,用于打开弹窗
/** 提交表单 */
const
emit
=
defineEmits
([
'success'
])
// 定义 success 事件,用于操作成功后的回调
const
submitForm
=
async
()
=>
{
if
(
true
)
{
formLoading
.
value
=
true
console
.
log
(
'1111'
)
return
}
const
formRef
=
proxy
.
$refs
[
'formRef'
]
// 校验表单
if
(
!
formRef
)
return
const
valid
=
await
formRef
.
validate
()
if
(
!
valid
)
return
// 提交请求
submit
Loading
.
value
=
true
form
Loading
.
value
=
true
try
{
const
data
=
formData
as
ConfigApi
.
ConfigVO
if
(
formType
.
value
===
'create'
)
{
...
...
@@ -114,7 +118,7 @@ const submitForm = async () => {
modelVisible
.
value
=
false
emit
(
'success'
)
}
finally
{
submit
Loading
.
value
=
false
form
Loading
.
value
=
false
}
}
...
...
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