import React,{Component} from 'react'; import { Button, Input, message, Select, Spin, Table, } from "antd"; import './index.less'; import $ from "jquery/src/ajax"; import CustomerDetails from './customerDetails'; class DepartmentStatistics extends Component{ constructor(props) { super(props); this.state={ superId:'', nameSearch: '', columns: [ { title: "部门", dataIndex: "name", key: "name", width: '25%', }, { title: "客户总数", dataIndex: "userCount", key: "userCount", className: 'tableRowStyle', render: (text, record) => { return (
{ if(record.aid){ e.stopPropagation(); this.setState({ customerVisible: true, aid: record.aid, type: 0, }) } }}> {text}
); }, }, { title: "成交客户总数", dataIndex: "completeCount", key: "completeCount", className: 'tableRowStyle', render: (text, record) => { return (
{ if(record.aid){ e.stopPropagation(); this.setState({ customerVisible: true, aid: record.aid, type: 3, }) } }}> {text}
); }, }, { title: "新增客户数", dataIndex: "inputCount", key: "inputCount", className: 'tableRowStyle', render: (text, record) => { return (
{ if(record.aid){ e.stopPropagation(); this.setState({ customerVisible: true, aid: record.aid, type: 1, }) } }}> {text}
); }, }, { title: "新增面谈数", dataIndex: "interviewCount", key: "interviewCount", className: 'tableRowStyle', render: (text, record) => { return (
{ if(record.aid){ e.stopPropagation(); this.setState({ customerVisible: true, aid: record.aid, type: 4, }) } }}> {text}
); }, }, { title: "新增领取客户数", dataIndex: "receiveCount", key: "receiveCount", className: 'tableRowStyle', render: (text, record) => { return (
{ if(record.aid){ e.stopPropagation(); this.setState({ customerVisible: true, aid: record.aid, type: 2, }) } }}> {text}
); }, }, ], contactsOption:null, loading: false, ispage: 1, aid:'', type:'', visible:false, }; this.loadData = this.loadData.bind(this); this.reset = this.reset.bind(this); this.selectSuperId = this.selectSuperId.bind(this); } componentDidMount() { this.loadData(); this.selectSuperId(); } loadData() { this.setState({ loading: true, }); let api = '/api/admin/customer/selectAllUser'; let data = {}; if(this.state.superId){ data.depId = this.state.superId; } if(this.state.nameSearch){ data.aName = this.state.nameSearch; } $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + api, data: data, success: function (data) { let theArr = []; if (data.error.length !== 0) { if (data.error && data.error.length) { message.warning(data.error[0].message); } } else { data.data.children = data.data.list; data.data.children = data.data.children.concat(data.data.aList); theArr.push(data.data); theArr = this.handleTabsInfor(theArr); console.log(theArr,'表格数据') this.setState({ ispage: data.data.pageNo, dataSource: theArr, }); } }.bind(this), }).always( function () { this.setState({ loading: false, }); }.bind(this) ); }; //表格数据处理 handleTabsInfor(infor){ for(let i=0;i{ this.loadData(); }); }; //获取上级组织 selectSuperId() { this.state.data = [] $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/organization/selectSuperId", data:{}, success: function (data) { let theArr = []; let theId=[];//用于保存上级组织的ID和名称 let thedata=data.data; if (!thedata) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; thedata = {}; }; for(var i=0;i{theData.name} ); theId.push( [theData.id,theData.name] ); }; this.setState({ SuperArr:thedata, contactsOption: theArr, theId: theId, orderStatusOptions:data.data, }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); } render() { return(
指导意见
{ this.setState({ nameSearch: e.target.value }); }} />
{this.state.customerVisible ? { this.setState({ customerVisible: false, aid: '', type: '', }) }} /> :
}
) } } export default DepartmentStatistics;