import React from 'react';
import {
Tooltip,
Button,
AutoComplete,
Input,
Select,
Spin,
Table,
message,
Form,
Tabs,
} from 'antd';
import $ from 'jquery/src/ajax';
import { ShowModal, } from "@/tools.js";
import { industry } from "@/dataDic.js"
import ShowModalDiv from "@/showModal.jsx";
import { ChooseList } from "../../../order/orderNew/chooseList";
import MainBusinessLog from './mainBusinessLog';
import './customer.less';
const TabPane = Tabs.TabPane;
const IntentionCustomer = Form.create()(React.createClass({
getInitialState() {
return {
searchInfor: {},
fjlist: [],
loading: false,
visible: false,
changeList: undefined,
uid: '',
dataSource: [],
pagination: {
defaultCurrent: 1,
defaultPageSize: 10,
showQuickJumper: true,
pageSize: 10,
onChange: function (page) {
this.loadData(page);
}.bind(this),
showTotal: function (total) {
return '共' + total + '条数据';
}
},
columns: [{
title: '客户名称',
dataIndex: 'nickname',
key: 'nickname',
fixed: 'left',
width: 200,
render: text => {
return (
{text}
)
}
},
{
title: '地区',
dataIndex: 'area',
key: 'area',
width: 150,
render: (text, record) => {
return (record.province || "") + (!record.city ? "" : "-") + (record.city || "") + (!record.area ? "" : "-") + (record.area || "");
},
},
{
title: '客户类型',
dataIndex: 'shareType',
key: 'shareType',
render: text => {
return (
{["私有客户", "公共客户", "签单客户", "外联客户"][text]}
)
}
},
{
title: '主营产品',
dataIndex: 'businessScope',
key: 'businessScope',
width: 200,
},
{
title: '行业',
dataIndex: 'industry',
key: 'industry',
},
{
title: '联系人',
dataIndex: 'contactName',
key: 'contactName',
},
{
title: '所属人',
dataIndex: 'adminName',
key: 'adminName',
},
{
title: '意向合作项目',
dataIndex: 'intendedProject',
key: 'intendedProject'
},
{
title: '知产情况',
dataIndex: 'patentCount',
key: 'patentCount',
width: 220,
render: (text, record) => {
return (
专利 {text || 0}
其中发明专利 {record.inventionPatentCount || 0}
实用新型 {record.utilityModelCount || 0}
外观设计 {record.appearancePatentCount || 0}
软著 {record.softwareWorksCount || 0}
其他类型 {record.otherCount || 0}
)
}
},
{
title: '财务数据',
dataIndex: 'financialData',
key: 'financialData',
width: 200,
},
{
title: '前期沟通',
dataIndex: 'earlyCommunication',
key: 'earlyCommunication',
width: 200,
},
{
title: '面谈思路及目的',
dataIndex: 'interviewIdeas',
key: 'interviewIdeas',
width: 200,
},
{
title: '所属部门',
dataIndex: 'depName',
key: 'depName',
},
{
title: '操作',
dataIndex: 'id',
key: 'id',
render: text => {
return (
)
}
}
],
columnsX: [
{
title: '客户名称',
dataIndex: 'nickname',
key: 'nickname',
fixed: 'left',
width: 200,
render: text => {
return (
{text}
)
}
},
{
title: '地区',
dataIndex: 'area',
key: 'area',
width: 150,
render: (text, record) => {
return (record.province || "") + (!record.city ? "" : "-") + (record.city || "") + (!record.area ? "" : "-") + (record.area || "");
},
},
{
title: '客户类型',
dataIndex: 'shareType',
key: 'shareType',
render: text => {
return (
{["私有客户", "公共客户", "签单客户", "外联客户"][text]}
)
}
},
{
title: '渠道类别',
dataIndex: 'channelType',
key: 'channelType',
render: text => {
return (
{["", "其他", "民主党派", "园区", "民间组织", "战略合作单位"][text]}
)
}
},
{
title: '企业数',
dataIndex: 'enterpriseCount',
key: 'enterpriseCount',
},
{
title: '联系人',
dataIndex: 'contactName',
key: 'contactName',
},
{
title: '所属人',
dataIndex: 'adminName',
key: 'adminName',
},
{
title: '面谈项目',
dataIndex: 'intendedProject',
key: 'intendedProject',
width: 200,
},
{
title: '考核指标',
dataIndex: 'channelIndicators',
key: 'channelIndicators',
width: 200,
},
{
title: '面谈思路及目的',
dataIndex: 'interviewIdeas',
key: 'interviewIdeas',
width: 200,
},
{
title: '面谈人及分工',
dataIndex: 'interviewDistribution',
key: 'interviewDistribution',
width: 200,
},
{
title: '所属部门',
dataIndex: 'depName',
key: 'depName',
},
{
title: '操作',
dataIndex: 'id',
key: 'id',
render: text => {
return (
)
}
}
],
dataSource: [],
};
},
componentWillMount() {
this.loadData();
},
componentWillReceiveProps(nextProps) {
if (nextProps.newChannel !== this.props.newChannel) {
this.setState({
changeList: undefined
})
this.reset();
}
},
loadData(pageNo) {
const { searchInfor, pagination } = this.state;
this.setState({
loading: true,
});
let datas = Object.assign(searchInfor, {
newChannel: this.props.newChannel,
pageNo: pageNo || 1,
pageSize: pagination.pageSize,
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/userArchives/selectUserArchives",
data: datas,
success: function (data) {
ShowModal(this);
this.setState({
loading: false,
});
if (data.error && data.error.length === 0) {
if (data.data.list) {
pagination.current = data.data.pageNo;
pagination.total = data.data.totalCount;
if (data.data && data.data.list && !data.data.list.length) {
pagination.current = 0;
pagination.total = 0;
}
this.setState({
dataSource: data.data.list,
pagination: this.state.pagination,
pageNo: data.data.pageNo,
});
} else {
this.setState({
dataSource: data.data,
pagination: false,
});
}
} else {
message.warning(data.error[0].message);
}
}.bind(this),
}).always(
function () {
this.setState({
loading: false,
});
}.bind(this)
);
},
followUp(e) {
const { searchInfor } = this.state;
this.setState({
searchInfor: Object.assign(searchInfor, {
aname: e,
}),
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/listAdminByName",
data: {
adminName: e,
},
success: function (data) {
let thedata = data.data;
if (!thedata) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
}
thedata = {};
}
this.setState({
fjlist: thedata,
});
}.bind(this),
}).always(
function () {
this.setState({
loading: false,
});
}.bind(this)
);
},
selectF(value) {
const { searchInfor, fjlist } = this.state;
const newdataSources = JSON.stringify(fjlist) == "{}" ? [] : fjlist;
this.setState({
searchInfor: Object.assign(searchInfor, {
aid: newdataSources.find((item) => item.name == value).id,
}),
});
},
changeList(arr) {
const newArr = [];
let list = this.props.newChannel == 1
? this.state.columnsX
: this.state.columns
list.forEach((item) => {
arr.forEach((val) => {
if (val === item.title) {
newArr.push(item);
}
});
});
this.setState({
changeList: newArr,
});
},
search() {
this.loadData();
},
reset() {
this.setState({
searchInfor: JSON.parse(JSON.stringify({})),
}, () => {
this.loadData();
})
},
render() {
const { searchInfor } = this.state
const { newChannel } = this.props
const newdataSources =
JSON.stringify(this.state.fjlist) == "{}" ? [] : this.state.fjlist;
const newoptions = newdataSources.map((group) => (
{group.name}
));
return (
{ this.setState({ showModal: false }) }} />
{newChannel == 1 ? "渠道档案汇总" : "客户档案汇总"}
{
this.setState({
searchInfor: Object.assign(searchInfor, {
name: e.target.value,
}),
});
}}
/>
{newChannel == 1 &&
}
{newChannel == 0 && {
this.setState({
searchInfor: Object.assign(searchInfor, {
businessScope: e.target.value,
}),
});
}}
/>}
{newChannel == 0 &&
}
{this.state.visible &&
{
this.setState({
visible: false,
uid: ''
})
}}
/>}
);
}
}));
export default IntentionCustomer;