Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Chatopera OpenSource
/
ferry_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
51324228
authored
Jun 03, 2021
by
lanyulei
Committed by
GitHub
Jun 03, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #76 from lanyulei/dev
fix: 修复子表单内标签不验证数据的问题。#190
parents
de36047c
5a394dba
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
11 deletions
src/components/VueFormMaking/components/GenerateForm.vue
src/components/VueFormMaking/components/GenerateFormItem.vue
src/components/VueFormMaking/components/GenerateForm.vue
View file @
51324228
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
:label-width=
"data.config.labelWidth + 'px'"
:label-width=
"data.config.labelWidth + 'px'"
>
>
<template
v-for=
"item in data.list"
>
<template
v-for=
"item in data.list"
>
<template
v-if=
"item.type == 'grid'"
>
<template
v-if=
"item.type == 'grid'"
>
<el-row
<el-row
:key=
"item.key"
:key=
"item.key"
...
@@ -20,7 +19,6 @@
...
@@ -20,7 +19,6 @@
:align=
"item.options.align"
:align=
"item.options.align"
>
>
<el-col
v-for=
"(col, colIndex) in item.columns"
:key=
"colIndex"
:span=
"col.span"
>
<el-col
v-for=
"(col, colIndex) in item.columns"
:key=
"colIndex"
:span=
"col.span"
>
<template
v-for=
"citem in col.list"
>
<template
v-for=
"citem in col.list"
>
<el-form-item
v-if=
"citem.type=='blank'"
:key=
"citem.key"
:label=
"citem.name"
:prop=
"citem.model"
>
<el-form-item
v-if=
"citem.type=='blank'"
:key=
"citem.key"
:label=
"citem.name"
:prop=
"citem.model"
>
<slot
:name=
"citem.model"
:model=
"models"
/>
<slot
:name=
"citem.model"
:model=
"models"
/>
...
@@ -31,9 +29,9 @@
...
@@ -31,9 +29,9 @@
:preview=
"preview"
:preview=
"preview"
:models
.
sync=
"models"
:models
.
sync=
"models"
:remote=
"remote"
:remote=
"remote"
:rules=
"rules"
:widget=
"citem"
:widget=
"citem"
:data=
"data"
:data=
"data"
:prop-value=
"citem.model"
@
input-change=
"onInputChange"
@
input-change=
"onInputChange"
/>
/>
</
template
>
</
template
>
...
@@ -47,18 +45,18 @@
...
@@ -47,18 +45,18 @@
</el-form-item>
</el-form-item>
</
template
>
</
template
>
<!-- 子表单 -->
<!-- 子表单 -->
<
template
v-if=
"item.type === 'subform'"
>
<
template
v-
else-
if=
"item.type === 'subform'"
>
<el-form-item
<el-form-item
:key=
"item.key"
:key=
"item.key"
:label-width=
"!item.options.labelWidthStatus?'0px': item.options.labelWidth + 'px'"
:label-width=
"!item.options.labelWidthStatus?'0px': item.options.labelWidth + 'px'"
:label=
"!item.options.labelWidthStatus?'':item.name"
:label=
"!item.options.labelWidthStatus?'':item.name"
:prop=
"item.model"
>
>
<el-table
<el-table
:data=
"models[item.model]"
:data=
"models[item.model]"
border
border
style=
"width: 100%"
style=
"width: 100%"
:header-cell-style=
"
{padding: '5px 0'}"
:header-cell-style=
"
{padding: '5px 0'}"
size="mini"
>
>
<el-table-column
<el-table-column
v-if=
"!preview"
v-if=
"!preview"
...
@@ -71,22 +69,21 @@
...
@@ -71,22 +69,21 @@
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<i
style=
"font-size: 25px; color: red"
class=
"el-icon-remove"
@
click=
"delSubformCol(item, scope.$index)"
/>
<i
style=
"font-size: 25px; color: red"
class=
"el-icon-remove"
@
click=
"delSubformCol(item, scope.$index)"
/>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<
template
v-for=
"(c, i) in item.columns"
>
<
template
v-for=
"(c, i) in item.columns"
>
<div
:key=
"i"
>
<div
:key=
"i"
>
<el-table-column
<el-table-column
v-for=
"v in c.list"
v-for=
"v in c.list"
:key=
"v.key"
:key=
"v.key"
:prop=
"v.mod
a
l"
:prop=
"v.mod
e
l"
:label=
"v.name"
:label=
"v.name"
min-width=
"250"
min-width=
"250"
>
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
<genetate-form-item
<genetate-form-item
:prop-value=
"item.model + '.' + scope.$index + '.' + v.model"
:preview=
"preview"
:preview=
"preview"
:models
.
sync=
"models"
:models
.
sync=
"models"
:rules=
"rules"
:widget=
"v"
:widget=
"v"
:remote=
"remote"
:remote=
"remote"
:data=
"data"
:data=
"data"
...
@@ -106,9 +103,9 @@
...
@@ -106,9 +103,9 @@
<
template
v-else
>
<
template
v-else
>
<genetate-form-item
<genetate-form-item
:key=
"item.key"
:key=
"item.key"
:prop-value=
"item.model"
:preview=
"preview"
:preview=
"preview"
:models
.
sync=
"models"
:models
.
sync=
"models"
:rules=
"rules"
:widget=
"item"
:widget=
"item"
:remote=
"remote"
:remote=
"remote"
:data=
"data"
:data=
"data"
...
@@ -169,6 +166,20 @@ export default {
...
@@ -169,6 +166,20 @@ export default {
}
else
{
}
else
{
subformFields
[
l
.
model
]
=
""
subformFields
[
l
.
model
]
=
""
}
}
if
(
this
.
rules
[
item
.
model
]
===
undefined
)
{
this
.
rules
[
item
.
model
]
=
[]
}
if
(
this
.
rules
[
item
.
model
][
this
.
models
[
item
.
model
].
length
]
===
undefined
)
{
this
.
rules
[
item
.
model
][
this
.
models
[
item
.
model
].
length
]
=
{}
}
this
.
rules
[
item
.
model
][
this
.
models
[
item
.
model
].
length
][
l
.
model
]
=
[...
l
.
rules
.
map
(
item
=>
{
if
(
item
.
pattern
)
{
return
{
...
item
,
pattern
:
eval
(
item
.
pattern
)
}
}
else
{
return
{
...
item
}
}
})]
}
}
}
}
this
.
models
[
item
.
model
].
push
(
subformFields
)
this
.
models
[
item
.
model
].
push
(
subformFields
)
...
...
src/components/VueFormMaking/components/GenerateFormItem.vue
View file @
51324228
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
v-if=
"showStatus"
v-if=
"showStatus"
:label-width=
"isLabel===false||!widget.options.labelWidthStatus?'0px': widgetLabelWidth + 'px'"
:label-width=
"isLabel===false||!widget.options.labelWidthStatus?'0px': widgetLabelWidth + 'px'"
:label=
"isLabel===false||widget.type==='divider' || !widget.options.labelWidthStatus?'':widget.name"
:label=
"isLabel===false||widget.type==='divider' || !widget.options.labelWidthStatus?'':widget.name"
:prop=
"
widget.model
"
:prop=
"
propValue
"
:style=
"subformIndex !== undefined?
{'margin-bottom': '0'}: {}"
:style=
"subformIndex !== undefined?
{'margin-bottom': '0'}: {}"
>
>
<template
v-if=
"preview"
>
<template
v-if=
"preview"
>
...
@@ -335,7 +335,7 @@ export default {
...
@@ -335,7 +335,7 @@ export default {
FileUpload
FileUpload
},
},
/* eslint-disable */
/* eslint-disable */
props
:
[
'widget'
,
'models'
,
'
rules
'
,
'remote'
,
'data'
,
'disabled'
,
'preview'
,
'isLabel'
,
'subformIndex'
,
'subformModel'
],
props
:
[
'widget'
,
'models'
,
'
propValue
'
,
'remote'
,
'data'
,
'disabled'
,
'preview'
,
'isLabel'
,
'subformIndex'
,
'subformModel'
],
data
()
{
data
()
{
return
{
return
{
showStatus
:
true
,
showStatus
:
true
,
...
...
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