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
f6ab18c4
Commit
f6ab18c4
authored
Feb 10, 2018
by
王康
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表单页面
parent
1a55d85b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
49 deletions
+91
-49
HmComplexDetail.vue
src/views/haomo/components/details/HmComplexDetail.vue
+2
-1
HmComplexForm.vue
src/views/haomo/components/forms/HmComplexForm.vue
+85
-47
index.vue
src/views/haomo/components/forms/index.vue
+4
-1
No files found.
src/views/haomo/components/details/HmComplexDetail.vue
View file @
f6ab18c4
...
@@ -73,8 +73,9 @@
...
@@ -73,8 +73,9 @@
params
:
params
params
:
params
}).
then
(
resp
=>
{
}).
then
(
resp
=>
{
self
.
list
=
resp
.
data
self
.
list
=
resp
.
data
self
.
detail
=
self
.
list
[
0
]
console
.
log
(
self
.
list
)
console
.
log
(
self
.
list
)
self
.
detail
=
self
.
list
[
0
]
// console.log(self.list)
})
})
}
}
}
}
...
...
src/views/haomo/components/forms/HmComplexForm.vue
View file @
f6ab18c4
<
template
>
<
template
>
<el-row
type=
"flex"
class=
"hm-form"
>
<el-row
type=
"flex"
class=
"hm-form"
>
<!--左侧留白-->
<el-col
:span=
"6"
><div></div></el-col>
<el-col
:span=
"6"
><div></div></el-col>
<el-col
:span=
"12"
style=
"border:1px solid orange"
><div>
<el-col
:span=
"12"
style=
"border:1px solid orange"
><div>
<!--标题-->
<!--标题-->
<h2
class=
"title"
>
表单页面
</h2>
<h2
class=
"title"
>
表单页面
</h2>
<!--表单部分-->
<!--表单部分-->
<el-form
:model=
"form"
ref=
"form"
:rules=
"rules"
label-width=
"110px"
status-icon
style=
"width:80%;margin:0 auto"
>
<
!--
<
el-form
:model=
"form"
ref=
"form"
:rules=
"rules"
label-width=
"110px"
status-icon
style=
"width:80%;margin:0 auto"
>
<el-form-item
label=
"姓名"
prop=
"name"
>
<el-form-item
label=
"姓名"
prop=
"name"
>
<el-input
type=
"text"
v-model=
"form.name"
autofocus
placeholder=
"请输入姓名"
></el-input>
<el-input
type=
"text"
v-model=
"form.name"
autofocus
placeholder=
"请输入姓名"
></el-input>
</el-form-item>
</el-form-item>
...
@@ -25,7 +24,7 @@
...
@@ -25,7 +24,7 @@
<el-form-item
label=
"照片"
prop=
"img"
>
<el-form-item
label=
"照片"
prop=
"img"
>
<input
type=
"file"
>
<input
type=
"file"
>
</el-form-item>
</el-form-item>
<!--选择学历-->
<
!
–
选择学历
–>
<el-form-item
label=
"学历"
prop=
"education"
>
<el-form-item
label=
"学历"
prop=
"education"
>
<el-select
v-model=
"form.education"
placeholder=
"请选择学历"
>
<el-select
v-model=
"form.education"
placeholder=
"请选择学历"
>
<el-option
label=
"博士"
value=
"doctor"
></el-option>
<el-option
label=
"博士"
value=
"doctor"
></el-option>
...
@@ -53,7 +52,20 @@
...
@@ -53,7 +52,20 @@
<el-form-item
label=
"住址"
prop=
"address"
>
<el-form-item
label=
"住址"
prop=
"address"
>
<el-input
type=
"textarea"
placeholder=
"请填写地址"
:autosize=
"
{ minRows: 2, maxRows: 4}" resize="none" v-model="form.address">
</el-input>
<el-input
type=
"textarea"
placeholder=
"请填写地址"
:autosize=
"
{ minRows: 2, maxRows: 4}" resize="none" v-model="form.address">
</el-input>
</el-form-item>
</el-form-item>
<!--确定提交和重置-->
<
!
–
确定提交和重置
–>
<el-form-item>
<el-col
:span=
"12"
>
<el-button
type=
"primary"
@
click=
"onSubmit()"
>
确定
</el-button>
</el-col>
<el-col
:span=
"12"
>
<el-button
@
click=
"resetForm()"
>
重置
</el-button>
</el-col>
</el-form-item>
</el-form>
-->
<el-form
label-width=
"110px"
status-icon
style=
"width:80%;margin:0 auto"
>
<el-form-item
v-for=
"column in showColumns"
:label=
"column.name"
>
<el-input
:placeholder=
"column.codeCamel"
></el-input>
</el-form-item>
<el-form-item>
<el-form-item>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-button
type=
"primary"
@
click=
"onSubmit()"
>
确定
</el-button>
<el-button
type=
"primary"
@
click=
"onSubmit()"
>
确定
</el-button>
...
@@ -65,12 +77,13 @@
...
@@ -65,12 +77,13 @@
</el-form>
</el-form>
</div>
</div>
</el-col>
</el-col>
<!--右侧留白-->
<el-col
:span=
"6"
><div></div></el-col>
<el-col
:span=
"6"
><div></div></el-col>
</el-row>
</el-row>
</
template
>
</
template
>
<
script
>
<
script
>
import
_
from
'lodash'
import
request
from
'@/utils/request'
/**
/**
* 表单页面。
* 表单页面。
*/
*/
...
@@ -82,52 +95,77 @@
...
@@ -82,52 +95,77 @@
components
:
{},
components
:
{},
// 混入公共对象
// 混入公共对象
mixins
:
[],
mixins
:
[],
props
:
{},
props
:
{
schema
:
{
type
:
Object
,
required
:
true
}
},
data
()
{
data
()
{
return
{
return
{
form
:
{
list
:
null
,
name
:
''
,
form
:
null
,
gender
:
'男'
,
showColumns
:
[]
// 要显示的列数据
age
:
''
,
// form: {
password
:
''
,
// name: '',
website
:
''
,
// gender: '男',
img
:
''
,
// age: '',
date
:
''
,
// password: '',
education
:
''
,
// website: '',
color
:
'#ff0000'
,
// img: '',
phone
:
''
,
// date: '',
email
:
''
,
// education: '',
address
:
''
// color: '#ff0000',
},
// phone: '',
rules
:
{
// email: '',
name
:
[
// address: ''
{
required
:
true
,
message
:
'请输入姓名'
,
trigger
:
'blur'
},
// },
{
min
:
2
,
max
:
5
,
message
:
'长度在 2 到 5 个字符'
,
trigger
:
'blur'
}
// rules: {
],
// name: [
age
:
[
// { required: true, message: '请输入姓名', trigger: 'blur' },
{
required
:
true
,
message
:
'请输入年龄'
,
trigger
:
'blur'
},
// { min: 2, max: 5, message: '长度在 2 到 5 个字符', trigger: 'blur' }
{
type
:
'number'
,
message
:
'年龄必须为数字'
,
trigger
:
'change'
}
// ],
],
// age: [
website
:
[
// { required: true, message: '请输入年龄', trigger: 'blur' },
{
required
:
true
,
message
:
'请输入网址'
,
trigger
:
'blur'
},
// { type: 'number', message: '年龄必须为数字', trigger: 'change' }
{
pattern
:
/
[
a-zA-z
]
+:
\/\/[^\s]
*/
,
message
:
'请输入正确的网址'
,
trigger
:
'change'
}
// ],
],
// website: [
password
:
[
// { required: true, message: '请输入网址', trigger: 'blur' },
{
required
:
true
,
message
:
'请输入密码'
,
trigger
:
'blur'
},
// { pattern: /[a-zA-z]+:\/\/[^\s]*/, message: '请输入正确的网址', trigger: 'change' }
{
pattern
:
/^
(?![
0-9
]
+$
)(?![
a-zA-Z
]
+$
)[
0-9A-Za-z
]{6,20}
$/
,
message
:
'密码必须同时包含数字和字母 6-20位'
,
trigger
:
'change'
}
// ],
],
// password: [
phone
:
[
// { required: true, message: '请输入密码', trigger: 'blur' },
{
type
:
'number'
,
required
:
true
,
message
:
'请输入手机号'
,
trigger
:
'blur'
},
// { pattern: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/, message: '密码必须同时包含数字和字母 6-20位', trigger: 'change' }
{
pattern
:
/^1
[
34578
]\d{9}
$/
,
message
:
'请输入正确的手机号'
,
trigger
:
'change'
}
// ],
],
// phone: [
email
:
[
// { type: 'number', required: true, message: '请输入手机号', trigger: 'blur' },
{
required
:
true
,
message
:
'请输入邮箱地址'
,
trigger
:
'blur'
},
// { pattern: /^1[34578]\d{9}$/, message: '请输入正确的手机号', trigger: 'change' }
{
type
:
'email'
,
message
:
'请输入正确的邮箱地址'
,
trigger
:
'blur,change'
}
// ],
]
// email: [
}
// { required: true, message: '请输入邮箱地址', trigger: 'blur' },
// { type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur,change' }
// ]
// }
}
}
},
},
created
()
{
this
.
init
()
// console.log(this.schema)
},
methods
:
{
methods
:
{
init
()
{
const
self
=
this
_
.
each
(
self
.
schema
[
'columns'
],
function
(
column
)
{
const
tmp
=
JSON
.
parse
(
JSON
.
stringify
(
column
))
self
.
showColumns
.
push
(
tmp
)
})
console
.
log
(
self
.
showColumns
)
if
(
!
request
.
defaults
.
baseURL
)
{
request
.
defaults
.
baseURL
=
'/org/api'
}
console
.
log
(
request
.
defaults
)
},
// 提交
// 提交
/**
/**
* 确定提交函数。
* 确定提交函数。
...
...
src/views/haomo/components/forms/index.vue
View file @
f6ab18c4
<
template
>
<
template
>
<div>
<div>
<hm-complex-form>
<hm-complex-form
:schema=
"schema['HmUser']"
>
</hm-complex-form>
</hm-complex-form>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
HmComplexForm
from
'./HmComplexForm.vue'
import
HmComplexForm
from
'./HmComplexForm.vue'
import
schema
from
'../../schemas/hm_org_schema'
export
default
{
export
default
{
name
:
'HmComplexForm'
,
name
:
'HmComplexForm'
,
...
@@ -24,6 +25,8 @@
...
@@ -24,6 +25,8 @@
filters
:
{
filters
:
{
},
},
created
()
{
created
()
{
this
.
schema
=
schema
// console.log(this.schema)
},
},
methods
:
{}
methods
:
{}
}
}
...
...
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