intentionCustomer.jsx 36 KB

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