index.js 3.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
// import React, { Fragment } from 'react';
// import {
//   Button,
//   Card, Col,
//   Form, message, Row,
// } from 'antd';
// import { connect } from 'dva';
// import PageHeaderWrapper from '@/components/PageHeaderWrapper';
// import moment from 'moment';
// import router from 'umi/router';
// import { text, number, date, getFormArrayConfig } from '../config/index';
// import FormArray from '../AffairPage/component/FormArray';
// import ButtonDiy from '@/baseComponent/ButtonDiy';
// import Shell from '../Shell';
//
//
// @connect(({ formList, loading }) => ({
//   formList,
// }))
// @Form.create()
// class Edit extends React.Component {
//
//   state = {
//     modalVisible: false,
//     formData: {},
//     formItem: [],
//     isAdd: false,
//     objId: this.props.id,
//     recordId: this.props.recordId,
//     recordKey: this.props.recordKey,
//   };
//   columns = [];
//
//   //渲染值
//   componentDidMount() {
//     const { dispatch } = this.props;
//     const { objId, recordKey, recordId } = this.state;
//     dispatch({
//       type: 'formList/getHead',
//       payload: { dataObjId: objId },
//       callback: (dates) => {
//         if (dates) {
//           this.setState({
//             formItem: dates,
//           });
//         }
//       },
//     });
//     //渲染表单字段
//     if (recordId != null) {
//       dispatch({
//         type: 'formList/getDetail',
//         payload: {
//           dataObjId: objId,
//           key: recordKey,
//           value: recordId,
//         },
//         callback: (res) => {
//           if (res) {
//             this.setState({
//               formData: res,
//             });
//           }
//         },
//       });
//       this.setState({
//         isAdd: false,
//       })
//     }else{
//       this.setState({
//         isAdd: true,
//       })
//     }
//   }
//
//   onSubmit = () => {
//     //router.goBack();
//     const {  isAdd, objId, formData } = this.state;
//     let payload = {
//       params: {...formData},
//       objId,
//       isAdd,
//     };
//     this.props.dispatch({
//       type: 'formList/add',
//       payload,
//       callback: () => {
//         message.success('操作成功');
//         this.props.returnThis();
//       },
//     });
//   };
//
//   goBack = () => {
//     this.props.returnThis();
//   };
//
//   changeFormData = (value, key) => {
//     let oldValue = this.state.formData;
//     oldValue[key] = value;
//     this.setState({
//       formData: oldValue,
//     });
//   };
//
//   render() {
//     let { formItem, formData } = this.state;
//     let formConfig = getFormArrayConfig(formItem);
//     return (
//         <Shell>
//         <Row>
//           <FormArray
//             config={formConfig}
//             nameSpan={{ big: 10, small: 12 }}
//             fileSpan={{ big: 4, small: 3 }}
//             value={formData}
//             changeValue={this.changeFormData}
//           />
//           <Col span={24}
//                style={{ textAlign: 'center', paddingTop: '200px', paddingBottom: '50px' }}>
//
//             <ButtonDiy
//               className={'primaryBlue'}
//               handleClick={this.onSubmit}
//               name={'保存'}
//             />
//             <ButtonDiy
//               className={'defaultRed'}
//               handleClick={this.goBack}
//               name={'返回'}
//               />
//           </Col>
//         </Row>
//         </Shell>
//     );
//   }
// }
//
// export default Edit;