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
ba7cfd53
authored
Sep 30, 2020
by
YuleiLan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增子表单功能。
parent
f28e9536
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
22 deletions
src/components/VueFormMaking/components/GenerateForm.vue
src/components/VueFormMaking/components/GenerateFormItem.vue
src/components/VueFormMaking/components/GenerateForm.vue
View file @
ba7cfd53
...
...
@@ -58,8 +58,10 @@
:data=
"models[item.model]"
border
style=
"width: 100%"
:header-cell-style=
"
{padding: '5px 0'}"
>
<el-table-column
v-if=
"!preview"
fixed
width=
"50"
>
...
...
@@ -92,7 +94,6 @@
:is-label=
"false"
:subform-index=
"scope.$index"
:subform-model=
"item.model"
@
input-change=
"onSubformInputChange"
/>
</
template
>
</el-table-column>
...
...
@@ -224,12 +225,8 @@ export default {
reset
()
{
this
.
$refs
.
generateForm
.
resetFields
()
},
onSubformInputChange
(
value
,
field
,
index
)
{
console
.
log
(
value
,
field
,
index
)
// this.$emit('on-change', field, value, this.models)
},
onInputChange
(
value
,
field
)
{
this
.
$emit
(
'on-change'
,
field
,
value
,
this
.
models
)
//
this.$emit('on-change', field, value, this.models)
},
refresh
()
{
...
...
src/components/VueFormMaking/components/GenerateFormItem.vue
View file @
ba7cfd53
...
...
@@ -3,6 +3,7 @@
:label-width=
"isLabel===false||!widget.options.labelWidthStatus?'0px': widgetLabelWidth + 'px'"
:label=
"isLabel===false||widget.type==='divider' || !widget.options.labelWidthStatus?'':widget.name"
:prop=
"widget.model"
:style=
"subformIndex !== undefined?
{'margin-bottom': '0'}: {}"
>
<template
v-if=
"preview"
>
<template
v-if=
"widget.type === 'color'"
>
...
...
@@ -327,7 +328,7 @@ export default {
data
()
{
return
{
widgetLabelWidth
:
''
,
dataModel
:
this
.
models
[
this
.
widget
.
model
],
dataModel
:
this
.
subformIndex
===
undefined
?
this
.
models
[
this
.
widget
.
model
]:
this
.
models
[
this
.
subformModel
][
this
.
subformIndex
]
[
this
.
widget
.
model
],
tableData
:
[]
}
},
...
...
@@ -335,27 +336,33 @@ export default {
dataModel
:
{
deep
:
true
,
handler
(
val
)
{
if
(
this
.
subformIndex
!==
undefined
)
{
this
.
models
[
this
.
subformModel
][
this
.
subformIndex
][
this
.
widget
.
model
]
=
val
this
.
$emit
(
'update:models'
,
{
...
this
.
models
[
this
.
subformModel
][
this
.
subformIndex
],
[
this
.
widget
.
model
]:
val
})
this
.
$emit
(
'input-change'
,
val
,
this
.
widget
.
model
,
this
.
subformIndex
)
}
else
{
this
.
models
[
this
.
widget
.
model
]
=
val
this
.
$emit
(
'update:models'
,
{
...
this
.
models
,
[
this
.
widget
.
model
]:
val
})
this
.
$emit
(
'input-change'
,
val
,
this
.
widget
.
model
)
if
(
val
!==
undefined
)
{
if
(
this
.
subformIndex
!==
undefined
)
{
this
.
models
[
this
.
subformModel
][
this
.
subformIndex
][
this
.
widget
.
model
]
=
val
this
.
$emit
(
'update:models'
,
{
...
this
.
models
,
[
this
.
subformModel
]:
this
.
models
[
this
.
subformModel
]
})
this
.
$emit
(
'input-change'
,
val
,
this
.
widget
.
model
,
this
.
subformIndex
)
}
else
{
this
.
models
[
this
.
widget
.
model
]
=
val
this
.
$emit
(
'update:models'
,
{
...
this
.
models
,
[
this
.
widget
.
model
]:
val
})
this
.
$emit
(
'input-change'
,
val
,
this
.
widget
.
model
)
}
}
}
},
models
:
{
deep
:
true
,
handler
(
val
)
{
this
.
dataModel
=
val
[
this
.
widget
.
model
]
if
(
this
.
subformIndex
===
undefined
)
{
this
.
dataModel
=
val
[
this
.
widget
.
model
]
}
else
{
this
.
dataModel
=
val
[
this
.
subformModel
][
this
.
subformIndex
][
this
.
widget
.
model
]
}
}
}
},
...
...
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