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
72357b6c
Commit
72357b6c
authored
Mar 16, 2018
by
gaochao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of 115.28.80.125:softwarefactory/vueelementtemplate
parents
075dd351
5cccefd7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
11 deletions
+26
-11
HmComplexForm.vue
src/views/haomo/components/forms/HmComplexForm.vue
+17
-10
index.vue
src/views/haomo/components/forms/index.vue
+9
-1
No files found.
src/views/haomo/components/forms/HmComplexForm.vue
View file @
72357b6c
...
...
@@ -111,15 +111,21 @@
required
:
true
},
/**
* 必传,指定要显示的表单字段及类型。数组的每个元素须有name和widgetType两个字段,name表示要显示的表单字段,widgetType表示该字段要显示的表单类型(普通输入框、文本域、富文本、下拉框...),取值1-7(1表示普通输入框,2表示下拉框,3表示复选框,4表示文本域,5表示富文本,6表示日期格式,7表示单选框),若表单类型为下拉框/复选框/单选框,还需传入options字段,值为数组(数组元素是下拉框/复选框/单选框的选项),对于复选框,如果只有一个备选项则不必传options
* 必传,指定要显示的表单字段及类型。数组的每个元素包含name、codeCamel和widgetType三个字段,
* codeCamel表示要显示的表单字段,
* name表示自定义的字段名,如果不传,默认为数据库中的字段名,
* widgetType表示该字段要显示的表单类型(普通输入框、文本域、富文本、下拉框...),
* 取值1-7(1表示普通输入框,2表示下拉框,3表示复选框,4表示文本域,5表示富文本,6表示日期格式,7表示单选框),
* 若表单类型为下拉框/复选框/单选框,还需传入options字段,值为数组(数组元素是下拉框/复选框/单选框的选项),
* 对于复选框,如果只有一个备选项则不必传options
* 示例:[
* { name: 'username', widgetType: 1 },
* { name: 'securityLevel', widgetType: 5 },
* { name: '
type', widgetType: 2, options: ['企业', '代理商
'] },
* { name: '
avatar', widgetType: 3
},
* { name: 'departmentId', widgetType: 4 },
* { name: 'createTime', widgetType: 6 },
* { name: '
identity
', widgetType: 7, options: ['会员', '访客'] },
* { name: '
姓名', codeCamel: '
username', widgetType: 1 },
* { name: '
安全级别', codeCamel: '
securityLevel', widgetType: 5 },
* { name: '
选择类型', codeCamel: 'type', widgetType: 2, options: ['选项1', '选项2
'] },
* { name: '
选择头像', codeCamel: 'avatar', widgetType: 3, options: ['美女', '帅哥']
},
* { name: '
部门', codeCamel: '
departmentId', widgetType: 4 },
* { name: '
新建时间', codeCamel: '
createTime', widgetType: 6 },
* { name: '
登陆地址', codeCamel: 'loginid
', widgetType: 7, options: ['会员', '访客'] },
* ]
*/
columns
:
{
...
...
@@ -327,9 +333,10 @@
_
.
each
(
self
.
showUserColumns
,
function
(
column
,
index
)
{
if
(
typeof
column
===
'object'
)
{
// 生成一个新对象
const
tmp
=
_
.
keyBy
(
self
.
schema
[
'columns'
],
'codeCamel'
)[
column
.
name
]
const
tmp
=
_
.
keyBy
(
self
.
schema
[
'columns'
],
'codeCamel'
)[
column
.
codeCamel
]
// console.log(tmp)
self
.
$set
(
tmp
,
'code'
,
tmp
.
code
.
toLowerCase
())
// self.$set(tmp, 'code', tmp.code.toLowerCase())
column
.
name
&&
self
.
$set
(
tmp
,
'name'
,
column
.
name
)
// 自定义字段名
self
.
$set
(
tmp
,
'widgetType'
,
column
.
widgetType
||
1
)
column
.
options
&&
self
.
$set
(
tmp
,
'options'
,
column
.
options
)
self
.
$set
(
self
.
showUserColumns
,
index
,
tmp
)
// 顺序
...
...
src/views/haomo/components/forms/index.vue
View file @
72357b6c
...
...
@@ -25,7 +25,15 @@
data
()
{
return
{
// widgetType值 1:普通input 2:下拉框 (如果是下拉框 再传一个options表示下拉框选项)3:复选框 4:文本域 5:富文本 6:日期 7:单选框
showUserColumns
:
[{
name
:
'username'
,
widgetType
:
1
},
{
name
:
'securityLevel'
,
widgetType
:
5
},
{
name
:
'type'
,
widgetType
:
2
,
options
:
[
'选项1'
,
'选项2'
]
},
{
name
:
'avatar'
,
widgetType
:
3
,
options
:
[
'美女'
,
'帅哥'
]
},
{
name
:
'departmentId'
,
widgetType
:
4
},
{
name
:
'createTime'
,
widgetType
:
6
},
{
name
:
'loginid'
,
widgetType
:
7
,
options
:
[
'会员'
,
'访客'
]
}],
showUserColumns
:
[
{
name
:
'姓名'
,
codeCamel
:
'username'
,
widgetType
:
1
},
{
name
:
'安全级别'
,
codeCamel
:
'securityLevel'
,
widgetType
:
5
},
{
name
:
'选择类型'
,
codeCamel
:
'type'
,
widgetType
:
2
,
options
:
[
'选项1'
,
'选项2'
]
},
{
name
:
'选择头像'
,
codeCamel
:
'avatar'
,
widgetType
:
3
,
options
:
[
'美女'
,
'帅哥'
]
},
{
name
:
'部门'
,
codeCamel
:
'departmentId'
,
widgetType
:
4
},
{
name
:
'新建时间'
,
codeCamel
:
'createTime'
,
widgetType
:
6
},
{
name
:
'登陆地址'
,
codeCamel
:
'loginid'
,
widgetType
:
7
,
options
:
[
'会员'
,
'访客'
]
}
],
// 要显示按钮 暂只支持确定、保存、取消、提交、重置
showUserButtons
:
[
'确定'
,
'取消'
]
// showUserButtons: []
...
...
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