import React from 'react'; import { Icon, Form, Button, Input, Spin, message, InputNumber, DatePicker, Select, Checkbox, Cascader, Table, Radio } from 'antd'; import './techProduct.less'; import { areaSelect } from '../../../../NewDicProvinceList'; import { industryList, scaleList, companyType } from '../../../../dataDic'; import { techFieldList } from '../../../../DicTechFieldList'; import moment from 'moment'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; const CompanyDetail = Form.create()(React.createClass({ loadInfoData(uid) { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/basic/info", data: { uid: uid || this.props.data.uid } }).done(function (data) { let thisdata = data.data; if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; return; }; this.setState({ data: thisdata, id: thisdata.id, uid: thisdata.uid, hid: thisdata.hid, unitName: thisdata.unitName, postalAddress: thisdata.postalAddress, postcode: thisdata.postcode, firstContacts: thisdata.firstContacts, firstMobile: thisdata.firstMobile, contactsFixedTel: thisdata.contactsFixedTel, contactsFax: thisdata.contactsFax, legalPersonTel: thisdata.legalPersonTel, legalPersonFax: thisdata.legalPersonFax, legalPersonEmail: thisdata.legalPersonEmail, registeredCapital: thisdata.registeredCapital, registrationTime: thisdata.registrationTime, legalPerson: thisdata.legalPerson, legalPersonIdCard: thisdata.legalPersonIdCard, orgCode: thisdata.orgCode, ratepayCode: thisdata.ratepayCode, industry: thisdata.industry, enterpriseScale: thisdata.enterpriseScale, foreignInvestment: thisdata.foreignInvestment, taxAuthority: thisdata.taxAuthority, ratepayMethod: thisdata.ratepayMethod, listed: thisdata.listed, listedDate: thisdata.listedDate, listedType: thisdata.listedType, stockCode: thisdata.stockCode, highTechZone: thisdata.highTechZone, highTechName: thisdata.highTechName, riskInvestment: thisdata.riskInvestment, businessScope: thisdata.businessScope, firmTotal: thisdata.firmTotal, techTotal: thisdata.techTotal, listedDateFormattedDate: thisdata.listedDateFormattedDate, registrationTimeFormattedDate: thisdata.registrationTimeFormattedDate, address: [thisdata.licenceProvince, thisdata.licenceCity, thisdata.licenceArea], field: thisdata.field ? thisdata.field.split(',') : [], registerType: thisdata.registerType ? thisdata.registerType.split(',') : [] }); }.bind(this)).always(function () { this.setState({ loading: false }); }.bind(this)); }, loadHumanData(uid) { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/basic/listNature", data: { uid: uid || this.props.data.uid } }).done(function (data) { let theTableData = []; if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; return; }; data.data.map(function (item, i) { theTableData.push({ key: i, id: item.id, uid: item.uid, type: item.type, name: item.name, idNumber: item.idNumber, investment: item.investment }); }); this.setState({ humanTableData: theTableData }); }.bind(this)).always(function () { this.setState({ loading: false }); }.bind(this)); }, loadLegalData(uid) { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/basic/listLegalPerson", data: { uid: uid || this.props.data.uid } }).done(function (data) { let theTableData = []; if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; return; }; data.data.map(function (item, i) { theTableData.push({ key: i, id: item.id, uid: item.uid, type: item.type, name: item.name, orgCode: item.orgCode, investment: item.investment }); }); this.setState({ legalTableData: theTableData }); }.bind(this)).always(function () { this.setState({ loading: false }); }.bind(this)); }, getInitialState() { return { loading: false, industryOption: [], scaleOption: [], humanTableData: [], legalTableData: [], humanColumns: [ { title: '公民类型', dataIndex: 'type', key: 'type', width: '130px', render: (text, record, index) => { return } }, { title: '姓名', dataIndex: 'name', key: 'name', render: (text, record, index) => { return { record.name = e.target.value; this.setState({ humanTableData: this.state.humanTableData }); }} /> } }, { title: '身份证(护照)号', dataIndex: 'idNumber', key: 'idNumber', render: (text, record, index) => { return { record.idNumber = e.target.value; this.setState({ humanTableData: this.state.humanTableData }); }} /> } }, { title: '投资额(万元)', dataIndex: 'investment', key: 'investment', render: (text, record, index) => { return { record.investment = e; this.setState({ humanTableData: this.state.humanTableData }); }} /> } } ], legalColumns: [ { title: '法人类型', dataIndex: 'type', key: 'type', width: '130px', render: (text, record, index) => { return } }, { title: '名称', dataIndex: 'name', key: 'name', render: (text, record, index) => { return { record.name = e.target.value; this.setState({ legalTableData: this.state.legalTableData }); }} /> } }, { title: '组织机构代码或统一社会信用代码', dataIndex: 'orgCode', key: 'orgCode', render: (text, record, index) => { return { record.orgCode = e.target.value; this.setState({ legalTableData: this.state.legalTableData }); }} /> } }, { title: '投资额(万元)', dataIndex: 'investment', key: 'investment', render: (text, record, index) => { return { record.investment = e; this.setState({ legalTableData: this.state.legalTableData }); }} /> } } ], humanSelectedRowKeys: [], humanSelectedRows: [], legalSelectedRowKeys: [], legalSelectedRows: [] }; }, handleSubmit(e) { this.setState({ loading: true }); e.preventDefault(); this.props.form.validateFields((err, values) => { if (!err) { $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/basic/disposeInfo", data: { id: this.state.data.id, uid: this.props.data.uid || this.state.data.uid, hid: this.state.data.hid, unitName: values.unitName, licenceProvince: values.address[0], licenceCity: values.address[1], licenceArea: values.address[2], postalAddress: values.postalAddress, postcode: values.postcode, firstContacts: values.firstContacts, firstMobile: values.firstMobile, contactsFixedTel: values.contactsFixedTel, contactsFax: values.contactsFax, legalPersonTel: values.legalPersonTel, legalPersonFax: values.legalPersonFax, legalPersonEmail: values.legalPersonEmail, registeredCapital: values.registeredCapital, legalPerson: values.legalPerson, legalPersonIdCard: values.legalPersonIdCard, orgCode: values.orgCode, ratepayCode: values.ratepayCode, industry: values.industry, enterpriseScale: values.enterpriseScale, registerType: values.registerType ? values.registerType.join(',') : '', foreignInvestment: values.foreignInvestment, field: values.field ? values.field.join(',') : '', taxAuthority: values.taxAuthority, ratepayMethod: values.ratepayMethod, listed: values.listed, listedType: values.listedType ? Number(values.listedType) : null, stockCode: values.stockCode, highTechZone: values.highTechZone, highTechName: values.highTechName, riskInvestment: values.riskInvestment, businessScope: values.businessScope, firmTotal: values.firmTotal, techTotal: values.techTotal, listedDateFormattedDate: values.listedDate ? values.listedDate.format("YYYY-MM-DD") : '', registrationTimeFormattedDate: values.registrationTime ? values.registrationTime.format("YYYY-MM-DD") : '' } }).done(function (data) { if (!data.error.length) { message.success('保存成功!'); this.loadInfoData(); } else { message.warning(data.error[0].message); }; this.setState({ loading: false }); }.bind(this)); } }); }, componentWillMount() { let _me = this; industryList.map(function (item) { _me.state.industryOption.push( {item.key} ) }); scaleList.map(function (item) { _me.state.scaleOption.push( {item.key} ) }); this.loadHumanData(); this.loadLegalData(); this.loadInfoData(); }, componentWillReceiveProps(nextProps) { if (this.props.data.uid !== nextProps.data.uid) { this.loadHumanData(nextProps.data.uid); this.loadLegalData(nextProps.data.uid); this.loadInfoData(nextProps.data.uid); }; }, humanRemove() { let deletedIds = []; for (let idx = 0; idx < this.state.humanSelectedRows.length; idx++) { let rowItem = this.state.humanSelectedRows[idx]; if (rowItem.id) { deletedIds.push(rowItem.id) } }; this.setState({ loading: deletedIds.length > 0 }); if (deletedIds.length) { $.ajax({ url: globalConfig.context + '/api/admin/basic/deleteNature', method: 'post', data: { ids: deletedIds } }).done((res) => { if (!res.error.length) { message.success("删除成功"); this.state.humanSelectedRowKeys.sort((a, b) => { return b - a }); for (let idx = 0; idx < this.state.humanSelectedRowKeys.length; idx++) { let dataIndex = this.state.humanSelectedRowKeys[idx]; this.state.humanTableData.splice(dataIndex, 1); }; this.setState({ humanTableData: this.state.humanTableData, humanSelectedRowKeys: [] }); } else { message.error(res.error[0].message); } }).always(() => { this.setState({ loading: false }); }) } }, humanAdd() { this.state.humanTableData.push({ id: null, type: null, uid: this.state.uid, name: '', idNumber: '', investment: 0 }); this.setState({ humanTableData: this.state.humanTableData }) }, humanSave() { this.setState({ loading: true }); $.ajax({ url: globalConfig.context + '/api/admin/basic/nature', method: 'post', data: { data: JSON.stringify(this.state.humanTableData) } }).done((res) => { if (!res.error.length) { message.success("保存成功"); this.loadHumanData() } else { message.error(res.error[0].message); } }).always(() => { this.setState({ loading: false }); }) }, legalRemove() { let deletedIds = []; for (let idx = 0; idx < this.state.legalSelectedRows.length; idx++) { let rowItem = this.state.legalSelectedRows[idx]; if (rowItem.id) { deletedIds.push(rowItem.id) } }; this.setState({ loading: deletedIds.length > 0 }); if (deletedIds.length) { $.ajax({ url: globalConfig.context + '/api/admin/basic/deleteLegalPerson', method: 'post', data: { ids: deletedIds } }).done((res) => { if (!res.error.length) { message.success("删除成功"); this.state.legalSelectedRowKeys.sort((a, b) => { return b - a }); for (let idx = 0; idx < this.state.legalSelectedRowKeys.length; idx++) { let dataIndex = this.state.legalSelectedRowKeys[idx]; this.state.legalTableData.splice(dataIndex, 1); }; this.setState({ legalTableData: this.state.legalTableData, legalSelectedRowKeys: [] }); } else { message.error(res.error[0].message); } }).always(() => { this.setState({ loading: false }); }) } }, legalAdd() { this.state.legalTableData.push({ id: null, type: null, uid: this.state.uid, name: '', idNumber: '', investment: 0 }); this.setState({ legalTableData: this.state.legalTableData }) }, legalSave() { this.setState({ loading: true }); $.ajax({ url: globalConfig.context + '/api/admin/basic/legalPerson', method: 'post', data: { data: JSON.stringify(this.state.legalTableData) } }).done((res) => { if (!res.error.length) { message.success("保存成功"); this.loadLegalData() } else { message.error(res.error[0].message); } }).always(() => { this.setState({ loading: false }); }) }, render() { const FormItem = Form.Item; const { getFieldDecorator } = this.props.form; const theData = this.state; const formItemLayout = { labelCol: { span: 8 }, wrapperCol: { span: 16 }, }; const humanRowSelection = { type: 'checkbox', selectedRowKeys: this.state.humanSelectedRowKeys, onChange: (selectedRowKeys, selectedRows) => { this.setState({ humanSelectedRows: selectedRows, humanSelectedRowKeys: selectedRowKeys }); } }; const humanHasSelected = this.state.humanSelectedRowKeys.length > 0; const legalRowSelection = { type: 'checkbox', selectedRowKeys: this.state.legalSelectedRowKeys, onChange: (selectedRowKeys, selectedRows) => { this.setState({ legalSelectedRows: selectedRows, legalSelectedRowKeys: selectedRowKeys }); } }; const legalHasSelected = this.state.legalSelectedRowKeys.length > 0; if (this.state.data) { return (
企业基本信息
{getFieldDecorator('unitName', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.unitName })( )} {getFieldDecorator('address', { rules: [{ type: 'array', required: true, message: '此项为必填项!' }], initialValue: theData.address })( )} {getFieldDecorator('postalAddress', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.postalAddress })( )} {getFieldDecorator('postcode', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.postcode })( )}

