Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
9e051436
Commit
9e051436
authored
Oct 17, 2017
by
afc163
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update BasicForm
parent
44173606
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
50 deletions
+98
-50
src/routes/Forms/BasicForm.js
src/routes/Forms/BasicForm.js
+93
-50
src/routes/Forms/style.less
src/routes/Forms/style.less
+5
-0
No files found.
src/routes/Forms/BasicForm.js
View file @
9e051436
import
React
,
{
PureComponent
}
from
'
react
'
;
import
{
connect
}
from
'
dva
'
;
import
{
Form
,
Input
,
DatePicker
,
Select
,
Button
,
Card
}
from
'
antd
'
;
import
{
Form
,
Input
,
DatePicker
,
Select
,
Button
,
Card
,
InputNumber
,
Radio
,
Icon
,
Tooltip
,
}
from
'
antd
'
;
import
PageHeaderLayout
from
'
../../layouts/PageHeaderLayout
'
;
import
styles
from
'
./style.less
'
;
const
FormItem
=
Form
.
Item
;
const
{
Option
}
=
Select
;
const
{
RangePicker
}
=
DatePicker
;
const
{
TextArea
}
=
Input
;
@
connect
(
state
=>
({
submitting
:
state
.
form
.
regularFormSubmitting
,
...
...
@@ -25,12 +29,12 @@ export default class BasicForms extends PureComponent {
}
render
()
{
const
{
submitting
}
=
this
.
props
;
const
{
getFieldDecorator
}
=
this
.
props
.
form
;
const
{
getFieldDecorator
,
getFieldValue
}
=
this
.
props
.
form
;
const
formItemLayout
=
{
labelCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
3
},
sm
:
{
span
:
7
},
},
wrapperCol
:
{
xs
:
{
span
:
24
},
...
...
@@ -42,100 +46,139 @@ export default class BasicForms extends PureComponent {
const
submitFormLayout
=
{
wrapperCol
:
{
xs
:
{
span
:
24
,
offset
:
0
},
sm
:
{
span
:
10
,
offset
:
3
},
sm
:
{
span
:
10
,
offset
:
7
},
},
};
return
(
<
PageHeaderLayout
title
=
"
基础表单
"
content
=
"
表单页是向后台提交数据的标准场景。
"
>
<
Card
bordered
=
{
false
}
>
<
Form
onSubmit
=
{
this
.
handleSubmit
}
hideRequiredMark
style
=
{{
marginTop
:
24
}}
>
<
Form
onSubmit
=
{
this
.
handleSubmit
}
hideRequiredMark
style
=
{{
marginTop
:
8
}}
>
<
FormItem
{...
formItemLayout
}
label
=
"
应用类型
"
hasFeedback
label
=
"
标题
"
>
{
getFieldDecorator
(
'
appTyp
e
'
,
{
{
getFieldDecorator
(
'
titl
e
'
,
{
rules
:
[{
required
:
true
,
message
:
'
应用类型
'
,
required
:
true
,
message
:
'
请输入标题
'
,
}],
})(
<
Select
placeholder
=
"
请选择应用类型
"
>
<
Option
value
=
"
type1
"
>
类型一
<
/Option
>
<
Option
value
=
"
type2
"
>
类型二
<
/Option
>
<
Option
value
=
"
type3
"
>
类型三
<
/Option
>
<
/Select
>
<
Input
placeholder
=
"
给目标起个名字
"
/>
)}
<
/FormItem
>
<
FormItem
{...
formItemLayout
}
label
=
"
产品名
"
hasFeedback
label
=
"
起止日期
"
>
{
getFieldDecorator
(
'
productNam
e
'
,
{
{
getFieldDecorator
(
'
dat
e
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请
输入产品名
'
,
required
:
true
,
message
:
'
请
选择起止日期
'
,
}],
})(
<
Input
placeholder
=
"
产品名
"
/>
<
RangePicker
style
=
{{
width
:
'
100%
'
}}
placeholder
=
{[
'
开始日期
'
,
'
结束日期
'
]}
/
>
)}
<
/FormItem
>
<
FormItem
{...
formItemLayout
}
label
=
"
应用名
"
hasFeedback
label
=
"
目标描述
"
>
{
getFieldDecorator
(
'
appName
'
,
{
rules
:
[
{
required
:
true
,
message
:
'
请输入应用名
'
},
{
pattern
:
/^
[
a-zA-Z0-9-
]
+$/
,
message
:
'
只能输入英文、数字、中划线
'
},
],
{
getFieldDecorator
(
'
goal
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入目标描述
'
,
}],
})(
<
Input
placeholder
=
"
只能输入英文、数字、中划线
"
/>
<
TextArea
placeholder
=
"
请输入你的阶段性工作目标
"
rows
=
{
4
}
/
>
)}
<
/FormItem
>
<
FormItem
{...
formItemLayout
}
label
=
"
中文名
"
hasFeedback
label
=
"
衡量标准
"
>
{
getFieldDecorator
(
'
appChineseName
'
,
{
rules
:
[
{
required
:
true
,
message
:
'
请输入应用中文名
'
},
{
pattern
:
/^
[\u
4e00-
\u
9fa5
]
+$/
,
message
:
'
请输入中文
'
},
],
{
getFieldDecorator
(
'
standard
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入衡量标准
'
,
}],
})(
<
Input
placeholder
=
"
应用中文名
"
/>
<
TextArea
placeholder
=
"
请输入衡量标准
"
rows
=
{
4
}
/
>
)}
<
/FormItem
>
<
FormItem
{...
formItemLayout
}
label
=
"
生效日期
"
label
=
{
<
span
>
客户
<
em
className
=
{
styles
.
optional
}
>
(
选填
)
<
Tooltip
title
=
"
目标的服务对象
"
>
<
Icon
type
=
"
info-circle-o
"
style
=
{{
marginRight
:
4
}}
/
>
<
/Tooltip
>
<
/em
>
<
/span
>
}
>
{
getFieldDecorator
(
'
dateRange
'
,
{
rules
:
[{
type
:
'
array
'
,
required
:
true
,
message
:
'
请选择生效日期
'
}],
})(
<
RangePicker
format
=
"
YYYY-MM-DD
"
placeholder
=
{[
'
开始日期
'
,
'
结束日期
'
]}
style
=
{{
width
:
'
100%
'
}}
/
>
{
getFieldDecorator
(
'
client
'
)(
<
Input
placeholder
=
"
请描述你服务的客户,内部客户直接 @姓名/工号
"
/>
)}
<
/FormItem
>
<
FormItem
{...
formItemLayout
}
label
=
"
域名
"
label
=
{
<
span
>
邀评人
<
em
className
=
{
styles
.
optional
}
>
(
选填
)
<
/em></
span
>
}
>
{
getFieldDecorator
(
'
domain
'
,
{
rules
:
[{
required
:
true
,
message
:
'
请输入域名
'
}],
})(
<
Input
addonBefore
=
"
http://
"
addonAfter
=
"
.com
"
placeholder
=
"
facebook
"
style
=
{{
width
:
'
100%
'
}}
/
>
{
getFieldDecorator
(
'
invites
'
)(
<
Input
placeholder
=
"
请直接 @姓名/工号,最多可邀请 5 人
"
/>
)}
<
/FormItem
>
<
FormItem
{...
formItemLayout
}
label
=
{
<
span
>
权重
<
em
className
=
{
styles
.
optional
}
>
(
选填
)
<
/em></
span
>
}
>
{
getFieldDecorator
(
'
weight
'
)(
<
InputNumber
placeholder
=
"
请输入
"
min
=
{
0
}
max
=
{
100
}
/
>
)}
<
span
>%<
/span
>
<
/FormItem
>
<
FormItem
{...
formItemLayout
}
label
=
"
目标公开
"
help
=
"
客户、邀评人默认被分享
"
>
<
div
>
{
getFieldDecorator
(
'
public
'
,
{
initialValue
:
'
1
'
,
})(
<
Radio
.
Group
>
<
Radio
value
=
"
1
"
>
公开
<
/Radio
>
<
Radio
value
=
"
2
"
>
部分公开
<
/Radio
>
<
Radio
value
=
"
3
"
>
不公开
<
/Radio
>
<
/Radio.Group
>
)}
{
getFieldDecorator
(
'
publicUsers
'
,
{
})(
<
Select
mode
=
"
multiple
"
placeholder
=
"
公开给
"
style
=
{{
margin
:
'
12px 0
'
,
display
:
getFieldValue
(
'
public
'
)
===
'
2
'
?
'
block
'
:
'
none
'
,
}}
>
<
Option
value
=
"
1
"
>
同事甲
<
/Option
>
<
Option
value
=
"
2
"
>
同事乙
<
/Option
>
<
Option
value
=
"
3
"
>
同事丙
<
/Option
>
<
/Select
>
)}
<
/div
>
<
/FormItem
>
<
FormItem
{...
submitFormLayout
}
style
=
{{
marginTop
:
40
}}
>
<
Button
type
=
"
primary
"
htmlType
=
"
submit
"
loading
=
{
submitting
}
>
新建应用
提交
<
/Button
>
<
Button
style
=
{{
marginLeft
:
8
}}
>
保存
<
/Button
>
<
Button
style
=
{{
marginLeft
:
8
}}
>
删除
<
/Button
>
<
/FormItem
>
<
/Form
>
<
/Card
>
...
...
src/routes/Forms/style.less
View file @
9e051436
...
...
@@ -84,3 +84,8 @@
.withFooterToolbar + div {
padding-bottom: 64px;
}
.optional {
color: @text-color-secondary;
font-style: normal;
}
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