import React,{Component} from "react"; import {Button, message, Modal, Spin, Table, Tag, Tooltip} from "antd"; import { getSocialAttribute, getChannelAllocationStatus } from "@/tools.js"; import { channelAllocationStatus } from "@/dataDic.js"; import $ from "jquery/src/ajax"; import IntentionDetail from "./intentionDetail/intentionDetail"; class StatisticalDetails extends Component{ constructor(props) { super(props); this.state={ columns: [ { title: "客户名称", dataIndex: "userName", key: "userName", width:250, render: (text,record) => { return (
{record.recovery === 1 ?
回收
: null} {text}
) }, }, { title: "地区", dataIndex: "locationProvince", key: "locationProvince", }, { title: "社会性质", dataIndex: "societyTag", key: "societyTag", render: (text) => { return getSocialAttribute(text); }, }, { title: "外联专员", dataIndex: "channelName", key: "channelName", }, { title: "客户联系人", dataIndex: "contacts", key: "contacts", }, { title: "联系电话", dataIndex: "contactMobile", key: "contactMobile", }, { title: "外联初始时间", dataIndex: "createTimes", key: "createTimes", }, { title: "分配状态", dataIndex: "status", key: "status", render: (text) => ( getChannelAllocationStatus(text,true) ) }, { title: "当前跟进人", dataIndex: "adminName", key: "adminName", render: (text, record) => { return ( record.status !== 0 ? text : '' ) } }, { title: "跟进操作", dataIndex: "abc", key: "abc", render: (text, record, index) => { return (
); }, }, { title: "备注", dataIndex: "remarks", key: "remarks", render: (text) => { return (
{text}
) } } ], dataSource:[], pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadData(page); }.bind(this), showTotal: function (total) { return "共" + total + "条数据"; }, }, pageNo:1, listLoading:false, categoryArr:[], } this.tableRowClick = this.tableRowClick.bind(this); this.category = this.category.bind(this); this.detailCloseDesc = this.detailCloseDesc.bind(this); this.loadData = this.loadData.bind(this); } tableRowClick(record) { this.category(); this.setState({ rowData:record, modalVisible: true, basicState: true, contactState: true, modalName: record.userName }) } componentWillReceiveProps (nextProps){ if(nextProps.visible){ this.loadData(1,nextProps); } } loadData(pageNo = 1,nextProps=this.props) { this.setState({ listLoading: true, selectedRows: [], selectedRowKeys: [], }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/customer/listChannelCustomer', data: { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize, type:nextProps.type, // 0营销员 1外联专员 2营销总监 3营销经理 4释放 5未分配 6已分配 7已签单 aid:nextProps.aid }, success: function (data) { let theArr = []; if (data.error.length > 0) { message.warning(data.error[0].message); } else { if(data.data.list.length === 0 && pageNo !== 1){ this.loadData(pageNo - 1) }else{ for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; let diqu = (thisdata.province == null ? "" : thisdata.province) + (thisdata.city == null ? "" : "-" + thisdata.city) + (thisdata.area == null ? "" : "-" + thisdata.area); thisdata.key = i; thisdata.id = thisdata.uid; thisdata.lastFollowTime = thisdata.lastFollowTime && thisdata.lastFollowTime.split(" ")[0]; thisdata.transferTime= thisdata.transferTime && thisdata.transferTime.split(" ")[0]; thisdata.surplusFollowTime = thisdata.surplusFollowTime && thisdata.surplusFollowTime.split(" ")[0]; thisdata.surplusSignTime = thisdata.surplusSignTime && thisdata.surplusSignTime.split(" ")[0]; thisdata.locationProvince = diqu; theArr.push(thisdata); } this.state.pagination.current = data.data.pageNo; this.state.pagination.total = data.data.totalCount; this.setState({ pageNo: data.data.pageNo, dataSource: theArr, pagination: this.state.pagination, }) } } }.bind(this), }).always( function () { this.setState({ listLoading: false, }); }.bind(this) ); } category() { $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/Varieties/getSuperList", 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({ value: item.id, key: item.cname, }); }); } this.setState({ categoryArr: theArr, }); }.bind(this), }); } detailCloseDesc(){ this.setState({ rowData:'', modalVisible: false, basicState: false, contactState: false, modalName: '', },()=>{ this.loadData(this.state.pageNo); }) } render() { return ( 详细列表 {this.props.aName} { this.props.type === 1? '当前客户总数': this.props.type === 4? '释放客数': this.props.type === 5? '未分配数': this.props.type === 6? '已分配数': this.props.type === 7? '已签单数': '' } } width="1200px" visible={this.props.visible} onOk={this.props.onCancel} onCancel={this.props.onCancel} > ); } } export default StatisticalDetails;