import React from 'react'; import { Icon, Button, Spin, message, Table, Cascader, Input } from 'antd'; import { techFieldList } from '../../../DicTechFieldList'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; const Star = React.createClass({ loadUserData(pageNo) { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/star/list', data: { pageNo: pageNo || 1, pageSize: this.state.userPagination.pageSize, number: this.state.searchUserNumber, //编号 username: this.state.searchUserName, //名称 engagedField: this.state.searchField ? this.state.searchField.join(',') : undefined, professionalTitle: this.state.searchPfs, workUnit: this.state.searchUnit }, 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, uid: thisdata.uid, engagedField: thisdata.engagedField, username: thisdata.username, professionalTitle: thisdata.professionalTitle, workUnit: thisdata.workUnit, number: thisdata.number, achievementNums: thisdata.achievementNums, }); }; this.state.userPagination.current = data.data.pageNo; this.state.userPagination.total = data.data.totalCount; }; this.setState({ dataSource: theArr, userPagination: this.state.userPagination }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, loadLectureData(pageNo) { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/lecture/list', data: { pageNo: pageNo || 1, pageSize: this.state.lecturePagination.pageSize, username: this.state.searchLectureUser, //用户名称 name: this.state.searchLectureName, //讲座名称 startLectureTime: this.state.startTime ? this.state.startTime.format("yyyy-MM-dd HH:MM:SS") : undefined, endLectureTime: this.state.endTime ? this.state.endTime.format("yyyy-MM-dd HH:MM:SS") : undefined, }, 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({ id: thisdata.id, uid: thisdata.uid, lectureTime: thisdata.lectureTime, name: thisdata.name, summary: thisdata.summary, username: thisdata.username, lectureUrl: thisdata.lectureUrl, lectureTimeFormattedDate: thisdata.lectureTimeFormattedDate, }); }; this.state.lecturePagination.current = data.data.pageNo; this.state.lecturePagination.total = data.data.totalCount; }; this.setState({ lectureTableData: theArr, lecturePagination: this.state.lecturePagination }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, loadHotData() { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/star/hotList', success: function (data) { let theArr = []; if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; } else { for (let i = 0; i < data.data.length; i++) { let thisdata = data.data[i]; theArr.push({ key: i, uid: thisdata.uid, engagedField: thisdata.engagedField, username: thisdata.username, professionalTitle: thisdata.professionalTitle, workUnit: thisdata.workUnit, number: thisdata.number, achievementNums: thisdata.achievementNums, }); }; }; this.setState({ hotTableData: theArr }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, loadStarData() { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/star/starList', success: function (data) { let theArr = []; if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; } else { for (let i = 0; i < data.data.length; i++) { let thisdata = data.data[i]; theArr.push({ key: i, uid: thisdata.uid, engagedField: thisdata.engagedField, username: thisdata.username, professionalTitle: thisdata.professionalTitle, workUnit: thisdata.workUnit, number: thisdata.number, achievementNums: thisdata.achievementNums, }); }; }; this.setState({ starTableData: theArr }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, getInitialState() { return { loading: false, addVisible: false, hotSelectedRowKeys: [], hotSelectedRows: [], starSelectedRowKeys: [], starSelectedRows: [], userPagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadUserData(page); }.bind(this), showTotal: function (total) { return '共' + total + '条数据'; } }, lecturePagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadLectureData(page); }.bind(this), showTotal: function (total) { return '共' + total + '条数据'; } }, userColumns: [ { title: '编号', dataIndex: 'number', key: 'number', }, { title: '姓名', dataIndex: 'username', key: 'username', }, { title: '从事领域', dataIndex: 'engagedField', key: 'engagedField', }, { title: '职称名字', dataIndex: 'professionalTitle', key: 'professionalTitle', }, { title: '工作单位', dataIndex: 'workUnit', key: 'workUnit', }, { title: '成果数量', dataIndex: 'achievementNums', key: 'achievementNums', }, { title: '操作', dataIndex: 'action', key: 'action', render: (text, record, index) => { return