import React from 'react';
import {
Icon,
Button,
Input,
Select,
Spin,
Checkbox,
Cascader,
Table,
Form,
Switch,
message,
DatePicker,
Modal,
Row,
Col,
InputNumber,
notification
} from 'antd';
import ajax from 'jquery/src/ajax/xhr.js';
import $ from 'jquery/src/ajax';
//import axios from 'axios';
import 'antd/dist/antd.css';
const FormItem = Form.Item;
import './sichuan.css';
const { TextArea } = Input;
class Achievement extends React.Component {
constructor(props) {
super(props);
this.state = {
loading:false,
publishPages: [],
visible: 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: 'name',
key: 'name'
},
{
title: '关键字',
dataIndex: 'keyword',
key: 'keyword'
},
{
title: '行业领域',
dataIndex: 'auditStatus',
key: 'auditStatus'
},
{
title: '企业名称',
dataIndex: 'createTime',
key: 'createTime'
},
{
title: '拟对接单位',
dataIndex: 'releaseDate',
key: 'releaseDate'
},
{
title: '成果状态',
dataIndex: 'releaseDate1',
key: 'releaseDate1'
},
{
title: '操作',
dataIndex: 'caozuo',
key: 'caozuo',
render: (text, recard) => {
return (
);
}
}
]
};
}
loadData(pageNo) {
this.setState({
page: pageNo,
// loading: true
});
// axios.get('api/list',{
// params:{
// page:pageNo||1,
// pageSize:10
// }
// })
// .then(function(res) {
// 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,
// name: thisdata.name,
// category:thisdata.category,
// fieldA:thisdata.thisdata,
// fieldB:thisdata.fieldB,
// });
// };
// }
// this.state.pagination.current = data.data.pageNo;
// this.state.pagination.total = data.data.totalCount;
// if(data.data&&data.data.list&&!data.data.list.length){
// this.state.pagination.current=0
// this.state.pagination.total=0
// }
// this.setState({
// loading:false,
// dataSource: theArr,
// pagination: this.state.pagination
// });
// })
// .catch(function(error) {
// console.log(error);
// });
}
//消息提示
message(mess) {
notification.open({
message: '提示',
description: mess,
placement: 'bottomRight'
});
}
//删除
delectRow(recard) {
this.setState({
loading: true
});
// axios({
// method:'get',
// url:'api/sdas',
// }).then(function(res) {
// this.success('success');
// this.setState({
// loading: false
// });
// })
// .catch(function(error) {
// console.log(error);
// });
}
details(recard){
this.state({
loading:true
})
}
add() {
this.setState({
uid: '',
visible: true,
addState: true,
name: '',
introduce: '',
industry: '',
summary: '',
ownerName: '',
reserveButtMode: '',
patentNumber: '',
transferPrice: '',
telephone: '',
cname: ''
});
}
search() {
this.loadData(1);
}
reset() {
this.state.nameSearch = '';
this.state.keyword = '';
this.loadData(1);
}
tableRowClick(record, index) {
this.state.RowData = record;
this.setState({
visible: true,
addState: false,
uid: record.id
});
this.details(record)
}
handleOk() {
this.handleSubmit();
}
handleCancel() {
this.setState({
visible: false
});
}
handleSubmit() {
if (!this.state.name || !this.state.introduce) {
this.message('请填写带*项');
return false;
}
this.setState({
loading: true
});
let api = this.state.addState ? '/api/achievements' : '/api/update';
// axios
// .post(api, {
// id: this.state.uid,
// achievementDTO: {
// name: this.state.name,
// type: this.state.type,
// industry: this.state.industry,
// summary: this.state.summary,
// introduce: this.state.introduce,
// ownerName: this.state.ownerName,
// reserveButtMode: this.state.reserveButtMode,
// patentNumber: this.state.patentNumber,
// transferPrice: this.state.transferPrice
// },
// publisherDTO: {
// name: this.state.name,
// telephone: this.state.telephone
// }
// })
// .then(function(res) {
// console.log(res);
// this.message('success');
// this.setState({
// loading: false,
// visible: false
// });
// this.loadData(1);
// })
// .catch(function(error) {
// console.log(error);
// });
}
componentWillMount() {
this.loadData(1);
}
render() {
const rowSelection = {
selectedRowKeys: this.state.selectedRowKeys,
onChange: (selectedRowKeys, selectedRows) => {
this.setState({
selectedRows: selectedRows.slice(-1),
selectedRowKeys: selectedRowKeys.slice(-1)
});
}
};
const formItemLayout = {
labelCol: { span: 6 },
wrapperCol: { span: 12 }
};
this.state.dataSource = [ { id: 212, key: 1, name: 'liting' }, { key: 2, name: 'YouXi' } ];
return (
);
}
}
export default Achievement;