import React from 'react';
import { Tag, Tooltip, Radio, Icon, Button, AutoComplete, Cascader, Input, Select, Spin, Popconfirm, Table, Switch, message, Calendar, DatePicker, Upload, Form, Modal, Tabs, Card } from 'antd';
import ajax from 'jquery/src/ajax/xhr.js';
import $ from 'jquery/src/ajax';
import Jquery from 'jquery/dist/jquery.js';
import moment from 'moment';
import MainBusinessLog from './mainBusinessLog';
import ChangeMainProducts from './ChangeMainProducts';
import PDF from 'react-pdf';
import 'viewer/dist/crocodoc.viewer.css';
import TechAchievementDesc from '@/manageCenter/achievement/crmAchievement.jsx';
import { citySelect, provinceList, areaSelect } from '@/NewDicProvinceList';
import { socialAttribute, industry, auditStatusL, lvl, currentMember, slcRedit, dataGrade, year, xiangmoState } from '@/dataDic.js';
import {
getSocialAttribute,
beforeUploadFile,
splitUrl,
getSlcRedit,
getDataGrade,
getAchievementCategory,
getTechAuditStatus,
getboutique,
getPreviews,
getPreview,
getXiangmoState,
ShowModal,
onReplace,
} from "@/tools.js";
import './customer.less';
const TabPane = Tabs.TabPane;
import ShowModalDiv from "@/showModal.jsx";
import ImgList from "../../../../common/imgList";
import { ChooseList } from "../../../order/orderNew/chooseList";
import EnterpriseNameChange from "../../../../common/enterpriseNameChange";
import TextArea from "antd/es/input/TextArea";
const Dragger = Upload.Dragger;
//图片组件
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;
this.state.pojectApplicationUrl = undefined;
},
render() {
const {
previewVisible,
previewImage,
fileList
} = this.state;
const uploadButton = (
);
return (
{
this.handleChange(infor)
}}
fileList={fileList}
/>
);
}
});
const IntentionCustomer = Form.create()(React.createClass({
loadData(pageNo, apiUrl) {
this.setState({
visitModul: false,
loading: true,
ispage: pageNo,
modalVisible: false
});
let url = this.props.isMaintain ? '/api/admin/customer/mainProductsList' : "/api/admin/customer/listCustomerInformation";
let data = {
pageNo: pageNo || 1,
pageSize: this.state.pagination.pageSize,
businessScope: this.state.businessScope,
dataGrade: this.state.dataGrade,
follow: this.state.follow,
province: !(this.state.addressSearch).length ? this.state.provinceSearch : this.state.addressSearch[0],
city: !(this.state.addressSearch).length ? undefined : this.state.addressSearch[1],
}
if (this.props.isMaintain) {
data.shiroType = this.props.shiroType;
data.userName = this.state.nameSearch || undefined;
data.adminName = this.state.adminName || undefined;
data.key = this.state.productKeyword || undefined;
data.startTime = this.state.releaseDate[0] || undefined;
data.endTime = this.state.releaseDate[1] || undefined;
data.depId = this.state.depId || undefined;
data.shareType = isNaN(parseInt(this.state.shareType)) ? undefined : this.state.shareType
} else {
data.name = this.state.nameSearch;
data.startDate = this.state.releaseDate[0];
data.endDate = this.state.releaseDate[1];
}
$.ajax({
method: this.props.isMaintain ? 'get' : "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + url,
data,
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 = (thisdata.province == null ? "" : thisdata.province) + (thisdata.city == null ? "" : "-" + thisdata.city) + (thisdata.area == null ? "" : "-" + thisdata.area);
thisdata.key = i;
thisdata.diqu = diqu;
thisdata.dataGrade = thisdata.dataGrade ? (thisdata.dataGrade * 100).toFixed(2) + "%" : "";
theArr.push(thisdata);
};
this.state.pagination.current = data.data.pageNo;
this.state.pagination.total = data.data.totalCount;
if (data.data && data.data.list && !data.data.list.length) {
this.state.pagination.current = 0
this.state.pagination.total = 0
}
this.setState({
dataSource: theArr,
pageNo: data.data.pageNo,
pagination: this.state.pagination,
selectedRowKeys: []
});
} else {
message.warning(data.error[0].message);
}
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
loadDatas(pageNos) {
this.setState({
loading: true,
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/achievement/listUserAchievement",
data: {
pageNo: pageNos || 1,
pageSize: this.state.paginationDate.pageSize,
uid: this.state.uid,
},
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,
serialNumber: thisdata.serialNumber,
dataCategory: thisdata.dataCategory,
name: thisdata.name,
keyword: thisdata.keyword,
theName: thisdata.username || thisdata.ownerName,
category: thisdata.category,
ownerName: thisdata.username ? thisdata.username : thisdata.ownerName,
ownerType: thisdata.ownerType,
ownerMobile: thisdata.ownerMobile,
status: thisdata.status,
releaseDate: thisdata.releaseDate,
releaseDateFormattedDate: thisdata.releaseDateFormattedDate,
auditStatus: thisdata.auditStatus,
boutique: thisdata.boutique,
hot: thisdata.hot,
techBrokerId: thisdata.techBrokerId,
createTimeFormattedDate: thisdata.createTimeFormattedDate,
remark: thisdata.remark
});
};
this.state.paginationDate.current = data.data.pageNo;
this.state.paginationDate.total = data.data.totalCount;
};
this.setState({
dataSourceDate: theArr,
pageNos: pageNos,
paginationDate: this.state.paginationDate
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
loadDatac(pageNo, apiUrl) {
this.setState({
loading: true,
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customers/selectListOrgAnnual",
data: {
// pageNo: pageNo || 1,
// pageSize: this.state.pagination.pageSize,
uid: this.state.uid,
},
success: function (data) {
let theArr = [];
if (data.error.length || 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];
let diqu = (thisdata.province == null ? "" : thisdata.province) + (thisdata.city == null ? "" : "-" + thisdata.city) + (thisdata.area == null ? "" : "-" + thisdata.area);
theArr.push({
key: i,
id: thisdata.id,//年报ID
uid: thisdata.uid,//客户ID
year: thisdata.year,//年份
salesAmount: thisdata.salesAmount,//营销额
researchAmount: thisdata.researchAmount,//研发费用
assets: thisdata.assets,//总资产
fixedAssets: thisdata.fixedAssets,//固定资产
aid: thisdata.aid,//录入人
});
};
// this.state.pagination.current = data.data.pageNo;
// this.state.pagination.total = data.data.totalCount;
};
if (data.data && data.data.list && !data.data.list.length) {
this.state.pagination.current = 0
this.state.pagination.total = 0
}
this.setState({
dataSourcec: theArr,
// pageNo: pageNo,
// pagination: this.state.pagination,
// selectedRowKeys:[]
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
loadDatax(pageNo, apiUrl) {
this.setState({
loading: true,
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customers/selectListOrgYearProject",
data: {
uid: this.state.uid,
},
success: function (data) {
let theArr = [];
if (data.error.length || 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];
let diqu = (thisdata.province == null ? "" : thisdata.province) + (thisdata.city == null ? "" : "-" + thisdata.city) + (thisdata.area == null ? "" : "-" + thisdata.area);
theArr.push({
key: i,
id: thisdata.id,//用户ID
uid: thisdata.uid,//客户ID
projectName: thisdata.projectName,//项目名称
year: thisdata.year,//年份
status: thisdata.status ? thisdata.status.toString() : "",//项目状态
remark: thisdata.remark,//备注
aid: thisdata.aid,//录入人
});
};
// this.state.pagination.current = data.data.pageNo;
// this.state.pagination.total = data.data.totalCount;
};
if (data.data && data.data.list && !data.data.list.length) {
this.state.pagination.current = 0
this.state.pagination.total = 0
}
this.setState({
dataSourcex: theArr,
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
getInitialState() {
return {
businessScope: [],
departmentArr: [],
inputVisible: false,
inputValue: '',
salesTarget: [],
inputVisible1: false,
inputValue1: '',
pdfUrl: '',
addressSearch: [],
orgCodeUrl: [],
companyLogoUrl: [],
visible: false,
releaseDate: [],
visitModul: false,
detailApi: '',
followData: {},
selectedRowKeys: [],
selectedRows: [],
loading: false,
callnub: "0",
pojectApplicationUrl: "",
isXian: 0,
modalVisible: false,
numPages: null,
pageNumber: 1,
pagec: 0,
pages: 18,
mainProductsArr: '',
isXin: 1,
pagination: {
defaultCurrent: 1,
defaultPageSize: 10,
showQuickJumper: true,
pageSize: 10,
onChange: function (page) {
this.loadData(page);
}.bind(this),
showTotal: function (total) {
return '共' + total + '条数据';
}
},
paginationDate: {
defaultCurrent: 1,
defaultPageSize: 10,
showQuickJumper: true,
pageSize: 10,
onChange: function (page) {
this.loadDatas(page);
}.bind(this),
showTotal: function (total) {
return '共' + total + '条数据';
}
},
changeMainProductsArr: [],
adminMaintainColumns: [
{
title: '客户名称',
dataIndex: 'userName',
key: 'userName',
width: 200,
render: text => {
return (
{onReplace(text)}
)
}
},
{
title: '地区',
dataIndex: 'province',
key: 'province',
},
{
title: '客户类型',
dataIndex: 'shareType',
key: 'shareType',
width: 80,
render: (text) => {
return (
text === 0 ? '私有客户' :
text === 1 ? '公共客户' :
text === 2 ? '签单客户' :
text === 3 ? '外联客户' : ''
)
}
},
{
title: '主营产品',
dataIndex: 'businessScope',
key: 'businessScope',
width: 250,
render: (text) => {
return (
{text}
)
}
},
{
title: '所属人',
dataIndex: 'adminName',
key: 'adminName',
},
{
title: '所属部门',
dataIndex: 'depName',
key: 'depName',
},
{
title: '更新人',
dataIndex: 'updateName',
key: 'updateName',
},
{
title: '更新时间',
dataIndex: 'dateUpdateTimes',
key: 'dateUpdateTimes',
width: 130,
},
{
title: '操作',
dataIndex: 'uid',
key: 'uid',
render: text => {
return (
{this.props.shiroType !== 2 && }
)
}
}
],
maintainColumns: [
{
title: '客户名称',
dataIndex: 'userName',
key: 'userName',
width: 200,
render: text => {
return (
{text}
)
}
},
{
title: '主营产品',
dataIndex: 'businessScope',
key: 'businessScope',
width: 250,
className: 'crmBusinessScope',
render: (text, record) => {
return (
主营产品
(请以"/"分割)
)
}
},
{
title: '初始时间',
dataIndex: 'transferTimes',
key: 'transferTimes',
width: 130,
},
{
title: '更新人',
dataIndex: 'updateName',
key: 'updateName',
},
{
title: '更新时间',
dataIndex: 'dateUpdateTimes',
key: 'dateUpdateTimes',
width: 130,
},
{
title: '操作',
dataIndex: 'uid',
key: 'uid',
render: (text, record) => {
return (
{this.props.shiroType !== 2 && }
)
}
}
],
maintainColumnsYXY: [
{
title: '客户名称',
dataIndex: 'userName',
key: 'userName',
width: 200,
render: text => {
return (
{text}
)
}
},
{
title: '客户类型',
dataIndex: 'shareType',
key: 'shareType',
width: 80,
render: (text) => {
return (
text === 0 ? '私有客户' :
text === 1 ? '公共客户' :
text === 2 ? '签单客户' :
text === 3 ? '外联客户' : ''
)
}
},
{
title: '主营产品',
dataIndex: 'businessScope',
key: 'businessScope',
width: 250,
className: 'crmBusinessScope',
render: (text, record) => {
return (
主营产品
(请以"/"分割)
)
}
},
{
title: '初始时间',
dataIndex: 'transferTimes',
key: 'transferTimes',
width: 130,
},
{
title: '更新人',
dataIndex: 'updateName',
key: 'updateName',
},
{
title: '更新时间',
dataIndex: 'dateUpdateTimes',
key: 'dateUpdateTimes',
width: 130,
},
{
title: '操作',
dataIndex: 'uid',
key: 'uid',
render: (text, record) => {
return (
{this.props.shiroType !== 2 && }
)
}
}
],
columns: [{
title: '客户名称',
dataIndex: 'name',
key: 'name',
width: 200,
render: text => {
return (
{text}
)
}
}, {
title: '地区',
dataIndex: 'diqu',
key: 'diqu',
}, {
title: '联系人',
dataIndex: 'contacts',
key: 'contacts',
}, {
title: '联系电话',
dataIndex: 'contactMobile',
key: 'contactMobile',
},
{
title: '资料完整度',
dataIndex: 'dataGrade',
key: 'dataGrade',
},
{
title: '行业',
dataIndex: 'industry',
key: 'industry'
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
width: 130,
}
],
data: [],
dataSource: [],
columnsDate: [
{
title: '编号',
dataIndex: 'serialNumber',
key: 'serialNumber',
}, {
title: '名称',
dataIndex: 'name',
key: 'name',
}, {
title: '关键字',
dataIndex: 'keyword',
key: 'keyword',
}, {
title: '类型',
dataIndex: 'category',
key: 'category',
render: text => { return getAchievementCategory(text); }
}, {
title: '审核状态',
dataIndex: 'auditStatus',
key: 'auditStatus',
render: text => { return getTechAuditStatus(text) }
},
{
title: '是否精品',
dataIndex: 'boutique',
key: 'boutique',
render: text => { return getboutique(text) }
},
{
title: '发布时间',
dataIndex: 'releaseDateFormattedDate',
key: 'releaseDateFormattedDate',
}, {
title: '录入时间',
dataIndex: 'createTimeFormattedDate',
key: 'createTimeFormattedDate',
},
],
dataSourceDate: [],
columnsc: [{
title: '年份',
dataIndex: 'year',
key: 'year',
}, {
title: '营销收入(万)',
dataIndex: 'salesAmount',
key: 'salesAmount',
},
{
title: '总资产(万)',
dataIndex: 'assets',
key: 'assets'
},
{
title: '固定资产(万)',
dataIndex: 'fixedAssets',
key: 'fixedAssets'
}, {
title: '研发费用(万)',
dataIndex: 'researchAmount',
key: 'researchAmount',
}, {
title: '操作',
dataIndex: 'rrtk',
key: 'rrtk',
render: (text, record, index) => {
return (
{ this.deltalc(record) }} okText="确认" cancelText="取消">
)
}
}
],
dataSourcec: [],
columnsx: [{
title: '项目名称',
dataIndex: 'projectName',
key: 'projectName',
}, {
title: '年份',
dataIndex: 'year',
key: 'year',
},
{
title: '项目状态',
dataIndex: 'status',
key: 'status',
render: text => { return getXiangmoState(text); }
}, {
title: '备注',
dataIndex: 'remark',
key: 'remark',
}, {
title: '操作',
dataIndex: 'rrtk',
key: 'rrtk',
render: (text, record, index) => {
return (
{ this.deltalx(record) }} okText="确认" cancelText="取消">
)
}
}
],
dataSourcex: [],
};
},
handleClose(removedTag) {
let businessScope = this.state.businessScope.filter(tag => { return tag !== removedTag });
this.setState({ businessScope });
},
showInput() {
let str = this.state.businessScope.join('/')
this.setState({
inputVisible: true,
inputValue: str
});
},
handleInputChange(e) {
this.setState({ inputValue: e.target.value });
},
updateUserBusinessScope(record) {
let lv = true;
let arr = this.state.mainProductsArr.split('/');
for (let i of arr) {
if (i.length > 16) {
message.warning('单个标签字数不能超过16个字符')
lv = false;
return;
}
}
if (!lv) { return; }
let loading = message.loading('加载中...')
arr = Array.from(new Set(arr));
arr = arr.filter(v => v);
let str = this.state.mainProductsArr ? arr.join(',') : ''
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/updateUserBusinessScope",
data: {
id: record.id,
businessScope: str
},
success: function (data) {
if (data.error.length === 0) {
message.success('修改成功');
this.state.dataSource[record.key].visible = false;
this.state.dataSource[record.key].businessScope = str;
this.setState({
dataSource: this.state.dataSource,
mainProductsArr: '',
})
} else {
message.warning(data.error[0].message);
}
}.bind(this),
}).always(function () {
loading();
}.bind(this));
},
handleInputConfirm() {
const state = this.state;
const inputValue = state.inputValue;
let arr = inputValue.split('/');
let lv = true;
for (let i of arr) {
if (i.length > 16) {
message.warning('单个标签字数不能超过16个字符')
lv = false;
return;
}
}
if (lv) {
arr = Array.from(new Set(arr));
arr = arr.filter(v => v);
this.setState({
businessScope: arr,
inputVisible: false,
inputValue: '',
});
}
},
handleClose1(removedTag) {
const salesTarget = this.state.salesTarget.filter(tag => tag !== removedTag);
this.setState({ salesTarget });
},
showInput1() {
this.setState({ inputVisible1: true }, () => this.input1.focus());
},
handleInputChange1(e) {
this.setState({ inputValue1: e.target.value });
},
handleInputConfirm1() {
const state = this.state;
const inputValue = state.inputValue1;
let salesTarget = state.salesTarget;
if (inputValue.length > 16) {
message.warning('标签字数不能超过16个字符')
return;
}
let arr = inputValue.split(',');
for (let i of arr) {
if (i && salesTarget.indexOf(i) === -1) {
salesTarget = [...salesTarget, i];
}
this.setState({
salesTarget,
inputVisible1: false,
inputValue1: '',
});
}
},
componentWillMount() {
//城市
let Province = [];
provinceList.map(function (item) {
var id = String(item.id)
Province.push(
{item.name}
)
});
//行业
let intentionalArr = [];
industry.map(function (item) {
intentionalArr.push(
{item.key}
)
});
//会员等级
let lvlArr = [];
lvl.map(function (item) {
lvlArr.push(
{item.key}
)
});
//会员状态customerStatus
let currentMemberArr = [];
currentMember.map(function (item) {
currentMemberArr.push(
{item.key}
)
});
this.state.Provinces = Province;
this.state.intentionalOption = intentionalArr;
this.state.lvlArrOption = lvlArr;
this.state.currentMemberArrOption = currentMemberArr;
this.loadData();
this.departmentList();
},
search() {
this.loadData();
},
reset() {
this.setState({
nameSearch: '',
adminName: '',
productKeyword: '',
businessScope: [],
addressSearch: [],
dataGrade: undefined,
follow: undefined,
provinceSearch: undefined,
shareType: undefined,
depId: undefined,
citySearch: undefined,
releaseDate: []
}, () => {
this.loadData();
})
},
resetc() {
this.state.id = undefined;//年报ID
this.state.assets = undefined;//总资产
this.state.fixedAssets = undefined;//固定资产
this.state.researchAmount = undefined;//研发费用
this.state.salesAmount = undefined;//销售额
this.state.year = undefined;//年份清零
},
resetx() {
this.state.id = undefined;//年报ID
this.state.projectName = undefined;//项目名称
this.state.status = undefined;//项目状态
this.state.remark = undefined;//备注
this.state.year = undefined;//年份清零
},
//列表详情
details(id) {
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/findOrganizationCustomerDetail",
data: {
uid: id
},
success: function (data) {
let thisDetail = data.data;
if (data.error.length || data.data.list == "") {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
} else {
let ProvinceCityArr = [];
let ProvinceS = thisDetail.locationProvince; //省
let citys = thisDetail.locationCity;//市
let Areas = thisDetail.locationArea;//区
ProvinceCityArr.push(ProvinceS, citys, Areas);
this.setState({
detailId: thisDetail.id,//详情ID
identifyName: thisDetail.identifyName,//客户名称
uid: thisDetail.uid,//客户ID
societyTag: thisDetail.societyTag,//社会标签
companyLogoUrl: thisDetail.companyLogoUrl ? splitUrl(thisDetail.companyLogoUrl, ',', globalConfig.avatarHost + '/upload') : [],//公司LOGO
introduction: thisDetail.introduction,//介绍
industry: thisDetail.industry ? thisDetail.industry.toString() : "",//行业
locationProvince: thisDetail.locationProvince,//省
locationCity: thisDetail.locationCity,//市
locationArea: thisDetail.locationArea,//区
ProvinceCity: ProvinceCityArr[0] != null ? ProvinceCityArr : undefined,//省市区
postalAddress: thisDetail.postalAddress,//通讯地址
contactsFixedTel: thisDetail.contactsFixedTel,//固定电话
contactsFax: thisDetail.contactsFax,//传真地址
registeredCapital: thisDetail.registeredCapital,//注册资金
enterpriseScale: thisDetail.enterpriseScale,//企业规模
legalPerson: thisDetail.legalPerson,//法人
legalPersonIdCard: thisDetail.legalPersonIdCard,//法人身份证
legalPersonTel: thisDetail.legalPersonTel,//法人联系电话
legalPersonEmail: thisDetail.legalPersonEmail,//法人联系邮箱
highTechZone: thisDetail.highTechZone,//是否高新
listed: thisDetail.listed,//是否高新
international: thisDetail.international,//是否国际化
orgCode: thisDetail.orgCode,//社会统一机构
orgCodeUrl: thisDetail.orgCodeUrl ? splitUrl(thisDetail.orgCodeUrl, ',', globalConfig.avatarHost + '/upload') : [],//社会统一机构地址
businessScope: thisDetail.businessScope ? thisDetail.businessScope.split(',').filter((v) => v) : [],//业务范围
salesTarget: thisDetail.salesTarget ? thisDetail.salesTarget.split(',').filter((v) => v) : [],//销售目标企业
contacts: thisDetail.contacts,//主要联系人姓名
contactMobile: thisDetail.contactMobile,//主要联系人电话
investment: thisDetail.investment,//投资机构
businessAudit: thisDetail.businessAudit,//业务认证
auditStatus: thisDetail.auditStatus,//实名认证
intellectualProperty: thisDetail.intellectualProperty,//已有知识产权情况
yearSalesAmount: thisDetail.yearSalesAmount,//年度销售额
lastYearResearchAmount: thisDetail.lastYearResearchAmount,//上年度研发费用
assets: thisDetail.assets,//总资产
qualification: thisDetail.qualification,//企业资质情况
cooperationSituation: thisDetail.cooperationSituation,//企业与高校院所
informationMaintainer: thisDetail.informationMaintainer,//资料维护人
informationMaintainerName: thisDetail.informationMaintainerName,//资料维护人
coreTechnology: thisDetail.coreTechnology,//核心技术
accomplishSituation: thisDetail.accomplishSituation,//客户已完成项目情况
creditRating: thisDetail.creditRating ? thisDetail.creditRating.toString() : "",//信用等级
pojectApplicationUrl: thisDetail.pojectApplicationUrl,//文件地址
});
}
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//基本信息提交
newSubmit(e) {
e.preventDefault();
if (!this.state.industry) {
message.warning('请选择行业');
return false;
};
if (!this.state.societyTag && !this.props.isMaintain) {
message.warning('请选择社会属性');
return false;
};
if (!this.state.ProvinceCity[1] && !this.props.isMaintain) {
message.warning('请选择地区');
return false;
};
if (!this.state.registeredCapital && !this.props.isMaintain) {
message.warning('请填写注册资本');
return false;
};
if (this.state.businessScope.length <= 0) {
message.warning('请填写公司主营产品');
return false;
};
if (this.state.salesTarget.length <= 0 && !this.props.isMaintain) {
message.warning('请填写销售目标企业');
return false;
};
var reg = /^[1-9]\d*$|^0$/;
if (this.state.consultationPrice) {
if (this.state.consultationPrice.length > 6) {
message.warning('咨询费用不超过6位数');
this.refs.consul.focus();
return false;
};
if (!reg.test(this.state.consultationPrice)) {
message.warning('咨询费用只能输入数字');
this.refs.consul.focus();
return false;
}
}
this.state.data = [];
this.setState({
selectedRowKeys: [],
});
let theorgCodeUrl = [];
if (this.state.orgCodeUrl.length) {
let picArr = [];
this.state.orgCodeUrl.map(function (item) {
if (item.response && item.response.data && item.response.data.length) {
picArr.push(item.response.data);
}
});
theorgCodeUrl = picArr.join(",");
};
let thecompanyLogoUrl = [];
if (this.state.companyLogoUrl.length) {
let picArr = [];
this.state.companyLogoUrl.map(function (item) {
if (item.response && item.response.data && item.response.data.length) {
picArr.push(item.response.data);
}
});
thecompanyLogoUrl = picArr.join(",");
};
let years = [];
let yearMonth = this.state.yearMonth != undefined ? new Date(this.state.yearMonth).toLocaleDateString() : '';
years = yearMonth.split('/');
this.setState({
loading: true
});
$.ajax({
method: "post",
dataType: "json",
url: globalConfig.context + '/api/admin/customer/updateOrganizationCustomer',
data: {
id: this.state.detailId,//详情ID
identifyName: this.state.identifyName,//客户名称
uid: this.state.uid,//客户ID
societyTag: this.state.societyTag,//社会标签
companyLogoUrl: thecompanyLogoUrl.length != 0 ? thecompanyLogoUrl : '',//公司LOGO
introduction: this.state.introduction,//介绍
industry: this.state.industry,//行业
locationProvince: (this.state.ProvinceCity)[0],//省
locationCity: (this.state.ProvinceCity)[1],//市
locationArea: (this.state.ProvinceCity)[2],//区
postalAddress: this.state.postalAddress,//通讯地址
contactsFixedTel: this.state.contactsFixedTel,//固定电话
contactsFax: this.state.contactsFax,//传真地址
registeredCapital: this.state.registeredCapital,//注册资金
enterpriseScale: this.state.enterpriseScale,//企业规模
legalPerson: this.state.legalPerson,//法人
legalPersonIdCard: this.state.legalPersonIdCard,//法人身份证
legalPersonTel: this.state.legalPersonTel,//法人联系电话
legalPersonEmail: this.state.legalPersonEmail,//法人联系邮箱
highTechZone: this.state.highTechZone,//是否高新
listed: this.state.listed,//是否高新
international: this.state.international,//是否国际化
orgCode: this.state.orgCode,//社会统一机构
orgCodeUrl: theorgCodeUrl.length != 0 ? theorgCodeUrl : '',//社会统一机构地址
businessScope: this.state.businessScope.join(','),//业务范围
salesTarget: this.state.salesTarget.join(','),//销售目标企业
contacts: this.state.contacts,//主要联系人姓名
contactMobile: this.state.contactMobile,//主要联系人电话
investment: this.state.investment,//投资机构
businessAudit: this.state.businessAudit,//业务认证
auditStatus: this.state.auditStatus,//实名认证
intellectualProperty: this.state.intellectualProperty,//已有知识产权情况
qualification: this.state.qualification,//企业资质情况
cooperationSituation: this.state.cooperationSituation,//企业与高校院所
informationMaintainer: this.state.informationMaintainer,//资料维护人
informationMaintainerName: this.state.informationMaintainerName,//资料维护人
coreTechnology: this.state.coreTechnology,//核心技术
creditRating: this.state.creditRating,//信用等级
pojectApplicationUrl: this.state.pojectApplicationUrl,//文件地址
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('保存成功!');
this.visitCancel();
this.loadData(this.state.pageNo);
} else {
message.warning(data.error[0].message);
}
}.bind(this));
},
//财务信息提交
newSubmitc(e) {
e.preventDefault();
if (!this.state.year) {
message.warning('请选择年份');
return false;
};
this.setState({
loading: true
});
$.ajax({
method: "post",
dataType: "json",
url: globalConfig.context + this.state.isXin == 1 ? '/api/admin/customers/addOrgAnnual' : '/api/admin/customers/updateOrgAnnual',
data: {
id: this.state.id ? this.state.id : undefined,//年报ID
uid: this.state.uid,//客户ID
year: this.state.year,//年份
researchAmount: this.state.researchAmount,//研发费用
assets: this.state.assets,//总资产
fixedAssets: this.state.fixedAssets,//固定资产
salesAmount: this.state.salesAmount,//销售额
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('保存成功!');
this.visitCancelc();
this.loadDatac();
this.loadData();
} else {
message.warning(data.error[0].message);
}
}.bind(this));
},
//财务信息提交
newSubmitx(e) {
e.preventDefault();
if (!this.state.year) {
message.warning('请选择年份');
return false;
};
this.setState({
loading: true
});
$.ajax({
method: "post",
dataType: "json",
url: globalConfig.context + this.state.isXinx == 1 ? '/api/admin/customers/addOrgYearProject' : '/api/admin/customers/updateOrgYearProject',
data: {
id: this.state.id ? this.state.id : undefined,//年报ID
uid: this.state.uid,//客户ID
year: this.state.year,//年份
projectName: this.state.projectName,//研发费用
status: this.state.status,//总资产
remark: this.state.remark,//销售额
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('保存成功!');
this.visitCancelc();
this.loadDatax();
this.loadData();
} else {
message.warning(data.error[0].message);
}
}.bind(this));
},
//获取ID
getStateData(id) {
this.setState({
loading: true
});
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/techproject/techProjectLog",
data: {
pid: id || this.props.data.id
},
success: function (data) {
if (!data.data) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
return;
};
var myDate = new Date();
this.state.stateTable = [];
for (let i = 0; i < data.data.length; i++) {
this.state.stateTable.push({
key: i,
state: data.data[i].state,
recordTime: data.data[i].recordTime,
recordTimeFormattedDate: data.data[i].recordTimeFormattedDate,
principal: data.data[i].principal,
operator: data.data[i].operator,
comment: data.data[i].comment
});
};
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//整行点击
tableRowClick(record, index) {
let arr = this.state.dataSource.filter(v => v.visible);
if (arr.length !== 0) {
this.state.dataSource[arr[0].key].visible = false;
}
this.setState({
dataSource: this.state.dataSource,
inputValue: '',
visitModul: true,
pojectApplicationUrl: undefined,
isXian: 0,
})
this.details(this.props.isMaintain ? record.uid : record.id);
},
//指定转交人自动补全
supervisor(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({
customerArr: thedata,
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//输入转交人输入框失去焦点是判断客户是否存在
selectAuto(value, options) {
this.setState({
auto: value
})
},
blurChange(e) {
let theType = '';
let contactLists = this.state.customerArr || [];
if (e) {
contactLists.map(function (item) {
if (item.name == e.toString()) {
theType = item.id;
}
});
}
this.setState({
theTypes: theType
})
},
//值改变时请求客户名称
httpChange(e) {
if (e.length >= 1) {
this.supervisor(e);
}
this.setState({
auto: e
})
},
//转交
changeAssigner() {
if (this.state.theTypes) {
this.setState({
selectedRowKeys: [],
});
let id;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
id = rowItem.id;
};
};
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/updateInformationMaintainerr",
data: {
id: id, //客户ID
aid: this.state.theTypes, //指定转交人的ID
}
}).done(function (data) {
if (!data.error.length) {
message.success('转交成功!');
this.setState({
auto: '',
loading: false,
});
} else {
message.warning(data.error[0].message);
};
this.loadData(Math.min(this.state.pageNo == undefined ? 1 : this.state.pageNo, Math.ceil((this.state.pagination.total - 1) / 10)));
}.bind(this));
} else {
message.warning('请输入转交人姓名')
}
},
//详情打开
visitOk(e) {
this.setState({
visitModul: false
});
},
//详情关闭
visitCancel(e) {
this.state.fileList = [];
this.setState({
visitModul: false,
callnub: "0",
inputVisible: false,
businessScope: [],
});
},
//新增年报打开
visitOkc(e) {
this.setState({
visitModulc: true,
visitModulx: true
});
},
//新增年报关闭
visitCancelc(e) {
this.resetc();
this.resetx();
this.setState({
visitModulc: false,
visitModulx: false,
});
},
//PDF打开
visitOk1(e) {
this.getPrevie(this.state.uid, 'techProject', 'organization_application');
this.setState({
visitModul1: true
});
},
//PDF关闭
visitCancel1(e) {
this.setState({
visitModul1: false,
loading: false,
});
},
//获取PDF地址
getPrevie(id, url, sign) {
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/" + url,
data: {
"id": id,
"sign": sign
},
success: function (data) {
if (!data.data) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
};
this.setState({
pdfUrl: location.origin + globalConfig.context + "/open/preview?" + data.data,
});
}.bind(this)
});
},
//PDF分页
//一开始就加载这个函数
onDocumentComplete(pages) {
this.setState({
loading: true,
});
this.setState({ pagec: 0, pages: pages.total });
},
//随后
onPageComplete(pagec) {
this.setState({ pagec });
},
handlePrevious() {
this.setState({ pagec: this.state.pagec - 1 });
},
handleNext() {
this.setState({ pagec: this.state.pagec + 1 });
},
renderPagination(pagec, pages) {
let previousButton = 上一页 ;
if (pagec == 0) {
previousButton = 上一页 ;
}
let nextButton = 下一页;
if (pagec == pages) {
nextButton = 下一页;
}
return (
);
},
//上面是做PDF分页的
getOrgCodeUrl(e) {
this.setState({ orgCodeUrl: e });
},
getCompanyLogoUrl(e) {
this.setState({ companyLogoUrl: e });
},
componentWillReceiveProps(nextProps) {
if (nextProps.ApiUrl != this.props.ApiUrl) {
this.state.nameSearch = '';
this.state.adminName = '';
this.state.productKeyword = '';
this.state.businessScope = '';
this.state.addressSearch = [];
this.state.provinceSearch = undefined;
this.state.shareType = undefined;
this.state.depId = undefined;
this.state.citySearch = undefined;
this.state.releaseDate[0] = undefined;
this.state.releaseDate[1] = undefined;
this.loadData(null, nextProps.ApiUrl);
};
if (nextProps.isMaintain !== this.props.isMaintain || nextProps.shiroType !== this.props.shiroType) {
this.reset();
}
},
callback(e) {
if (e == '0') {
this.setState({
callnub: e,
})
}
if (e == '1') {
this.setState({
callnub: e,
})
this.loadDatas();
}
if (e == '2') {
this.setState({
callnub: e,
})
this.loadDatac();
}
if (e == '3') {
this.setState({
callnub: e,
})
this.loadDatax();
}
},
//发布成果
addClick() {
this.state.RowData = {};
this.setState({
showDesc: true,
});
},
//新增财务信息
addClickc() {
this.state.RowData = {};
this.resetc();
this.setState({
visitModulc: true,
isXin: 1,
});
},
//新增项目信息
addClickx() {
this.state.RowData = {};
this.resetx();
this.setState({
visitModulx: true,
isXinx: 1,
});
},
//关闭发布成果
closeDesc(e, s) {
this.state.showDesc = e;
if (s) {
this.loadDatas();
};
},
//客户资料每行点击
tableRowClickDate(record, index) {
this.state.RowData = record;
if (index != undefined) {
this.setState({
showDesc: true
});
}
},
//年度每行点击
tableRowClickDatec(record, index) {
this.state.RowData = record;
if (index != undefined) {
this.setState({
isXin: 2,
visitModulc: true,
year: record.year.toString(),//年份
id: record.id,//年报详情ID
assets: record.assets,//总资产
fixedAssets: record.fixedAssets,//固定资产
researchAmount: record.researchAmount,//研发费用
salesAmount: record.salesAmount,//销售额
});
}
},
//项目每行点击
tableRowClickDatex(record, index) {
this.state.RowData = record;
if (index != undefined) {
this.setState({
isXinx: 2,
visitModulx: true,
year: record.year.toString(),//年份
id: record.id,//年报详情ID
projectName: record.projectName,//项目名称
status: record.status.toString(),//项目状态
remark: record.remark,//销售额
});
}
},
//删除财务信息
deltalc(record) {
this.setState({
loading: true
});
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + '/api/admin/customers/delectOrgAnnual',
data: {
id: record.id,
uid: record.uid
}
}).done(function (data) {
if (!data.error.length) {
message.success('操作成功');
this.setState({
loading: false,
});
this.loadDatac();
this.loadData();
} else {
message.warning(data.error[0].message);
};
}.bind(this));
},
//删除财务信息
deltalx(record) {
this.setState({
loading: true
});
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + '/api/admin/customers/delectOrgYearProject',
data: {
id: record.id,
uid: record.uid
}
}).done(function (data) {
if (!data.error.length) {
message.success('操作成功');
this.setState({
loading: false,
});
this.loadDatax();
this.loadData();
} else {
message.warning(data.error[0].message);
};
}.bind(this));
},
//部门
departmentList() {
this.setState({
departmentListLoading: true
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/organization/selectSuperId",
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({
key: index,
name: item.name,
id: item.id
});
});
}
this.setState({
departmentArr: theArr
});
}.bind(this)
}).always(
function () {
this.setState({
departmentListLoading: false
});
}.bind(this)
);
},
changeList(arr) {
const newArr = [];
let columns = this.props.isMaintain ? (this.props.shiroType === 2 ? this.state.adminMaintainColumns : this.props.shiroType === 1 ? this.state.maintainColumnsYXY : this.state.maintainColumns) : this.state.columns;
columns.forEach(item => {
arr.forEach(val => {
if (val === item.title) {
newArr.push(item);
}
});
});
this.setState({
changeList: newArr
});
},
render() {
let paginationss = null;
if (this.state.pagec >= 0) {
paginationss = this.renderPagination(this.state.pagec, this.state.pages);
}
const {
RangePicker,
MonthPicker
} = DatePicker;
const formItemLayout = {
labelCol: { span: 8 },
wrapperCol: { span: 14 },
};
const formItemLayoutc = {
labelCol: { span: 6 },
wrapperCol: { span: 14 },
};
const FormItem = Form.Item;
const rowSelection = {
selectedRowKeys: this.state.selectedRowKeys,
onChange: (selectedRowKeys, selectedRows) => {
this.setState({
modalVisible: false,
selectedRows: selectedRows.slice(-1),
selectedRowKeys: selectedRowKeys.slice(-1)
});
},
onSelect: (recordt, selected, selectedRows) => {
this.setState({
modalVisible: false,
recordt: recordt.id
})
},
};
const hasSelected = this.state.selectedRowKeys.length > 0;
const dataSources = this.state.customerArr || [];
const options = dataSources.map((group) =>
{group.name}
)
const { businessScope, inputVisible, inputValue, salesTarget, inputVisible1, inputValue1 } = this.state;
const intentionState = this.props.intentionState || '';
const props = {
name: 'file',
multiple: true,
action: '/api/admin/techproject/upload',
onChange(info) {
const status = info.file.status;
if (status !== 'uploading') {
}
if (status === 'done') {
message.success(`${info.file.name} file uploaded successfully.`);
} else if (status === 'error') {
message.error(`${info.file.name} file upload failed.`);
}
},
};
let pdfUrl = this.state.pdfUrl || '';
this.saveInputRef = input => this.input = input
this.saveInputRef1 = input => this.input1 = input
return (
);
}
}));
export default IntentionCustomer;