Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VueElementTemplate
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
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄瑜
VueElementTemplate
Commits
c0a72b97
Commit
c0a72b97
authored
Mar 30, 2018
by
王康
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
form
parent
5a9a7b40
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
14 deletions
+44
-14
HmComplexForm.vue
src/views/haomo/components/forms/HmComplexForm.vue
+15
-3
index.vue
src/views/haomo/components/forms/index.vue
+29
-11
No files found.
src/views/haomo/components/forms/HmComplexForm.vue
View file @
c0a72b97
...
@@ -396,12 +396,12 @@
...
@@ -396,12 +396,12 @@
if
(
item
.
widgetType
===
8
)
{
if
(
item
.
widgetType
===
8
)
{
_
.
forEach
(
self
.
formModel
,
function
(
value
,
key
)
{
_
.
forEach
(
self
.
formModel
,
function
(
value
,
key
)
{
if
(
item
.
codeCamel
===
key
)
{
if
(
item
.
codeCamel
===
key
)
{
self
.
formModel
[
key
]
=
response
.
visitName
self
.
formModel
[
key
]
=
response
.
message
||
response
.
visitName
}
}
})
})
}
}
})
})
console
.
log
(
self
.
formModel
)
console
.
log
(
404
,
self
.
formModel
)
},
},
// inputChange(val) {
// inputChange(val) {
// // console.log(event)
// // console.log(event)
...
@@ -482,7 +482,19 @@
...
@@ -482,7 +482,19 @@
var
formArray
=
_
.
keys
(
self
.
formModel
)
// 提取formModel的属性到数组
var
formArray
=
_
.
keys
(
self
.
formModel
)
// 提取formModel的属性到数组
// console.log(formArray)
// console.log(formArray)
self
.
formModel
=
_
.
pick
(
resp
.
data
,
formArray
)
// 根据数组中的属性提取出data中对应的数据
self
.
formModel
=
_
.
pick
(
resp
.
data
,
formArray
)
// 根据数组中的属性提取出data中对应的数据
// console.log(self.formModel)
// 下拉框多选时将字符串转为数组
_
.
each
(
self
.
columns
,
function
(
item
,
index
)
{
if
(
item
.
widgetType
===
2
)
{
_
.
forEach
(
self
.
formModel
,
function
(
value
,
key
)
{
if
(
item
.
codeCamel
===
key
)
{
// console.log(11111, self.formModel[key])
self
.
formModel
[
key
]
=
self
.
formModel
[
key
].
split
(
','
)
}
})
}
})
// console.log(2222, self.formModel)
})
})
},
},
init
()
{
init
()
{
...
...
src/views/haomo/components/forms/index.vue
View file @
c0a72b97
<
template
>
<
template
>
<!--
:tableId="tableId"
-->
<!---->
<div>
<div>
<hm-complex-form
:schema=
"schema['HmUser']"
<hm-complex-form
:schema=
"schema['HmUser']"
:columns=
"showUserColumns"
:columns=
"showUserColumns"
:buttons=
"showUserButtons"
:buttons=
"showUserButtons"
:layout=
"layout"
:layout=
"layout"
:tableId=
"tableId"
:refers=
"judgeRefers"
>
:refers=
"judgeRefers"
>
</hm-complex-form>
</hm-complex-form>
</div>
</div>
...
@@ -27,9 +28,11 @@
...
@@ -27,9 +28,11 @@
// widgetType值 1:普通input 2:下拉框 (如果是下拉框 再传一个options表示下拉框选项)3:复选框 4:文本域 5:富文本 6:日期 7:单选框 8: 文件上传
// widgetType值 1:普通input 2:下拉框 (如果是下拉框 再传一个options表示下拉框选项)3:复选框 4:文本域 5:富文本 6:日期 7:单选框 8: 文件上传
showUserColumns
:
[
showUserColumns
:
[
// 1普通input
// 1普通input
{
name
:
'
用户名称'
,
codeCamel
:
'username'
,
widgetType
:
1
,
disabled
:
false
,
default
:
'默认值'
,
{
name
:
'
选择类型'
,
codeCamel
:
'type'
,
widgetType
:
1
,
disabled
:
false
,
change
:
this
.
inputChange
,
hide
:
true
change
:
this
.
inputChange
// rule: { required: true, message: '用户名不能为空', trigger: 'blur' }
// rule: { required: true, message: '用户名不能为空', trigger: 'blur' }
// hide: true
// default: '默认值',
},
},
// 5富文本
// 5富文本
{
name
:
'电子邮件'
,
codeCamel
:
'email'
,
widgetType
:
5
,
disabled
:
false
,
{
name
:
'电子邮件'
,
codeCamel
:
'email'
,
widgetType
:
5
,
disabled
:
false
,
...
@@ -40,11 +43,13 @@
...
@@ -40,11 +43,13 @@
// ]
// ]
},
},
// 2下拉框
// 2下拉框
{
name
:
'
选择类型'
,
codeCamel
:
'type'
,
widgetType
:
2
,
multiple
:
fals
e
,
{
name
:
'
用户名称'
,
codeCamel
:
'username'
,
widgetType
:
2
,
multiple
:
tru
e
,
change
:
this
.
inputChange
,
default
:
1
,
//
如果开启多选,默认选中项用数组[1]、[1,2,3]
change
:
this
.
inputChange
,
// default: [1],
如果开启多选,默认选中项用数组[1]、[1,2,3]
options
:
[
options
:
[
{
value
:
1
,
label
:
'企业'
},
// 下拉框的label是选项文字,value是选中值
{
value
:
'1'
,
label
:
'企业'
},
// 下拉框的label是选项文字,value是选中值
{
value
:
3
,
label
:
'代理商'
}
{
value
:
'2'
,
label
:
'代理商'
},
{
value
:
'3'
,
label
:
'会员'
},
{
value
:
'4'
,
label
:
'访客'
}
]
]
},
},
// 3多选 不支持默认值
// 3多选 不支持默认值
...
@@ -54,7 +59,8 @@
...
@@ -54,7 +59,8 @@
'password'
,
'password'
,
// 6日期
// 6日期
{
name
:
'新建时间'
,
codeCamel
:
'createTime'
,
widgetType
:
6
,
dateType
:
'datetime'
,
{
name
:
'新建时间'
,
codeCamel
:
'createTime'
,
widgetType
:
6
,
dateType
:
'datetime'
,
dateFormate
:
'yyyy-MM-dd HH:mm:ss'
,
change
:
this
.
inputChange
,
default
:
'2018-01-01 00:07:08'
dateFormate
:
'yyyy-MM-dd HH:mm:ss'
,
change
:
this
.
inputChange
// default: '2018-01-01 00:07:08'
},
},
'lastUpdateTime'
,
'lastUpdateTime'
,
// 7单选
// 7单选
...
@@ -62,11 +68,23 @@
...
@@ -62,11 +68,23 @@
options
:
[
options
:
[
{
label
:
1
,
value
:
'会员'
},
// 单选的value是选项文字,label是选中值
{
label
:
1
,
value
:
'会员'
},
// 单选的value是选项文字,label是选中值
{
label
:
2
,
value
:
'访客'
}
{
label
:
2
,
value
:
'访客'
}
],
],
// default: 1
change
:
this
.
inputChange
,
default
:
1
},
change
:
this
.
inputChange
},
// 8文件
// 8文件
{
name
:
'选择头像'
,
codeCamel
:
'avatar'
,
widgetType
:
8
,
url
:
'/api/upload'
}
// url是后台接口地址
{
name
:
'选择头像'
,
codeCamel
:
'avatar'
,
widgetType
:
8
,
url
:
'/api/upload'
}
// url是后台接口地址
],
],
showUserColumnss
:
[
{
name
:
'模板名称'
,
codeCamel
:
'name'
,
widgetType
:
1
,
rule
:
{
required
:
true
,
message
:
'模板名称不能为空'
,
trigger
:
'blur'
}},
{
name
:
'选择模板'
,
codeCamel
:
'template'
,
widgetType
:
8
,
url
:
'/zhangjiakouOA/upload_template'
,
rule
:
{
required
:
true
,
message
:
'模板不能为空'
,
trigger
:
'blur'
}},
{
name
:
'使用科室'
,
codeCamel
:
'departmentId'
,
widgetType
:
2
,
multiple
:
true
,
options
:
[
{
value
:
'104'
,
label
:
'APP技术支持'
},
{
value
:
'105'
,
label
:
'党组成员'
},
{
value
:
'106'
,
label
:
'专职检委'
},
{
value
:
'107'
,
label
:
'正处级检察员'
}
],
rule
:
{
required
:
true
,
message
:
'科室不能为空'
,
trigger
:
'blur'
}}
],
// 要显示按钮
// 要显示按钮
//
//
// ,
// ,
...
@@ -97,7 +115,7 @@
...
@@ -97,7 +115,7 @@
this
.
schema
=
schema
this
.
schema
=
schema
// console.log(this.schema)
// console.log(this.schema)
// this.tableId = '1efff63125954583b0ac5a9c252b9041'
// this.tableId = '1efff63125954583b0ac5a9c252b9041'
this
.
tableId
=
'
363fff1772b840aa9714b491aea70806
'
this
.
tableId
=
'
b08d2220d2574bf2ac09ec4f470ed999
'
},
},
methods
:
{
methods
:
{
inputChange
(
val
)
{
inputChange
(
val
)
{
...
...
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