intentionDetail.jsx 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. import React from 'react';
  2. import { Modal, Tabs } from 'antd';
  3. const TabPane = Tabs.TabPane;
  4. import Basic from './detail/basic.jsx';
  5. import ajax from 'jquery/src/ajax/xhr.js';
  6. import $ from 'jquery/src/ajax';
  7. import ContactPerson from './detail/contactPerson.jsx'; //联系人
  8. import Account from './detail/account.jsx'; //账户信息
  9. import Visit from './detail/visit.jsx';
  10. import Business from './detail/business.jsx';
  11. import BasicPerson from './detail/basicPerson.jsx';
  12. const IntentionDetail = React.createClass({
  13. getInitialState() {
  14. return {
  15. modalVisible: false,
  16. switchState: false,
  17. contactData: [],
  18. contactState: true,
  19. IntentionState: false,
  20. businessState: false,
  21. visitState: false,
  22. accountState: false,
  23. basicState: false
  24. }
  25. },
  26. detailsModal() {
  27. this.setState({
  28. basicState: false,
  29. modalVisible: false
  30. })
  31. this.props.closeDesc(false, true)
  32. },
  33. //详情tab切换数据处理
  34. callback(e) {
  35. if (e == '1') {
  36. this.setState({
  37. IntentionState: true,
  38. contactState: false,
  39. accountState: false,
  40. visitState: false,
  41. businessState: false,
  42. basicState: true
  43. })
  44. }
  45. if (e == '2') {
  46. this.setState({
  47. IntentionState: false,
  48. contactState: true,
  49. accountState: false,
  50. visitState: false,
  51. businessState: false,
  52. basicState: false
  53. })
  54. }
  55. // if(e == '3') {
  56. // this.setState({
  57. // IntentionState:false,
  58. // contactState:false,
  59. // accountState:true,
  60. // visitState:false,
  61. // businessState:false,
  62. // basicState:false
  63. // })
  64. // }
  65. if (e == '4') {
  66. this.setState({
  67. IntentionState: false,
  68. contactState: false,
  69. accountState: false,
  70. visitState: true,
  71. businessState: false,
  72. basicState: false
  73. })
  74. }
  75. if (e == '5') {
  76. this.setState({
  77. IntentionState: false,
  78. contactState: false,
  79. accountState: false,
  80. visitState: false,
  81. businessState: true,
  82. basicState: false
  83. })
  84. }
  85. this.setState({
  86. callnub: e,
  87. })
  88. },
  89. //取消函数
  90. closeDetail(e, s) {
  91. this.setState({
  92. basicState: false,
  93. modalVisible: e,
  94. })
  95. if (s) {
  96. this.props.closeDesc(false, true)
  97. }
  98. },
  99. componentWillReceiveProps(nextProps) {
  100. if (nextProps.modalVisible && nextProps.IntentionData.id) {
  101. this.setState({
  102. modalVisible: true,
  103. callnub: this.props.isCustomerAdmin ? '2' : (nextProps.isGuidanceLv ? (nextProps.tabsKey ? nextProps.tabsKey : "4") : (nextProps.tabsKey ? nextProps.tabsKey : (nextProps.detailApi.indexOf('Organization')) > 0 ? "2" : '1')),
  104. })
  105. };
  106. this.setState({
  107. basicState: nextProps.basicState,
  108. contactState: nextProps.contactState,
  109. })
  110. },
  111. render() {
  112. return (
  113. <div>
  114. {this.state.modalVisible ? <Modal
  115. className="customeDetails"
  116. title="意向客户详情"
  117. width='92%'
  118. visible={this.state.modalVisible}
  119. onOk={this.detailsModal}
  120. onCancel={this.detailsModal}
  121. footer=''
  122. >
  123. <Tabs onChange={this.callback} activeKey={this.state.callnub}>
  124. {this.props.isGuidanceLv || this.props.detailApi.indexOf('Organization') > 0 ? "" :
  125. <TabPane tab="基本信息" key="1">
  126. <BasicPerson
  127. detailApi={this.props.detailApi}
  128. closeDetail={this.closeDetail}
  129. data={this.props.IntentionData}
  130. IntentionState={this.state.IntentionState}
  131. basicState={this.state.basicState}
  132. />
  133. </TabPane>}
  134. {!this.props.isGuidanceLv || this.props.isCustomerAdmin ? <TabPane tab="企业&联系人详情" key="2">
  135. <ContactPerson
  136. isCustomerAdmin={this.props.isCustomerAdmin}
  137. closeDetail={this.closeDetail}
  138. name={this.props.name}
  139. data={this.props.IntentionData}
  140. contactState={this.state.contactState}
  141. onCancel={this.detailsModal}
  142. />
  143. </TabPane> : ""}
  144. {/* {!this.props.isGuidanceLv ? <TabPane tab="账户信息" key="3">*/}
  145. {/* <Account*/}
  146. {/* isGuidanceLv={this.props.isGuidanceLv} //用于判断是否为跟进管理页面*/}
  147. {/* closeDetail={this.closeDetail}*/}
  148. {/* data={this.props.IntentionData}*/}
  149. {/* accountState={this.state.accountState}*/}
  150. {/* />*/}
  151. {/*</TabPane>: ""}*/}
  152. <TabPane tab="客户跟进" key="4">
  153. <Visit
  154. isLimit={this.props.isLimit}
  155. isGuidanceLv={this.props.isGuidanceLv}
  156. isEditGuidanceLv={this.props.isEditGuidanceLv}
  157. categoryArr={this.props.categoryArr}
  158. closeDetail={this.closeDetail}
  159. data={this.props.IntentionData}
  160. visitState={this.state.visitState}
  161. />
  162. </TabPane>
  163. <TabPane tab="业务意向" key="5">
  164. <Business
  165. closeDetail={this.closeDetail}
  166. data={this.props.IntentionData}
  167. businessState={this.state.businessState}
  168. />
  169. </TabPane>
  170. </Tabs>
  171. </Modal> : <div />}
  172. </div>
  173. )
  174. }
  175. })
  176. export default IntentionDetail;