123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319 |
- import React from 'react';
- import { Icon, Button, Select, Spin, Table, message } from 'antd';
- import { companySearch, getTechnologyState } from '../../tools.js';
- import { getProvince } from '../../NewDicProvinceList'
- import ajax from 'jquery/src/ajax/xhr.js';
- import $ from 'jquery/src/ajax';
- import './technology.less';
- import ApplyAdd from './technologyAdd.jsx';
- import ApplyChange from './technologyChange.jsx';
- const Technology = React.createClass({
- loadData(pageNo) {
- this.state.data = [];
- this.setState({
- loading: true
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/user/techproject/listClientTechProject",
- data: {
- pageNo: pageNo || 1,
- pageSize: this.state.pagination.pageSize,
- },
- 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];
- switch (thisdata.contacts) {
- case 1:
- thisdata.contacts = thisdata.firstContacts;
- break;
- case 2:
- thisdata.contacts = thisdata.secondContacts;
- break;
- case 3:
- thisdata.contacts = thisdata.thirdContacts;
- break;
- }
- this.state.data.push({
- key: i,
- pid: thisdata.id,
- uid: thisdata.uid,
- serialNumber: thisdata.serialNumber,
- province: thisdata.province,
- unitName: thisdata.unitName,
- contacts: thisdata.contacts,
- projectName: thisdata.projectName,
- projectCatagory: thisdata.projectCatagory,
- techField: thisdata.techField,
- state: thisdata.state,
- createTime: thisdata.createTimeFormattedDate,
- consultant: thisdata.consultant
- });
- };
- 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));
- },
- getAuthorList() {
- this.setState({
- loading: true
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/user/patent/getAdmin",
- success: function (data) {
- let theOption = [];
- if (data.error && data.error.length) {
- message.error(data.error[0].message);
- } else {
- for (var item in data.data) {
- theOption.push(
- <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
- )
- };
- };
- this.setState({
- authorOption: theOption
- });
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- getContactsList() {
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/user/getContacts",
- success: function (data) {
- let theOption = [];
- if (data.error && data.error.length) {
- message.error(data.error[0].message);
- } else {
- for (let item in data.data) {
- let theData = data.data[item];
- theOption.push(
- <Select.Option value={item} key={item}>{theData}</Select.Option>
- );
- };
- };
- this.setState({
- contactsOption: theOption
- });
- }.bind(this),
- });
- },
- getDepartment() {
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/user/techproject/getDepartment",
- success: function (data) {
- let theOption = [];
- if (data.error && data.error.length) {
- message.error(data.error[0].message);
- } else {
- for (let item in data.data) {
- let theData = data.data[item];
- theOption.push(
- <Select.Option value={item} key={item}>{theData}</Select.Option>
- );
- };
- };
- this.setState({
- departmentOption: theOption,
- departmentObj: data.data
- });
- }.bind(this),
- });
- },
- getInitialState() {
- return {
- authorOption: [],
- selectedRows: [],
- loading: false,
- showAdd: false,
- showDesc: 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: 'serialNumber',
- key: 'serialNumber'
- }, {
- title: '省份',
- dataIndex: 'province',
- key: 'province',
- render: text => { return getProvince(text) }
- }, {
- title: '公司',
- dataIndex: 'unitName',
- key: 'unitName'
- }, {
- title: '联系方式',
- dataIndex: 'contacts',
- key: 'contacts'
- }, {
- title: '项目名称',
- dataIndex: 'projectName',
- key: 'projectName'
- }, {
- title: '项目类型',
- dataIndex: 'projectCatagory',
- key: 'projectCatagory'
- }, {
- title: '技术领域',
- dataIndex: 'techField',
- key: 'techField'
- }, {
- title: '项目情况',
- dataIndex: 'state',
- key: 'state',
- render: text => { return getTechnologyState(text) },
- }, {
- title: '派单日',
- dataIndex: 'createTime',
- key: 'createTime'
- }, {
- title: '负责人',
- dataIndex: 'consultant',
- key: 'consultant'
- }
- ],
- dataSource: []
- };
- },
- componentWillMount() {
- this.loadData();
- this.getAuthorList();
- this.getContactsList();
- this.getDepartment();
- },
- tableRowClick(record, index) {
- this.state.RowData = record;
- this.setState({
- showDesc: true
- });
- },
- addClick() {
- this.setState({
- showAdd: 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)
- }
- }
- $.ajax({
- method: "POST",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/user/cognizance/deleteCognizance",
- 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) {
- this.state.showDesc = e;
- this.loadData();
- },
- closeAdd(e) {
- this.state.showAdd = e;
- this.loadData();
- },
- render() {
- return (
- <div className="foster-content" >
- <div className="content-title">
- <span>科技项目申报管理</span>
- </div>
- <div className="patent-table">
- <Spin spinning={this.state.loading}>
- <Table columns={this.state.columns}
- dataSource={this.state.dataSource}
- pagination={this.state.pagination}
- style={{
- cursor: 'pointer',
- }}
- onRowClick={this.tableRowClick} />
- </Spin>
- </div>
- <ApplyChange
- data={this.state.RowData}
- contactsOption={this.state.contactsOption}
- departmentOption={this.state.departmentOption}
- departmentObj={this.state.departmentObj}
- showDesc={this.state.showDesc}
- closeDesc={this.closeDesc} />
- <ApplyAdd
- authorOption={this.state.authorOption}
- contactsOption={this.state.contactsOption}
- departmentOption={this.state.departmentOption}
- departmentObj={this.state.departmentObj}
- showAdd={this.state.showAdd}
- closeAdd={this.closeAdd} />
- </div >
- );
- }
- });
- export default Technology;
- // <div className="foster-query" style={{ float: "right" }}>
- // <div>
- // <Button style={{ background: "#ea0862", border: "none", color: "#fff" }}
- // onClick={this.addClick}>申请新科技项目<Icon type="plus" /></Button>
- // </div>
- // </div>
|