|
@@ -1,122 +1,223 @@
|
1
|
|
-import React from 'react'
|
2
|
|
-import { Row, Col, Card, Tree, DatePicker, Radio,Form, Select, Input,InputNumber, Button } from 'antd';
|
|
1
|
+// // import React from 'react'
|
|
2
|
+// import { Row, Col, Card, Tree, DatePicker, Radio,Form, Select, Input,InputNumber, Button } from 'antd';
|
|
3
|
+// import React, { useEffect, useState, useCallback } from 'react';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+// import ImageUpload from '@/components/XForm/ImageUpload';
|
|
7
|
+// const FormItem = Form.Item;
|
|
8
|
+// const {RangePicker}=DatePicker
|
|
9
|
+// const [loading, setLoading] = useState(false);
|
|
10
|
+
|
|
11
|
+// const formItemLayout = {
|
|
12
|
+// labelCol: { span: 6 },
|
|
13
|
+// wrapperCol: { span: 14 },
|
|
14
|
+// };
|
|
15
|
+
|
|
16
|
+// class TreedataFrom extends React.Component {
|
|
17
|
+
|
|
18
|
+// handleSubmit = e => {
|
|
19
|
+// e.preventDefault();
|
|
20
|
+// this.props.form.validateFields((err, values) => {
|
|
21
|
+// if (!err) {
|
|
22
|
+// return;
|
|
23
|
+// }
|
|
24
|
+// setLoading(true);
|
|
25
|
+
|
|
26
|
+// if (eventKey) {
|
|
27
|
+// //如果有这个id拿。没有就,拿返回的curriculumId
|
|
28
|
+// updateCurriculumData({
|
|
29
|
+// data: {
|
|
30
|
+// ...values,
|
|
31
|
+// eventKey
|
|
32
|
+// },
|
|
33
|
+// urlData: { id: eventKey }
|
|
34
|
+// }).then(() => {
|
|
35
|
+// setLoading(false);
|
|
36
|
+// message.success('数据更新成功');
|
|
37
|
+// goBack()
|
|
38
|
+// }).catch((err) => {
|
|
39
|
+// setLoading(false);//loading消失
|
|
40
|
+// message.error(err.message || err);
|
|
41
|
+// })
|
|
42
|
+// } else {
|
|
43
|
+// saveCurriculumData({ data: values }).then(() => {
|
|
44
|
+// setLoading(false);
|
|
45
|
+// message.success('数据保存成功');
|
|
46
|
+// goBack()
|
|
47
|
+// }).catch((err) => {
|
|
48
|
+// setLoading(false);//loading消失
|
|
49
|
+// message.error(err.message || err);
|
|
50
|
+// })
|
|
51
|
+// }
|
|
52
|
+
|
|
53
|
+// });
|
|
54
|
+// };
|
|
55
|
+
|
|
56
|
+// render() {
|
|
57
|
+// const { form,getFieldDecorator } = this.props.form;
|
|
58
|
+// return (
|
|
59
|
+// <Form {...formItemLayout} onSubmit={this.handleSubmit} >
|
|
60
|
+// <FormItem label="照片" help="建议尺寸:750px*600px,比例5:4,格式:jpg,用于:列表和详情">
|
|
61
|
+// {
|
|
62
|
+// getFieldDecorator('curriculumImg', {
|
|
63
|
+// rules: [
|
|
64
|
+// { required: true, message: '请上传照片' }
|
|
65
|
+// ]
|
|
66
|
+// })(
|
|
67
|
+// <ImageUpload />
|
|
68
|
+// )
|
|
69
|
+// }
|
|
70
|
+// </FormItem>
|
|
71
|
+// <FormItem label="姓名">
|
|
72
|
+// {getFieldDecorator('note', {
|
|
73
|
+// rules: [{ required: true, message: '请输入姓名!' }],
|
|
74
|
+// })(<Input style={{width:"200px"}} />)}
|
|
75
|
+// </FormItem>
|
|
76
|
+// <FormItem label="年龄" >
|
|
77
|
+// {
|
|
78
|
+// getFieldDecorator('weight', {
|
|
79
|
+// rules: [{ required: true, message: '请输入年龄' }]
|
|
80
|
+// })(
|
|
81
|
+// <InputNumber min='18' />
|
|
82
|
+// )
|
|
83
|
+// }
|
|
84
|
+// </FormItem>
|
|
85
|
+// <FormItem label="性别">
|
|
86
|
+// {
|
|
87
|
+// getFieldDecorator('type', {
|
|
88
|
+// rules: [
|
|
89
|
+// { required: true, message: '请选择性别' }
|
|
90
|
+// ]
|
|
91
|
+// })(
|
|
92
|
+// <Radio.Group style={{ width: '500px' }} initialValue={1}>
|
|
93
|
+// {/* onChange={e => setContentType(e.target.value)} */}
|
|
94
|
+// <Radio value={1}>男</Radio>
|
|
95
|
+// <Radio value={2}>女</Radio>
|
|
96
|
+// </Radio.Group>
|
|
97
|
+// )
|
|
98
|
+// }
|
|
99
|
+// </FormItem>
|
|
100
|
+// <FormItem label="工作总时间" style={{ marginBottom: 0 }} help="如未离职,结束日期和开始日期一样即可">
|
|
101
|
+// <FormItem style={{ display: 'inline-block' }} >
|
|
102
|
+// <RangePicker style={{width: '255px'}}/>
|
|
103
|
+// </FormItem>
|
|
104
|
+// </FormItem>
|
|
105
|
+// <FormItem wrapperCol={{ span: 12, offset: 5 }}>
|
|
106
|
+// <Button type="primary" htmlType="submit">
|
|
107
|
+// Submit
|
|
108
|
+// </Button>
|
|
109
|
+// </FormItem>
|
|
110
|
+// </Form>
|
|
111
|
+// );
|
|
112
|
+// }
|
|
113
|
+// }
|
3
|
114
|
|
|
115
|
+// export default Form.create({})(TreedataFrom);
|
4
|
116
|
|
5
|
|
-import ImageUpload from '@/components/XForm/ImageUpload';
|
6
|
117
|
|
7
|
|
-const { Option } = Select;
|
|
118
|
+// TreedataFrom = Form.create({})(TreedataFrom);
|
|
119
|
+// export default TreedataFrom
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+import React, { useEffect, useState, useCallback } from 'react';
|
|
123
|
+import { Button, Form, Select, Input, InputNumber, Radio, message, Card,DatePicker, } from 'antd';
|
|
124
|
+import ImageUpload from '@/components/XForm/ImageUpload';
|
8
|
125
|
const FormItem = Form.Item;
|
9
|
126
|
const {RangePicker}=DatePicker
|
10
|
127
|
|
11
|
|
-const formItemLayout = {
|
|
128
|
+const TreedataFrom = React.forwardRef((props, ref) => {
|
|
129
|
+ const [treeData, setTreeData] = useState();
|
|
130
|
+ const [data, setData] = useState(treeData);
|
|
131
|
+ const { form, treeTitle } = props;
|
|
132
|
+ const { getFieldDecorator, setFieldsValue, validateFields } = form;
|
|
133
|
+
|
|
134
|
+ const formItemLayout = {
|
|
135
|
+ //布局
|
12
|
136
|
labelCol: { span: 6 },
|
13
|
137
|
wrapperCol: { span: 14 },
|
14
|
|
-};
|
15
|
138
|
|
16
|
|
-class TreedataFrom extends React.Component {
|
17
|
|
- handleSubmit = e => {
|
18
|
|
- e.preventDefault();
|
19
|
|
- this.props.form.validateFields((err, values) => {
|
20
|
|
- if (!err) {
|
21
|
|
- console.log('Received values of form: ', values);
|
22
|
|
- }
|
23
|
|
- });
|
24
|
139
|
};
|
|
140
|
+ const formRef = React.createRef();
|
25
|
141
|
|
26
|
|
- handleSelectChange = value => {
|
27
|
|
- console.log(value);
|
28
|
|
- this.props.form.setFieldsValue({
|
29
|
|
- note: `Hi, ${value === 'male' ? 'man' : 'lady'}!`,
|
30
|
|
- });
|
31
|
|
- };
|
32
|
|
-
|
33
|
|
- render() {
|
34
|
|
- const { getFieldDecorator } = this.props.form;
|
35
|
|
- return (
|
36
|
|
- <Form {...formItemLayout} onSubmit={this.handleSubmit}>
|
37
|
|
- <FormItem label="照片" help="建议尺寸:750px*600px,比例5:4,格式:jpg,用于:列表和详情">
|
38
|
|
- {
|
39
|
|
- getFieldDecorator('curriculumImg', {
|
40
|
|
- rules: [
|
41
|
|
- { required: true, message: '请上传照片' }
|
42
|
|
- ]
|
43
|
|
- })(
|
44
|
|
- <ImageUpload />
|
45
|
|
- )
|
46
|
|
- }
|
47
|
|
- </FormItem>
|
48
|
|
- <FormItem label="姓名">
|
49
|
|
- {getFieldDecorator('note', {
|
50
|
|
- rules: [{ required: true, message: '请输入姓名!' }],
|
51
|
|
- })(<Input />)}
|
52
|
|
- </FormItem>
|
53
|
|
- <FormItem label="年龄" >
|
54
|
|
- {
|
55
|
|
- getFieldDecorator('weight', {
|
56
|
|
- rules: [{ required: true, message: '请输入年龄' }]
|
57
|
|
- })(
|
58
|
|
- <InputNumber min='18' />
|
59
|
|
- )
|
60
|
|
- }
|
61
|
|
- </FormItem>
|
62
|
|
- <FormItem label="性别">
|
63
|
|
- {
|
64
|
|
- getFieldDecorator('type', {
|
65
|
|
- rules: [
|
66
|
|
- { required: true, message: '请选择性别' }
|
67
|
|
- ]
|
68
|
|
- })(
|
69
|
|
- <Radio.Group style={{ width: '500px' }} defaultValue={1}>
|
70
|
|
- {/* onChange={e => setContentType(e.target.value)} */}
|
71
|
|
- <Radio value={1}>男</Radio>
|
72
|
|
- <Radio value={2}>女</Radio>
|
73
|
|
- </Radio.Group>
|
74
|
|
- )
|
75
|
|
- }
|
76
|
|
- </FormItem>
|
77
|
|
- <FormItem label="工作总时间" style={{ marginBottom: 0 }} help="如未离职,结束日期和开始日期一样即可">
|
78
|
|
- <FormItem style={{ display: 'inline-block' }} >
|
79
|
|
- <RangePicker style={{width: '255px'}}/>
|
80
|
|
- </FormItem>
|
81
|
|
- </FormItem>
|
82
|
|
- <FormItem label="Gender">
|
83
|
|
- {getFieldDecorator('gender', {
|
84
|
|
- rules: [{ required: true, message: 'Please select your gender!' }],
|
85
|
|
- })(
|
86
|
|
- <Select
|
87
|
|
- placeholder="Select a option and change input text above"
|
88
|
|
- onChange={this.handleSelectChange}
|
89
|
|
- >
|
90
|
|
- <Option value="male">male</Option>
|
91
|
|
- <Option value="female">female</Option>
|
92
|
|
- </Select>,
|
93
|
|
- )}
|
94
|
|
- </FormItem>
|
95
|
|
- <FormItem wrapperCol={{ span: 12, offset: 5 }}>
|
96
|
|
- <Button type="primary" htmlType="submit">
|
97
|
|
- Submit
|
98
|
|
- </Button>
|
99
|
|
- </FormItem>
|
100
|
|
- </Form>
|
101
|
|
- );
|
|
142
|
+ const onChange=(date, dateString)=> {
|
|
143
|
+ console.log(date, dateString);
|
102
|
144
|
}
|
103
|
|
-}
|
104
|
|
-
|
105
|
|
-
|
106
|
|
-TreedataFrom = Form.create({})(TreedataFrom);
|
107
|
|
-
|
108
|
|
-export default TreedataFrom
|
109
|
|
-
|
110
|
145
|
|
111
|
146
|
|
|
147
|
+ const handleSubmit = (e) => {
|
|
148
|
+ e.preventDefault();
|
|
149
|
+ validateFields((err, values) => {
|
|
150
|
+ if (err) {
|
|
151
|
+ return;
|
|
152
|
+ //字符验证未填写---返回
|
|
153
|
+ }
|
|
154
|
+ });
|
|
155
|
+ }
|
112
|
156
|
|
113
|
|
-// import React from 'react'
|
114
|
157
|
|
115
|
|
-// class Hello extends React.Component{
|
116
|
|
-// render(){
|
117
|
|
-// return<h1>asdasdasdas</h1>
|
118
|
|
-// }
|
119
|
|
-// }
|
|
158
|
+ return (
|
|
159
|
+ <Form {...formItemLayout} ref={formRef} onSubmit={handleSubmit} >
|
|
160
|
+ <FormItem label="照片" help="建议尺寸:750px*600px,比例5:4,格式:jpg,用于:列表和详情">
|
|
161
|
+ {
|
|
162
|
+ getFieldDecorator('curriculumImg', {
|
|
163
|
+ rules: [
|
|
164
|
+ { required: true, message: '请上传照片' }
|
|
165
|
+ ]
|
|
166
|
+ })(
|
|
167
|
+ <ImageUpload />
|
|
168
|
+ )
|
|
169
|
+ }
|
|
170
|
+ </FormItem>
|
|
171
|
+ <FormItem label="姓名">
|
|
172
|
+ {getFieldDecorator('name', {
|
|
173
|
+ rules: [{ required: true, message: '请输入姓名!' }],
|
|
174
|
+ })(<Input style={{width:"200px"}} />)}
|
|
175
|
+ </FormItem>
|
|
176
|
+ <FormItem label="年龄" >
|
|
177
|
+ {
|
|
178
|
+ getFieldDecorator('age', {
|
|
179
|
+ rules: [{ required: true, message: '请输入年龄' }]
|
|
180
|
+ })(
|
|
181
|
+ <InputNumber min={18} />
|
|
182
|
+ )
|
|
183
|
+ }
|
|
184
|
+ </FormItem>
|
|
185
|
+ <FormItem label="性别">
|
|
186
|
+ {
|
|
187
|
+ getFieldDecorator('sex', {
|
|
188
|
+ rules: [
|
|
189
|
+ { required: true, message: '请选择性别' }
|
|
190
|
+ ]
|
|
191
|
+ })(
|
|
192
|
+ <Radio.Group style={{ width: '500px' }} initialValue={1}>
|
|
193
|
+ {/* onChange={e => setContentType(e.target.value)} */}
|
|
194
|
+ <Radio value={1}>男</Radio>
|
|
195
|
+ <Radio value={2}>女</Radio>
|
|
196
|
+ </Radio.Group>
|
|
197
|
+ )
|
|
198
|
+ }
|
|
199
|
+ </FormItem>
|
|
200
|
+ <FormItem label="工作总时间" style={{ marginBottom: 0 }} >
|
|
201
|
+ {
|
|
202
|
+ getFieldDecorator('day', {
|
|
203
|
+ rules: [
|
|
204
|
+ { required: true, message: '请选择日期' }
|
|
205
|
+ ]
|
|
206
|
+ })(
|
|
207
|
+ // <RangePicker style={{width: '255px'}} />
|
|
208
|
+ <DatePicker onChange={onChange} />
|
|
209
|
+ )
|
|
210
|
+ }
|
|
211
|
+ </FormItem>
|
|
212
|
+ <FormItem wrapperCol={{ span: 12, offset: 5 }}>
|
|
213
|
+ <Button type="primary" htmlType="submit" style={{marginLeft:'80px' , marginTop:'30px'}}>
|
|
214
|
+ 修改
|
|
215
|
+ </Button>
|
|
216
|
+ </FormItem>
|
|
217
|
+ </Form>
|
|
218
|
+ )
|
|
219
|
+})
|
|
220
|
+
|
|
221
|
+export default Form.create({})(TreedataFrom);
|
120
|
222
|
|
121
|
223
|
|
122
|
|
-// export default Hello
|