import React,{Component} from "react"; import { Button, DatePicker, Form, Input, message, Select, Spin, Table, Tabs, Tooltip } from "antd"; import moment from "moment"; import ShowModalDiv from "@/showModal.jsx"; import {ShowModal,getContactType} from "@/tools.js"; import {ChooseList} from "../../../order/orderNew/chooseList"; import $ from "jquery/src/ajax"; import IntentionDetail from "../../NEW/intentionCustomer/intentionDetail/intentionDetail"; import { getProvince } from '@/NewDicProvinceList'; const {TabPane} = Tabs; const { RangePicker } = DatePicker; class FollowUpSummary extends Component{ constructor(props) { super(props); this.state={ loading:false, changeList:[], columns:[ { title: "客户名称", dataIndex: "nickname", key: "nickname", render: text => { return (
{text}
) } }, { title: '客户类型', dataIndex: 'shareType', key: 'shareType', render: text => { // 0-私有 1-公共 2 签单 3渠道 return ( text === 0 ? '私有客户' : text === 1 ? '公共客户' : text === 2 ? '签单客户' : text === 3 ? '渠道客户' : '' ) } }, { title: '客户初始时间', dataIndex: 'startTimes', key: 'startTimes', }, { title: "跟进方式", dataIndex: "contactType", key: "contactType", render: (text) => { return getContactType(text); }, }, { title: "跟进人", dataIndex: "followName", key: "followName", }, { title: "跟进部门", dataIndex: "followDep", key: "followDep", }, { title: "跟进说明", dataIndex: "result", key: "result", width: 150, render: (text, record) => { return ( {text}}>
{text}
); }, }, { title: "跟进时间", dataIndex: "followTimes", key: "followTimes", }, { title: "次数", dataIndex: "followCount", key: "followCount", }, { title: "指导意见", dataIndex: "guidance", key: "guidance", width:150, render: (text, record) => { return ( {(record.guidanceName ? '('+record.guidanceName+')' : '') + text}}>
{record.guidanceName ? '('+record.guidanceName+')' : null} {text}
); }, }, { title: "指导时间", dataIndex: "guidanceTimes", key: "guidanceTimes", render: (text) => { return ( {text ? text : ''} ) } } ], dataSource:[], pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadData(page); }.bind(this), showTotal: function (total) { return "共" + total + "条数据"; }, }, releaseDate:[], releaseDate1:[], releaseDate2:[], userName:undefined, followName:undefined, userType:undefined, contactType:undefined, depId: undefined, shiroType: props.shiroType, } this.reset = this.reset.bind(this); this.loadData = this.loadData.bind(this); this.selectSuperId = this.selectSuperId.bind(this); this.category = this.category.bind(this); this.closeDesc = this.closeDesc.bind(this); this.tableRowClick = this.tableRowClick.bind(this); this.export = this.export.bind(this); } componentWillReceiveProps(prevProps) { if(prevProps.shiroType !== this.state.shiroType){ this.setState({ shiroType:prevProps.shiroType },()=>{ this.reset(); this.selectSuperId(); }) } } componentDidMount() { this.loadData(); this.selectSuperId(); } loadData(pageNo) { this.setState({ loading: true, }); let api = '/api/admin/userFollowList'; $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + api, data: { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize, userName:this.state.userName || undefined, followName: this.state.followName || undefined, userType:isNaN(parseInt(this.state.userType)) ? undefined : this.state.userType, contactType: isNaN(parseInt(this.state.contactType)) ? undefined : this.state.contactType, depId: this.state.depId || undefined, followStartTime:this.state.releaseDate[0] ? this.state.releaseDate[0] : undefined, followEndTime:this.state.releaseDate[1] ? this.state.releaseDate[1] : undefined, createStartTime:this.state.releaseDate1[0] ? this.state.releaseDate1[0] : undefined, createEndTime:this.state.releaseDate1[1] ? this.state.releaseDate1[1] : undefined, guidanceStartTime:this.state.releaseDate2[0] ? this.state.releaseDate2[0] : undefined, guidanceEndTime:this.state.releaseDate2[1] ? this.state.releaseDate2[1] : undefined, shiroType:this.state.shiroType }, success: function (data) { ShowModal(this); if (data.error.length === 0) { let theArr = []; for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; let diqu =getProvince(thisdata.province,thisdata.city,thisdata.area) thisdata.key = i; 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; thisdata.uid = thisdata.id; 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, }); }else{ message.warning(data.error[0].message); } }.bind(this), }).always( function () { this.setState({ loading: false, }); }.bind(this) ); }; selectSuperId() { this.state.data = [] $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/organization/selectSuperId", data:{}, success: function (data) { if(data.error.length === 0){ let theArr = []; for(let i=0;i{theData.name} ); } this.setState({ contactsOption: theArr, }); }else{ message.warning(data.error[0].message); } }.bind(this), }).always(function () {}.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); } } else { thedata.map(function (item, index) { theArr.push({ value: item.id, key: item.cname, }); }); } this.setState({ categoryArr: theArr, }); }.bind(this), }); } tableRowClick(record){ this.category(); this.setState({ rowData: record, modalVisible:true, modalName: record.nickname, }) } closeDesc(e, s) { this.setState({ visitModul: e, modalVisible: e, showDesc: e, tabsKey: '', }) if (s) { this.loadData(this.state.pageNo); } } export(){ this.setState({ exportExecLoading: true }) let loading = message.loading('加载中...'); let data = { userName:this.state.userName || undefined, followName:this.state.followName || undefined, userType:isNaN(parseInt(this.state.userType)) ? undefined : this.state.userType, contactType: isNaN(parseInt(this.state.contactType)) ? undefined : this.state.contactType, depId:this.state.depId || undefined, followStartTime:this.state.releaseDate[0] ? this.state.releaseDate[0] : undefined, followEndTime:this.state.releaseDate[1] ? this.state.releaseDate[1] : undefined, createStartTime:this.state.releaseDate1[0] ? this.state.releaseDate1[0] : undefined, createEndTime:this.state.releaseDate1[1] ? this.state.releaseDate1[1] : undefined, guidanceStartTime:this.state.releaseDate2[0] ? this.state.releaseDate2[0] : undefined, guidanceEndTime:this.state.releaseDate2[1] ? this.state.releaseDate2[1] : undefined, shiroType:this.state.shiroType }; for (let i in data){ if(typeof data[i] === "undefined"){ delete data[i] } } $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/userFollowListExport", data, success: function(data) { if(data.error.length === 0){ this.download(data.data); }else{ message.warning(data.error[0].message); } }.bind(this), }).always(function() { loading(); this.setState({ exportExecLoading: false }) }.bind(this)); } download(fileName){ window.location.href = globalConfig.context + "/open/download?fileName=" + fileName } reset(){ this.setState({ userName:undefined, followName:undefined, userType:undefined, contactType:undefined, depId:undefined, releaseDate:[], releaseDate1:[], releaseDate2:[], },()=>{ this.loadData(); }) } render() { return (
客户跟进汇总
{ this.setState({ userName: e.target.value }); }} /> { this.setState({ followName: e.target.value }); }} /> { this.setState({ releaseDate: dataString }); }} /> { this.setState({ releaseDate1: dataString }); }} /> { this.setState({ releaseDate2: dataString }); }} />
) } } export default FollowUpSummary;