customerDetails.jsx 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. import React, { Component } from 'react';
  2. import { message, Modal, Spin, Table, Tooltip, Tag } from "antd";
  3. import PropTypes from 'prop-types';
  4. import $ from "jquery/src/ajax";
  5. class CustomerDetails extends Component {
  6. constructor(props) {
  7. super(props);
  8. this.state = {
  9. loading: false,
  10. columns: [{
  11. title: '客户名称',
  12. dataIndex: 'name',
  13. key: 'name'
  14. }, {
  15. title: '来源',
  16. dataIndex: 'sourceName',
  17. key: 'sourceName',
  18. width: 75,
  19. }, {
  20. title: '联系人(部门/职务)',
  21. dataIndex: 'contacts',
  22. key: 'contacts',
  23. width: 155,
  24. render: (text, record) => {
  25. if (!text) { return '' }
  26. let str = text + '(' + (record.contactsDep ? record.contactsDep : ' ') + '/' + (record.contactsPosition ? record.contactsPosition : ' ') + ')';
  27. return (
  28. <Tooltip title={str}>
  29. <div style={{
  30. maxWidth: '155px',
  31. overflow: 'hidden',
  32. textOverflow: "ellipsis",
  33. whiteSpace: 'nowrap',
  34. }}>{str}</div>
  35. </Tooltip>
  36. )
  37. }
  38. }, {
  39. title: '联系人电话',
  40. dataIndex: 'contactMobile',
  41. key: 'contactMobile'
  42. }, {
  43. title: '创建时间',
  44. dataIndex: 'createTime',
  45. key: 'createTime',
  46. width: 145,
  47. }, {
  48. title: '跟进时间',
  49. dataIndex: 'followTime',
  50. key: 'followTime',
  51. width: 145,
  52. }, {
  53. title: '企业主营',
  54. dataIndex: 'businessScope',
  55. key: 'businessScope',
  56. width: 200,
  57. render: (text) => {
  58. return (
  59. <Tooltip title={text}>
  60. <div style={{
  61. maxWidth: '200px',
  62. overflow: 'hidden',
  63. textOverflow: "ellipsis",
  64. whiteSpace: 'nowrap',
  65. }}>{text}</div>
  66. </Tooltip>
  67. )
  68. }
  69. }, {
  70. title: '意向合作',
  71. dataIndex: 'intendedProject',
  72. key: 'intendedProject',
  73. width: 200,
  74. render: (text) => {
  75. return (
  76. <Tooltip title={text}>
  77. <div style={{
  78. maxWidth: '200px',
  79. overflow: 'hidden',
  80. textOverflow: "ellipsis",
  81. whiteSpace: 'nowrap',
  82. }}>{text}</div>
  83. </Tooltip>
  84. )
  85. }
  86. },],
  87. pagination: {
  88. defaultCurrent: 1,
  89. defaultPageSize: 10,
  90. showQuickJumper: true,
  91. pageSize: 10,
  92. onChange: function (page) {
  93. this.loadData(page);
  94. }.bind(this),
  95. showTotal: function (total) {
  96. return '共' + total + '条数据';
  97. }
  98. }
  99. }
  100. this.loadData = this.loadData.bind(this);
  101. this.isView = this.isView.bind(this);
  102. }
  103. componentDidMount() {
  104. this.loadData();
  105. }
  106. loadData(pageNo) {
  107. this.setState({
  108. loading: true
  109. })
  110. $.ajax({
  111. method: "get",
  112. dataType: "json",
  113. crossDomain: false,
  114. url: globalConfig.context + "/api/admin/customer/selectAdminCustomerList",
  115. data: {
  116. pageNo: pageNo || 1,
  117. pageSize: this.state.pagination.pageSize,
  118. aid: this.props.aid,
  119. type: this.props.type, //0 所有 1新增 2领取 3已签 4面谈
  120. startTime: this.props.startTime,
  121. endTime: this.props.endTime,
  122. },
  123. success: function (data) {
  124. let theArr = [];
  125. if (data.error.length || data.data.list == "") {
  126. if (data.error && data.error.length) {
  127. message.warning(data.error[0].message);
  128. };
  129. } else {
  130. for (let i = 0; i < data.data.list.length; i++) {
  131. let thisdata = data.data.list[i];
  132. thisdata.key = i;
  133. theArr.push(thisdata);
  134. };
  135. this.state.pagination.current = pageNo;
  136. this.state.pagination.total = data.data.totalCount;
  137. };
  138. if (!data.data.list.length) {
  139. this.state.pagination.current = 0
  140. this.state.pagination.total = 0
  141. }
  142. this.setState({
  143. dataSource: theArr,
  144. pagination: this.state.pagination,
  145. });
  146. }.bind(this),
  147. }).always(function () {
  148. this.setState({
  149. loading: false
  150. });
  151. }.bind(this));
  152. }
  153. // 判断是否有权限查看详情
  154. isView() {
  155. // 11=运营管理,12=总裁助理,13=总裁
  156. let iskeep =
  157. window.adminData.shiroList.indexOf("11") != -1 ||
  158. window.adminData.shiroList.indexOf("12") != -1 ||
  159. window.adminData.shiroList.indexOf("13") != -1
  160. //
  161. let isName = this.props.aName.indexOf("曹津") != -1
  162. if (iskeep && isName) {
  163. return false
  164. } else {
  165. return true
  166. }
  167. }
  168. render() {
  169. return (
  170. <div>
  171. <Modal
  172. maskClosable={true}
  173. visible={this.props.visible}
  174. onOk={this.props.onCancel}
  175. onCancel={this.props.onCancel}
  176. width='1300px'
  177. title={
  178. <span>
  179. <span style={{ marginRight: '15px' }}>客户详情</span>
  180. <Tag color="#f50">{this.props.aName}</Tag>
  181. <Tag color="#108ee9">
  182. {
  183. this.props.type === 0 ?
  184. '私有客户' :
  185. this.props.type === 1 ?
  186. '外联客户' :
  187. this.props.type === 2 ?
  188. '签单客户' :
  189. this.props.type === 3 ?
  190. '私有新增客户' :
  191. this.props.type === 4 ?
  192. '外联新增客户' :
  193. this.props.type === 5 ?
  194. '私有面谈客户' :
  195. this.props.type === 6 ?
  196. '外联面谈客户' :
  197. this.props.type === 7 ?
  198. '私有领取客户' :
  199. this.props.type === 8 ?
  200. '私有转交客户' : ''
  201. }
  202. </Tag>
  203. </span>
  204. }
  205. footer=''
  206. className="admin-desc-content">
  207. <div className="patent-table">
  208. <Spin spinning={this.state.loading}>
  209. {
  210. this.isView()
  211. ? <Table
  212. columns={this.state.columns}
  213. dataSource={this.state.dataSource}
  214. pagination={this.state.pagination}
  215. />
  216. : <div style={{ padding: "40px 0", textAlign: "center", color: "red", fontSize: "20px" }}>
  217. 暂无权限查看
  218. </div>
  219. }
  220. </Spin>
  221. </div>
  222. </Modal>
  223. </div>
  224. );
  225. }
  226. }
  227. CustomerDetails.propTypes = {
  228. visible: PropTypes.bool,
  229. onCancel: PropTypes.func,
  230. aid: PropTypes.number, //员工ID
  231. type: PropTypes.number, //列表类型 客户总数 成交客户总数 新增客户数等等
  232. startTime: PropTypes.string, //开始时间
  233. endTime: PropTypes.string, //结束时间
  234. }
  235. CustomerDetails.defaultProps = {
  236. visible: false,
  237. onCancel: () => { }
  238. }
  239. export default CustomerDetails;