123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- import React from 'react';
- import { Icon, Button, Input, Select, Spin, Table, DatePicker, message } from 'antd';
- import { copyrightStateList } from '../../../dataDic.js';
- import { getTime, getCopyrightState } from '../../../tools.js';
- import ajax from 'jquery/src/ajax/xhr.js';
- import $ from 'jquery/src/ajax';
- import PatentAdd from './comPatentAdd.jsx';
- import PatentChange from './comPatentChange.jsx';
- import './copyright.less';
- const copyright = React.createClass({
- loadData(pageNo) {
- this.state.data = [];
- this.setState({
- loading: true
- });
- $.ajax({
- method: "post",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/techservice/patent/managePatentList",
- data: {
- pageNo: pageNo || 1,
- pageSize: this.state.pagination.pageSize,
- locationProvince: this.state.province,
- unitName: this.state.unitName,
- },
- success: function (data) {
- if (data.error.length || !data.data || !data.data.list) {
- message.warning(data.error[0].message);
- return;
- }
- this.state.pagination.defaultCurrent = data.data.pageNo;
- this.state.pagination.total = data.data.totalCount;
- this.setState({
- dataSource: data.data.list,
- 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 + "/techservice/cognizance/getContacts",
- success: function (data) {
- if (data.error.length || !data.data) {
- return;
- };
- this.state.contactsOption = [];
- for (let item in data2[0].data) {
- let theData = data2[0].data[item];
- contactsOption.push(
- <Select.Option value={item} key={theData}>{theData}</Select.Option>
- );
- };
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- getInitialState() {
- return {
- visible: false,
- stateOption: [],
- data: [],
- selectedRowKeys: [],
- 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: 'number',
- key: 'number',
- }, {
- title: '软著名称',
- dataIndex: 'copyrightName',
- key: 'copyrightName',
- }, {
- title: '加急',
- dataIndex: 'urgent',
- key: 'urgent',
- }, {
- title: '咨询师',
- dataIndex: 'consultant',
- key: 'consultant',
- }, {
- title: '派单日',
- dataIndex: 'createTime',
- key: 'createTime',
- }, {
- title: '受理日',
- dataIndex: 'acceptanceTime',
- key: 'acceptanceTime',
- }, {
- title: '(预计)下证时间',
- dataIndex: 'endTime',
- key: 'endTime',
- }, {
- title: '派单信息',
- dataIndex: 'createInfo',
- key: 'createInfo',
- }, {
- title: '备注',
- dataIndex: 'explain',
- key: 'explain',
- }
- ],
- dataSource: []
- };
- },
- componentWillMount() {
- let _me = this;
- copyrightStateList.map(function (item) {
- _me.state.stateOption.push(
- <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
- )
- });
- this.loadData();
- this.getAuthorList();
- },
- 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.cid) {
- deletedIds.push(rowItem.cid)
- }
- }
- this.setState({
- selectedRowKeys: [],
- loading: deletedIds.length > 0
- });
- $.ajax({
- method: "POST",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/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, s) {
- this.state.showDesc = e;
- if (s) {
- this.loadData();
- };
- },
- addClick() {
- this.setState({
- showAdd: true
- });
- },
- closeAdd(e, s) {
- this.state.showAdd = e;
- if (s) {
- this.loadData();
- };
- },
- search() {
- this.loadData();
- },
- reset() {
- this.state.searchNumber = undefined;
- this.state.searchName = undefined;
- this.state.searchState = 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 (
- <div className="foster-box">
- <div className="foster-content">
- <div className="content-title">
- <span>软著申请管理</span>
- <PatentAdd
- onClick={this.addClick}
- closeAdd={this.closeAdd} />
- </div>
- <div className="foster-query">
- <Input placeholder="软著编号" value={this.state.searchNumber} onChange={(e) => { this.setState({ searchNumber: e.target.value }); }} />
- <Input placeholder="软著名称" value={this.state.searchName} onChange={(e) => { this.setState({ searchName: e.target.value }); }} />
- <Select placeholder="软著状态" value={this.state.searchState} style={{ width: 200 }} onChange={(e) => { this.setState({ searchState: e }); }}>{this.state.stateOption}</Select>
- <Button type="primary" onClick={this.search}>搜索</Button>
- <Button onClick={this.reset}>重置</Button>
- <Button style={{ background: "#3fcf9e", border: "none", color: "#fff", display: 'none' }}
- disabled={!hasSelected}
- onClick={this.delectRow}>删除<Icon type="minus" /></Button>
- </div>
- <div className="foster-table">
- <Spin spinning={this.state.loading}>
- <Table columns={this.state.columns}
- //rowSelection={rowSelection}
- dataSource={this.state.dataSource}
- pagination={this.state.pagination}
- onRowClick={this.tableRowClick} />
- </Spin>
- </div>
- <PatentChange
- data={this.state.RowData}
- showDesc={this.state.showDesc}
- closeDesc={this.closeDesc} />
- </div >
- </div>
- );
- }
- });
- export default copyright;
|