business.jsx 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. businessProjectId:thisdata.businessProjectId,
  93. businessName: thisdata.businessName,
  94. identifyName: thisdata.identifyName,
  95. followSituation: thisdata.followSituation,
  96. customerStatus: thisdata.customerStatus,
  97. adminName: thisdata.adminName,
  98. createTime: thisdata.createTime
  99. });
  100. };
  101. this.state.paginationt.current = data.data.pageNo;
  102. this.state.paginationt.total = data.data.totalCount;
  103. };
  104. if(data.data&&data.data.list&&!data.data.list.length){
  105. this.state.paginationt.current=0
  106. this.state.paginationt.total=0
  107. }
  108. this.setState({
  109. dataBusiness: theArr,
  110. paginationt: this.state.paginationt||[]
  111. });
  112. }.bind(this),
  113. }).always(function() {
  114. this.setState({
  115. loading: false
  116. });
  117. }.bind(this));
  118. },
  119. componentWillMount(){
  120. this.BusinessList();
  121. },
  122. detailsModal(){
  123. this.props.closeDetail(false, false)
  124. },
  125. componentWillReceiveProps(nextProps) {
  126. if(nextProps.data.id&&nextProps.businessState){
  127. this.BusinessList();
  128. }
  129. this.setState({
  130. businessModul:false
  131. })
  132. },
  133. render(){
  134. return(
  135. <div className="clearfix">
  136. <Spin spinning={this.state.loading}>
  137. <Table
  138. pagination={this.state.paginationt}
  139. columns={this.state.businessIntentionList}
  140. dataSource={this.state.dataBusiness}
  141. />
  142. </Spin>
  143. <BusinessDetail
  144. ids={this.props.data.id}
  145. data={this.state.followData}
  146. businessModul={this.state.businessModul}
  147. />
  148. </div>
  149. )
  150. }
  151. })
  152. export default Business;