import React from 'react';
import { Radio, Icon, Button, Input, Select, Spin,Popconfirm, Table, Switch, message, DatePicker, Modal, Upload,Form ,Row,Col,TimePicker} from 'antd';
import ajax from 'jquery/src/ajax/xhr.js';
import $ from 'jquery/src/ajax';
import moment from 'moment';
import './myClient.less';
const { Column, ColumnGroup } = Table;
import TechAchievementDesc from './myClientDesc.jsx';
import { achievementCategoryList, techAuditStatusList,cityArr,tag,customerStatus,intentionalService,newFollow ,newFollowOn,contact,sex,intentionalServiceOn} from '../../dataDic.js';
import { beforeUploadFile, companySearch, getAchievementCategory,getsex,getSearchUrl,getTechAuditStatus,getcustomerTyp,getcityArr,getCompanyIntentionOn,getcustomerStatue,getCompanyIntention,getfllowSituation,getcontact,getfllowSituationOn} from '../../tools.js';
import BatchImport from './batchImport';
//历史记录
const datas = [{
key: '1',
firstName: 'John',
lastName: 'Brown',
age: 32,
address: 'New York No. 1 Lake Park',
addres:'31232',
addre:'31231',
addr:'231321',
}, {
key: '2',
firstName: 'Jim',
lastName: 'Green',
age: 42,
address: 'London No. 1 Lake Park',
addres:'31232',
addre:'31231',
addr:'231321',
}, {
key: '3',
firstName: 'Joe',
lastName: 'Black',
age: 32,
address: 'Sidney No. 1 Lake Park',
addres:'31232',
addre:'31231',
addr:'231321',
}, {
key: '4',
firstName: 'Jim',
lastName: 'Green',
age: 42,
address: 'London No. 1 Lake Park',
addres:'31232',
addre:'31231',
addr:'231321',
},
];
//图片组件
const PicturesWall = React.createClass({
getInitialState() {
return {
previewVisible: false,
previewImage: '',
fileList: [],
}
},
handleCancel() {
this.setState({ previewVisible: false })
},
handlePreview(file) {
this.setState({
previewImage: file.url || file.thumbUrl,
previewVisible: true,
});
},
handleChange(info) {
let fileList = info.fileList;
this.setState({ fileList });
this.props.fileList(fileList);
},
componentWillReceiveProps(nextProps) {
this.state.fileList = nextProps.pictureUrl;
},
render() {
const { previewVisible, previewImage, fileList } = this.state;
const uploadButton = (
);
return (
{fileList.length >= 5 ? null : uploadButton}
);
}
});
const contactsOptionWoman=[];
const datat = [{
key: 1,
name: 'John Brown sr.',
},
{
key: 12,
name: 'John Brown jr.',
}, {
key: 13,
name: 'Jim Green sr.',
}];
const AchievementList = Form.create()(React.createClass({
loadData(pageNumber, apiUrl) {
this.state.data = [];
this.setState({
loading: true
});
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/customer/listPrivateCustomer',
data: {
pageNumber: pageNumber || 1,
pageSize: this.state.pagination.pageSize,
// customerName: this.state.customerName, //名称1
// shareTyp: this.state.shareTyp, //客户类型1
// province:this.state.province,//地区
// customerStatus:this.state.customerStatus,//客户状态1
// contactName:this.state.contactName,//联系人姓名1
// adminName:this.state.adminName,//跟单人1
// companyIntention:this.state.companyIntention,//意向服务
// followSituation:this.state.followSituation,//最新跟进
//releaseDateStartDate: this.state.releaseDate[0],
//releaseDateEndDate: this.state.releaseDate[1],
},
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,
companyName:thisdata.companyName,//公司名称
_shareType:thisdata._shareType,//客户类型
locationProvince:thisdata.locationProvince,//地区
contactName:thisdata.contactName, //联系人姓名
telNum:thisdata.telNum,//手机号
_customerStatus:thisdata._customerStatus,//客户状态
_companyIntention:thisdata._companyIntention,//意向服务
_followSituation:thisdata._followSituation,//最新跟进
customerStatus:thisdata.customerStatus,//客户状态
companyIntention:thisdata.companyIntention,//意向服务
followSituation:thisdata.followSituation,//最新跟进
adminName:thisdata.adminName, //跟进人
followDate:thisdata.followDate,
customerStatus:thisdata.customerStatus,//客户状态
companyIntention:thisdata.companyIntention,//意向服务
});
};
this.state.pagination.current = data.data.pageNumber;
this.state.pagination.total = data.data.totalCount;
};
this.setState({
dataSource: theArr,
pagination: this.state.pagination
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//通过ID查询这个个公司的跟进记录
getNewWoman(deletedIds) {
const contactsOptionWoman=[]
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/findCustomerUserList",
data:{
cid:deletedIds
},
success: function (data) {
let theArr = [];
let thedata=data.data;
var email=[];
var telNum=[];
var contactId=[];
thedata.map(function (item,index) {
email.push(thedata[index].email);
contactId.push(thedata[index].id);
telNum.push(thedata[index].telNum);
theArr.push({item.name})
});
var lastName= thedata[thedata.length-1].name;
var nub=thedata[thedata.length-1].telNum;
var kid=thedata[thedata.length-1].id;
var contacts='电话';
this.setState({
kid:kid,
contactId:contactId,
contacts:contacts,
nub:nub,
telNum:telNum,
email:email,
lastName:lastName,
orderStatusOption: theArr,
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//在添加联系记录页面,选择联系方式查看号码
contacts(e){
let conts='';
if(e==0){
conts='电话'
this.state.nub=this.state.changNub
}
if(e==1){
conts='邮件'
this.state.nub=this.state.changEmail
}
if(e==2){
conts='面谈'
this.state.nub=''
}
if(e==3){
conts='短信'
this.state.nub=''
}
this.setState({
conts:conts,
contacts: e,
});
},
//通过ID查询这一条的信息
Detailload(deletedIds){
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + '/api/admin/customer/findCustomerUserDetails',
data: {
id: deletedIds
},
success: function (data) {
let thisData = data.data;
if (!thisData) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
thisData = {};
};
this.setState({
data: thisData,
followSituation:thisData.followSituation,
customerStatus:thisData.customerStatus,
});
if (thisData.ownerId) {
this.getContactsList(thisData.ownerId);
};
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//点击便捷记录,点击最新跟进下的+号,将会查询出很多数据,展示在列表里面
setModal1Visible(modal1Visible) {
this.setState({ modal1Visible });
let deletedIds;
let adminName;
let customerStatus;
let companyIntention;
let followSituation;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id;
adminName=rowItem.adminName;
companyIntention=rowItem.companyIntention;
followSituation=rowItem.followSituation;
};
};
this.Detailload(deletedIds);
this.getNewWoman(deletedIds);
},
setModal2Visible(modal2Visible) {
this.setState({ modal2Visible });
alert(1111111);
},
//历史记录中点击跟进人模板出现,点击最新跟进的第一个按钮(跟进状态)执行的函数,将会出现很多跟进列表
setModal3Visible(modal3Visible) {
this.setState({ modal3Visible });
this.state.data = [];
this.setState({
loading: true
});
let deletedIds;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id;
};
};
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/customer/listFollowUpRecord',
data: {
customerId:deletedIds
},
success: function (data) {
let theArr = [];
let theWomanID=[];
if (!data.data) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
} else {
data.data.map(function (item,index) {
theWomanID.push(data.data[index].id);
});
for (let i = 0; i < data.data.length; i++) {
let thisdata = data.data[i];
theArr.push({
key:i,
_followDate:thisdata._followDate,//跟进时间
adminName:thisdata.adminName,//跟进人
contactName:thisdata.contactName, //联系人姓名
contactId:thisdata.contactId, //联系人ID
contactInfo:thisdata.contactInfo,//联系信息
_customerStatus:thisdata._customerStatus,//客户状态
_followSituation:thisdata._followSituation,//最新跟进
followResult:thisdata.followResult,//跟进结果
attachment:thisdata.attachment,//附件地址
});
};
};
this.setState({//导出数据
datahistory: theArr,
theWomanID:theWomanID,
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//删除历史记录
onDelete(){
},
//点击客户的名字,进行详情的查询
setModal4Visible(modal4Visible) {
console.log()
let changeIds=this.state.datahistory[1].contactId;
this.setState({ modal4Visible }); //需要一个请求数据
// for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
// let rowItem = this.state.selectedRows[idx];
// if (rowItem.id) {
// changeIds=rowItem.id;
// };
// };
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/customer/findContactDetail',
data: {
contactId:changeIds
},
success: function (data) {
let theArr = [];
let theDate=data.data;
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,
name:name,//联系人姓名
sex:sex,//联系人性别
mobile:mobile,//座机号
telNum:telNum,//手机号
email:email,//邮箱
qq:qq,//qq
wechat:wechat,//微信号
depatrment:depatrment,//部门
customerPosition:customerPosition,//职位
// _followSituation:thisdata._followSituation,//最新跟进
});
};
};
this.setState({//导出数据
theDate:theDate,
name:theDate.name,//联系人姓名
sex:theDate.sex,//联系人性别
mobile:theDate.mobile,//座机号
telNum:theDate.telNum,//手机号
email:theDate.email,//邮箱
qq:theDate.qq,//qq
wechat:theDate.wechat,//微信号
depatrment:theDate.depatrment,//部门
customerPosition:theDate.customerPosition,//职位
companyName:theDate.companyName,//公司
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//点击名称时获取列表
setModal5Visible(modal5Visible) {
this.setState({ modal5Visible });
let deletedIds;
let adminName;
let customerStatus;
let companyIntention;
let followSituation;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id;
adminName=rowItem.adminName;
companyIntention=rowItem.companyIntention;
followSituation=rowItem.followSituation;
};
};
this.setState({ modal5Visible }); //需要一个请求数据
this.Detailload(deletedIds);
},
//历史记录查看更多,还是历史记录接口
setModal6Visible(modal6Visible) {
this.setState({ modal6Visible }); //需要一个请求数据
},
getPictureUrl(e) {
this.setState({pictureUrl: e });
},
componentWillReceiveProps(nextProps) {
if (!this.props.visible && nextProps.visible) {
if (nextProps.data && nextProps.data.id) {
this.loadData(nextProps.data.id, nextProps.detailApiUrl);
};
this.state.technicalPictureUrl = [];
};
},
//添加一条跟进记录,点击保存按钮进行添加
addFollowSubmit(e) {
e.preventDefault();
this.state.data = []
this.setState({
selectedRowKeys: [],
//loading: deletedIds.length > 0
});
let deletedIds;
this.state.data = [];
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id
};
};
this.props.form.validateFields((err, values) => {
// let theMaturityPictureUrl = [];
// if (this.state.maturityPictureUrl.length) {
// let picArr = [];
// this.state.maturityPictureUrl.map(function (item) {
// picArr.push(item.response.data);
// });
// theMaturityPictureUrl = picArr.join(",");
// };
if (!err) {
this.setState({
loading: true
});
let custype=values._shareType;
let customerTypechange="";
switch(custype){
case "个人客户":customerTypechange=0;break;
case "公司客户":customerTypechange=1;break;
}
console.log(this.state.kid)
let companyIntentions= getCompanyIntentionOn(values.companyIntention);
let followSituations= getfllowSituationOn(values.followSituation);
alert("这是1234");
$.ajax({
method: "POST",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/customer/addFollow',
data: {
id: deletedIds,//编号id
cuid:this.state.kid,//联系人ID
followDates:(values.createTime ? values.createTime.format('YYYY-MM-DD'):undefined)+" "+(values.createTim ? values.createTim.format('YYYY:MM:DD'):undefined),//跟进时间
followResult:values.remarks,//跟进结果
attachment:"",//附件地址
contactInfo:values.contacts,//联系信息,
customerStatus:values.customerStatus,//跟进客户状态
followSituation:values.followSituation,//跟进进度
contactInfo:this.state.conts+"-"+(this.state.nub?this.state.nub:""),
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('保存成功!');
this.setModal1Visible(false)
} else {
message.warning(data.error[0].message);
}
this.loadData();
}.bind(this));
}
})
this.setModal5Visible(false);
},
//当选择联系人的列表变化时,则执行
hundleName(e){
let changNub=this.state.telNum[e];
let changEmail=this.state.email[e];
let kid=this.state.contactId[e];
console.log(kid)
this.setState({
kid:kid,
contacts:'电话',
nub:this.state.telNum[e],
lastName: e,
changNub:changNub,
changEmail:changEmail,
});
},
//所有资料修改保存提交,点击保存按钮进行更新
handleSubmit(e) {
e.preventDefault();
let adminName;
let customerStatus;
let companyIntention;
let followSituation;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id;
adminName=rowItem.adminName;
customerStatus=rowItem.customerStatus;
companyIntention=rowItem.companyIntention;
followSituation=rowItem.followSituation;
};
};
this.state.data = []
this.setState({
selectedRowKeys: [],
loading: deletedIds.length > 0
});
let deletedIds;
this.state.data = [];
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id
};
};
this.setState({
selectedRowKeys: [],
});
this.props.form.validateFields((err, values) => {
if (!err) {
this.setState({
loading: true
});
let custype=values._shareType;
let customerTypechange="";
switch(custype){
case "个人客户":customerTypechange=0;break;
case "公司客户":customerTypechange=1;break;
}
let companyIntentions= getCompanyIntentionOn(values.companyIntention);
let followSituations= getfllowSituationOn(values.followSituation);
alert("这是112233");
$.ajax({
method: "POST",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/customer/updCustomer',
data: {
id: deletedIds,//编号id
customerTyp :customerTypechange,//客户信息 1
createTime: values.createTime ? values.createTime.format('YYYY-MM-DD') : undefined,//时间 1\
companyIntention: companyIntentions,
companyName: values.companyName,//公司名称 1
companyIndustry: values.companyIndustry,//公司行业
tag: values.tag,
locationProvince: values.locationProvince,//省份1
adress: values.adress,//详细地址1
remarks: values.remarks,//备注1
followSituation:followSituations,//最新跟进1
customerStatus: values.customerStatus,//客户状态1
name: values.name,//客户姓名1
mobile: values.mobile,//座机1
telNum: values.telNum,//手机号码1
sex: values.sex,//性别1
customerPosition: values.customerPosition,//职位1
wechat: values.wechat,//微信号1
qq: values.qq,//qq 1
depatrment: values.depatrment,//部门 1
email: values.email,//邮箱 1
shareTyp:0,
customerStatus:customerStatus,
beforeCustomerStatus:customerStatus,
beforeCompanyIntention:companyIntention,
beforeFollowSituation:followSituation,
beforeAdminName:adminName,
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('保存成功!');
this.setModal1Visible(false)
} else {
message.warning(data.error[0].message);
}
this.loadData();
}.bind(this));
}
})
this.setModal5Visible(false);
},
submitcontact(e){
let deletedIds;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id
};
};
this.setState({
selectedRowKeys: [],
});
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
this.setState({
loading: true
});
alert(23333);
$.ajax({
method: "POST",
dataType: "json",
crossDomain: false,
url: globalConfig.context + '/api/admin/customer/addContacter',
data: {
cid: deletedIds,//编号id
sex:this.state.hot,//性别
primaryFlg:this.state.hots,//是否是主要联系人
name:this.state.paymentId,//联系人姓名
mobile:this.state.paym,//座机
telNum:this.state.pay,//电话
qq:this.state.entId,//qq
wechat:this.state.payId,//微信
customerPosition:this.state.paentId,//职位
depatrment:this.state.paytId,//部门
email:this.state.email,//邮箱
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('保存成功!');
this.setModal2Visible(false)
} else {
message.warning(data.error[0].message);
}
this.loadData();
}.bind(this));
}
});
},
getTechnicalPictureUrl(e) {
this.setState({ technicalPictureUrl: e });
},
//新建联系人modal框显示
showModal(){
this.setState({
visible: true,
});
},
//指定转交人的点击函数
showModa(){
this.setState({
visible: true,
});
let changeIds;
let adminName;
let customerStatus;
let companyIntention;
let followSituation;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
changeIds=rowItem.id;
adminName=rowItem.adminName;
customerStatus=rowItem.customerStatus;
companyIntention=rowItem.companyIntention;
followSituation=rowItem.followSituation;
};
};
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/findAdmin",
data: {
id: changeIds,//这一行数据的ID
beforeCompanyIntention:companyIntention,//意向服务
beforeCustomerStatus:customerStatus,//客户状态
beforeFollowSituation:followSituation,//最新跟进状态
beforeAdminName:adminName,//跟进人
}
}).done(function (data) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
} else {
let theAssigne = [];
if (!data.data) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
alert(111);
} else {
for (let i = 0; i < data.data.length; i++) {
let thisdata = data.data[i];
//处理数据 进行循环
theAssigne.push({
key: thisdata.name,
id: thisdata.id,
ids: thisdata.cid,
mobile:thisdata.mobile,
adminName: thisdata.beforeAdminName,
customerStatus: thisdata.beforeCustomerStatus,
companyIntention: thisdata.beforeCompanyIntention,
followSituation: thisdata.beforeFollowSituation,
});
};
};
this.setState({
dataman: theAssigne,
});
}
}.bind(this));
},
//选择了指定人之后的保存点击函数,需要修改函数
changeAssigner() {
this.setState({
visible: false,
});
let changeId;
let changeIds;
let adminName;
let beforeAdminName;
let customerStatus;
let companyIntention;
let followSituation;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
changeId=rowItem.id;
beforeAdminName=rowItem.adminName;
adminName=rowItem.key;
customerStatus=rowItem.customerStatus;
companyIntention=rowItem.companyIntention;
followSituation=rowItem.followSituation;
changeIds=rowItem.ids;
};
};
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/transferCustomer",
data: {
id: changeIds,//这一行数据的ID
aid:changeId,//指定转交人的ID
beforeCompanyIntention:companyIntention,//意向服务
beforeCustomerStatus:customerStatus,//客户状态
beforeFollowSituation:followSituation,//最新跟进状态
beforeAdminName:beforeAdminName,//之前的跟进人
adminName:adminName,//转交的跟进人
}
}).done(function (data) {
if (!data.error.length) {
message.success('转交成功!');
this.setState({
loading: false,
});
} else {
message.warning(data.error[0].message);
};
this.loadData();
}.bind(this));
},
handleOk(e){
this.setState({
visible: false,
});
},
handleCancel(e){
this.setState({
visible: false,
});
},
//点击公司名称,进行弹出框动作,同时进行资料详情查询
getInitialState() {
return {
technicalPictureUrl: [],
modal1Visible: false,
modal2Visible: false,
visible: false ,
searchMore: true,
searchType: 0,
validityPeriodDate: [],
releaseDate: [],
selectedRowKeys: [],
selectedRows: [],
loading: false,
pagination: {
defaultCurrent: 1,
defaultPageSize: 10,
showQuickJumper: true,
pageSize: 10,
onChange: function (page) {
this.loadData(page);
}.bind(this),
showTotal: function (total) {
return '共' + total + '条数据';
}
},
columnsman:[{
title: '姓名',
dataIndex: 'key',
key: 'key'
},{
title: '手机号码',
dataIndex: 'mobile',
key: 'mobile'
}
],
columns: [
{
title: '公司名称',
dataIndex: 'companyName',
key: 'companyName',
render: text => {
const theData = this.state.data || {};
const contactsOption="";
const { getFieldDecorator } = this.props.form;
const FormItem = Form.Item
const formItemLayout = {
labelCol: { span: 8 },
wrapperCol: { span: 14 },
};
return (
this.setModal5Visible(false)}
onCancel={() => this.setModal5Visible(false)}
>
)
}
}, {
title: '客户类型',
dataIndex: '_shareType',
key: '_shareType'
// render: text => { return getcustomerTyp(text); }
}, {
title: '地区',
dataIndex: 'locationProvince',
key: 'locationProvince',
render: text => { return getcityArr(text); }
}, {
title: '联系人姓名',
dataIndex: 'contactName',
key: 'contactName',
},
{
title: '手机号',
dataIndex: 'telNum',
key:'telNum',
},
{
title: '客户状态',
dataIndex: '_customerStatus',
key: '_customerStatus'
//render: text => { return getcustomerStatue(text) }
},
{
title: '意向服务',
dataIndex: 'companyIntention',
key: 'companyIntention',
render: text => { return getCompanyIntention(text) }
},
{
title: '最新跟进',
dataIndex: '_followSituation',
key: '_followSituation',
render:text => {
const theData = this.state.data || {};
const contactsOption="";
const rowSelection = {
selectedRowKeys: this.state.selectedRowKeys,
onChange: (selectedRowKeys, selectedRows) => {
this.setState({
selectedRows: selectedRows.slice(-1),
selectedRowKeys: selectedRowKeys.slice(-1)
});
}
};
//const lastwomen=this.state.wemon || {};
const FormItem = Form.Item;
const { getFieldDecorator } = this.props.form;
const formItemLayout = {
labelCol: { span: 8 },
wrapperCol: { span: 14 },
};
const formItemLayput = {
labelCol: { span: 10 },
wrapperCol: { span: 14 },
};
return (
this.setModal4Visible(false)}
onCancel={() => this.setModal4Visible(false)}
>
this.setModal3Visible(false)}
onCancel={() => this.setModal3Visible(false)}
>
this.setModal1Visible(false)}
onCancel={() => this.setModal1Visible(false)}
>
)
}
},
{
title: '跟单人',
dataIndex: 'adminName',
key: 'adminName',
},
{
title: '时间',
dataIndex: 'followDate',
key: 'followDate',
}
],
dataSource: [],
searchTime: [,]
};
},
componentWillMount() {
let theArr = [];
customerStatus.map(function (item) {
theArr.push(
{item.key}
)
});
let auditArr = [];
cityArr.map(function (item) {
auditArr.push(
{item.key}
)
});
let intentionalArr = [];
intentionalService.map(function (item) {
intentionalArr.push(
{item.key}
)
});
let newArr = [];
newFollow.map(function (item) {
newArr.push(
{item.key}
)
});
this.state.customerStatuarr = theArr;
this.state.auditStatusOption = auditArr;
this.state.intentionalOption = intentionalArr;
this.state.newOption = newArr;
if (window.location.search) {
let theObj = getSearchUrl(window.location.search);
if (theObj.rid) {
theObj.id = theObj.rid;
if (theObj.rid != 'null') {
this.tableRowClick(theObj);
};
};
};
this.loadData();
},
tableRowClick(record, index) {
this.state.RowData = record;
this.setState({
showDesc: true
});
},
//删除功能,已经完成
delectRow() {
let deletedIds;
let adminName;
let customerStatus;
let companyIntention;
let followSituation;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id;
adminName=rowItem.adminName;
customerStatus=rowItem.customerStatus;
companyIntention=rowItem.companyIntention;
followSituation=rowItem.followSituation;
};
};
this.state.data = []
this.setState({
selectedRowKeys: [],
loading: deletedIds.length > 0
});
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/deleteCustomer",
data: {
id: deletedIds,//删除的ID
beforeCustomerStatus:customerStatus,
beforeCompanyIntention:companyIntention,
beforeFollowSituation:followSituation,
adminName:adminName
}
}).done(function (data) {
if (!data.error.length) {
message.success('删除成功!');
this.setState({
loading: false,
});
} else {
message.warning(data.error[0].message);
};
this.loadData();
}.bind(this));
},
//转为公共客户功能
changeRow() {
let deletedIds;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id
};
};
this.setState({
selectedRowKeys: [],
loading: deletedIds.length > 0
});
$.ajax({
method: "GET",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/deleteCustomer", //等待接口
data: {
id: deletedIds
}
}).done(function (data) {
if (!data.data.error.length) {
message.success('已转为公共客户!');
this.setState({
loading: false,
});
} else {
message.warning(data.error[0].message);
};
this.loadData();
}.bind(this));
},
addClick() {
this.state.RowData = {};
this.setState({
showDesc: true
});
},
closeDesc(e, s) {
this.state.showDesc = e;
if (s) {
this.loadData();
};
},
search() {
this.loadData();
},
reset() {
this.state.id = undefined;
this.state.customerName = undefined;
this.state.shareTyp = undefined;
this.state.province = undefined;
this.state.ownerType = undefined;
this.state.customerStatus = undefined;
this.state.auditStatus = undefined;
this.state.adminName = undefined;
this.state.contactName = undefined;
this.state.releaseDate = [];
this.loadData();
},
searchSwitch() {
this.setState({
searchMore: !this.state.searchMore
});
},
render() {
const FormItem = Form.Item
const rowSelection = {
selectedRowKeys: this.state.selectedRowKeys,
onChange: (selectedRowKeys, selectedRows) => {
this.setState({
selectedRows: selectedRows.slice(-1),
selectedRowKeys: selectedRowKeys.slice(-1)
});
}
};
const hasSelected = this.state.selectedRowKeys.length > 0;
const { RangePicker } = DatePicker;
const theData = this.props.data || {};
const { getFieldDecorator } = this.props.form;
const formItemLayout = {
labelCol: { span: 8 },
wrapperCol: { span: 14 },
};
return (
客户管理
{
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList);
}
if (info.file.status === 'done') {
if (!info.file.response.error.length) {
message.success(`${info.file.name} 文件上传成功!`);
} else {
message.warning(info.file.response.error[0].message);
return;
};
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 文件上传失败。`);
};
}} >
);
}
}));
export default AchievementList;