customerProfile.jsx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. import React from 'react';
  2. import {
  3. Tooltip,
  4. Button,
  5. AutoComplete,
  6. Input,
  7. Select,
  8. Spin,
  9. Table,
  10. message,
  11. Form,
  12. Tabs,
  13. DatePicker,
  14. } from 'antd';
  15. import $ from 'jquery/src/ajax';
  16. import { ShowModal, } from "@/tools.js";
  17. import { industry } from "@/dataDic.js"
  18. import ShowModalDiv from "@/showModal.jsx";
  19. import { ChooseList } from "../../../order/orderNew/chooseList";
  20. import MainBusinessLog from './mainBusinessLog';
  21. import moment from 'moment';
  22. import './customer.less';
  23. const TabPane = Tabs.TabPane;
  24. const { RangePicker } = DatePicker;
  25. const IntentionCustomer = Form.create()(React.createClass({
  26. getInitialState() {
  27. return {
  28. searchInfor: {},
  29. fjlist: [],
  30. loading: false,
  31. visible: false,
  32. changeList: undefined,
  33. uid: '',
  34. dataSource: [],
  35. pagination: {
  36. defaultCurrent: 1,
  37. defaultPageSize: 10,
  38. showQuickJumper: true,
  39. pageSize: 10,
  40. onChange: function (page) {
  41. this.loadData(page);
  42. }.bind(this),
  43. showTotal: function (total) {
  44. return '共' + total + '条数据';
  45. }
  46. },
  47. columns: [{
  48. title: '客户名称',
  49. dataIndex: 'nickname',
  50. key: 'nickname',
  51. fixed: 'left',
  52. width: 200,
  53. render: text => {
  54. return (
  55. <Tooltip title={text}>
  56. <div>{text}</div>
  57. </Tooltip>
  58. )
  59. }
  60. },
  61. {
  62. title: '地区',
  63. dataIndex: 'area',
  64. key: 'area',
  65. width: 150,
  66. render: (text, record) => {
  67. return (record.province || "") + (!record.city ? "" : "-") + (record.city || "") + (!record.area ? "" : "-") + (record.area || "");
  68. },
  69. },
  70. {
  71. title: '客户类型',
  72. dataIndex: 'shareType',
  73. key: 'shareType',
  74. render: text => {
  75. return (
  76. <div>{["私有客户", "公共客户", "签单客户", "外联客户"][text]}</div>
  77. )
  78. }
  79. },
  80. {
  81. title: '是否签单',
  82. dataIndex: 'signBills',
  83. key: 'signBills',
  84. render: text => {
  85. return (
  86. <div>{["否", "是"][text]}</div>
  87. )
  88. }
  89. },
  90. {
  91. title: '主营产品',
  92. dataIndex: 'businessScope',
  93. key: 'businessScope',
  94. width: 200,
  95. },
  96. {
  97. title: '行业',
  98. dataIndex: 'industry',
  99. key: 'industry',
  100. },
  101. {
  102. title: '联系人',
  103. dataIndex: 'contactName',
  104. key: 'contactName',
  105. },
  106. {
  107. title: '所属人',
  108. dataIndex: 'adminName',
  109. key: 'adminName',
  110. },
  111. {
  112. title: '意向合作项目',
  113. dataIndex: 'intendedProject',
  114. key: 'intendedProject',
  115. width: 220,
  116. },
  117. {
  118. title: '知产情况',
  119. dataIndex: 'patentCount',
  120. key: 'patentCount',
  121. width: 220,
  122. render: (text, record) => {
  123. return (
  124. <div>
  125. 专利&nbsp;{text || 0}&nbsp;
  126. 其中发明专利&nbsp;{record.inventionPatentCount || 0}&nbsp;
  127. 实用新型&nbsp;{record.utilityModelCount || 0}&nbsp;
  128. 外观设计&nbsp;{record.appearancePatentCount || 0}&nbsp;
  129. 软著&nbsp;{record.softwareWorksCount || 0}&nbsp;
  130. 其他类型&nbsp;{record.otherCount || 0}
  131. </div>
  132. )
  133. }
  134. },
  135. {
  136. title: '财务数据',
  137. dataIndex: 'financialData',
  138. key: 'financialData',
  139. width: 200,
  140. },
  141. {
  142. title: '前期沟通',
  143. dataIndex: 'earlyCommunication',
  144. key: 'earlyCommunication',
  145. width: 200,
  146. },
  147. {
  148. title: '面谈思路及目的',
  149. dataIndex: 'interviewIdeas',
  150. key: 'interviewIdeas',
  151. width: 200,
  152. },
  153. {
  154. title: '更新时间',
  155. dataIndex: 'updateTime',
  156. key: 'updateTime',
  157. width: 80,
  158. },
  159. {
  160. title: '所属部门',
  161. dataIndex: 'depName',
  162. key: 'depName',
  163. },
  164. {
  165. title: '操作',
  166. dataIndex: 'id',
  167. key: 'id',
  168. render: text => {
  169. return (
  170. <div>
  171. <Button
  172. onClick={(e) => {
  173. e.stopPropagation();
  174. this.setState({
  175. visible: true,
  176. uid: text
  177. })
  178. }} type="primary" style={{ marginLeft: '10px' }}>主营日志</Button>
  179. </div>
  180. )
  181. }
  182. }
  183. ],
  184. columnsX: [
  185. {
  186. title: '客户名称',
  187. dataIndex: 'nickname',
  188. key: 'nickname',
  189. fixed: 'left',
  190. width: 200,
  191. render: text => {
  192. return (
  193. <Tooltip title={text}>
  194. <div>{text}</div>
  195. </Tooltip>
  196. )
  197. }
  198. },
  199. {
  200. title: '地区',
  201. dataIndex: 'area',
  202. key: 'area',
  203. width: 150,
  204. render: (text, record) => {
  205. return (record.province || "") + (!record.city ? "" : "-") + (record.city || "") + (!record.area ? "" : "-") + (record.area || "");
  206. },
  207. },
  208. {
  209. title: '客户类型',
  210. dataIndex: 'shareType',
  211. key: 'shareType',
  212. render: text => {
  213. return (
  214. <div>{["私有客户", "公共客户", "签单客户", "外联客户"][text]}</div>
  215. )
  216. }
  217. },
  218. {
  219. title: '渠道类别',
  220. dataIndex: 'channelType',
  221. key: 'channelType',
  222. render: text => {
  223. return (
  224. <div>{["", "其他", "民主党派", "园区", "民间组织", "战略合作单位"][text]}</div>
  225. )
  226. }
  227. },
  228. {
  229. title: '企业数',
  230. dataIndex: 'enterpriseCount',
  231. key: 'enterpriseCount',
  232. },
  233. {
  234. title: '联系人',
  235. dataIndex: 'contactName',
  236. key: 'contactName',
  237. },
  238. {
  239. title: '所属人',
  240. dataIndex: 'adminName',
  241. key: 'adminName',
  242. },
  243. {
  244. title: '面谈项目',
  245. dataIndex: 'intendedProject',
  246. key: 'intendedProject',
  247. width: 200,
  248. },
  249. {
  250. title: '考核指标',
  251. dataIndex: 'channelIndicators',
  252. key: 'channelIndicators',
  253. width: 200,
  254. },
  255. {
  256. title: '面谈思路及目的',
  257. dataIndex: 'interviewIdeas',
  258. key: 'interviewIdeas',
  259. width: 200,
  260. },
  261. {
  262. title: '面谈人及分工',
  263. dataIndex: 'interviewDistribution',
  264. key: 'interviewDistribution',
  265. width: 200,
  266. },
  267. {
  268. title: '所属部门',
  269. dataIndex: 'depName',
  270. key: 'depName',
  271. },
  272. {
  273. title: '操作',
  274. dataIndex: 'id',
  275. key: 'id',
  276. render: text => {
  277. return (
  278. <div>
  279. <Button
  280. onClick={(e) => {
  281. e.stopPropagation();
  282. this.setState({
  283. visible: true,
  284. uid: text
  285. })
  286. }} type="primary" style={{ marginLeft: '10px' }}>主营日志</Button>
  287. </div>
  288. )
  289. }
  290. }
  291. ],
  292. dataSource: [],
  293. };
  294. },
  295. componentWillMount() {
  296. this.loadData();
  297. },
  298. componentWillReceiveProps(nextProps) {
  299. if (nextProps.newChannel !== this.props.newChannel) {
  300. this.setState({
  301. changeList: undefined
  302. })
  303. this.reset();
  304. }
  305. },
  306. loadData(pageNo) {
  307. const { searchInfor, pagination } = this.state;
  308. this.setState({
  309. loading: true,
  310. });
  311. let datas = Object.assign(searchInfor, {
  312. newChannel: this.props.newChannel,
  313. pageNo: pageNo || 1,
  314. pageSize: pagination.pageSize,
  315. });
  316. $.ajax({
  317. method: "get",
  318. dataType: "json",
  319. crossDomain: false,
  320. url: globalConfig.context + "/api/admin/userArchives/selectUserArchives",
  321. data: datas,
  322. success: function (data) {
  323. ShowModal(this);
  324. this.setState({
  325. loading: false,
  326. });
  327. if (data.error && data.error.length === 0) {
  328. if (data.data.list) {
  329. pagination.current = data.data.pageNo;
  330. pagination.total = data.data.totalCount;
  331. if (data.data && data.data.list && !data.data.list.length) {
  332. pagination.current = 0;
  333. pagination.total = 0;
  334. }
  335. this.setState({
  336. dataSource: data.data.list,
  337. pagination: this.state.pagination,
  338. pageNo: data.data.pageNo,
  339. });
  340. } else {
  341. this.setState({
  342. dataSource: data.data,
  343. pagination: false,
  344. });
  345. }
  346. } else {
  347. message.warning(data.error[0].message);
  348. }
  349. }.bind(this),
  350. }).always(
  351. function () {
  352. this.setState({
  353. loading: false,
  354. });
  355. }.bind(this)
  356. );
  357. },
  358. followUp(e) {
  359. const { searchInfor } = this.state;
  360. this.setState({
  361. searchInfor: Object.assign(searchInfor, {
  362. aname: e,
  363. }),
  364. });
  365. $.ajax({
  366. method: "get",
  367. dataType: "json",
  368. crossDomain: false,
  369. url: globalConfig.context + "/api/admin/customer/listAdminByName",
  370. data: {
  371. adminName: e,
  372. },
  373. success: function (data) {
  374. let thedata = data.data;
  375. if (!thedata) {
  376. if (data.error && data.error.length) {
  377. message.warning(data.error[0].message);
  378. }
  379. thedata = {};
  380. }
  381. this.setState({
  382. fjlist: thedata,
  383. });
  384. }.bind(this),
  385. }).always(
  386. function () {
  387. this.setState({
  388. loading: false,
  389. });
  390. }.bind(this)
  391. );
  392. },
  393. selectF(value) {
  394. const { searchInfor, fjlist } = this.state;
  395. const newdataSources = JSON.stringify(fjlist) == "{}" ? [] : fjlist;
  396. this.setState({
  397. searchInfor: Object.assign(searchInfor, {
  398. aid: newdataSources.find((item) => item.name == value).id,
  399. }),
  400. });
  401. },
  402. changeList(arr) {
  403. const newArr = [];
  404. let list = this.props.newChannel == 1
  405. ? this.state.columnsX
  406. : this.state.columns
  407. list.forEach((item) => {
  408. arr.forEach((val) => {
  409. if (val === item.title) {
  410. newArr.push(item);
  411. }
  412. });
  413. });
  414. this.setState({
  415. changeList: newArr,
  416. });
  417. },
  418. exportAll() {
  419. message.config({
  420. duration: 20,
  421. });
  422. let loading = message.loading("下载中...");
  423. this.setState({
  424. exportPendingLoading: true,
  425. });
  426. let data = JSON.parse(JSON.stringify(this.state.searchInfor));
  427. $.ajax({
  428. method: "get",
  429. dataType: "json",
  430. crossDomain: false,
  431. url: "/api/admin/userArchives/selectUserArchives/export",
  432. data,
  433. success: function (data) {
  434. if (data.error.length === 0) {
  435. this.download(data.data);
  436. } else {
  437. message.warning(data.error[0].message);
  438. }
  439. }.bind(this),
  440. }).always(
  441. function () {
  442. loading();
  443. this.setState({
  444. exportPendingLoading: false,
  445. });
  446. }.bind(this)
  447. );
  448. },
  449. download(fileName) {
  450. window.location.href =
  451. globalConfig.context + "/open/download?fileName=" + fileName;
  452. },
  453. search() {
  454. this.loadData();
  455. },
  456. reset() {
  457. this.setState({
  458. searchInfor: JSON.parse(JSON.stringify({})),
  459. }, () => {
  460. this.loadData();
  461. })
  462. },
  463. render() {
  464. const { searchInfor } = this.state
  465. const { newChannel } = this.props
  466. const newdataSources =
  467. JSON.stringify(this.state.fjlist) == "{}" ? [] : this.state.fjlist;
  468. const newoptions = newdataSources.map((group) => (
  469. <Select.Option key={group.id} value={group.name}>
  470. {group.name}
  471. </Select.Option>
  472. ));
  473. return (
  474. <div className="user-content">
  475. <ShowModalDiv ShowModal={this.state.showModal} onClose={() => { this.setState({ showModal: false }) }} />
  476. <div className="content-title" style={{ marginBottom: 10 }}>
  477. <span style={{ fontWeight: 900, fontSize: 16 }}>{newChannel == 1 ? "渠道档案汇总" : "客户档案汇总"}</span>
  478. </div>
  479. <div className="user-search">
  480. <Tabs
  481. defaultActiveKey="1"
  482. className="test">
  483. <TabPane tab="搜索" key="1" style={{ paddingTop: '10px' }}>
  484. <Input
  485. placeholder={newChannel == 1 ? "渠道名称" : "客户名称"}
  486. value={searchInfor.name || undefined}
  487. style={{ width: 150, marginRight: 10 }}
  488. onChange={e => {
  489. this.setState({
  490. searchInfor: Object.assign(searchInfor, {
  491. name: e.target.value,
  492. }),
  493. });
  494. }}
  495. />
  496. <AutoComplete
  497. className="certain-category-search"
  498. dropdownClassName="certain-category-search-dropdown"
  499. dropdownMatchSelectWidth={false}
  500. style={{ width: "150px" }}
  501. dataSource={newoptions}
  502. placeholder="所属人"
  503. value={searchInfor.aname || undefined}
  504. onChange={this.followUp.bind(this)}
  505. filterOption={true}
  506. onSelect={this.selectF.bind(this)}
  507. >
  508. <Input />
  509. </AutoComplete>
  510. {newChannel == 1 &&
  511. <Select
  512. mode="multiple"
  513. placeholder={"请选择渠道类别"}
  514. style={{ width: 200 }}
  515. value={searchInfor.channelType ? searchInfor.channelType.split(",") : undefined}
  516. onChange={(e) => {
  517. this.setState({
  518. searchInfor: Object.assign(searchInfor, {
  519. channelType: e.toString(),
  520. }),
  521. });
  522. }}
  523. >
  524. {[
  525. { name: "民主党派", val: 2 },
  526. { name: "园区", val: 3 },
  527. { name: "民间组织", val: 4 },
  528. { name: "战略合作单位", val: 5 },
  529. { name: "其他", val: 1 },].map((it, ins) => (
  530. <Option key={it.val}>{it.name}</Option>
  531. ))}
  532. </Select>}
  533. {newChannel == 0 && <Input
  534. placeholder="产品关键字"
  535. value={searchInfor.businessScope || undefined}
  536. style={{ width: 150, marginRight: 10 }}
  537. onChange={e => {
  538. this.setState({
  539. searchInfor: Object.assign(searchInfor, {
  540. businessScope: e.target.value,
  541. }),
  542. });
  543. }}
  544. />}
  545. {newChannel == 0 &&
  546. <Select
  547. mode="multiple"
  548. placeholder={"请选择行业"}
  549. style={{ width: 150 }}
  550. value={searchInfor.industry ? searchInfor.industry.split(",") : undefined}
  551. onChange={(e) => {
  552. this.setState({
  553. searchInfor: Object.assign(searchInfor, {
  554. industry: e.toString(),
  555. }),
  556. });
  557. }}
  558. >
  559. {industry.map((it, ins) => (
  560. <Option key={it.value}>{it.key}</Option>
  561. ))}
  562. </Select>}
  563. <Select
  564. placeholder={"请选择客户类型"}
  565. style={{ width: 150 }}
  566. value={searchInfor.shareType}
  567. onChange={(e) => {
  568. this.setState({
  569. searchInfor: Object.assign(searchInfor, {
  570. shareType: e,
  571. }),
  572. });
  573. }}
  574. >
  575. <Option value="">全部客户</Option>
  576. <Option value="0">私有客户</Option>
  577. <Option value="1">公共客户</Option>
  578. <Option value="2">签单客户</Option>
  579. <Option value="3">外联客户</Option>
  580. <Option value="4">私有&签单</Option>
  581. </Select>
  582. <Select
  583. placeholder={"是否签单"}
  584. style={{ width: 100 }}
  585. value={searchInfor.signBills}
  586. onChange={(e) => {
  587. this.setState({
  588. searchInfor: Object.assign(searchInfor, {
  589. signBills: e,
  590. }),
  591. });
  592. }}
  593. >
  594. <Option value="0">否</Option>
  595. <Option value="1">是</Option>
  596. </Select>
  597. <span>更新时间: </span>
  598. <RangePicker
  599. style={{ width: 300 }}
  600. value={[
  601. searchInfor.startTime ? moment(searchInfor.startTime) : null,
  602. searchInfor.endTime ? moment(searchInfor.endTime) : null,
  603. ]}
  604. onChange={(data, dataString) => {
  605. this.setState({
  606. searchInfor: Object.assign(searchInfor, {
  607. startTime: dataString[0],
  608. endTime: dataString[1],
  609. }),
  610. });
  611. }}
  612. />
  613. <Button type="primary" onClick={this.search} style={{ marginRight: 10 }}>
  614. 搜索
  615. </Button>
  616. <Button onClick={this.reset}>重置</Button>
  617. </TabPane>
  618. <TabPane tab="更改表格显示数据" key="2">
  619. <div style={{ marginLeft: 10 }}>
  620. <ChooseList
  621. columns={newChannel == 1 ? this.state.columnsX : this.state.columns}
  622. changeFn={this.changeList}
  623. changeList={this.state.changeList}
  624. top={55}
  625. margin={11}
  626. />
  627. </div>
  628. </TabPane>
  629. <TabPane tab="导出EXCEL" key="3">
  630. <Button
  631. type="primary"
  632. loading={this.state.exportPendingLoading}
  633. onClick={this.exportAll}
  634. style={{ margin: 10 }}
  635. >
  636. 导出excel
  637. </Button>
  638. </TabPane>
  639. </Tabs>
  640. </div>
  641. <div className="patent-table">
  642. <Spin spinning={this.state.loading}>
  643. <Table
  644. columns={this.state.changeList
  645. ? this.state.changeList
  646. : newChannel == 1
  647. ? this.state.columnsX
  648. : this.state.columns}
  649. dataSource={this.state.dataSource}
  650. pagination={this.state.pagination}
  651. bordered
  652. scroll={{ x: newChannel == 0 ? "140%" : "130%" }}
  653. />
  654. </Spin>
  655. </div>
  656. {this.state.visible &&
  657. <MainBusinessLog
  658. visible={this.state.visible}
  659. uid={this.state.uid}
  660. onCancel={() => {
  661. this.setState({
  662. visible: false,
  663. uid: ''
  664. })
  665. }}
  666. />}
  667. </div>
  668. );
  669. }
  670. }));
  671. export default IntentionCustomer;