detail.jsx 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import React from 'react';
  2. import { Table,Spin, message,Modal } from 'antd';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. const Detail =React.createClass({
  6. loadData(data,apiUrl) {
  7. console.log(data)
  8. this.setState({
  9. loading: true,
  10. });
  11. $.ajax({
  12. method: "get",
  13. dataType: "json",
  14. crossDomain: false,
  15. //url: globalConfig.context + apiUrl,
  16. url: globalConfig.context + '/api/admin/customer/toAddFollow',
  17. data: {
  18. uid: data.id,
  19. },
  20. success: function(data) {
  21. let listArr = [];
  22. let thedata = data.data;
  23. if(!thedata) {
  24. if(data.error && data.error.length) {
  25. message.warning(data.error[0].message);
  26. };
  27. thedata = {};
  28. };
  29. for(let i = 0; i < data.data.userBusinessList.length; i++) {
  30. let thisdata = data.data.userBusinessList[i];
  31. listArr.push({
  32. id: thisdata.id,
  33. businessName:thisdata.businessName,
  34. businessGlossoryId: String(thisdata.businessGlossoryId),
  35. followSituation: String(thisdata.followSituation),
  36. customerStatus: String(thisdata.customerStatus),
  37. remarks: thisdata.remarks,
  38. });
  39. };
  40. this.setState({
  41. dataSource: listArr,
  42. });
  43. }.bind(this),
  44. }).always(function() {
  45. this.setState({
  46. loading: false
  47. });
  48. }.bind(this));
  49. },
  50. getInitialState(){
  51. return{
  52. loading:false,
  53. dataSource:[],
  54. columns: [{
  55. title: '业务名称',
  56. dataIndex: 'businessName',
  57. key: 'businessName',
  58. }, {
  59. title: '项目名称',
  60. dataIndex: 'locationProvince',
  61. key: 'locationProvince',
  62. },{
  63. title: '签单时间',
  64. dataIndex: 'createTime',
  65. key: 'createTime',
  66. },
  67. {
  68. title: '客户名称',
  69. dataIndex: 'contacts',
  70. key: 'contacts',
  71. },
  72. {
  73. title: '营销员',
  74. dataIndex: 'contactst',
  75. key: 'contactst',
  76. }
  77. ],
  78. }
  79. },
  80. visitCancel(){
  81. this.setState({
  82. visitModul:false
  83. })
  84. this.props.closeDesc(false)
  85. },
  86. componentWillReceiveProps(nextProps) {
  87. if(nextProps.visitModul){
  88. this.setState({
  89. visitModul:true
  90. })
  91. this.loadData(nextProps.data,nextProps.detailApi)
  92. }
  93. },
  94. render(){
  95. return(
  96. <Modal
  97. className="customeDetails"
  98. footer=''
  99. title="已签业务"
  100. width='800px'
  101. visible={this.state.visitModul}
  102. onOk={this.visitCancel}
  103. onCancel={this.visitCancel}
  104. >
  105. <Spin spinning={this.state.loading}>
  106. <Table columns={this.state.columns}
  107. dataSource={this.state.dataSource}
  108. pagination={false}
  109. />
  110. </Spin>
  111. </Modal>
  112. )
  113. }
  114. })
  115. export default Detail;