import React from 'react'; import { Icon, message, Row, Col, Radio, Checkbox, Input, InputNumber, Button, Table, Spin, Carousel } from 'antd'; import '../portal.less'; import logoImg from '../../../../image/logo.png'; import searchImg from '../../../../image/search.png'; import slideImg from '../../../../image/slide_img_1.png'; import { IndustryObject, getIndustryCategory } from '../../DicIndustryList'; import { achievementCategoryList, transferModeList, maturityList } from '../../dataDic'; import { getAchievementCategory } from '../../tools'; import ajax from 'jquery/src/ajax/xhr.js' import $ from 'jquery/src/ajax'; import AchievementDesc from './achievementDesc'; const Content = React.createClass({ loadData(pageNo) { this.setState({ loading: true }); switch (this.state.transferPrice) { case 1: this.state.transferPriceLower = 1; this.state.transferPriceUpper = 10; break; case 2: this.state.transferPriceLower = 10; this.state.transferPriceUpper = 50; break; case 3: this.state.transferPriceLower = 50; this.state.transferPriceUpper = 100; break; case 4: this.state.transferPriceLower = 100; this.state.transferPriceUpper = 500; break; case 5: this.state.transferPriceLower = 500; this.state.transferPriceUpper = 1000; break; case 6: this.state.bargainingMode = 1; break; case 999: this.state.transferPriceLower = null; this.state.transferPriceUpper = null; break; } $.ajax({ method: "get", dataType: "json", url: globalConfig.context + "/portal/search/achievementList", data: { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize, category: this.state.category == 999 ? null : this.state.category, //技术类型 keyword: this.state.keyword, maturity: this.state.maturity == 999 ? null : this.state.maturity, //成熟度 transferPriceLower: this.state.transferPriceLower, //交易金额下限 transferPriceUpper: this.state.transferPriceUpper, //交易金额上限 bargainingMode: this.state.bargainingMode, transferMode: this.state.transferMode == 999 ? null : this.state.transferMode, //交易方式 fieldA: this.state.fieldA, //技术领域(行业类别A) fieldB: this.state.fieldB == 999 ? null : this.state.fieldB, //技术领域(行业类别B) }, success: function (data) { let theArr = []; if (!data.data || !data.data.list) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; } else { for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; theArr.push({ key: i, id: thisdata.id, serialNumber: thisdata.serialNumber, keyword: thisdata.keyword, name: thisdata.name, dataCategory: thisdata.dataCategory, category: thisdata.category, ownerName: thisdata.username || thisdata.unitName, username: thisdata.username, unitName: thisdata.unitName, releaseDate: thisdata.releaseDate, ownerType: thisdata.ownerType, field: [thisdata.fieldA, thisdata.fieldB], transferPrice: thisdata.transferPrice, maturity: thisdata.maturity, transferMode: thisdata.transferMode, releaseDateFormattedDate: thisdata.releaseDateFormattedDate }); }; }; this.state.pagination.defaultCurrent = data.data.pageNo; this.state.pagination.total = data.data.totalCount; this.setState({ dataSource: theArr, pagination: this.state.pagination }); }.bind(this), }).done(function (data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; this.setState({ loading: false }); this.state.bargainingMode = 0; }.bind(this)); }, getInitialState() { return { loading: false, showDesc: false, industryRadioB: [], transferPrice: 999, 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: 'serialNumber', key: 'serialNumber', }, { title: '名称', dataIndex: 'name', key: 'name', }, { title: '关键字', dataIndex: 'keyword', key: 'keyword', }, { title: '成果类型', dataIndex: 'dataCategory', key: 'dataCategory', render: text => { switch (text) { case "0": return 成果; case "1": return 技术; case "2": return 项目; } } }, { title: '类型', dataIndex: 'category', key: 'category', render: text => { return getAchievementCategory(text); } }, { title: '行业分类', dataIndex: 'field', key: 'field', render: text => { return getIndustryCategory(text[0], text[1]) } }, { title: '所有人名称', dataIndex: 'ownerName', key: 'ownerName', }, { title: '所有人类型', dataIndex: 'ownerType', key: 'ownerType', render: text => { switch (text) { case "0": return 个人; case "1": return 组织 } } }, { title: '发布时间', dataIndex: 'releaseDateFormattedDate', key: 'releaseDateFormattedDate', } ], dataSource: [] }; }, componentWillMount() { let theArr = []; let theCategoryArr = [], theTransferModeArr = [], theMaturityArr = []; //行业分类单选项 theArr.push( 不限 ); IndustryObject.map(function (item) { theArr.push( {item.label} ); }); //技术类型单选项目 theCategoryArr.push( 不限 ); achievementCategoryList.map(function (item) { theCategoryArr.push( {item.key} ); }); //交易方式单选项目 theTransferModeArr.push( 不限 ); transferModeList.map(function (item) { theTransferModeArr.push( {item.key} ); }); //成熟度单选项目 theMaturityArr.push( 不限 ); maturityList.map(function (item) { theMaturityArr.push( {item.key} ); }); this.state.industryRadioA = theArr; this.state.categoryRadio = theCategoryArr; this.state.transferModeRadio = theTransferModeArr; this.state.maturityRadio = theMaturityArr; this.loadData(); }, industryChange(e) { let theArr = []; if (e.target.value !== 999) { theArr.push( 不限 ); IndustryObject.map(function (item1) { if (item1.value == e.target.value) { item1.children.map(function (item2) { theArr.push( {item2.label} ); }); } }); this.state.fieldA = e.target.value; } else { this.state.fieldA = null; }; this.loadData(); this.setState({ industryRadioB: theArr }); }, tableRowClick(record, index) { window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + record.id + '&type=' + record.ownerType); }, closeDesc(e) { this.setState({ showDesc: e }); }, render() { return (
{ this.state.keyword = e.target.value; }} />
行业分类 {this.state.industryRadioA} {this.state.industryRadioB.length > 1 ? 行业子分类 { this.state.fieldB = e.target.value; this.loadData() }}> {this.state.industryRadioB} :
} 交易价格 { this.setState({ transferPrice: e.target.value }); this.state.transferPrice = e.target.value; this.loadData(); }}> 不限 1-10万元 10-50万元 50-100万元 100-500万元 500-1000万元 面议 { if (e.target.checked) { this.setState({ transferPrice: null }) } }}>自定义金额 { this.state.transferPriceLower = e; }} /> { this.state.transferPriceUpper = e; }} /> 万元 技术类型 { this.setState({ category: e.target.value }); this.state.category = e.target.value; this.loadData(); }}> {this.state.categoryRadio} 交易方式 { this.setState({ transferMode: e.target.value }); this.state.transferMode = e.target.value this.loadData(); }}> {this.state.transferModeRadio} 成熟度 { this.setState({ maturity: e.target.value }); this.state.maturity = e.target.value this.loadData(); }}> {this.state.maturityRadio} ) } }); export default Content;