index.jsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. import React, { Component } from "react";
  2. import {
  3. Button,
  4. DatePicker,
  5. Form,
  6. Input,
  7. message,
  8. Select,
  9. Spin,
  10. Table,
  11. Tabs,
  12. Tooltip
  13. } from "antd";
  14. import moment from "moment";
  15. import ShowModalDiv from "@/showModal.jsx";
  16. import { ShowModal, getContactType } from "@/tools.js";
  17. import { ChooseList } from "../../../order/orderNew/chooseList";
  18. import $ from "jquery/src/ajax";
  19. import IntentionDetail from "../../NEW/intentionCustomer/intentionDetail/intentionDetail";
  20. import { getProvince } from '@/NewDicProvinceList';
  21. import Cascaders from "../../../../common/cascaders";
  22. const { TabPane } = Tabs;
  23. const { RangePicker } = DatePicker;
  24. class FollowUpSummary extends Component {
  25. constructor(props) {
  26. super(props);
  27. this.state = {
  28. loading: false,
  29. changeList: [],
  30. columns: [
  31. {
  32. title: "客户名称",
  33. dataIndex: "nickname",
  34. key: "nickname",
  35. render: text => {
  36. return (
  37. <Tooltip title={text}>
  38. <div
  39. // style={{
  40. // maxWidth: '150px',
  41. // overflow: 'hidden',
  42. // textOverflow: "ellipsis",
  43. // whiteSpace: 'nowrap',
  44. // }}
  45. >{text}</div>
  46. </Tooltip>
  47. )
  48. }
  49. },
  50. {
  51. title: '客户类型',
  52. dataIndex: 'shareType',
  53. key: 'shareType',
  54. render: text => {
  55. // 0-私有 1-公共 2 签单 3外联
  56. return (
  57. text === 0 ? '私有客户' :
  58. text === 1 ? '公共客户' :
  59. text === 2 ? '签单客户' :
  60. text === 3 ? '外联客户' : ''
  61. )
  62. }
  63. },
  64. {
  65. title: '客户初始时间',
  66. dataIndex: 'startTimes',
  67. key: 'startTimes',
  68. },
  69. {
  70. title: "跟进方式",
  71. dataIndex: "contactType",
  72. key: "contactType",
  73. render: (text) => {
  74. return getContactType(text);
  75. },
  76. },
  77. {
  78. title: "跟进人",
  79. dataIndex: "followName",
  80. key: "followName",
  81. },
  82. {
  83. title: "跟进部门",
  84. dataIndex: "followDep",
  85. key: "followDep",
  86. },
  87. {
  88. title: "跟进说明",
  89. dataIndex: "result",
  90. key: "result",
  91. width: 150,
  92. render: (text, record) => {
  93. return (
  94. <Tooltip placement="topLeft" title={<div style={{ wordBreak: "break-all" }}>{text}</div>}>
  95. <div style={{
  96. cursor: "pointer",
  97. width: '150px',
  98. whiteSpace: 'nowrap',
  99. overflow: 'hidden',
  100. textOverflow: 'ellipsis',
  101. }}>
  102. {text}
  103. </div>
  104. </Tooltip>
  105. );
  106. },
  107. },
  108. {
  109. title: "跟进时间",
  110. dataIndex: "followTimes",
  111. key: "followTimes",
  112. },
  113. {
  114. title: "次数",
  115. dataIndex: "followCount",
  116. key: "followCount",
  117. },
  118. {
  119. title: "指导意见",
  120. dataIndex: "guidance",
  121. key: "guidance",
  122. width: 150,
  123. render: (text, record) => {
  124. return (
  125. <Tooltip placement="topLeft" title={<div style={{ wordBreak: "break-all" }}>{(record.guidanceName ? '(' + record.guidanceName + ')' : '') + text}</div>}>
  126. <div style={{
  127. cursor: "pointer",
  128. width: '150px',
  129. whiteSpace: 'nowrap',
  130. overflow: 'hidden',
  131. textOverflow: 'ellipsis',
  132. }}>
  133. {record.guidanceName ? '(' + record.guidanceName + ')' : null}
  134. {text}
  135. </div>
  136. </Tooltip>
  137. );
  138. },
  139. },
  140. {
  141. title: "指导时间",
  142. dataIndex: "guidanceTimes",
  143. key: "guidanceTimes",
  144. render: (text) => {
  145. return (
  146. <span>{text ? text : ''}</span>
  147. )
  148. }
  149. }
  150. ],
  151. dataSource: [],
  152. pagination: {
  153. defaultCurrent: 1,
  154. defaultPageSize: 10,
  155. showQuickJumper: true,
  156. pageSize: 10,
  157. onChange: function (page) {
  158. this.loadData(page);
  159. }.bind(this),
  160. showTotal: function (total) {
  161. return "共" + total + "条数据";
  162. },
  163. },
  164. releaseDate: [],
  165. releaseDate1: [],
  166. releaseDate2: [],
  167. userName: undefined,
  168. followName: undefined,
  169. userType: undefined,
  170. contactType: undefined,
  171. deps: undefined,
  172. shiroType: props.shiroType,
  173. }
  174. this.reset = this.reset.bind(this);
  175. this.loadData = this.loadData.bind(this);
  176. this.selectSuperId = this.selectSuperId.bind(this);
  177. this.category = this.category.bind(this);
  178. this.closeDesc = this.closeDesc.bind(this);
  179. this.tableRowClick = this.tableRowClick.bind(this);
  180. this.export = this.export.bind(this);
  181. }
  182. componentWillReceiveProps(prevProps) {
  183. if (prevProps.shiroType !== this.state.shiroType) {
  184. this.setState({
  185. shiroType: prevProps.shiroType
  186. }, () => {
  187. this.reset();
  188. // this.selectSuperId();
  189. })
  190. }
  191. }
  192. componentDidMount() {
  193. this.props.shiroType != 2 && this.loadData();
  194. // this.selectSuperId();
  195. }
  196. loadData(pageNo) {
  197. if (this.state.userName == undefined &&
  198. this.state.followName == undefined &&
  199. this.state.userType == undefined &&
  200. this.state.contactType == undefined &&
  201. this.state.deps == undefined &&
  202. this.state.releaseDate.length == 0 &&
  203. this.state.releaseDate1.length == 0 &&
  204. this.state.releaseDate2.length == 0 &&
  205. this.props.shiroType == 2
  206. ) {
  207. message.warning("请先填写筛选条件!");
  208. return
  209. }
  210. let data = {
  211. pageNo: pageNo || 1,
  212. pageSize: this.state.pagination.pageSize,
  213. userName: this.state.userName || undefined,
  214. followName: this.state.followName || undefined,
  215. userType: isNaN(parseInt(this.state.userType)) ? undefined : this.state.userType,
  216. contactType: isNaN(parseInt(this.state.contactType)) ? undefined : this.state.contactType,
  217. deps: this.state.deps || undefined,
  218. followStartTime: this.state.releaseDate[0] ? this.state.releaseDate[0] : undefined,
  219. followEndTime: this.state.releaseDate[1] ? this.state.releaseDate[1] : undefined,
  220. createStartTime: this.state.releaseDate1[0] ? this.state.releaseDate1[0] : undefined,
  221. createEndTime: this.state.releaseDate1[1] ? this.state.releaseDate1[1] : undefined,
  222. guidanceStartTime: this.state.releaseDate2[0] ? this.state.releaseDate2[0] : undefined,
  223. guidanceEndTime: this.state.releaseDate2[1] ? this.state.releaseDate2[1] : undefined,
  224. shiroType: this.state.shiroType
  225. };
  226. this.setState({
  227. loading: true,
  228. });
  229. $.ajax({
  230. method: "get",
  231. dataType: "json",
  232. crossDomain: false,
  233. url: globalConfig.context + '/api/admin/userFollowList',
  234. data,
  235. success: function (data) {
  236. ShowModal(this);
  237. if (data.error.length === 0) {
  238. let theArr = [];
  239. for (let i = 0; i < data.data.list.length; i++) {
  240. let thisdata = data.data.list[i];
  241. let diqu = getProvince(thisdata.province, thisdata.city, thisdata.area)
  242. thisdata.key = i;
  243. thisdata.lastFollowTime = thisdata.lastFollowTime && thisdata.lastFollowTime.split(" ")[0];
  244. thisdata.transferTime = thisdata.transferTime && thisdata.transferTime.split(" ")[0];
  245. thisdata.surplusFollowTime = thisdata.surplusFollowTime && thisdata.surplusFollowTime.split(" ")[0];
  246. thisdata.surplusSignTime = thisdata.surplusSignTime && thisdata.surplusSignTime.split(" ")[0];
  247. thisdata.locationProvince = diqu;
  248. thisdata.uid = thisdata.id;
  249. theArr.push(thisdata);
  250. }
  251. this.state.pagination.current = data.data.pageNo;
  252. this.state.pagination.total = data.data.totalCount;
  253. this.setState({
  254. pageNo: data.data.pageNo,
  255. dataSource: theArr,
  256. pagination: this.state.pagination,
  257. });
  258. } else {
  259. message.warning(data.error[0].message);
  260. }
  261. }.bind(this),
  262. }).always(
  263. function () {
  264. this.setState({
  265. loading: false,
  266. });
  267. }.bind(this)
  268. );
  269. };
  270. selectSuperId() {
  271. this.state.data = []
  272. $.ajax({
  273. method: "get",
  274. dataType: "json",
  275. crossDomain: false,
  276. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  277. data: {},
  278. success: function (data) {
  279. if (data.error.length === 0) {
  280. let theArr = [];
  281. for (let i = 0; i < data.data.length; i++) {
  282. let theData = data.data[i];
  283. theArr.push(
  284. <Select.Option value={theData.id} key={theData.name}>{theData.name}</Select.Option>
  285. );
  286. }
  287. this.setState({
  288. contactsOption: theArr,
  289. });
  290. } else {
  291. message.warning(data.error[0].message);
  292. }
  293. }.bind(this),
  294. }).always(function () { }.bind(this));
  295. }
  296. //品类数据获取
  297. category() {
  298. $.ajax({
  299. method: "get",
  300. dataType: "json",
  301. crossDomain: false,
  302. url: globalConfig.context + "/api/admin/Varieties/getSuperList",
  303. data: {},
  304. success: function (data) {
  305. let thedata = data.data;
  306. let theArr = [];
  307. if (!thedata) {
  308. if (data.error && data.error.length) {
  309. message.warning(data.error[0].message);
  310. }
  311. } else {
  312. thedata.map(function (item, index) {
  313. theArr.push({
  314. value: item.id,
  315. key: item.cname,
  316. });
  317. });
  318. }
  319. this.setState({
  320. categoryArr: theArr,
  321. });
  322. }.bind(this),
  323. });
  324. }
  325. tableRowClick(record) {
  326. this.category();
  327. this.setState({
  328. rowData: record,
  329. modalVisible: true,
  330. modalName: record.nickname,
  331. })
  332. }
  333. closeDesc(e, s) {
  334. this.setState({
  335. visitModul: e,
  336. modalVisible: e,
  337. showDesc: e,
  338. tabsKey: '',
  339. })
  340. if (s) {
  341. this.props.shiroType != 2 && this.loadData(this.state.pageNo);
  342. }
  343. }
  344. export() {
  345. this.setState({
  346. exportExecLoading: true
  347. })
  348. let loading = message.loading('加载中...');
  349. let data = {
  350. userName: this.state.userName || undefined,
  351. followName: this.state.followName || undefined,
  352. userType: isNaN(parseInt(this.state.userType)) ? undefined : this.state.userType,
  353. contactType: isNaN(parseInt(this.state.contactType)) ? undefined : this.state.contactType,
  354. deps: this.state.deps || undefined,
  355. followStartTime: this.state.releaseDate[0] ? this.state.releaseDate[0] : undefined,
  356. followEndTime: this.state.releaseDate[1] ? this.state.releaseDate[1] : undefined,
  357. createStartTime: this.state.releaseDate1[0] ? this.state.releaseDate1[0] : undefined,
  358. createEndTime: this.state.releaseDate1[1] ? this.state.releaseDate1[1] : undefined,
  359. guidanceStartTime: this.state.releaseDate2[0] ? this.state.releaseDate2[0] : undefined,
  360. guidanceEndTime: this.state.releaseDate2[1] ? this.state.releaseDate2[1] : undefined,
  361. shiroType: this.state.shiroType
  362. };
  363. for (let i in data) {
  364. if (typeof data[i] === "undefined") {
  365. delete data[i]
  366. }
  367. }
  368. $.ajax({
  369. method: "get",
  370. dataType: "json",
  371. crossDomain: false,
  372. url: globalConfig.context + "/api/admin/userFollowListExport",
  373. data,
  374. success: function (data) {
  375. if (data.error.length === 0) {
  376. this.download(data.data);
  377. } else {
  378. message.warning(data.error[0].message);
  379. }
  380. }.bind(this),
  381. }).always(function () {
  382. loading();
  383. this.setState({
  384. exportExecLoading: false
  385. })
  386. }.bind(this));
  387. }
  388. download(fileName) {
  389. window.location.href = globalConfig.context + "/open/download?fileName=" + fileName
  390. }
  391. reset() {
  392. this.setState({
  393. userName: undefined,
  394. followName: undefined,
  395. userType: undefined,
  396. contactType: undefined,
  397. deps: undefined,
  398. releaseDate: [],
  399. releaseDate1: [],
  400. releaseDate2: [],
  401. dataSource: [],
  402. }, () => {
  403. this.Cascaders.empty();
  404. this.props.shiroType != 2 && this.loadData();
  405. })
  406. }
  407. render() {
  408. return (
  409. <div className="user-content">
  410. <ShowModalDiv ShowModal={this.state.showModal} />
  411. <div className="content-title" style={{ marginBottom: 10 }}>
  412. <span style={{ fontWeight: 900, fontSize: 16 }}>客户跟进汇总</span>
  413. </div>
  414. <Tabs defaultActiveKey="1" className="test">
  415. <TabPane tab="搜索" key="1">
  416. <div className="user-search">
  417. <Form layout="inline">
  418. <Form.Item style={{ marginTop: '10px' }}>
  419. <Input
  420. placeholder="客户名称"
  421. value={this.state.userName}
  422. style={{ width: 150, }}
  423. onChange={(e) => {
  424. this.setState({ userName: e.target.value });
  425. }}
  426. />
  427. </Form.Item>
  428. <Form.Item style={{ marginTop: '10px' }}>
  429. <Input
  430. placeholder="跟进人名称"
  431. value={this.state.followName}
  432. style={{ width: 150 }}
  433. onChange={(e) => {
  434. this.setState({ followName: e.target.value });
  435. }}
  436. />
  437. </Form.Item>
  438. <Form.Item>
  439. <Select
  440. placeholder="选择客户类型"
  441. style={{ width: 100, }}
  442. value={this.state.userType}
  443. onChange={
  444. (e) => {
  445. this.setState({ userType: e })
  446. }}
  447. >
  448. {/*0所有 1私有客户2 公共客户 3签单客户4外联客户*/}
  449. <Select.Option value={0}>所有</Select.Option>
  450. <Select.Option value={1}>私有客户</Select.Option>
  451. <Select.Option value={2}>公共客户</Select.Option>
  452. <Select.Option value={3}>签单客户</Select.Option>
  453. <Select.Option value={4}>外联客户</Select.Option>
  454. </Select>
  455. </Form.Item>
  456. <Form.Item>
  457. <Select
  458. placeholder="选择跟进方式"
  459. style={{ width: 100, }}
  460. value={this.state.contactType}
  461. onChange={(e) => { this.setState({ contactType: e }) }}
  462. >
  463. <Select.Option value={0}>外出</Select.Option>
  464. <Select.Option value={1}>电话</Select.Option>
  465. <Select.Option value={2}>QQ</Select.Option>
  466. <Select.Option value={3}>微信</Select.Option>
  467. <Select.Option value={4}>邮箱</Select.Option>
  468. <Select.Option value={5}>公出打卡</Select.Option>
  469. </Select>
  470. </Form.Item>
  471. <Form.Item style={{ marginTop: '8px' }}>
  472. <Cascaders
  473. ref={ref => this.Cascaders = ref}
  474. placeholder="选择跟进部门"
  475. id="id"
  476. name="name"
  477. children="list"
  478. height={32}
  479. onSel={(e) => {
  480. this.setState({
  481. deps: JSON.stringify(e)
  482. })
  483. }}
  484. />
  485. {/* <Select
  486. placeholder="选择跟进部门"
  487. style={{ width: '200px', marginRight: '10px' }}
  488. value={this.state.depId}
  489. onChange={
  490. (e) => {
  491. this.setState({ depId: e })
  492. }}
  493. notFoundContent="未获取到上级组织列表"
  494. >
  495. {this.state.contactsOption}
  496. </Select> */}
  497. </Form.Item>
  498. <Form.Item label='跟进时间:' style={{ marginTop: '10px' }}>
  499. <RangePicker
  500. style={{}}
  501. value={[
  502. this.state.releaseDate[0]
  503. ? moment(this.state.releaseDate[0])
  504. : null,
  505. this.state.releaseDate[1]
  506. ? moment(this.state.releaseDate[1])
  507. : null,
  508. ]}
  509. onChange={(data, dataString) => {
  510. this.setState({ releaseDate: dataString });
  511. }}
  512. />
  513. </Form.Item>
  514. <Form.Item label='客户初始时间:' style={{ marginTop: '10px' }}>
  515. <RangePicker
  516. style={{}}
  517. value={[
  518. this.state.releaseDate1[0]
  519. ? moment(this.state.releaseDate1[0])
  520. : null,
  521. this.state.releaseDate1[1]
  522. ? moment(this.state.releaseDate1[1])
  523. : null,
  524. ]}
  525. onChange={(data, dataString) => {
  526. this.setState({ releaseDate1: dataString });
  527. }}
  528. />
  529. </Form.Item>
  530. <Form.Item label='指导时间:' style={{ marginTop: '10px' }}>
  531. <RangePicker
  532. style={{}}
  533. value={[
  534. this.state.releaseDate2[0]
  535. ? moment(this.state.releaseDate2[0])
  536. : null,
  537. this.state.releaseDate2[1]
  538. ? moment(this.state.releaseDate2[1])
  539. : null,
  540. ]}
  541. onChange={(data, dataString) => {
  542. this.setState({ releaseDate2: dataString });
  543. }}
  544. />
  545. </Form.Item>
  546. <Form.Item style={{ marginTop: 10 }}>
  547. <Button
  548. type="primary"
  549. style={{ marginLeft: 10, marginRight: 10 }}
  550. onClick={() => {
  551. this.loadData();
  552. }}
  553. >
  554. 搜索
  555. </Button>
  556. <Button onClick={this.reset}>重置</Button>
  557. </Form.Item>
  558. </Form>
  559. </div>
  560. </TabPane>
  561. <TabPane tab="更改表格显示数据" key="2">
  562. <div style={{ marginLeft: 10 }}>
  563. <ChooseList
  564. columns={this.state.columns}
  565. changeFn={this.changeList}
  566. changeList={this.state.changeList}
  567. top={55}
  568. margin={11}
  569. />
  570. </div>
  571. </TabPane>
  572. <TabPane tab="导出" key="3">
  573. <Button style={{ float: "left", margin: 10 }} onClick={this.export}>
  574. 导出excel
  575. </Button>
  576. </TabPane>
  577. </Tabs>
  578. <div className="patent-table">
  579. <Spin spinning={this.state.loading}>
  580. <Table
  581. columns={
  582. this.state.changeList.length
  583. ? this.state.changeList
  584. : this.state.columns
  585. }
  586. dataSource={this.state.dataSource}
  587. pagination={this.state.pagination}
  588. onRowClick={this.tableRowClick}
  589. style={{
  590. cursor: 'pointer',
  591. }}
  592. />
  593. </Spin>
  594. </div>
  595. <IntentionDetail
  596. isCustomerAdmin={this.props.isCustomerAdmin}
  597. categoryArr={this.state.categoryArr}
  598. IntentionData={this.state.rowData}
  599. modalVisible={this.state.modalVisible}
  600. isGuidanceLv={this.props.isGuidanceLv}
  601. isEditGuidanceLv={this.props.isEditGuidanceLv}
  602. name={this.state.modalName}
  603. closeDesc={this.closeDesc}
  604. />
  605. </div>
  606. )
  607. }
  608. }
  609. export default FollowUpSummary;