business.jsx 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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 style={{
  34. maxWidth:'150px',
  35. overflow:'hidden',
  36. textOverflow: "ellipsis",
  37. whiteSpace:'nowrap',
  38. }}>{text}</div>
  39. </Tooltip>
  40. )
  41. }
  42. },
  43. {
  44. title: "业务名",
  45. dataIndex: "businessName",
  46. key: "businessName",
  47. },
  48. {
  49. title: "营销员",
  50. dataIndex: "adminName",
  51. key: "adminName",
  52. },
  53. {
  54. title: "业务意向进度",
  55. dataIndex: "followSituation",
  56. key: "followSituation",
  57. render: (text) => {
  58. return getfllowSituation(text);
  59. },
  60. },
  61. {
  62. title: "客户状态",
  63. dataIndex: "customerStatus",
  64. key: "customerStatus",
  65. render: (text) => {
  66. return getcustomerStatue(text);
  67. },
  68. },{
  69. title: "意向时间",
  70. dataIndex: "createTime",
  71. key: "createTime",
  72. },
  73. {
  74. title: "操作",
  75. dataIndex: "ooo",
  76. key: "ooo",
  77. render: (text, record) => {
  78. return (
  79. <Button
  80. onClick={(e) => {
  81. this.businessIntentionDetails(record);
  82. }}
  83. >
  84. 查看
  85. </Button>
  86. );
  87. },
  88. },
  89. ],
  90. };
  91. },
  92. businessIntentionDetails(record){
  93. this.setState({
  94. followData: record,
  95. businessModul:true
  96. })
  97. },
  98. //业务意向
  99. BusinessList(pageNo) {
  100. this.setState({
  101. loading: true
  102. });
  103. $.ajax({
  104. method: "post",
  105. dataType: "json",
  106. crossDomain: false,
  107. url: globalConfig.context + '/api/admin/customer/listBusiness',
  108. data: {
  109. pageNo: pageNo || 1,
  110. pageSize: this.state.paginationt.pageSize,
  111. uid: this.props.data.id
  112. },
  113. success: function(data) {
  114. let theArr = [];
  115. if(data.error.length || data.data.list == "") {
  116. if(data.error && data.error.length) {
  117. message.warning(data.error[0].message);
  118. };
  119. } else {
  120. for(let i = 0; i < data.data.list.length; i++) {
  121. let thisdata = data.data.list[i];
  122. theArr.push({
  123. key: i,
  124. businessId: thisdata.businessId,
  125. businessProjectId:thisdata.businessProjectId,
  126. businessName: thisdata.businessName,
  127. identifyName: thisdata.identifyName,
  128. followSituation: thisdata.followSituation,
  129. customerStatus: thisdata.customerStatus,
  130. adminName: thisdata.adminName,
  131. createTime: thisdata.createTime
  132. });
  133. };
  134. this.state.paginationt.current = data.data.pageNo;
  135. this.state.paginationt.total = data.data.totalCount;
  136. };
  137. if(data.data.list&&!data.data.list.length){
  138. this.state.paginationt.current=0;
  139. this.state.paginationt.total=0;
  140. }
  141. this.setState({
  142. dataBusiness: theArr,
  143. paginationt: this.state.paginationt||[]
  144. });
  145. }.bind(this),
  146. }).always(function() {
  147. this.setState({
  148. loading: false
  149. });
  150. }.bind(this));
  151. },
  152. componentWillMount(){
  153. this.BusinessList();
  154. },
  155. detailsModal(){
  156. this.props.closeDetail(false, false)
  157. },
  158. componentWillReceiveProps(nextProps) {
  159. if(nextProps.data.id&&nextProps.businessState){
  160. this.BusinessList();
  161. }
  162. this.setState({
  163. businessModul:false
  164. })
  165. },
  166. render(){
  167. return(
  168. <div className="clearfix">
  169. <Spin spinning={this.state.loading}>
  170. <Table
  171. pagination={this.state.paginationt}
  172. columns={this.state.businessIntentionList}
  173. dataSource={this.state.dataBusiness}
  174. />
  175. </Spin>
  176. <BusinessDetail
  177. ids={this.props.data.id}
  178. data={this.state.followData}
  179. businessModul={this.state.businessModul}
  180. />
  181. </div>
  182. )
  183. }
  184. })
  185. export default Business;