business.jsx 3.8 KB

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