import React from 'react'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import "./statistics.less"; import { Button, Select, Table, Spin, message, Tabs, DatePicker } from 'antd'; const TabPane = Tabs.TabPane; import moment from 'moment'; import { intentionalService,newFollow } from '../../../dataDic.js'; import {ChooseList} from "../../order/orderNew/chooseList"; const FollowStatistics = React.createClass({ loadData(pageNo, nub) { this.state.data = []; this.setState({ loading: true }); let urls = ''; switch(nub) { case "1": urls = ""; break; //日 case "2": urls = "daySpan"; break; //日 case "3": urls = "weekSpan"; break; //周 case "4": urls = "monthSpan"; break; //月 case "5": urls = "quarterSpan"; break; //季 case "6": urls = "yearSpan"; break; //年 default: urls =''; } $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/customer/businessStatistic", data: { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize, startDate: this.state.releaseDate[0], endDate: this.state.releaseDate[1], timeSpan:this.state.releaseDate[0]?'':urls, depId:this.state.depId, businessGlossoryId:this.state.followSearch, depNo:this.state.departmentt }, 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, adminName: thisdata.adminName, departmentName: thisdata.departmentName, sendMaterialNo: thisdata.sendMaterialNo, interviewNo: thisdata.interviewNo, sendProspectusNo: thisdata.sendProspectusNo, quoteNo: thisdata.quoteNo, sendContractNo: thisdata.sendContractNo , signContractNo: thisdata.signContractNo, onVisaNo: thisdata.onVisaNo, visaNo: thisdata.visaNo, }); }; this.state.pagination.current = data.data.pageNo; this.state.pagination.total = data.data.totalCount; }; if(!data.data.list.length){ this.state.pagination.current=0; this.state.pagination.total=0; } this.setState({ dataSource: theArr, pagination: this.state.pagination, }); }.bind(this), }).always(function() { this.setState({ loading: false }); }.bind(this)); }, getInitialState() { return { releaseDate: [], loading: false, callnub:'1', pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function(page) { this.call(page) }.bind(this), showTotal: function(total) { return '共' + total + '条数据'; } }, columns: [{ title: '营销员', dataIndex: 'adminName', key: 'adminName', }, { title: '部门', dataIndex: 'departmentName', key: 'departmentName', }, { title: '已发项目介绍资料', dataIndex: 'sendMaterialNo', key: 'sendMaterialNo', }, { title: '已约面谈', dataIndex: 'interviewNo', key: 'interviewNo', }, { title: '已发合同计划书', dataIndex: 'sendProspectusNo', key: 'sendProspectusNo', }, { title: '已报价', dataIndex: 'quoteNo', key: 'quoteNo', }, { title: '已发合同', dataIndex: 'sendContractNo', key: 'sendContractNo', }, { title: '已签合同', dataIndex: 'signContractNo', key: 'signContractNo', }, { title: '面谈中', dataIndex: 'onVisaNo', key: 'onVisaNo', }, { title: '已面签', dataIndex: 'visaNo', key: 'visaNo', }] } }, //部门 departmentList() { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/organization/selectSuperId", data: { }, success: function(data) { let thedata = data.data; let theArr=[]; if(!thedata) { if(data.error && data.error.length) { message.warning(data.error[0].message); }; thedata = {}; }else{ thedata.map(function(item,index){ theArr.push({ key:index, name:item.name, id:item.id, depNo:item.depNo }) }) } this.setState({ departmentArr:theArr, }) }.bind(this), }).always(function() { this.setState({ loading: false }); }.bind(this)); }, callback(e) { this.setState({ callnub: e, releaseDate:[] }) this.loadData(1, e) }, call(a){ this.loadData(a, this.state.callnub) }, search() { if(this.state.releaseDate[0]){ this.setState({ callnub:'1' }) }else{ this.state.releaseDate=[] } this.loadData(1, this.state.callnub) }, reset() { this.state.departmentt=undefined; this.state.releaseDate = []; this.state.followSearch=undefined; this.loadData(1, this.state.callnub); }, changeList(arr) { const newArr = []; this.state.columns.forEach(item => { arr.forEach(val => { if (val === item.title) { newArr.push(item); } }); }); this.setState({ changeList: newArr }); }, componentWillMount() { this.loadData(); this.departmentList() }, render() { const { RangePicker } = DatePicker; let departmentArr = this.state.departmentArr || []; return