customerDetails.jsx 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. }
  102. componentDidMount() {
  103. this.loadData();
  104. }
  105. loadData(pageNo) {
  106. this.setState({
  107. loading:true
  108. })
  109. $.ajax({
  110. method: "get",
  111. dataType: "json",
  112. crossDomain: false,
  113. url: globalConfig.context +"/api/admin/customer/selectAdminCustomerList",
  114. data: {
  115. pageNo:pageNo || 1,
  116. pageSize:this.state.pagination.pageSize,
  117. aid:this.props.aid,
  118. type:this.props.type, //0 所有 1新增 2领取 3已签 4面谈
  119. startTime:this.props.startTime,
  120. endTime:this.props.endTime,
  121. },
  122. success: function(data) {
  123. let theArr = [];
  124. if(data.error.length || data.data.list == "") {
  125. if(data.error && data.error.length) {
  126. message.warning(data.error[0].message);
  127. };
  128. } else {
  129. for (let i = 0; i < data.data.list.length; i++) {
  130. let thisdata = data.data.list[i];
  131. thisdata.key = i;
  132. theArr.push(thisdata);
  133. };
  134. this.state.pagination.current = pageNo;
  135. this.state.pagination.total = data.data.totalCount;
  136. };
  137. if(!data.data.list.length) {
  138. this.state.pagination.current = 0
  139. this.state.pagination.total = 0
  140. }
  141. this.setState({
  142. dataSource: theArr,
  143. pagination: this.state.pagination,
  144. });
  145. }.bind(this),
  146. }).always(function() {
  147. this.setState({
  148. loading: false
  149. });
  150. }.bind(this));
  151. }
  152. render() {
  153. return (
  154. <div>
  155. <Modal
  156. maskClosable={true}
  157. visible={this.props.visible}
  158. onOk={this.props.onCancel}
  159. onCancel={this.props.onCancel}
  160. width='1300px'
  161. title={
  162. <span>
  163. <span style={{marginRight:'15px'}}>客户详情</span>
  164. <Tag color="#f50">{this.props.aName}</Tag>
  165. <Tag color="#108ee9">
  166. {
  167. this.props.type === 0?
  168. '私有客户':
  169. this.props.type === 1?
  170. '渠道客户':
  171. this.props.type === 2?
  172. '签单客户':
  173. this.props.type === 3?
  174. '私有新增客户':
  175. this.props.type === 4?
  176. '渠道新增客户':
  177. this.props.type === 5?
  178. '私有面谈客户':
  179. this.props.type === 6?
  180. '渠道面谈客户':
  181. this.props.type === 7?
  182. '私有领取客户': ''
  183. }
  184. </Tag>
  185. </span>
  186. }
  187. footer=''
  188. className="admin-desc-content">
  189. <div className="patent-table">
  190. <Spin spinning={this.state.loading}>
  191. <Table
  192. columns={this.state.columns}
  193. dataSource={this.state.dataSource}
  194. pagination={this.state.pagination}
  195. />
  196. </Spin>
  197. </div>
  198. </Modal>
  199. </div>
  200. );
  201. }
  202. }
  203. CustomerDetails.propTypes={
  204. visible: PropTypes.bool,
  205. onCancel: PropTypes.func,
  206. aid: PropTypes.number, //员工ID
  207. type: PropTypes.number, //列表类型 客户总数 成交客户总数 新增客户数等等
  208. startTime:PropTypes.string, //开始时间
  209. endTime:PropTypes.string, //结束时间
  210. }
  211. CustomerDetails.defaultProps={
  212. visible: false,
  213. onCancel: ()=>{}
  214. }
  215. export default CustomerDetails;