import React from 'react'; import { Icon, message, Input, Select, Button, Form, DatePicker } from 'antd'; import './userList.less'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import moment from 'moment'; import { eduLevelList, auditStatusList } from '../../dataDic.js' import { addressInit } from '../../tools.js'; const OrgCertify = Form.create()(React.createClass({ getInitialState() { return { visible: false, loading: false, eduLvlOption: [], auditStatusOption: [] }; }, loadData() { this.state.data = []; this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orgDetail", data: { uid: this.props.uid }, success: function (data) { if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; return; }; addressInit('licenceProvince', 'licenceCity', 'licenceArea', data.data.licenceProvince, data.data.licenceCity, data.data.licenceArea); addressInit('locationProvince', 'locationCity', 'locationArea', data.data.locationProvince, data.data.locationCity, data.data.locationArea); this.setState({ id: data.data.id, contacts: data.data.contacts, contactMobile: data.data.contactMobile, fixedTel: data.data.fixedTel, qq: data.data.qq, postalAddress: data.data.postalAddress, postcode: data.data.postcode, aftUsername: data.data.aftUsername, unitName: data.data.unitName, identityType: String(data.data.identityType), //组织性质 registeredCapital: data.data.registeredCapital, //注册资金 legalPerson: data.data.legalPerson, legalPersonIdCard: data.data.legalPersonIdCard, licenceNumber: data.data.licenceNumber, licenceScanningUrl: data.data.licenceScanningUrl, orgCode: data.data.orgCode, orgCodeUrl: data.data.orgCodeUrl, bankAccount: data.data.bankAccount, banks: data.data.banks, bankBranch: data.data.bankBranch, bankCardNumber: data.data.bankCardNumber, validationAmount: data.data.validationAmount, //打款金额 paymentDate: data.data.paymentDate, paymentDateFormattedDate: data.data.paymentDateFormattedDate, lastYearTaxReportUrl: data.data.lastYearTaxReportUrl, auditStatus: String(data.data.auditStatus), process: data.data.process }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, handleSubmit(e) { e.preventDefault(); this.props.form.validateFields((err, values) => { if (!err) { this.setState({ loading: true }); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/updateOrgDetail", data: { id: this.state.id, contacts: values.contacts, contactMobile: values.contactMobile, postalAddress: values.postalAddress, postcode: values.postcode, aftUsername: values.aftUsername, unitName: values.unitName, identityType: values.identityType, //组织性质 registeredCapital: values.registeredCapital, //注册资金 legalPerson: values.legalPerson, legalPersonIdCard: values.legalPersonIdCard, licenceNumber: values.licenceNumber, orgCode: values.orgCode, bankAccount: values.bankAccount, banks: values.banks, bankBranch: values.bankBranch, bankCardNumber: values.bankCardNumber, validationAmount: values.validationAmount, //打款金额 paymentDateFormattedDate: values.paymentDateFormattedDate ? values.paymentDateFormattedDate.format("YYYY-MM-DD") : undefined, auditStatus: values.auditStatus, process: values.process } }).done(function (data) { if (!data.error.length) { message.success('保存成功!'); } else { message.warning(data.error[0].message); } }.bind(this)).always(function () { this.setState({ visible: false, }); this.props.handleOk(); }.bind(this)); } }); }, handleCancel() { this.props.closeDesc(false); }, componentWillMount() { let _me = this; eduLevelList.map(function (item, i) { _me.state.eduLvlOption.push( {item.key} ); }); auditStatusList.map(function (item, i) { _me.state.auditStatusOption.push( {item.key} ); }); }, componentDidMount() { addressInit('licenceProvince', 'licenceCity', 'licenceArea'); addressInit('locationProvince', 'locationCity', 'locationArea'); this.loadData(); }, componentWillReceiveProps(nextProps) { if (!this.props.visible && nextProps.visible) { this.props.form.resetFields(); this.loadData(); }; }, render() { const { getFieldDecorator } = this.props.form; const FormItem = Form.Item const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 12 }, }; return (
{getFieldDecorator('unitName', { initialValue: this.state.unitName })( )} {getFieldDecorator('aftUsername', { initialValue: this.state.aftUsername })( )} {getFieldDecorator('identityType', { initialValue: this.state.identityType })( )} {getFieldDecorator('contacts', { initialValue: this.state.contacts })( )} {getFieldDecorator('contactMobile', { initialValue: this.state.contactMobile })( )} {getFieldDecorator('legalPerson', { initialValue: this.state.legalPerson })( )} {getFieldDecorator('legalPersonIdCard', { initialValue: this.state.legalPersonIdCard })( )} {getFieldDecorator('registeredCapital', { initialValue: this.state.registeredCapital })( )} {getFieldDecorator('licenceNumber', { initialValue: this.state.licenceNumber })( )} {getFieldDecorator('licenceAddress')(
)}
{this.state.licenceScanningUrl ?
)}
{this.state.orgCodeUrl ?
)} {getFieldDecorator('bankBranch', { initialValue: this.state.bankBranch })( )} {getFieldDecorator('bankCardNumber', { initialValue: this.state.bankCardNumber })( )} {getFieldDecorator('locationAddress')(
)}
{getFieldDecorator('validationAmount', { initialValue: this.state.validationAmount })( )} {getFieldDecorator('paymentDateFormattedDate', { initialValue: this.state.paymentDate ? moment(this.state.paymentDate) : null })( )} {getFieldDecorator('auditStatus', { initialValue: this.state.auditStatus })( )} {getFieldDecorator('process', { initialValue: this.state.process })( )} ); } })); export default OrgCertify;