business.jsx 4.4 KB

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