customerProfile.jsx 16 KB

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