import React from 'react'; import { Icon, Button, Input, Spin, Table, message, Select, Modal, DatePicker } from 'antd'; import { technicalSourceList } from '../../dataDic.js'; import { getCatagory, getIntellectualObtainWay } from '../../tools.js'; import './intellectual.less'; import moment from 'moment'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import IntellectualDesc from './intellectualDesc.jsx'; const Intellectual = React.createClass({ loadData(pageNo) { this.state.data = []; this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/user/cognizance/intellectualList", data: { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize, startDate: this.state.startDateFormattedDate, endDate: this.state.endDateFormattedDate } }).done((data) => { if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); this.state.ButtonDisabled = true; } return; }; for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; this.state.data.push({ key: i, id: thisdata.id, uid: thisdata.uid, intellectualPropertyNumber: thisdata.intellectualPropertyNumber, intellectualPropertyName: thisdata.intellectualPropertyName, sortNumber: thisdata.sortNumber, catagory: thisdata.catagory, obtainWay: thisdata.obtainWay, authorizationNumber: thisdata.authorizationNumber, authorizationDate: thisdata.authorizationDate, evaluationCategory: thisdata.evaluationCategory, authorizationDateFormattedDate: thisdata.authorizationDateFormattedDate, propertyRightUrl: thisdata.propertyRightUrl, propertyRightDownloadFileName: thisdata.propertyRightDownloadFileName, type:thisdata.type }); }; this.state.pagination.current = data.data.pageNo; this.state.pagination.total = data.data.totalCount; this.setState({ dataSource: this.state.data, pagination: this.state.pagination }); }).always(function () { this.setState({ loading: false }); }.bind(this)); }, getInitialState() { return { selectedRowKeys: [], selectedRows: [], 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: 'intellectualPropertyNumber', key: 'intellectualPropertyNumber' }, { title: '知识产权名称', dataIndex: 'intellectualPropertyName', key: 'intellectualPropertyName' }, { title: '排序号', dataIndex: 'sortNumber', key: 'sortNumber' }, { title: '知识产权类型', dataIndex: 'catagory', key: 'catagory', render: text => { return getCatagory(text) } }, { title: '获取方式', dataIndex: 'obtainWay', key: 'obtainWay', render: text => { return getIntellectualObtainWay(text) } }, { title: '授权号', dataIndex: 'authorizationNumber', key: 'authorizationNumber' }, { title: '授权时间', dataIndex: 'authorizationDateFormattedDate', key: 'authorizationDateFormattedDate' } ], dataSource: [] }; }, componentWillMount() { this.loadData(); }, tableRowClick(record, index) { this.state.RowData = record; this.setState({ showDesc: true }); }, delectRow() { let deletedIds = []; for (let idx = 0; idx < this.state.selectedRows.length; idx++) { let rowItem = this.state.selectedRows[idx]; if (rowItem.id) { deletedIds.push(rowItem.id) } } this.setState({ selectedRowKeys: [], loading: deletedIds.length > 0 }); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/user/cognizance/deleteIntellectual", data: { ids: deletedIds } }).done(function (data) { if (!data.error.length) { message.success('删除成功!'); this.setState({ loading: false, }); } else { message.warning(data.error[0].message); }; this.loadData(); }.bind(this)); }, closeDesc(e, s) { this.state.showDesc = e; if (s) { this.loadData(); }; }, search() { this.loadData(); }, reset() { this.state.startDateFormattedDate = undefined; this.state.endDateFormattedDate = undefined; this.loadData(); }, render() { const rowSelection = { selectedRowKeys: this.state.selectedRowKeys, onChange: (selectedRowKeys, selectedRows) => { this.setState({ selectedRows: selectedRows, selectedRowKeys: selectedRowKeys }); } }; const hasSelected = this.state.selectedRowKeys.length > 0; return (