intentionCustomer.jsx 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057
  1. import React from 'react';
  2. import {Icon, Button, AutoComplete,Cascader,Input, Select, Spin, Table, message, DatePicker,Tooltip, Form,Tabs,Modal, Tag } from 'antd';
  3. import $ from 'jquery/src/ajax';
  4. import moment from 'moment';
  5. import { citySelect, provinceList } from '@/NewDicProvinceList';
  6. import AddIntention from './addIntention.jsx';
  7. import {industry, lvl, currentMember } from '@/dataDic.js';
  8. import ZhuanjiaoDetail from "@/zhuanjiaoDetail.jsx";
  9. import {
  10. getSocialAttribute,
  11. ShowModal
  12. } from "@/tools.js";
  13. import FollowDetail from './followDetail.jsx'
  14. import IntentionDetail from './intentionDetail/intentionDetail.jsx'
  15. import ShowModalDiv from "@/showModal.jsx";
  16. import './customer.less';
  17. import {ChooseList} from "../../../order/orderNew/chooseList";
  18. import EnterpriseNameChange from "../../../../common/enterpriseNameChange";
  19. const {TabPane} = Tabs
  20. const IntentionCustomer = Form.create()(
  21. React.createClass({
  22. loadData(pageNo, apiUrl) {
  23. this.setState({
  24. visitModul: false,
  25. loading: true,
  26. modalVisible: false,
  27. });
  28. let api = apiUrl ? apiUrl : this.props.ApiUrl;
  29. $.ajax({
  30. method: "post",
  31. dataType: "json",
  32. crossDomain: false,
  33. url: globalConfig.context + api,
  34. data: {
  35. pageNo: pageNo || 1,
  36. pageSize: this.state.pagination.pageSize,
  37. level: this.state.level ? this.state.level : undefined,
  38. name: this.state.nameSearch,
  39. province: !this.state.addressSearch.length
  40. ? this.state.provinceSearch
  41. : this.state.addressSearch[0],
  42. city: !this.state.addressSearch.length
  43. ? ""
  44. : this.state.addressSearch[1],
  45. startDate: this.state.releaseDate[0],
  46. endDate: this.state.releaseDate[1],
  47. },
  48. success: function (data) {
  49. ShowModal(this);
  50. let theArr = [];
  51. if (data.error.length || data.data.list == "") {
  52. if (data.error && data.error.length) {
  53. message.warning(data.error[0].message);
  54. }
  55. } else {
  56. for (let i = 0; i < data.data.list.length; i++) {
  57. let thisdata = data.data.list[i];
  58. let diqu =
  59. (thisdata.province == null ? "" : thisdata.province) +
  60. (thisdata.city == null ? "" : "-" + thisdata.city) +
  61. (thisdata.area == null ? "" : "-" + thisdata.area);
  62. thisdata.key = i;
  63. thisdata.id = thisdata.uid;
  64. thisdata.lastFollowTime = thisdata.lastFollowTime &&
  65. thisdata.lastFollowTime.split(" ")[0];
  66. thisdata.transferTime= thisdata.transferTime && thisdata.transferTime.split(" ")[0];
  67. thisdata.surplusFollowTime = thisdata.surplusFollowTime && thisdata.surplusFollowTime.split(" ")[0];
  68. thisdata.surplusSignTime = thisdata.surplusSignTime && thisdata.surplusSignTime.split(" ")[0];
  69. thisdata.locationProvince = diqu;
  70. theArr.push(thisdata);
  71. }
  72. this.state.pagination.current = data.data.pageNo;
  73. this.state.pagination.total = data.data.totalCount;
  74. this.setState({
  75. ispage: data.data.pageNo,
  76. })
  77. }
  78. if (data.data && data.data.list && !data.data.list.length) {
  79. this.state.pagination.current = 0;
  80. this.state.pagination.total = 0;
  81. }
  82. if(JSON.stringify(theArr) !== JSON.stringify(this.state.dataSource)){
  83. this.setState({
  84. selectedRowKeys: [],
  85. })
  86. }
  87. this.setState({
  88. dataSource: theArr,
  89. pagination: this.state.pagination,
  90. });
  91. }.bind(this),
  92. }).always(
  93. function () {
  94. this.setState({
  95. loading: false,
  96. });
  97. }.bind(this)
  98. );
  99. },
  100. //品类数据获取
  101. category() {
  102. $.ajax({
  103. method: "get",
  104. dataType: "json",
  105. crossDomain: false,
  106. url: globalConfig.context + "/api/admin/Varieties/getSuperList",
  107. data: {},
  108. success: function (data) {
  109. let thedata = data.data;
  110. let theArr = [];
  111. if (!thedata) {
  112. if (data.error && data.error.length) {
  113. message.warning(data.error[0].message);
  114. }
  115. thedata = {};
  116. } else {
  117. thedata.map(function (item, index) {
  118. theArr.push({
  119. value: item.id,
  120. key: item.cname,
  121. });
  122. });
  123. }
  124. this.setState({
  125. categoryArr: theArr,
  126. });
  127. }.bind(this),
  128. });
  129. },
  130. getInitialState() {
  131. return {
  132. addressSearch: [],
  133. orgCodeUrl: [],
  134. companyLogoUrl: [],
  135. visible: false,
  136. zhuanjiaoVisible: false,
  137. searchMore: true,
  138. releaseDate: [],
  139. categoryArr: [],
  140. visitModul: false,
  141. keys: false,
  142. detailApi: "",
  143. followData: {},
  144. selectedRowKeys: [],
  145. selectedRowKey: [],
  146. selectedRows: [],
  147. loading: false,
  148. modalVisible: false,
  149. pagination: {
  150. defaultCurrent: 1,
  151. defaultPageSize: 10,
  152. showQuickJumper: true,
  153. pageSize: 10,
  154. onChange: function (page) {
  155. this.loadData(page);
  156. }.bind(this),
  157. showTotal: function (total) {
  158. return "共" + total + "条数据";
  159. },
  160. },
  161. columns: [
  162. {
  163. title: "客户名称",
  164. dataIndex: "name",
  165. key: "name",
  166. width: 150,
  167. render: (text) => {
  168. return (
  169. <Tooltip title={text}>
  170. <div style={{
  171. maxWidth:'150px',
  172. overflow:'hidden',
  173. textOverflow: "ellipsis",
  174. whiteSpace:'nowrap',
  175. }}>{text}</div>
  176. </Tooltip>
  177. )
  178. },
  179. },
  180. {
  181. title: "地区",
  182. dataIndex: "locationProvince",
  183. key: "locationProvince",
  184. },
  185. // {
  186. // title: "联系人",
  187. // dataIndex: "contacts",
  188. // key: "contacts",
  189. // },
  190. // {
  191. // title: "联系电话",
  192. // dataIndex: "contactMobile",
  193. // key: "contactMobile",
  194. // },
  195. {
  196. title: "社会性质",
  197. dataIndex: "societyTag",
  198. key: "societyTag",
  199. render: (text) => {
  200. return getSocialAttribute(text);
  201. },
  202. },
  203. {
  204. title: "客户初始时间",
  205. dataIndex: "transferTime",
  206. key: "transferTime",
  207. },
  208. {
  209. title: "剩余私有天数",
  210. dataIndex: "surplusFollowTime",
  211. key: "surplusFollowTime",
  212. },
  213. {
  214. title: "剩余签单天数",
  215. dataIndex: "surplusSignTime",
  216. key: "surplusSignTime",
  217. },
  218. {
  219. title: "最新跟进时间",
  220. dataIndex: "lastFollowTime",
  221. key: "lastFollowTime",
  222. },
  223. {
  224. title: "客户等级",
  225. dataIndex: "level",
  226. key: "level",
  227. render: (text) => {
  228. if(text == 0) {
  229. return <Tag color="#87d068">一般客户</Tag>;
  230. }else if(text == 1) {
  231. return <Tag color="#D2691E">意向客户</Tag>;
  232. }else if(text == 2) {
  233. return <Tag color="#FF0000">重点客户</Tag>;
  234. }else {
  235. return "";
  236. }
  237. },
  238. },
  239. {
  240. title: "跟进操作",
  241. dataIndex: "abc",
  242. key: "abc",
  243. render: (text, record, index) => {
  244. return (
  245. <div style={{
  246. display: 'flex',
  247. flexFlow:'row',
  248. alignItems:'center',
  249. }}>
  250. <Button
  251. onClick={(e) => {
  252. e.stopPropagation(), this.visit(record);
  253. }}
  254. type="primary"
  255. >
  256. 客户跟进
  257. </Button>
  258. </div>
  259. );
  260. },
  261. },
  262. {
  263. title: "指导意见",
  264. dataIndex: "guidance",
  265. key: "guidance",
  266. render: (text, record, index) => {
  267. return (
  268. <div style={{
  269. display: 'flex',
  270. flexFlow:'row',
  271. alignItems:'center',
  272. }}>
  273. {/*指导 0无 1未读 2已读*/}
  274. {text === 1 || text === 2 ? <Button
  275. style={text === 1 ? {
  276. background:'#F00000',
  277. borderColor:'#F00000'
  278. } : {}}
  279. onClick={(e)=>{
  280. e.stopPropagation();
  281. this.guidanceRead(record.uid).then(()=>{
  282. this.setState({
  283. tabsKey:"4",
  284. },()=>{
  285. this.tableRowClick(record)
  286. })
  287. })
  288. }}
  289. type="primary"
  290. >
  291. {text === 1 ? '未读' : '查看'}
  292. </Button> : <div>暂无指导</div>}
  293. </div>
  294. );
  295. },
  296. }
  297. ],
  298. tabsKey:'',
  299. data: [],
  300. dataman: [],
  301. dataSource: [],
  302. visitArrList: [],
  303. searchTime: [,],
  304. };
  305. },
  306. //已读指导记录
  307. guidanceRead(id) {
  308. return new Promise((resolve,reject)=>{
  309. $.ajax({
  310. method: "post",
  311. dataType: "json",
  312. crossDomain: false,
  313. url: globalConfig.context + "/api/admin/customer/pushGuidance",
  314. data: {
  315. uid: id,
  316. }
  317. }).done(function(data) {
  318. if(!data.error.length) {
  319. resolve();
  320. } else {
  321. message.warning(data.error[0].message);
  322. reject();
  323. };
  324. }.bind(this));
  325. })
  326. },
  327. rankO(rank) {
  328. let deletedIds ='';
  329. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  330. let rowItem = this.state.selectedRows[idx];
  331. if (rowItem.id) {
  332. deletedIds = this.state.selectedRows.length-1 === idx ? deletedIds +rowItem.id : deletedIds + rowItem.id + ',';
  333. }
  334. }
  335. $.ajax({
  336. method: "get",
  337. dataType: "json",
  338. crossDomain: false,
  339. url: globalConfig.context + "/api/admin/customer/updateUserLevel",
  340. data: {
  341. id: deletedIds, //客户的ID
  342. level: rank,
  343. },
  344. }).done(
  345. function (data) {
  346. if (!data.error.length && data.data !== 0) {
  347. message.success("操作成功!");
  348. this.setState({
  349. loading: false,
  350. });
  351. this.loadData(this.state.ispage);
  352. } else {
  353. message.warning(data.data === 0 ? '操作失败,请联系管理员!' : data.error[0].message);
  354. }
  355. }.bind(this)
  356. );
  357. },
  358. //进入新增拜访记录
  359. visit(e) {
  360. this.setState({
  361. followData: e,
  362. visitModul: true,
  363. modalVisible: false,
  364. });
  365. },
  366. //列表删除功能
  367. delectRow() {
  368. let deletedIds='';
  369. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  370. let rowItem = this.state.selectedRows[idx];
  371. if (rowItem.id) {
  372. deletedIds = this.state.selectedRows.length-1 === idx ? deletedIds +rowItem.id : deletedIds + rowItem.id + ',';
  373. }
  374. }
  375. this.setState({
  376. loading: true,
  377. selectedRowKeys: [],
  378. });
  379. $.ajax({
  380. method: "get",
  381. dataType: "json",
  382. crossDomain: false,
  383. url: globalConfig.context + "/api/admin/customer/deleteCustomer",
  384. data: {
  385. uid: deletedIds, //删除的ID
  386. },
  387. }).done(
  388. function (data) {
  389. if (!data.error.length) {
  390. message.success("删除成功!");
  391. this.setState({
  392. loading: false,
  393. });
  394. } else {
  395. message.warning(data.error[0].message);
  396. }
  397. this.loadData(this.state.ispage);
  398. }.bind(this)
  399. );
  400. },
  401. componentWillMount() {
  402. //城市
  403. let Province = [];
  404. provinceList.map(function (item) {
  405. var id = String(item.id);
  406. Province.push(
  407. <Select.Option value={id} key={item.name}>
  408. {item.name}
  409. </Select.Option>
  410. );
  411. });
  412. //行业
  413. let intentionalArr = [];
  414. industry.map(function (item) {
  415. intentionalArr.push(
  416. <Select.Option value={item.value} key={item.key}>
  417. {item.key}
  418. </Select.Option>
  419. );
  420. });
  421. //会员等级
  422. let lvlArr = [];
  423. lvl.map(function (item) {
  424. lvlArr.push(
  425. <Select.Option value={item.value} key={item.key}>
  426. {item.key}
  427. </Select.Option>
  428. );
  429. });
  430. //会员状态customerStatus
  431. let currentMemberArr = [];
  432. currentMember.map(function (item) {
  433. currentMemberArr.push(
  434. <Select.Option value={item.value} key={item.key}>
  435. {item.key}
  436. </Select.Option>
  437. );
  438. });
  439. this.state.Provinces = Province;
  440. this.state.intentionalOption = intentionalArr;
  441. this.state.lvlArrOption = lvlArr;
  442. this.state.currentMemberArrOption = currentMemberArr;
  443. this.loadData();
  444. this.category();
  445. },
  446. addClick() {
  447. this.state.RowData = {};
  448. this.setState({
  449. detailApi: this.props.detailApi,
  450. showDesc: true,
  451. modalVisible: false,
  452. visitModul: false,
  453. });
  454. },
  455. closeDesc(e, s) {
  456. this.state.basicState = e;
  457. this.state.visitModul = e;
  458. this.state.modalVisible = e;
  459. this.state.showDesc = e;
  460. this.setState({
  461. tabsKey: '',
  462. })
  463. if (s) {
  464. this.loadData(this.state.ispage);
  465. }
  466. },
  467. search() {
  468. this.loadData();
  469. },
  470. reset() {
  471. this.state.nameSearch = "";
  472. this.state.level = undefined;
  473. this.state.addressSearch = [];
  474. this.state.provinceSearch = undefined;
  475. this.state.citySearch = undefined;
  476. this.state.releaseDate[0] = undefined;
  477. this.state.releaseDate[1] = undefined;
  478. this.loadData();
  479. },
  480. searchSwitch() {
  481. this.setState({
  482. visitModul: false,
  483. searchMore: !this.state.searchMore,
  484. });
  485. },
  486. //整行点击
  487. tableRowClick(record, index) {
  488. this.state.visitModul = false;
  489. this.state.RowData = record;
  490. this.setState({
  491. // selectedRowKeys: [],
  492. modalVisible: true,
  493. basicState: true,
  494. contactState: true,
  495. modalName: record.name
  496. });
  497. },
  498. //指定转交人自动补全
  499. supervisor(e) {
  500. $.ajax({
  501. method: "get",
  502. dataType: "json",
  503. crossDomain: false,
  504. url: globalConfig.context + "/api/admin/customer/listAdminByName",
  505. data: {
  506. adminName: e,
  507. },
  508. success: function (data) {
  509. let thedata = data.data;
  510. if (!thedata) {
  511. if (data.error && data.error.length) {
  512. message.warning(data.error[0].message);
  513. }
  514. thedata = {};
  515. }
  516. this.setState({
  517. customerArr: thedata,
  518. });
  519. }.bind(this),
  520. }).always(
  521. function () {
  522. this.setState({
  523. loading: false,
  524. });
  525. }.bind(this)
  526. );
  527. },
  528. //上级主管输入框失去焦点是判断客户是否存在
  529. selectAuto(value, options) {
  530. this.setState({
  531. auto: value,
  532. });
  533. },
  534. blurChange(e) {
  535. let theType = "";
  536. let contactLists = this.state.customerArr || [];
  537. if (e) {
  538. contactLists.map(function (item) {
  539. if (item.name == e.toString()) {
  540. theType = item.id;
  541. }
  542. });
  543. }
  544. this.setState({
  545. theTypes: theType,
  546. });
  547. },
  548. //值改变时请求客户名称
  549. httpChange(e) {
  550. if (e.length >= 1) {
  551. this.supervisor(e);
  552. }
  553. this.setState({
  554. auto: e,
  555. });
  556. },
  557. //转交
  558. changeAssigner() {
  559. if (this.state.theTypes) {
  560. let changeIds = '';
  561. let oldAid = '';
  562. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  563. let rowItem = this.state.selectedRows[idx];
  564. if (rowItem.id) {
  565. oldAid = rowItem.aid;
  566. changeIds = this.state.selectedRows.length-1 === idx ? changeIds +rowItem.id : changeIds + rowItem.id + ',' ;
  567. }
  568. }
  569. $.ajax({
  570. method: "get",
  571. dataType: "json",
  572. crossDomain: false,
  573. url: globalConfig.context + "/api/admin/customer/transferToOther",
  574. data: {
  575. uid: changeIds, //这一行数据的ID
  576. aid: this.state.theTypes, //指定转交人的ID
  577. oldAid: oldAid,
  578. },
  579. }).done(
  580. function (data) {
  581. if (!data.error.length) {
  582. message.success("转交成功!");
  583. this.setState({
  584. auto: "",
  585. loading: false,
  586. selectedRowKeys: [],
  587. });
  588. } else {
  589. message.warning(data.error[0].message);
  590. }
  591. this.loadData(
  592. Math.min(
  593. this.state.ispage == undefined ? 1 : this.state.ispage,
  594. Math.ceil((this.state.pagination.total - 1) / 10)
  595. )
  596. );
  597. }.bind(this)
  598. );
  599. } else {
  600. message.warning("请输入转交人姓名");
  601. }
  602. },
  603. //导出
  604. exportExec() {
  605. let departmentName = "",
  606. depart = this.state.departmentArr || [];
  607. depart.map((item) => {
  608. if (this.state.departmentId == item.id) {
  609. departmentName = item.name;
  610. return;
  611. }
  612. });
  613. let data = {
  614. name: this.state.nameSearch,
  615. province: this.state.provinceSearch,
  616. city: this.state.addressSearch,
  617. level: this.state.level,
  618. startDate: this.state.releaseDate[0],
  619. endDate: this.state.releaseDate[1],
  620. };
  621. window.location.href =
  622. globalConfig.context +
  623. "/api/admin/customer/privateUnitCustomerOutXls?" +
  624. $.param(data);
  625. },
  626. componentWillReceiveProps(nextProps) {
  627. if (nextProps.ApiUrl != this.props.ApiUrl) {
  628. if (!this.state.searchMore) {
  629. this.state.searchMore = true;
  630. }
  631. this.state.nameSearch = "";
  632. this.state.addressSearch = [];
  633. this.state.provinceSearch = undefined;
  634. this.state.citySearch = undefined;
  635. this.state.releaseDate[0] = undefined;
  636. this.state.releaseDate[1] = undefined;
  637. this.loadData(null, nextProps.ApiUrl);
  638. }
  639. },
  640. zhuanjiaoDetail(record) {
  641. this.setState({
  642. zhuanjiaoVisible: true,
  643. zhuanjiaoId: record.id,
  644. });
  645. },
  646. zhuanjiaoDetailCancel() {
  647. this.setState({
  648. zhuanjiaoVisible: false,
  649. });
  650. },
  651. showConfirm(fn, record) {
  652. Modal.confirm({
  653. title: "提示",
  654. content: (
  655. <span style={{ color: "red" }}>
  656. 确定要转交以下客户吗?
  657. {
  658. this.state.selectedRows.map((value,index)=>(
  659. <div key={index} style={{marginTop:'5px',color: "#000"}}>
  660. {value.name}
  661. </div>
  662. ))
  663. }
  664. </span>
  665. ),
  666. onOk() {
  667. fn(record);
  668. },
  669. onCancel() {},
  670. });
  671. },
  672. changeList(arr) {
  673. const newArr = [];
  674. this.state.columns.forEach(item => {
  675. arr.forEach(val => {
  676. if (val === item.title) {
  677. newArr.push(item);
  678. }
  679. });
  680. });
  681. this.setState({
  682. changeList: newArr
  683. });
  684. },
  685. showConfirms(fn, record) {
  686. Modal.confirm({
  687. title: "您确定将以下客户移至公共客户吗?",
  688. content: (
  689. <span style={{ color: "red" }}>
  690. 移除后,以下客户将被别人领取!
  691. {
  692. this.state.selectedRows.map((value,index)=>(
  693. <div key={index} style={{marginTop:'5px',color: "#000"}}>
  694. {value.name}
  695. </div>
  696. ))
  697. }
  698. </span>
  699. ),
  700. onOk() {
  701. fn(record);
  702. },
  703. onCancel() {},
  704. });
  705. },
  706. release() {
  707. this.setState({
  708. loading: true
  709. })
  710. let deletedIds='';
  711. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  712. let rowItem = this.state.selectedRows[idx];
  713. if (rowItem.id) {
  714. deletedIds = this.state.selectedRows.length-1 === idx ? deletedIds +rowItem.id : deletedIds + rowItem.id + ',';
  715. }
  716. }
  717. $.ajax({
  718. method: "get",
  719. dataType: "json",
  720. crossDomain: false,
  721. url: globalConfig.context + "/api/admin/customer/pushReleaseUser",
  722. data: {
  723. id: deletedIds,
  724. },
  725. success: function (data) {
  726. let thedata = data.data;
  727. if (!thedata) {
  728. if (data.error && data.error.length) {
  729. message.warning(data.error[0].message);
  730. }
  731. thedata = {};
  732. }else {
  733. message.success("移除成功");
  734. this.loadData(this.state.dataSource.length === 1 ? (this.state.ispage === 1?1:this.state.ispage - 1) : this.state.ispage)
  735. }
  736. }.bind(this),
  737. }).always(
  738. function () {
  739. this.setState({
  740. loading: false,
  741. });
  742. }.bind(this)
  743. );
  744. },
  745. render() {
  746. const FormItem = Form.Item;
  747. const rowSelection = {
  748. hideDefaultSelections: true,
  749. selectedRowKeys: this.state.selectedRowKeys,
  750. onChange: (selectedRowKeys, selectedRows) => {
  751. this.setState({
  752. modalVisible: false,
  753. selectedRows: selectedRows,
  754. selectedRowKeys: selectedRowKeys,
  755. });
  756. },
  757. onSelect: (recordt, selected, selectedRows) => {
  758. this.setState({
  759. modalVisible: false,
  760. recordt: recordt.id,
  761. });
  762. },
  763. };
  764. const hasSelected = this.state.selectedRowKeys.length > 0;
  765. const { RangePicker } = DatePicker;
  766. const dataSources = this.state.customerArr || [];
  767. const options = dataSources.map((group) => (
  768. <Select.Option key={group.id} value={group.name}>
  769. {group.name}
  770. </Select.Option>
  771. ));
  772. const intentionState = this.props.intentionState || "";
  773. return (
  774. <div className="user-content">
  775. <ShowModalDiv ShowModal={this.state.showModal} />
  776. <div className="content-title">
  777. <span>{!intentionState ? "私有单位客户" : "私有专家客户"}</span>
  778. </div>
  779. <div className="user-search">
  780. <Tabs
  781. defaultActiveKey="1"
  782. onChange={this.callback}
  783. className="test"
  784. >
  785. <TabPane tab="搜索" key="1">
  786. <Input
  787. placeholder="客户名称"
  788. value={this.state.nameSearch}
  789. style={{ width: 150, marginRight: 10, marginLeft: 10 }}
  790. onChange={(e) => {
  791. this.setState({ nameSearch: e.target.value });
  792. }}
  793. />
  794. <Select
  795. placeholder="省"
  796. style={{ width: 80 }}
  797. value={this.state.provinceSearch}
  798. onChange={(e) => {
  799. this.setState({ provinceSearch: e });
  800. }}
  801. >
  802. {this.state.Provinces}
  803. </Select>
  804. <span style={{ marginRight: "10px" }}>
  805. <Cascader
  806. options={citySelect()}
  807. value={this.state.addressSearch}
  808. placeholder="选择城市"
  809. onChange={(e, pre) => {
  810. this.setState({ addressSearch: e });
  811. }}
  812. />
  813. </span>
  814. <Select
  815. style={{ width: 120 }}
  816. value={this.state.level}
  817. onChange={(e) => {
  818. this.setState({ level: e });
  819. }}
  820. placeholder="请选择客户等级"
  821. >
  822. <Select.Option value="0">一般客户</Select.Option>
  823. <Select.Option value="1">意向客户</Select.Option>
  824. <Select.Option value="2">重点客户</Select.Option>
  825. </Select>
  826. <RangePicker
  827. value={[
  828. this.state.releaseDate[0]
  829. ? moment(this.state.releaseDate[0])
  830. : null,
  831. this.state.releaseDate[1]
  832. ? moment(this.state.releaseDate[1])
  833. : null,
  834. ]}
  835. onChange={(data, dataString) => {
  836. this.setState({ releaseDate: dataString });
  837. }}
  838. />
  839. <Button
  840. type="primary"
  841. style={{ marginLeft: "10px", marginRight: 10 }}
  842. onClick={this.search}
  843. >
  844. 搜索
  845. </Button>
  846. <Button onClick={this.reset}>重置</Button>
  847. </TabPane>
  848. {/*<Button onClick={() => { window.open(globalConfig.context + '/api/admin/customer/downloadTemplate?type=1') }}>下载批量导入模板</Button>
  849. <Upload
  850. name="file"
  851. action={globalConfig.context + "/api/admin/customer/uploadExcel"}
  852. beforeUpload={beforeUploadFile}
  853. showUploadList={false}
  854. onChange={(info) => {
  855. if (info.file.status !== 'uploading') {
  856. console.log(info.file, info.fileList);
  857. }
  858. if (info.file.status === 'done') {
  859. if (!info.file.response.error.length) {
  860. message.success(`${info.file.name} 文件上传成功!`);
  861. this.loadData();
  862. } else {
  863. message.warning(info.file.response.error[0].message);
  864. return;
  865. };
  866. } else if (info.file.status === 'error') {
  867. message.error(`${info.file.name} 文件上传失败。`);
  868. };
  869. }} >
  870. <Button>上传批量内容</Button>
  871. </Upload>
  872. {adminData.isSuperAdmin?<Popconfirm title="是否删除?" onConfirm={this.delectRow} okText="是" cancelText="否">
  873. <Button type="danger" style={{marginLeft:'10px'}}
  874. disabled={!hasSelected}
  875. >删除<Icon type="minus" />
  876. </Button>
  877. </Popconfirm>:''
  878. }*/}
  879. <TabPane tab="操作" key="2">
  880. <AutoComplete
  881. className="certain-category-search"
  882. dropdownClassName="certain-category-search-dropdown"
  883. dropdownMatchSelectWidth={false}
  884. dropdownStyle={{ width: 120 }}
  885. style={{ width: "120px" }}
  886. dataSource={options}
  887. placeholder="输入转交人姓名"
  888. value={this.state.auto}
  889. onChange={this.httpChange}
  890. filterOption={true}
  891. onBlur={this.blurChange}
  892. onSelect={this.selectAuto}
  893. disabled={!hasSelected}
  894. >
  895. <Input />
  896. </AutoComplete>
  897. <Button
  898. type="primary"
  899. // onClick={this.changeAssigner}
  900. onClick={(e) => {
  901. e.stopPropagation();
  902. this.showConfirm(this.changeAssigner);
  903. }}
  904. disabled={!hasSelected}
  905. style={{ marginRight: 10 }}
  906. >
  907. 转交
  908. </Button>
  909. <Button
  910. type="primary"
  911. style={{
  912. float: "right",
  913. marginTop: 10,
  914. marginLeft: 10,
  915. marginRight: 10,
  916. }}
  917. onClick={this.addClick}
  918. >
  919. 新增客户
  920. <Icon type="plus" />
  921. </Button>
  922. {/*<Button type="default" className="addButton" onClick={this.exportExec}>导出excel<Icon type="plus" /></Button>*/}
  923. {/* <div className="clearfix" style={{ marginTop: "5px" }}> */}
  924. <Button
  925. onClick={(e) => {
  926. e.stopPropagation(), this.rankO(0);
  927. }}
  928. type="primary"
  929. style={{ marginRight: "10px" }}
  930. disabled={!hasSelected}
  931. >
  932. 一般客户
  933. </Button>
  934. <Button
  935. onClick={(e) => {
  936. e.stopPropagation(), this.rankO(1);
  937. }}
  938. type="primary"
  939. style={{ marginRight: "10px" }}
  940. disabled={!hasSelected}
  941. >
  942. 意向客户
  943. </Button>
  944. <Button
  945. onClick={(e) => {
  946. e.stopPropagation(), this.rankO(2);
  947. }}
  948. type="primary"
  949. disabled={!hasSelected}
  950. >
  951. 重点客户
  952. </Button>
  953. <Button
  954. style={{ marginLeft: 10 }}
  955. onClick={(e) => {
  956. e.stopPropagation(),
  957. this.zhuanjiaoDetail(this.state.selectedRows[0]);
  958. }}
  959. type="primary"
  960. disabled={!hasSelected || this.state.selectedRows.length > 1}
  961. >
  962. 客户日志
  963. </Button>
  964. <Button
  965. style={{ marginLeft: 10 }}
  966. onClick={(e) => {
  967. e.stopPropagation(), this.showConfirms(this.release);
  968. }}
  969. type="primary"
  970. disabled={!hasSelected}
  971. >
  972. 移除客户
  973. </Button>
  974. <EnterpriseNameChange
  975. type='journal'
  976. disabled={!(hasSelected && this.state.selectedRows.length === 1)}
  977. style={{ marginLeft: 10 }}
  978. enterpriseId={this.state.selectedRows[0] && this.state.selectedRows[0].id}/>
  979. </TabPane>
  980. <TabPane tab="更改表格显示数据" key="3">
  981. <div style={{ marginLeft: 10 }}>
  982. <ChooseList
  983. columns={this.state.columns}
  984. changeFn={this.changeList}
  985. changeList={this.state.changeList}
  986. top={55}
  987. margin={11}
  988. />
  989. </div>
  990. </TabPane>
  991. </Tabs>
  992. </div>
  993. <div className="patent-table">
  994. <Spin spinning={this.state.loading}>
  995. <Table
  996. size="middle"
  997. className={'intentionCustomerTable'}
  998. columns={
  999. this.state.changeList
  1000. ? this.state.changeList
  1001. : this.state.columns
  1002. }
  1003. dataSource={this.state.dataSource}
  1004. rowSelection={rowSelection}
  1005. pagination={this.state.pagination}
  1006. onRowDoubleClick={this.tableRowClick}
  1007. />
  1008. </Spin>
  1009. </div>
  1010. <AddIntention
  1011. api={this.state.detailApi}
  1012. showDesc={this.state.showDesc}
  1013. closeDesc={this.closeDesc}
  1014. />
  1015. <FollowDetail
  1016. categoryArr={this.state.categoryArr}
  1017. followData={this.state.followData}
  1018. visitModul={this.state.visitModul}
  1019. closeDesc={this.closeDesc}
  1020. />
  1021. <IntentionDetail
  1022. tabsKey={this.state.tabsKey}
  1023. categoryArr={this.state.categoryArr}
  1024. detailApi={this.props.detailApi}
  1025. IntentionData={this.state.RowData}
  1026. modalVisible={this.state.modalVisible}
  1027. name={this.state.modalName}
  1028. closeDesc={this.closeDesc}
  1029. basicState={this.state.basicState}
  1030. contactState={this.state.contactState}
  1031. />
  1032. {this.state.zhuanjiaoVisible ? (
  1033. <ZhuanjiaoDetail
  1034. cancel={this.zhuanjiaoDetailCancel}
  1035. visible={this.state.zhuanjiaoVisible}
  1036. id={this.state.zhuanjiaoId}
  1037. />
  1038. ) : (
  1039. ""
  1040. )}
  1041. </div>
  1042. );
  1043. },
  1044. })
  1045. );
  1046. export default IntentionCustomer;