business.jsx 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. },
  115. success: function (data) {
  116. let theArr = [];
  117. if (data.error.length || data.data.list == "") {
  118. if (data.error && data.error.length) {
  119. message.warning(data.error[0].message);
  120. };
  121. } else {
  122. for (let i = 0; i < data.data.list.length; i++) {
  123. let thisdata = data.data.list[i];
  124. theArr.push({
  125. key: i,
  126. businessId: thisdata.businessId,
  127. businessProjectId: thisdata.businessProjectId,
  128. businessName: thisdata.businessName,
  129. identifyName: thisdata.identifyName,
  130. followSituation: thisdata.followSituation,
  131. customerStatus: thisdata.customerStatus,
  132. adminName: thisdata.adminName,
  133. createTime: thisdata.createTime
  134. });
  135. };
  136. this.state.paginationt.current = data.data.pageNo;
  137. this.state.paginationt.total = data.data.totalCount;
  138. };
  139. if (data.data.list && !data.data.list.length) {
  140. this.state.paginationt.current = 0;
  141. this.state.paginationt.total = 0;
  142. }
  143. this.setState({
  144. dataBusiness: theArr,
  145. paginationt: this.state.paginationt || []
  146. });
  147. }.bind(this),
  148. }).always(function () {
  149. this.setState({
  150. loading: false
  151. });
  152. }.bind(this));
  153. },
  154. componentWillMount() {
  155. this.BusinessList();
  156. },
  157. detailsModal() {
  158. this.props.closeDetail(false, false)
  159. },
  160. componentWillReceiveProps(nextProps) {
  161. if (nextProps.data.id && nextProps.businessState) {
  162. this.BusinessList();
  163. }
  164. this.setState({
  165. businessModul: false
  166. })
  167. },
  168. render() {
  169. return (
  170. <div className="clearfix">
  171. <Spin spinning={this.state.loading}>
  172. <Table
  173. pagination={this.state.paginationt}
  174. columns={this.state.businessIntentionList}
  175. dataSource={this.state.dataBusiness}
  176. />
  177. </Spin>
  178. <BusinessDetail
  179. ids={this.props.data.id}
  180. data={this.state.followData}
  181. businessModul={this.state.businessModul}
  182. />
  183. </div>
  184. )
  185. }
  186. })
  187. export default Business;