intentionCustomer.jsx 33 KB

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