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
fa929d85
authored
Aug 08, 2020
by
Mr. Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug.
parent
87d83e4e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
18 deletions
src/components/VueFormMaking/components/GenerateForm.vue
src/components/VueFormMaking/components/GenerateFormItem.vue
src/components/VueFormMaking/components/WidgetConfig.vue
src/components/VueFormMaking/components/WidgetForm.vue
src/components/VueFormMaking/components/GenerateForm.vue
View file @
fa929d85
...
...
@@ -46,6 +46,56 @@
<slot
:name=
"item.model"
:model=
"models"
/>
</el-form-item>
</
template
>
<!-- 子表单 -->
<
template
v-if=
"item.type === 'subform'"
>
<el-form-item
:key=
"item.key"
:label-width=
"!item.options.labelWidthStatus?'0px': item.options.labelWidth + 'px'"
:label=
"!item.options.labelWidthStatus?'':item.name"
:prop=
"item.model"
>
<el-table
:data=
"tableData"
border
style=
"width: 100%"
>
<el-table-column
width=
"50"
align=
"center"
header-align=
"center"
>
<template
slot=
"header"
>
<i
style=
"font-size: 25px; color: #409EFF;cursor:pointer;"
class=
"el-icon-circle-plus"
@
click=
"addCol(item)"
/>
</
template
>
<
template
>
<i
style=
"font-size: 25px; color: red"
class=
"el-icon-remove"
/>
</
template
>
</el-table-column>
<el-table-column
v-for=
"v in item.columns.list"
:key=
"v.key"
:prop=
"v.key"
:label=
"v.name"
width=
"250"
>
<
template
>
<genetate-form-item
:preview=
"preview"
:models
.
sync=
"models"
:rules=
"rules"
:widget=
"v"
:remote=
"remote"
:data=
"data"
:disabled=
"disabled"
:is-label=
"false"
@
input-change=
"onInputChange"
/>
</
template
>
</el-table-column>
</el-table>
</el-form-item>
</template>
<
template
v-else
>
<genetate-form-item
...
...
@@ -78,6 +128,7 @@ export default {
props
:
[
'data'
,
'remote'
,
'value'
,
'insite'
,
'disabled'
,
'preview'
],
data
()
{
return
{
tableData
:
[],
models
:
{},
rules
:
{}
}
...
...
@@ -102,12 +153,19 @@ export default {
mounted
()
{
},
methods
:
{
addCol
(
item
)
{
var
j
=
{}
j
[
"id"
]
=
this
.
tableData
.
length
+
1
this
.
tableData
.
push
(
j
)
},
generateModle
(
genList
)
{
for
(
let
i
=
0
;
i
<
genList
.
length
;
i
++
)
{
if
(
genList
[
i
].
type
===
'grid'
)
{
genList
[
i
].
columns
.
forEach
(
item
=>
{
this
.
generateModle
(
item
.
list
)
})
}
else
if
(
genList
[
i
].
type
===
'subform'
)
{
this
.
generateModle
(
genList
[
i
].
columns
.
list
)
}
else
{
if
(
this
.
value
&&
Object
.
keys
(
this
.
value
).
indexOf
(
genList
[
i
].
model
)
>=
0
)
{
this
.
models
[
genList
[
i
].
model
]
=
this
.
value
[
genList
[
i
].
model
]
...
...
src/components/VueFormMaking/components/GenerateFormItem.vue
View file @
fa929d85
<
template
>
<el-form-item
:label-width=
"
widget.options.labelWidthStatus?widgetLabelWidth + 'px': '0
px'"
:label=
"widget.type==='divider' || !widget.options.labelWidthStatus?'':widget.name"
:label-width=
"
isLabel===false||!widget.options.labelWidthStatus?'0px': widgetLabelWidth + '
px'"
:label=
"
isLabel===false||
widget.type==='divider' || !widget.options.labelWidthStatus?'':widget.name"
:prop=
"widget.model"
>
<template
v-if=
"preview"
>
<template
v-if=
"widget.type == 'color'"
>
<template
v-if=
"widget.type ==
=
'color'"
>
<div
style=
"width: 32px; height: 20px; margin-top: 6px; border-radius: 3px"
:style=
"
{'background-color': dataModel}" />
</
template
>
<
template
v-else-if=
"widget.type=='switch'"
>
...
...
@@ -14,7 +14,7 @@
:disabled=
"true"
/>
</
template
>
<
template
v-else-if=
"widget.type == 'editor'"
>
<
template
v-else-if=
"widget.type ==
=
'editor'"
>
<div
class=
"previewEditorDiv"
v-html=
"dataModel"
/>
</
template
>
<
template
v-else-if=
"widget.type=='imgupload'"
>
...
...
@@ -50,9 +50,9 @@
</
template
>
</template>
<
template
v-else
>
<template
v-if=
"widget.type == 'input'"
>
<template
v-if=
"widget.type ==
=
'input'"
>
<el-input
v-if=
"widget.options.dataType ==
'number' || widget.options.dataType == 'integer' || widget.options.dataType
== 'float'"
v-if=
"widget.options.dataType ==
= 'number' || widget.options.dataType === 'integer' || widget.options.dataType =
== 'float'"
v-model
.
number=
"dataModel"
:type=
"widget.options.dataType"
:placeholder=
"widget.options.placeholder"
...
...
@@ -69,7 +69,7 @@
/>
</
template
>
<
template
v-if=
"widget.type == 'textarea'"
>
<
template
v-if=
"widget.type ==
=
'textarea'"
>
<el-input
v-model=
"dataModel"
type=
"textarea"
...
...
@@ -80,7 +80,7 @@
/>
</
template
>
<
template
v-if=
"widget.type == 'number'"
>
<
template
v-if=
"widget.type ==
=
'number'"
>
<el-input-number
v-model=
"dataModel"
:style=
"
{width: widget.options.width}"
...
...
@@ -90,7 +90,7 @@
/>
</
template
>
<
template
v-if=
"widget.type == 'radio'"
>
<
template
v-if=
"widget.type ==
=
'radio'"
>
<el-radio-group
v-model=
"dataModel"
:style=
"
{width: widget.options.width}"
...
...
@@ -108,7 +108,7 @@
</el-radio-group>
</template>
<
template
v-if=
"widget.type == 'checkbox'"
>
<
template
v-if=
"widget.type ==
=
'checkbox'"
>
<el-checkbox-group
v-model=
"dataModel"
:style=
"
{width: widget.options.width}"
...
...
@@ -127,7 +127,7 @@
</el-checkbox-group>
</template>
<
template
v-if=
"widget.type == 'time'"
>
<
template
v-if=
"widget.type ==
=
'time'"
>
<el-time-picker
v-model=
"dataModel"
:is-range=
"widget.options.isRange"
...
...
@@ -170,7 +170,7 @@
/>
</
template
>
<
template
v-if=
"widget.type == 'color'"
>
<
template
v-if=
"widget.type ==
=
'color'"
>
<el-color-picker
v-model=
"dataModel"
:disabled=
"widget.options.disabled"
...
...
@@ -178,7 +178,7 @@
/>
</
template
>
<
template
v-if=
"widget.type == 'select'"
>
<
template
v-if=
"widget.type ==
=
'select'"
>
<el-select
v-model=
"dataModel"
:disabled=
"widget.options.disabled"
...
...
@@ -231,7 +231,7 @@
/>
</
template
>
<
template
v-if=
"widget.type == 'editor'"
>
<
template
v-if=
"widget.type ==
=
'editor'"
>
<vue-editor
v-model=
"dataModel"
:disabled=
"widget.options.disabled"
...
...
@@ -289,15 +289,17 @@
import
FmUpload
from
'./Upload'
export
default
{
name
:
'GenetateFormItem'
,
components
:
{
FmUpload
},
/* eslint-disable */
props
:
[
'widget'
,
'models'
,
'rules'
,
'remote'
,
'data'
,
'disabled'
,
'preview'
],
props
:
[
'widget'
,
'models'
,
'rules'
,
'remote'
,
'data'
,
'disabled'
,
'preview'
,
'isLabel'
],
data
()
{
return
{
widgetLabelWidth
:
''
,
dataModel
:
this
.
models
[
this
.
widget
.
model
]
dataModel
:
this
.
models
[
this
.
widget
.
model
],
tableData
:
[]
}
},
watch
:
{
...
...
src/components/VueFormMaking/components/WidgetConfig.vue
View file @
fa929d85
...
...
@@ -30,7 +30,7 @@
v-if=
"Object.keys(data.options).indexOf('labelWidthStatus')>=0 &&
data.type!=='grid' &&
data.type !== 'divider'"
label=
"
隐藏
标签"
label=
"
显示
标签"
>
<el-switch
v-model=
"data.options.labelWidthStatus"
...
...
src/components/VueFormMaking/components/WidgetForm.vue
View file @
fa929d85
...
...
@@ -98,7 +98,7 @@
<div
v-if=
"el && el.key"
:key=
"el.key"
:style=
"
{
minWidth: el.width ? `${el.width}px`: '33.3%', width: el.width ? `${el.width}px`: '33.3%
', 'display': 'inline-block', 'vertical-align': 'top'}"
:style=
"
{
width: '249px
', 'display': 'inline-block', 'vertical-align': 'top'}"
@click.native="handleSelectWidget(i)"
>
<widget-form-item
...
...
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