import React from 'react'; import { Icon, Button, Input, Select, Spin, Table, message, Cascader } from 'antd'; import { provinceSelect, getProvince } from '../../../NewDicProvinceList'; import { getTime, getCognizanceState, companySearch } from '../../../tools.js'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import moment from 'moment'; import './highTechFoster.less'; import FosterDesc from './fosterDesc/content.jsx'; const Patent = React.createClass({ loadData(pageNo) { this.state.data = []; this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/cultivate", data: { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize, locationProvince: this.state.province ? this.state.province[0] : undefined, uid: this.state.unitName, }, success: function (data) { if (data.error.length || !data.data || !data.data.list) { message.warning(data.error[0].message); return; } for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; this.state.data.push({ key: i, certificateNumber: thisdata.certificateNumber, contacts: [thisdata.cogContacts, { '1': thisdata.firstContacts, '2': thisdata.secondContacts, '3': thisdata.thirdContacts }], cogContacts: thisdata.cogContacts, consultant: thisdata.consultant, techPrincipal: thisdata.techPrincipal, firstContacts: thisdata.firstContacts, issuingDate: thisdata.issuingDate, issuingDateFormattedDate: thisdata.issuingDateFormattedDate, endtime: thisdata.issuingDateFormattedDate ? getTime(thisdata.issuingDateFormattedDate, 36) : null, province: thisdata.province, secondContacts: thisdata.secondContacts, thirdContacts: thisdata.thirdContacts, uid: thisdata.uid, unitName: thisdata.unitName, state: thisdata.issuingDateFormattedDate ? getTime(thisdata.issuingDateFormattedDate, 36) : null, }); }; this.state.pagination.current = data.data.pageNo; this.state.pagination.total = data.data.totalCount; this.setState({ dataSource: this.state.data, pagination: this.state.pagination }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, getCompanyList() { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/getUnitNames", success: function (data) { if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; return; }; let _me = this; for (var item in data.data) { _me.state.companyOption.push( {data.data[item]} ) }; }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, getInitialState() { return { companyOption: [], fosterDescDisplay: 'none', fosterDisplay: 'block', data: [], loading: false, pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadData(page); }.bind(this), showTotal: function (total) { return '共' + total + '条数据'; } }, columns: [ { title: '省份', dataIndex: 'province', key: 'province', render: text => { return getProvince(text) } }, { title: '公司名称', dataIndex: 'unitName', key: 'unitName', }, { title: '联系人', dataIndex: 'contacts', key: 'contacts', render: (text) => { for (let item in text[1]) { if (text[0] == item) { return text[1][item]; }; }; } }, { title: '状态', dataIndex: 'state', key: 'state', render: text => { if (text) { let n = moment(new Date()).format("YYYY-MM-DD"); if (text > n) { return '已下证'; } else { return '已到期'; } } else { return '培育中'; } } }, { title: '证书编号', dataIndex: 'certificateNumber', key: 'certificateNumber', }, { title: '发证日期', dataIndex: 'issuingDateFormattedDate', key: 'issuingDateFormattedDate', }, { title: '到期日期', dataIndex: 'endtime', key: 'endtime' }, { title: '业务员', dataIndex: 'consultant', key: 'consultant', }, { title: '技术员', dataIndex: 'techPrincipal', key: 'techPrincipal', } ], dataSource: [] }; }, componentWillMount() { let _me = this; this.loadData(); this.getCompanyList(); }, tableRowClick(record, index) { this.state.RowData = record; this.setState({ fosterDisplay: 'none', fosterDescDisplay: 'block' }); }, search() { this.loadData(); }, reset() { this.state.province = undefined; this.state.unitName = undefined; this.loadData(); }, returnBtn() { this.setState({ fosterDisplay: 'block', fosterDescDisplay: 'none' }); this.loadData(); }, render() { return ( 高企认定培育 { this.setState({ province: e }) }} /> { this.setState({ unitName: e }) }}> {this.state.companyOption} 搜索 重置 ); } }); export default Patent;