businessName.jsx 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. import React from 'react'
  2. import ajax from 'jquery/src/ajax/xhr.js';
  3. import $ from 'jquery/src/ajax';
  4. import { Radio, Form, Modal, message, layout, Spin, Button } from 'antd';
  5. const BusName = React.createClass({
  6. loadData(ids) {
  7. console.log(ids)
  8. return ;
  9. this.setState({
  10. loading: true
  11. })
  12. $.ajax({
  13. method: "get",
  14. dataType: "json",
  15. url: globalConfig.context + '/api/admin/customer/toAddFollow',
  16. data: {
  17. uid: e,
  18. },
  19. success: function(data) {
  20. let listArr = [];
  21. let thedata = data.data;
  22. if(!thedata) {
  23. if(data.error && data.error.length) {
  24. message.warning(data.error[0].message);
  25. };
  26. thedata = {};
  27. };
  28. for(let i = 0; i < data.data.userBusinessList.length; i++) {
  29. let thisdata = data.data.userBusinessList[i];
  30. listArr.push({
  31. id: thisdata.id,
  32. businessName: thisdata.businessName,
  33. businessGlossoryId: String(thisdata.businessGlossoryId),
  34. followSituation: String(thisdata.followSituation),
  35. customerStatus: String(thisdata.customerStatus),
  36. remarks: thisdata.remarks,
  37. });
  38. };
  39. this.setState({
  40. contacts: thedata.contacts,
  41. uid: thedata.uid,
  42. data: listArr,
  43. identifyName: thedata.identifyName,
  44. followTime: thedata.followTime,
  45. businessGlossoryId: thedata.businessGlossoryId,
  46. followSituation: thedata.followSituation,
  47. customerStatus: thedata.customerStatus,
  48. remarks: thedata.remarks,
  49. });
  50. }.bind(this),
  51. }).always(function() {
  52. this.setState({
  53. loading: false
  54. });
  55. }.bind(this));
  56. },
  57. getInitialState() {
  58. return {
  59. busModul: false
  60. }
  61. },
  62. visitCancel() {
  63. this.setState({
  64. busModul: false
  65. })
  66. this.props.closeBus(null,false,false)
  67. },
  68. selFn() {
  69. this.setState({
  70. busModul: false
  71. });
  72. this.props.closeBus(this.state.contactType, false, true);
  73. },
  74. componentWillReceiveProps(nextProps) {
  75. if(nextProps.busModul) {
  76. this.setState({
  77. busModul: true,
  78. loading: false
  79. })
  80. this.loadData(nextProps.businessId)
  81. };
  82. },
  83. render() {
  84. const formItemLayout = {
  85. labelCol: {
  86. span: 4
  87. },
  88. wrapperCol: {
  89. span: 18
  90. },
  91. };
  92. return(
  93. <Modal
  94. className="customeDetails"
  95. footer=''
  96. title="项目名称"
  97. width='600px'
  98. visible={this.state.busModul}
  99. onOk={this.visitCancel}
  100. onCancel={this.visitCancel}
  101. >
  102. <Form layout="horizontal" id="demand-form" >
  103. <Spin spinning={this.state.loading}>
  104. <div className="clearfix">
  105. <Form.Item
  106. {...formItemLayout}
  107. label="已签单业务" >
  108. <span>好东东.</span>
  109. </Form.Item>
  110. <Form.Item
  111. {...formItemLayout}
  112. label="项目名称" >
  113. <Radio.Group value={this.state.contactType} onChange={(e) => {
  114. this.setState({ contactType: e.target.value })
  115. }}>
  116. <Radio value={'外出'}>外出</Radio>
  117. <Radio value={'电话电话电话电话电话电话'}>电话</Radio>
  118. <Radio value={'QQ'}>QQ</Radio>
  119. <Radio value={'微信'}>微信</Radio>
  120. <Radio value={'邮箱'}>邮箱</Radio>
  121. </Radio.Group>
  122. </Form.Item>
  123. <Form.Item wrapperCol={{ span: 12, offset: 4 }}>
  124. <Button onClick={this.selFn} type='primary'>选定</Button>
  125. <Button onClick={this.visitCancel} style={{marginLeft:'40px'}}>取消</Button>
  126. </Form.Item>
  127. </div>
  128. </Spin>
  129. </Form>
  130. </Modal>
  131. )
  132. }
  133. })
  134. export default BusName;