123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397 |
- import React from 'react';
- import { Icon, message, Row, Col, Radio, Checkbox, Input, InputNumber, Button, Table, Spin } from 'antd';
- import '../portal.less';
- 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 <span>成果</span>;
- case "1":
- return <span>技术</span>;
- case "2":
- return <span>项目</span>;
- }
- }
- }, {
- 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 <span>个人</span>;
- case "1":
- return <span>组织</span>
- }
- }
- }, {
- title: '发布时间',
- dataIndex: 'releaseDateFormattedDate',
- key: 'releaseDateFormattedDate',
- }
- ],
- dataSource: []
- };
- },
- componentWillMount() {
- let theArr = [];
- let theCategoryArr = [], theTransferModeArr = [], theMaturityArr = [];
- //行业分类单选项
- theArr.push(
- <Radio.Button key={999} value={999}>不限</Radio.Button>
- );
- IndustryObject.map(function (item) {
- theArr.push(
- <Radio.Button key={item.value} value={item.value}>{item.label}</Radio.Button>
- );
- });
- //技术类型单选项目
- theCategoryArr.push(
- <Radio.Button key={999} value={999}>不限</Radio.Button>
- );
- achievementCategoryList.map(function (item) {
- theCategoryArr.push(
- <Radio.Button key={item.value} value={item.value}>{item.key}</Radio.Button>
- );
- });
- //交易方式单选项目
- theTransferModeArr.push(
- <Radio.Button key={999} value={999}>不限</Radio.Button>
- );
- transferModeList.map(function (item) {
- theTransferModeArr.push(
- <Radio.Button key={item.value} value={item.value}>{item.key}</Radio.Button>
- );
- });
- //成熟度单选项目
- theMaturityArr.push(
- <Radio.Button key={999} value={999}>不限</Radio.Button>
- );
- maturityList.map(function (item) {
- theMaturityArr.push(
- <Radio.Button key={item.value} value={item.value}>{item.key}</Radio.Button>
- );
- });
- 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(
- <Radio.Button key={999} value={999}>不限</Radio.Button>
- );
- IndustryObject.map(function (item1) {
- if (item1.value == e.target.value) {
- item1.children.map(function (item2) {
- theArr.push(
- <Radio.Button key={item2.value} value={item2.value}>{item2.label}</Radio.Button>
- );
- });
- }
- });
- this.state.fieldA = e.target.value;
- } else {
- this.state.fieldA = null;
- };
- this.loadData();
- this.setState({ industryRadioB: theArr });
- },
- tableRowClick(record, index) {
- this.state.RowData = record;
- this.setState({
- showDesc: true
- });
- },
- closeDesc(e) {
- this.setState({
- showDesc: e
- });
- },
- render() {
- return (
- <div className="portal-content">
- <Row className="search-criteria">
- <Col className="search-title" span={2}>
- <span>行业分类</span>
- </Col>
- <Col className="search-select" span={22}>
- <Radio.Group defaultValue={999} onChange={this.industryChange}>
- {this.state.industryRadioA}
- </Radio.Group>
- </Col>
- </Row>
- {this.state.industryRadioB.length > 1 ? <Row className="search-criteria">
- <Col className="search-title" span={2}>
- <span>行业子分类</span>
- </Col>
- <Col className="search-select" span={22}>
- <Radio.Group defaultValue={999} onChange={(e) => { this.state.fieldB = e.target.value; this.loadData() }}>
- {this.state.industryRadioB}
- </Radio.Group>
- </Col>
- </Row> : <div></div>}
- <Row className="search-criteria">
- <Col className="search-title" span={2}>
- <span>交易价格</span>
- </Col>
- <Col className="search-select" span={13}>
- <Radio.Group value={this.state.transferPrice}
- onChange={(e) => {
- this.setState({
- transferPrice: e.target.value
- });
- this.state.transferPrice = e.target.value;
- this.loadData();
- }}>
- <Radio.Button value={999}>不限</Radio.Button>
- <Radio.Button value={1}>1-10万元</Radio.Button>
- <Radio.Button value={2}>10-50万元</Radio.Button>
- <Radio.Button value={3}>50-100万元</Radio.Button>
- <Radio.Button value={4}>100-500万元</Radio.Button>
- <Radio.Button value={5}>500-1000万元</Radio.Button>
- <Radio.Button value={6}>面议</Radio.Button>
- </Radio.Group>
- </Col>
- <Col span={9}>
- <Checkbox checked={!this.state.transferPrice} onChange={(e) => { if (e.target.checked) { this.setState({ transferPrice: null }) } }}>自定义金额</Checkbox>
- <InputNumber style={{ width: 80 }}
- disabled={Boolean(this.state.transferPrice)}
- onChange={(e) => { this.state.transferPriceLower = e; }} />
- <span> 到 </span>
- <InputNumber style={{ width: 80 }}
- disabled={Boolean(this.state.transferPrice)}
- onChange={(e) => { this.state.transferPriceUpper = e; }} />
- <span> 万元</span>
- <Button style={{ marginLeft: '20px' }} disabled={Boolean(this.state.transferPrice)} onClick={() => { this.loadData() }}>确定</Button>
- </Col>
- </Row>
- <Row className="search-criteria">
- <Col className="search-title" span={2}>
- <span>技术类型</span>
- </Col>
- <Col className="search-select" span={22}>
- <Radio.Group defaultValue={999} onChange={(e) => {
- this.setState({
- category: e.target.value
- });
- this.state.category = e.target.value;
- this.loadData();
- }}>
- {this.state.categoryRadio}
- </Radio.Group>
- </Col>
- </Row>
- <Row className="search-criteria">
- <Col className="search-title" span={2}>
- <span>交易方式</span>
- </Col>
- <Col className="search-select" span={22}>
- <Radio.Group defaultValue={999} onChange={(e) => {
- this.setState({
- transferMode: e.target.value
- });
- this.state.transferMode = e.target.value
- this.loadData();
- }}>
- {this.state.transferModeRadio}
- </Radio.Group>
- </Col>
- </Row>
- <Row className="search-criteria">
- <Col className="search-title" span={2}>
- <span>成熟度</span>
- </Col>
- <Col className="search-select" span={22}>
- <Radio.Group defaultValue={999} onChange={(e) => {
- this.setState({
- maturity: e.target.value
- });
- this.state.maturity = e.target.value
- this.loadData();
- }}>
- {this.state.maturityRadio}
- </Radio.Group>
- </Col>
- </Row>
- <Row className="search-criteria" style={{ paddingBottom: '10px' }}>
- <Col className="search-title" span={2}>
- <span>关键字</span>
- </Col>
- <Col className="search-select" span={22}>
- <Input style={{ width: 120 }} onChange={(e) => { this.state.keyword = e.target.value; }} />
- <Button style={{ marginLeft: '20px' }} onClick={() => { this.loadData() }}>确定</Button>
- </Col>
- </Row>
- <Spin spinning={this.state.loading}>
- <Table columns={this.state.columns}
- dataSource={this.state.dataSource}
- pagination={this.state.pagination}
- onRowClick={this.tableRowClick} />
- </Spin>
- <AchievementDesc
- data={this.state.RowData}
- showDesc={this.state.showDesc}
- closeDesc={this.closeDesc} />
- </div >
- )
- }
- });
- export default Content;
|