联系人信息

{getFieldDecorator('firstContacts', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.firstContacts })( )} {getFieldDecorator('firstMobile', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.firstMobile })( )} {getFieldDecorator('contactsFixedTel', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.contactsFixedTel })( )} {getFieldDecorator('contactsFax', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.contactsFax })( )}

企业法人信息

{getFieldDecorator('legalPersonTel', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.legalPersonTel })( )} {getFieldDecorator('legalPersonFax', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.legalPersonFax })( )} {getFieldDecorator('legalPersonEmail', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.legalPersonEmail })( )}
企业重要信息
{getFieldDecorator('registeredCapital', { rules: [{ type: 'number', required: true, message: '此项为必填项!' }], initialValue: theData.registeredCapital })( )} 万元 {getFieldDecorator('registrationTime', { rules: [{ type: 'object', required: true, message: '此项为必填项!' }], initialValue: theData.registrationTime ? moment(theData.registrationTime) : null })( )} {getFieldDecorator('legalPerson', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.legalPerson })( )} {getFieldDecorator('legalPersonIdCard', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.legalPersonIdCard })( )} {getFieldDecorator('orgCode', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.orgCode })( )} {getFieldDecorator('ratepayCode', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.ratepayCode })( )} {getFieldDecorator('industry', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.industry })( )} {getFieldDecorator('enterpriseScale', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.enterpriseScale })( )} {getFieldDecorator('registerType', { rules: [{ type: 'array', required: true, message: '此项为必填项!' }], initialValue: theData.registerType })( )} {getFieldDecorator('foreignInvestment', { //rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.foreignInvestment })( )}
{getFieldDecorator('field', { rules: [{ type: 'array', required: true, message: '此项为必填项!' }], initialValue: theData.field })( )}
{getFieldDecorator('taxAuthority', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.taxAuthority })( 国税 地税 )} {getFieldDecorator('ratepayMethod', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.ratepayMethod })( 查账征收 核定征收 )}
{getFieldDecorator('listed', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.listed })( )}
{getFieldDecorator('listedDate', { initialValue: theData.listedDate ? moment(theData.listedDate) : null })( )} {getFieldDecorator('listedType', { initialValue: theData.listedType })( )} {getFieldDecorator('stockCode', { initialValue: theData.stockCode })( )}
{getFieldDecorator('highTechZone', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.highTechZone })( )}
{getFieldDecorator('highTechName', { initialValue: theData.highTechName })( )}
股权结构
自然人股权
法人股权
{getFieldDecorator('riskInvestment', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.riskInvestment })( )} {getFieldDecorator('businessScope', { rules: [{ required: true, message: '此项为必填项!' }], initialValue: theData.businessScope })( )}
员工情况
{getFieldDecorator('firmTotal', { initialValue: theData.firmTotal || 0 })( )} {getFieldDecorator('techTotal', { initialValue: theData.techTotal || 0 })( )} 其中科技人员占比 {(() => { if (!this.props.form.getFieldValue('techTotal') || !this.props.form.getFieldValue('firmTotal')) { return 0 } return (this.props.form.getFieldValue('techTotal') / this.props.form.getFieldValue('firmTotal') * 100).toFixed(2) })()} %
); } else { return (
) }; } })); export default CompanyDetail;