business.jsx 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. import React from 'react';
  2. import { Form, Button, Spin, message, Table, Popconfirm, Tooltip } from 'antd';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. import { getfllowSituation, getcustomerStatue } from '@/tools.js';
  6. import BusinessDetail from './businessDetail.jsx';
  7. const Business = React.createClass({
  8. getInitialState() {
  9. return {
  10. loading: false,
  11. dataBusiness: [],
  12. followData: {},
  13. paginationt: {
  14. defaultCurrent: 1,
  15. defaultPageSize: 10,
  16. showQuickJumper: true,
  17. pageSize: 10,
  18. onChange: function (page) {
  19. this.BusinessList(page, false);
  20. }.bind(this),
  21. showTotal: function (total) {
  22. return "共" + total + "条数据";
  23. },
  24. },
  25. businessIntentionList: [
  26. {
  27. title: "客户名称",
  28. dataIndex: "identifyName",
  29. key: "identifyName",
  30. render: (text) => {
  31. return (
  32. <Tooltip title={text}>
  33. <div
  34. // style={{
  35. // maxWidth: '150px',
  36. // overflow: 'hidden',
  37. // textOverflow: "ellipsis",
  38. // whiteSpace: 'nowrap',
  39. // }}
  40. >{text}</div>
  41. </Tooltip>
  42. )
  43. }
  44. },
  45. {
  46. title: "项目名称",
  47. dataIndex: "businessName",
  48. key: "businessName",
  49. },
  50. {
  51. title: "营销员",
  52. dataIndex: "adminName",
  53. key: "adminName",
  54. },
  55. {
  56. title: "业务意向进度",
  57. dataIndex: "followSituation",
  58. key: "followSituation",
  59. render: (text) => {
  60. return getfllowSituation(text);
  61. },
  62. },
  63. {
  64. title: "客户状态",
  65. dataIndex: "customerStatus",
  66. key: "customerStatus",
  67. render: (text) => {
  68. return getcustomerStatue(text);
  69. },
  70. }, {
  71. title: "意向时间",
  72. dataIndex: "createTime",
  73. key: "createTime",
  74. },
  75. {
  76. title: "操作",
  77. dataIndex: "ooo",
  78. key: "ooo",
  79. render: (text, record) => {
  80. return (
  81. <Button
  82. onClick={(e) => {
  83. this.businessIntentionDetails(record);
  84. }}
  85. >
  86. 查看跟进记录
  87. </Button>
  88. );
  89. },
  90. },
  91. ],
  92. };
  93. },
  94. businessIntentionDetails(record) {
  95. this.setState({
  96. followData: record,
  97. businessModul: true
  98. })
  99. },
  100. //业务意向
  101. BusinessList(pageNo) {
  102. this.setState({
  103. loading: true
  104. });
  105. $.ajax({
  106. method: "post",
  107. dataType: "json",
  108. crossDomain: false,
  109. url: globalConfig.context + '/api/admin/customer/listBusiness',
  110. data: {
  111. pageNo: pageNo || 1,
  112. pageSize: this.state.paginationt.pageSize,
  113. uid: this.props.data.id,
  114. type: this.props.type
  115. },
  116. success: function (data) {
  117. let theArr = [];
  118. if (data.error.length || data.data.list == "") {
  119. if (data.error && data.error.length) {
  120. message.warning(data.error[0].message);
  121. };
  122. } else {
  123. for (let i = 0; i < data.data.list.length; i++) {
  124. let thisdata = data.data.list[i];
  125. theArr.push({
  126. key: i,
  127. businessId: thisdata.businessId,
  128. businessProjectId: thisdata.businessProjectId,
  129. businessName: thisdata.businessName,
  130. identifyName: thisdata.identifyName,
  131. followSituation: thisdata.followSituation,
  132. customerStatus: thisdata.customerStatus,
  133. adminName: thisdata.adminName,
  134. createTime: thisdata.createTime
  135. });
  136. };
  137. this.state.paginationt.current = data.data.pageNo;
  138. this.state.paginationt.total = data.data.totalCount;
  139. };
  140. if (data.data.list && !data.data.list.length) {
  141. this.state.paginationt.current = 0;
  142. this.state.paginationt.total = 0;
  143. }
  144. this.setState({
  145. dataBusiness: theArr,
  146. paginationt: this.state.paginationt || []
  147. });
  148. }.bind(this),
  149. }).always(function () {
  150. this.setState({
  151. loading: false
  152. });
  153. }.bind(this));
  154. },
  155. componentWillMount() {
  156. this.BusinessList();
  157. },
  158. detailsModal() {
  159. this.props.closeDetail(false, false)
  160. },
  161. componentWillReceiveProps(nextProps) {
  162. if (nextProps.data.id && nextProps.businessState) {
  163. this.BusinessList();
  164. }
  165. this.setState({
  166. businessModul: false
  167. })
  168. },
  169. render() {
  170. return (
  171. <div className="clearfix">
  172. <Spin spinning={this.state.loading}>
  173. <Table
  174. pagination={this.state.paginationt}
  175. columns={this.state.businessIntentionList}
  176. dataSource={this.state.dataBusiness}
  177. />
  178. </Spin>
  179. <BusinessDetail
  180. ids={this.props.data.id}
  181. data={this.state.followData}
  182. businessModul={this.state.businessModul}
  183. />
  184. </div>
  185. )
  186. }
  187. })
  188. export default Business;