intentionCustomer.jsx 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085
  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(infor) {
  559. if (this.state.theTypes) {
  560. this.setState({
  561. informationTransferVisible:false
  562. })
  563. let changeIds = '';
  564. let oldAid = '';
  565. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  566. let rowItem = this.state.selectedRows[idx];
  567. if (rowItem.id) {
  568. oldAid = rowItem.aid;
  569. changeIds = this.state.selectedRows.length-1 === idx ? changeIds +rowItem.id : changeIds + rowItem.id + ',' ;
  570. }
  571. }
  572. let loading = message.loading('加载中...')
  573. $.ajax({
  574. method: "get",
  575. dataType: "json",
  576. crossDomain: false,
  577. url: globalConfig.context + "/api/admin/customer/transferToOther",
  578. data: {
  579. uid: changeIds, //这一行数据的ID
  580. aid: this.state.theTypes, //指定转交人的ID
  581. oldAid: oldAid,
  582. data:infor,
  583. },
  584. }).done(
  585. function (data) {
  586. loading();
  587. if (!data.error.length) {
  588. message.success("转交成功!");
  589. this.setState({
  590. auto: "",
  591. loading: false,
  592. selectedRowKeys: [],
  593. });
  594. } else {
  595. message.warning(data.error[0].message);
  596. }
  597. this.loadData(
  598. Math.min(
  599. this.state.ispage == undefined ? 1 : this.state.ispage,
  600. Math.ceil((this.state.pagination.total - 1) / 10)
  601. )
  602. );
  603. }.bind(this)
  604. );
  605. } else {
  606. message.warning("请输入转交人姓名");
  607. }
  608. },
  609. //导出
  610. exportExec() {
  611. let departmentName = "",
  612. depart = this.state.departmentArr || [];
  613. depart.map((item) => {
  614. if (this.state.departmentId == item.id) {
  615. departmentName = item.name;
  616. return;
  617. }
  618. });
  619. let data = {
  620. name: this.state.nameSearch,
  621. province: this.state.provinceSearch,
  622. city: this.state.addressSearch,
  623. level: this.state.level,
  624. startDate: this.state.releaseDate[0],
  625. endDate: this.state.releaseDate[1],
  626. };
  627. window.location.href =
  628. globalConfig.context +
  629. "/api/admin/customer/privateUnitCustomerOutXls?" +
  630. $.param(data);
  631. },
  632. componentWillReceiveProps(nextProps) {
  633. if (nextProps.ApiUrl != this.props.ApiUrl) {
  634. if (!this.state.searchMore) {
  635. this.state.searchMore = true;
  636. }
  637. this.state.nameSearch = "";
  638. this.state.addressSearch = [];
  639. this.state.provinceSearch = undefined;
  640. this.state.citySearch = undefined;
  641. this.state.releaseDate[0] = undefined;
  642. this.state.releaseDate[1] = undefined;
  643. this.loadData(null, nextProps.ApiUrl);
  644. }
  645. },
  646. zhuanjiaoDetail(record) {
  647. this.setState({
  648. zhuanjiaoVisible: true,
  649. zhuanjiaoId: record.id,
  650. });
  651. },
  652. zhuanjiaoDetailCancel() {
  653. this.setState({
  654. zhuanjiaoVisible: false,
  655. });
  656. },
  657. showConfirm() {
  658. let _this = this;
  659. Modal.confirm({
  660. title: "提示",
  661. content: (
  662. <span style={{ color: "red" }}>
  663. 确定要转交以下客户吗?
  664. {
  665. this.state.selectedRows.map((value,index)=>(
  666. <div key={index} style={{marginTop:'5px',color: "#000"}}>
  667. {value.name}
  668. </div>
  669. ))
  670. }
  671. </span>
  672. ),
  673. onOk() {
  674. _this.setState({
  675. informationTransferVisible:true
  676. })
  677. },
  678. onCancel() {},
  679. });
  680. },
  681. changeList(arr) {
  682. const newArr = [];
  683. this.state.columns.forEach(item => {
  684. arr.forEach(val => {
  685. if (val === item.title) {
  686. newArr.push(item);
  687. }
  688. });
  689. });
  690. this.setState({
  691. changeList: newArr
  692. });
  693. },
  694. showConfirms(fn, record) {
  695. Modal.confirm({
  696. title: "您确定将以下客户移至公共客户吗?",
  697. content: (
  698. <span style={{ color: "red" }}>
  699. 移除后,以下客户将被别人领取!
  700. {
  701. this.state.selectedRows.map((value,index)=>(
  702. <div key={index} style={{marginTop:'5px',color: "#000"}}>
  703. {value.name}
  704. </div>
  705. ))
  706. }
  707. </span>
  708. ),
  709. onOk() {
  710. fn(record);
  711. },
  712. onCancel() {},
  713. });
  714. },
  715. release() {
  716. this.setState({
  717. loading: true
  718. })
  719. let deletedIds='';
  720. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  721. let rowItem = this.state.selectedRows[idx];
  722. if (rowItem.id) {
  723. deletedIds = this.state.selectedRows.length-1 === idx ? deletedIds +rowItem.id : deletedIds + rowItem.id + ',';
  724. }
  725. }
  726. $.ajax({
  727. method: "get",
  728. dataType: "json",
  729. crossDomain: false,
  730. url: globalConfig.context + "/api/admin/customer/pushReleaseUser",
  731. data: {
  732. id: deletedIds,
  733. },
  734. success: function (data) {
  735. let thedata = data.data;
  736. if (!thedata) {
  737. if (data.error && data.error.length) {
  738. message.warning(data.error[0].message);
  739. }
  740. thedata = {};
  741. }else {
  742. message.success("移除成功");
  743. this.loadData(this.state.dataSource.length === 1 ? (this.state.ispage === 1?1:this.state.ispage - 1) : this.state.ispage)
  744. }
  745. }.bind(this),
  746. }).always(
  747. function () {
  748. this.setState({
  749. loading: false,
  750. });
  751. }.bind(this)
  752. );
  753. },
  754. render() {
  755. const FormItem = Form.Item;
  756. const rowSelection = {
  757. hideDefaultSelections: true,
  758. selectedRowKeys: this.state.selectedRowKeys,
  759. onChange: (selectedRowKeys, selectedRows) => {
  760. this.setState({
  761. modalVisible: false,
  762. selectedRows: selectedRows,
  763. selectedRowKeys: selectedRowKeys,
  764. });
  765. },
  766. onSelect: (recordt, selected, selectedRows) => {
  767. this.setState({
  768. modalVisible: false,
  769. recordt: recordt.id,
  770. });
  771. },
  772. };
  773. const hasSelected = this.state.selectedRowKeys.length > 0;
  774. const { RangePicker } = DatePicker;
  775. const dataSources = this.state.customerArr || [];
  776. const options = dataSources.map((group) => (
  777. <Select.Option key={group.id} value={group.name}>
  778. {group.name}
  779. </Select.Option>
  780. ));
  781. const intentionState = this.props.intentionState || "";
  782. return (
  783. <div className="user-content">
  784. <ShowModalDiv ShowModal={this.state.showModal} />
  785. <div className="content-title">
  786. <span>{!intentionState ? "私有单位客户" : "私有专家客户"}</span>
  787. </div>
  788. <div className="user-search">
  789. <Tabs
  790. defaultActiveKey="1"
  791. onChange={this.callback}
  792. className="test"
  793. >
  794. <TabPane tab="搜索" key="1">
  795. <Input
  796. placeholder="客户名称"
  797. value={this.state.nameSearch}
  798. style={{ width: 150, marginRight: 10, marginLeft: 10 }}
  799. onChange={(e) => {
  800. this.setState({ nameSearch: e.target.value });
  801. }}
  802. />
  803. <Select
  804. placeholder="省"
  805. style={{ width: 80 }}
  806. value={this.state.provinceSearch}
  807. onChange={(e) => {
  808. this.setState({ provinceSearch: e });
  809. }}
  810. >
  811. {this.state.Provinces}
  812. </Select>
  813. <span style={{ marginRight: "10px" }}>
  814. <Cascader
  815. options={citySelect()}
  816. value={this.state.addressSearch}
  817. placeholder="选择城市"
  818. onChange={(e, pre) => {
  819. this.setState({ addressSearch: e });
  820. }}
  821. />
  822. </span>
  823. <Select
  824. style={{ width: 120 }}
  825. value={this.state.level}
  826. onChange={(e) => {
  827. this.setState({ level: e });
  828. }}
  829. placeholder="请选择客户等级"
  830. >
  831. <Select.Option value="0">一般客户</Select.Option>
  832. <Select.Option value="1">意向客户</Select.Option>
  833. <Select.Option value="2">重点客户</Select.Option>
  834. </Select>
  835. <RangePicker
  836. value={[
  837. this.state.releaseDate[0]
  838. ? moment(this.state.releaseDate[0])
  839. : null,
  840. this.state.releaseDate[1]
  841. ? moment(this.state.releaseDate[1])
  842. : null,
  843. ]}
  844. onChange={(data, dataString) => {
  845. this.setState({ releaseDate: dataString });
  846. }}
  847. />
  848. <Button
  849. type="primary"
  850. style={{ marginLeft: "10px", marginRight: 10 }}
  851. onClick={this.search}
  852. >
  853. 搜索
  854. </Button>
  855. <Button onClick={this.reset}>重置</Button>
  856. </TabPane>
  857. {/*<Button onClick={() => { window.open(globalConfig.context + '/api/admin/customer/downloadTemplate?type=1') }}>下载批量导入模板</Button>
  858. <Upload
  859. name="file"
  860. action={globalConfig.context + "/api/admin/customer/uploadExcel"}
  861. beforeUpload={beforeUploadFile}
  862. showUploadList={false}
  863. onChange={(info) => {
  864. if (info.file.status !== 'uploading') {
  865. console.log(info.file, info.fileList);
  866. }
  867. if (info.file.status === 'done') {
  868. if (!info.file.response.error.length) {
  869. message.success(`${info.file.name} 文件上传成功!`);
  870. this.loadData();
  871. } else {
  872. message.warning(info.file.response.error[0].message);
  873. return;
  874. };
  875. } else if (info.file.status === 'error') {
  876. message.error(`${info.file.name} 文件上传失败。`);
  877. };
  878. }} >
  879. <Button>上传批量内容</Button>
  880. </Upload>
  881. {adminData.isSuperAdmin?<Popconfirm title="是否删除?" onConfirm={this.delectRow} okText="是" cancelText="否">
  882. <Button type="danger" style={{marginLeft:'10px'}}
  883. disabled={!hasSelected}
  884. >删除<Icon type="minus" />
  885. </Button>
  886. </Popconfirm>:''
  887. }*/}
  888. <TabPane tab="操作" key="2">
  889. <AutoComplete
  890. className="certain-category-search"
  891. dropdownClassName="certain-category-search-dropdown"
  892. dropdownMatchSelectWidth={false}
  893. dropdownStyle={{ width: 120 }}
  894. style={{ width: "120px" }}
  895. dataSource={options}
  896. placeholder="输入转交人姓名"
  897. value={this.state.auto}
  898. onChange={this.httpChange}
  899. filterOption={true}
  900. onBlur={this.blurChange}
  901. onSelect={this.selectAuto}
  902. disabled={!hasSelected}
  903. >
  904. <Input />
  905. </AutoComplete>
  906. <Button
  907. type="primary"
  908. // onClick={this.changeAssigner}
  909. onClick={(e) => {
  910. e.stopPropagation();
  911. this.showConfirm();
  912. }}
  913. disabled={!hasSelected}
  914. style={{ marginRight: 10 }}
  915. >
  916. 转交
  917. </Button>
  918. <Button
  919. type="primary"
  920. style={{
  921. float: "right",
  922. marginTop: 10,
  923. marginLeft: 10,
  924. marginRight: 10,
  925. }}
  926. onClick={this.addClick}
  927. >
  928. 新增客户
  929. <Icon type="plus" />
  930. </Button>
  931. {/*<Button type="default" className="addButton" onClick={this.exportExec}>导出excel<Icon type="plus" /></Button>*/}
  932. {/* <div className="clearfix" style={{ marginTop: "5px" }}> */}
  933. <Button
  934. onClick={(e) => {
  935. e.stopPropagation(), this.rankO(0);
  936. }}
  937. type="primary"
  938. style={{ marginRight: "10px" }}
  939. disabled={!hasSelected}
  940. >
  941. 一般客户
  942. </Button>
  943. <Button
  944. onClick={(e) => {
  945. e.stopPropagation(), this.rankO(1);
  946. }}
  947. type="primary"
  948. style={{ marginRight: "10px" }}
  949. disabled={!hasSelected}
  950. >
  951. 意向客户
  952. </Button>
  953. <Button
  954. onClick={(e) => {
  955. e.stopPropagation(), this.rankO(2);
  956. }}
  957. type="primary"
  958. disabled={!hasSelected}
  959. >
  960. 重点客户
  961. </Button>
  962. <Button
  963. style={{ marginLeft: 10 }}
  964. onClick={(e) => {
  965. e.stopPropagation(),
  966. this.zhuanjiaoDetail(this.state.selectedRows[0]);
  967. }}
  968. type="primary"
  969. disabled={!hasSelected || this.state.selectedRows.length > 1}
  970. >
  971. 客户日志
  972. </Button>
  973. <Button
  974. style={{ marginLeft: 10 }}
  975. onClick={(e) => {
  976. e.stopPropagation(), this.showConfirms(this.release);
  977. }}
  978. type="primary"
  979. disabled={!hasSelected}
  980. >
  981. 移除客户
  982. </Button>
  983. <EnterpriseNameChange
  984. type='journal'
  985. disabled={!(hasSelected && this.state.selectedRows.length === 1)}
  986. style={{ marginLeft: 10 }}
  987. enterpriseId={this.state.selectedRows[0] && this.state.selectedRows[0].id}/>
  988. </TabPane>
  989. <TabPane tab="更改表格显示数据" key="3">
  990. <div style={{ marginLeft: 10 }}>
  991. <ChooseList
  992. columns={this.state.columns}
  993. changeFn={this.changeList}
  994. changeList={this.state.changeList}
  995. top={55}
  996. margin={11}
  997. />
  998. </div>
  999. </TabPane>
  1000. </Tabs>
  1001. </div>
  1002. <div className="patent-table">
  1003. <Spin spinning={this.state.loading}>
  1004. <Table
  1005. size="middle"
  1006. className={'intentionCustomerTable'}
  1007. columns={
  1008. this.state.changeList
  1009. ? this.state.changeList
  1010. : this.state.columns
  1011. }
  1012. dataSource={this.state.dataSource}
  1013. rowSelection={rowSelection}
  1014. pagination={this.state.pagination}
  1015. onRowDoubleClick={this.tableRowClick}
  1016. />
  1017. </Spin>
  1018. </div>
  1019. <AddIntention
  1020. api={this.state.detailApi}
  1021. showDesc={this.state.showDesc}
  1022. closeDesc={this.closeDesc}
  1023. />
  1024. <FollowDetail
  1025. categoryArr={this.state.categoryArr}
  1026. followData={this.state.followData}
  1027. visitModul={this.state.visitModul}
  1028. closeDesc={this.closeDesc}
  1029. />
  1030. <IntentionDetail
  1031. tabsKey={this.state.tabsKey}
  1032. categoryArr={this.state.categoryArr}
  1033. detailApi={this.props.detailApi}
  1034. IntentionData={this.state.RowData}
  1035. modalVisible={this.state.modalVisible}
  1036. name={this.state.modalName}
  1037. closeDesc={this.closeDesc}
  1038. basicState={this.state.basicState}
  1039. contactState={this.state.contactState}
  1040. />
  1041. {this.state.zhuanjiaoVisible ? (
  1042. <ZhuanjiaoDetail
  1043. cancel={this.zhuanjiaoDetailCancel}
  1044. visible={this.state.zhuanjiaoVisible}
  1045. id={this.state.zhuanjiaoId}
  1046. />
  1047. ) : (
  1048. ""
  1049. )}
  1050. {this.state.informationTransferVisible && <Modal
  1051. visible={this.state.informationTransferVisible}
  1052. title="提醒"
  1053. onCancel={()=>{
  1054. this.setState({
  1055. informationTransferVisible:false
  1056. })
  1057. }}
  1058. footer={[
  1059. <Button key="1" size="large" type={"primary"} onClick={()=>{
  1060. this.changeAssigner(1);
  1061. }}>需要</Button>,
  1062. <Button key="2" size="large" type={"danger"} onClick={()=>{
  1063. this.changeAssigner(0);
  1064. }}>不需要</Button>,
  1065. ]}
  1066. >
  1067. 请确定,是否将客户资料一并转交!选择“需要”,系统将全部客户资料一并转交!选择“不需要”,原客户资料保存您的客户资料中,请注意客户资料的更新维护,谢谢
  1068. </Modal>}
  1069. </div>
  1070. );
  1071. },
  1072. })
  1073. );
  1074. export default IntentionCustomer;