|
@@ -219,13 +219,12 @@ const FormItem = Form.Item;
|
219
|
219
|
|
220
|
220
|
const userTree = React.forwardRef((props, ref) => {
|
221
|
221
|
const [loading, setLoading] = useState(false);//防止多次点击 定义loadind
|
222
|
|
- const [formData, setFormData] = useState();//提交表单的数据
|
|
222
|
+ // const [formData, setFormData] = useState();//提交表单的数据
|
223
|
223
|
const [contentType, setContentType] = useState(1);//单选。初始默认显示1 富文本框。点击视频, 渲染2
|
224
|
224
|
const { form, history } = props;
|
225
|
225
|
const { getFieldDecorator, setFieldsValue, validateFields } = form;
|
|
226
|
+ const {RangePicker} = DatePicker;
|
226
|
227
|
const { curriculumId } = history.location.query || {}
|
227
|
|
-
|
228
|
|
-
|
229
|
228
|
const formItemLayout = {
|
230
|
229
|
//布局
|
231
|
230
|
labelCol: { span: 6 },
|
|
@@ -241,12 +240,12 @@ const userTree = React.forwardRef((props, ref) => {
|
241
|
240
|
<Button type='danger' style={{ marginLeft: '2em' }} >
|
242
|
241
|
删除
|
243
|
242
|
</Button>
|
244
|
|
- <DirectoryTree multiple>
|
245
|
|
- <TreeNode title="parent 0" key="0-0">
|
246
|
|
- <TreeNode title="leaf 0-0" key="0-0-0" isLeaf />
|
247
|
|
- <TreeNode title="leaf 0-1" key="0-0-1" isLeaf />
|
|
243
|
+ <DirectoryTree >
|
|
244
|
+ <TreeNode title="厂长管理" key="0-0">
|
|
245
|
+ <TreeNode title="刘张" value='刘帐' key="0-0-0" isLeaf />
|
|
246
|
+ <TreeNode title="李徐" key="0-0-1" isLeaf />
|
248
|
247
|
</TreeNode>
|
249
|
|
- <TreeNode title="parent 1" key="0-1">
|
|
248
|
+ <TreeNode title="员工管理" key="0-1">
|
250
|
249
|
<TreeNode title="leaf 1-0" key="0-1-0" isLeaf />
|
251
|
250
|
<TreeNode title="leaf 1-1" key="0-1-1" isLeaf />
|
252
|
251
|
<TreeNode title="leaf 1-1" key="0-1-2" isLeaf />
|
|
@@ -260,70 +259,7 @@ const userTree = React.forwardRef((props, ref) => {
|
260
|
259
|
{/* FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF>Form表单 */}
|
261
|
260
|
<Col xs={{ span: 10, offset: 10 }} lg={{ span: 10, offset: 4 }}>
|
262
|
261
|
<Card>
|
263
|
|
- <Form {...formItemLayout} >
|
264
|
|
- <FormItem label="照片" help="建议尺寸:750px*600px,比例5:4,格式:jpg,用于:列表和详情">
|
265
|
|
- {
|
266
|
|
- getFieldDecorator('curriculumImg', {
|
267
|
|
- rules: [
|
268
|
|
- { required: true, message: '请上传照片' }
|
269
|
|
- ]
|
270
|
|
- })(
|
271
|
|
- <ImageUpload />
|
272
|
|
- )
|
273
|
|
- }
|
274
|
|
- </FormItem>
|
275
|
|
- <FormItem label="姓名">
|
276
|
|
- {
|
277
|
|
- getFieldDecorator('name', {
|
278
|
|
- rules: [
|
279
|
|
- { required: true, message: '请输入姓名' }
|
280
|
|
- ]
|
281
|
|
- })(
|
282
|
|
- <Input style={{ width: '88px' }} />
|
283
|
|
- )
|
284
|
|
- }
|
285
|
|
- </FormItem>
|
286
|
|
- <FormItem label="年龄" >
|
287
|
|
- {
|
288
|
|
- getFieldDecorator('weight', {
|
289
|
|
- rules: [{ required: true, message: '请输入年龄' }]
|
290
|
|
- })(
|
291
|
|
- <InputNumber min='18' />
|
292
|
|
- )
|
293
|
|
- }
|
294
|
|
- </FormItem>
|
295
|
|
-
|
296
|
|
- <FormItem label="性别">
|
297
|
|
- {
|
298
|
|
- getFieldDecorator('type', {
|
299
|
|
- rules: [
|
300
|
|
- { required: true, message: '请选择性别' }
|
301
|
|
- ]
|
302
|
|
- })(
|
303
|
|
- <Radio.Group value={contentType} style={{ width: '500px' }} defaultValue={1}>
|
304
|
|
- {/* onChange={e => setContentType(e.target.value)} */}
|
305
|
|
- <Radio value={1}>男</Radio>
|
306
|
|
- <Radio value={2}>女</Radio>
|
307
|
|
- </Radio.Group>
|
308
|
|
- )
|
309
|
|
- }
|
310
|
|
- </FormItem>
|
311
|
|
- <Form.Item label="工作总时间" style={{ marginBottom: 0 }} help="如未离职,第二个日期则不用输入">
|
312
|
|
- <Form.Item style={{ display: 'inline-block' }} >
|
313
|
|
- <DatePicker />
|
314
|
|
- </Form.Item>
|
315
|
|
- <span style={{ display: 'inline-block', width: '20px', textAlign: 'center' }}>至</span>
|
316
|
|
- <Form.Item style={{ display: 'inline-block' }}>
|
317
|
|
- <DatePicker />
|
318
|
|
- </Form.Item>
|
319
|
|
- </Form.Item>
|
320
|
|
-
|
321
|
|
- <FormItem wrapperCol={{ span: 12, offset: 6 }}>
|
322
|
|
- <Button loading={loading} type="primary" htmlType="">
|
323
|
|
- 确认修改
|
324
|
|
- </Button>
|
325
|
|
- </FormItem>
|
326
|
|
- </Form>
|
|
262
|
+
|
327
|
263
|
</Card>
|
328
|
264
|
</Col>
|
329
|
265
|
</Row>
|
|
@@ -333,170 +269,4 @@ const userTree = React.forwardRef((props, ref) => {
|
333
|
269
|
})
|
334
|
270
|
|
335
|
271
|
|
336
|
|
-
|
337
|
|
-// import React, { useEffect, useState, useCallback } from 'react';
|
338
|
|
-// import { Button, Form, Select, Input, InputNumber, Radio, message, DatePicker, Card } from 'antd';
|
339
|
|
-// import ImageUpload from '@/components/XForm/ImageUpload';
|
340
|
|
-// import FileUpload from '@/components/XForm/FileUpload';
|
341
|
|
-// import Wangedit from '@/components/Wangedit/Wangedit';
|
342
|
|
-// import router from 'umi/router';
|
343
|
|
-// import { fetch, apis } from '@/utils/request';
|
344
|
|
-
|
345
|
|
-// const FormItem = Form.Item;
|
346
|
|
-// const Option = Select.Option;
|
347
|
|
-// // const getCurriculumData = fetch(apis.course.searchCourse);
|
348
|
|
-// // const saveCurriculumData = fetch(apis.course.addCourse);
|
349
|
|
-// // const updateCurriculumData = fetch(apis.course.alterCourse);
|
350
|
|
-// const goBack = () => router.goBack(-1);
|
351
|
|
-
|
352
|
|
-// const userTree = React.forwardRef((props, ref) => {
|
353
|
|
-// const [loading, setLoading] = useState(false);//防止多次点击 定义loadind
|
354
|
|
-// const [formData, setFormData] = useState();//提交表单的数据
|
355
|
|
-// const [contentType, setContentType] = useState(1);//单选。初始默认显示1 富文本框。点击视频, 渲染2
|
356
|
|
-// const { form, history } = props;
|
357
|
|
-// const { getFieldDecorator, setFieldsValue, validateFields } = form;
|
358
|
|
-// const { curriculumId } = history.location.query || {}
|
359
|
|
-
|
360
|
|
-// const formItemLayout = {
|
361
|
|
-// //布局
|
362
|
|
-// labelCol: { span: 6 },
|
363
|
|
-// wrapperCol: { span: 14 },
|
364
|
|
-
|
365
|
|
-// };
|
366
|
|
-
|
367
|
|
-// const handleSubmit = (e) => {
|
368
|
|
-// e.preventDefault();
|
369
|
|
-// validateFields((err, values) => {
|
370
|
|
-// if (err) {
|
371
|
|
-// return;
|
372
|
|
-// //字符验证未填写---返回
|
373
|
|
-// }
|
374
|
|
-
|
375
|
|
-// setLoading(true);//loading开始
|
376
|
|
-
|
377
|
|
-// if (curriculumId) {
|
378
|
|
-// //如果有这个id拿。没有就,拿返回的curriculumId
|
379
|
|
-// updateCurriculumData({
|
380
|
|
-// data: {
|
381
|
|
-// ...values,
|
382
|
|
-// curriculumId
|
383
|
|
-// },
|
384
|
|
-// urlData: { id: curriculumId }
|
385
|
|
-// }).then(() => {
|
386
|
|
-// setLoading(false);
|
387
|
|
-// message.success('数据更新成功');
|
388
|
|
-// goBack()
|
389
|
|
-// }).catch((err) => {
|
390
|
|
-// setLoading(false);//loading消失
|
391
|
|
-// message.error(err.message || err);
|
392
|
|
-// })
|
393
|
|
-// } else {
|
394
|
|
-// saveCurriculumData({ data: values }).then(() => {
|
395
|
|
-// setLoading(false);
|
396
|
|
-// message.success('数据保存成功');
|
397
|
|
-// goBack()
|
398
|
|
-// }).catch((err) => {
|
399
|
|
-// setLoading(false);//loading消失
|
400
|
|
-// message.error(err.message || err);
|
401
|
|
-// })
|
402
|
|
-// }
|
403
|
|
-// });
|
404
|
|
-// }
|
405
|
|
-
|
406
|
|
-// const getCourseData = useCallback(({ curriculumId }) => {//函数结果存 初始化运行一次,等待调用。
|
407
|
|
-// getCurriculumData({ urlData: { id: curriculumId } }).then((res) => {
|
408
|
|
-// setFormData(res)
|
409
|
|
-// })
|
410
|
|
-// }, [])
|
411
|
|
-
|
412
|
|
-// useEffect(() => {
|
413
|
|
-// if (curriculumId) {
|
414
|
|
-// getCourseData({ curriculumId })//第一次渲染前//获取id
|
415
|
|
-// }
|
416
|
|
-// }, [curriculumId])//第二次id一样不执行
|
417
|
|
-
|
418
|
|
-// useEffect(() => {
|
419
|
|
-// if (formData) {//1.form表单数据{2} 执行。无变更不执行
|
420
|
|
-// setFieldsValue(formData)
|
421
|
|
-// }
|
422
|
|
-// }, [formData])//2.有变更跟的话
|
423
|
|
-
|
424
|
|
-
|
425
|
|
-// return (
|
426
|
|
-// <Card>
|
427
|
|
-// <Form {...formItemLayout} onSubmit={handleSubmit}>
|
428
|
|
-// <FormItem label="照片" help="建议尺寸:750px*600px,比例5:4,格式:jpg,用于:列表和详情">
|
429
|
|
-// {
|
430
|
|
-// getFieldDecorator('curriculumImg', {
|
431
|
|
-// rules: [
|
432
|
|
-// { required: true, message: '请上传照片' }
|
433
|
|
-// ]
|
434
|
|
-// })(
|
435
|
|
-// <ImageUpload />
|
436
|
|
-// )
|
437
|
|
-// }
|
438
|
|
-// </FormItem>
|
439
|
|
-// <FormItem label="姓名">
|
440
|
|
-// {
|
441
|
|
-// getFieldDecorator('name', {
|
442
|
|
-// rules: [
|
443
|
|
-// { required: true, message: '请输入姓名' }
|
444
|
|
-// ]
|
445
|
|
-// })(
|
446
|
|
-// <Input style={{ width: '88px' }} />
|
447
|
|
-// )
|
448
|
|
-// }
|
449
|
|
-// </FormItem>
|
450
|
|
-// <FormItem label="年龄" >
|
451
|
|
-// {
|
452
|
|
-// getFieldDecorator('weight', {
|
453
|
|
-// rules: [{ required: true, message: '请输入年龄' }]
|
454
|
|
-// })(
|
455
|
|
-// <InputNumber min='18' />
|
456
|
|
-// )
|
457
|
|
-// }
|
458
|
|
-// </FormItem>
|
459
|
|
-
|
460
|
|
-// <FormItem label="性别">
|
461
|
|
-// {
|
462
|
|
-// getFieldDecorator('type', {
|
463
|
|
-// rules: [
|
464
|
|
-// { required: true, message: '请选择性别' }
|
465
|
|
-// ]
|
466
|
|
-// })(
|
467
|
|
-// <Radio.Group value={contentType} style={{ width: '500px' }} defaultValue={1}>
|
468
|
|
-// {/* onChange={e => setContentType(e.target.value)} */}
|
469
|
|
-// <Radio value={1}>男</Radio>
|
470
|
|
-// <Radio value={2}>女</Radio>
|
471
|
|
-// </Radio.Group>
|
472
|
|
-// )
|
473
|
|
-// }
|
474
|
|
-// </FormItem>
|
475
|
|
-// <Form.Item label="工作总时间" style={{ marginBottom: 0 }} help="如未离职,第二个日期则不用输入">
|
476
|
|
-// <Form.Item style={{ display: 'inline-block' }} >
|
477
|
|
-// <DatePicker />
|
478
|
|
-// </Form.Item>
|
479
|
|
-// <span style={{ display: 'inline-block', width: '20px', textAlign: 'center' }}>至</span>
|
480
|
|
-// <Form.Item style={{ display: 'inline-block' }}>
|
481
|
|
-// <DatePicker />
|
482
|
|
-// </Form.Item>
|
483
|
|
-// </Form.Item>
|
484
|
|
-
|
485
|
|
-// <FormItem wrapperCol={{ span: 12, offset: 6 }}>
|
486
|
|
-// <Button loading={loading} type="primary" htmlType="">
|
487
|
|
-// 保存
|
488
|
|
-// </Button>
|
489
|
|
-// <Button style={{ marginLeft: '2em' }} onClick={goBack}>
|
490
|
|
-// 返回
|
491
|
|
-// </Button>
|
492
|
|
-// <Button type='danger' style={{ marginLeft: '2em' }} >
|
493
|
|
-// 删除
|
494
|
|
-// </Button>
|
495
|
|
-// </FormItem>
|
496
|
|
-// </Form>
|
497
|
|
-// </Card>
|
498
|
|
-
|
499
|
|
-// )
|
500
|
|
-// })
|
501
|
|
-
|
502
|
272
|
export default Form.create({})(userTree);
|