Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cy-admin-ui
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
webpack
cy-admin-ui
Commits
6d2ee4be
Commit
6d2ee4be
authored
Feb 09, 2022
by
毛线
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
81e463d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
layout-form.vue
packages/layout/src/layout-form.vue
+6
-7
No files found.
packages/layout/src/layout-form.vue
View file @
6d2ee4be
...
@@ -99,7 +99,7 @@ export default {
...
@@ -99,7 +99,7 @@ export default {
// 主键
// 主键
id
()
{
id
()
{
const
{
primaryKey
}
=
this
const
{
primaryKey
}
=
this
return
this
.
form
[
primaryKey
]
return
this
.
form
?
this
.
form
[
primaryKey
]
:
''
},
},
width
()
{
width
()
{
return
this
.
props
.
width
||
'900px'
return
this
.
props
.
width
||
'900px'
...
@@ -201,7 +201,7 @@ export default {
...
@@ -201,7 +201,7 @@ export default {
return
{
return
{
// 初始化表单数据
// 初始化表单数据
form
:
(
data
)
=>
{
form
:
(
data
)
=>
{
const
{
fieldList
}
=
this
const
{
fieldList
,
primaryKey
}
=
this
let
form
=
{}
let
form
=
{}
if
(
!
fieldList
)
{
if
(
!
fieldList
)
{
return
return
...
@@ -235,7 +235,7 @@ export default {
...
@@ -235,7 +235,7 @@ export default {
break
break
}
}
}
}
value
=
value
||
''
value
=
value
||
''
attr
.
placeholder
=
placeholder
attr
.
placeholder
=
placeholder
item
.
attr
=
attr
item
.
attr
=
attr
...
@@ -243,7 +243,8 @@ export default {
...
@@ -243,7 +243,8 @@ export default {
form
[
field
]
=
value
form
[
field
]
=
value
})
})
form
[
primaryKey
]
=
data
[
primaryKey
]
// 如果配置参数设置了编辑时候清空某个表单字段,则将字段的值清空
// 如果配置参数设置了编辑时候清空某个表单字段,则将字段的值清空
Object
.
keys
(
data
).
forEach
(
key
=>
{
Object
.
keys
(
data
).
forEach
(
key
=>
{
const
field
=
fieldList
.
filter
(
i
=>
i
.
field
==
key
)[
0
]
const
field
=
fieldList
.
filter
(
i
=>
i
.
field
==
key
)[
0
]
...
@@ -261,7 +262,6 @@ export default {
...
@@ -261,7 +262,6 @@ export default {
}
}
}
}
this
.
form
=
form
this
.
form
=
form
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
// 清除表单验证
// 清除表单验证
this
.
$refs
[
'form'
]?.
clearValidate
()
this
.
$refs
[
'form'
]?.
clearValidate
()
...
@@ -282,8 +282,7 @@ export default {
...
@@ -282,8 +282,7 @@ export default {
// 请求成功并返回数据
// 请求成功并返回数据
this
.
loading
=
false
// 关闭表单加载状态
this
.
loading
=
false
// 关闭表单加载状态
if
(
this
.
id
)
{
// id存在 把数据存储到当前页面
if
(
this
.
id
)
{
// id存在 把数据存储到当前页面
const
{
form
}
=
data
this
.
form
=
data
this
.
form
=
form
}
}
}
}
...
...
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