intentionCustomer.jsx 35 KB

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