intentionDetail.jsx 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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,false)
  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.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. <Modal
  115. className="customeDetails"
  116. title="意向客户详情"
  117. width='1300px'
  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.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. <TabPane tab="联系人信息" key="2">
  135. <ContactPerson
  136. closeDetail={this.closeDetail}
  137. data={this.props.IntentionData}
  138. contactState={this.state.contactState}
  139. />
  140. </TabPane>
  141. <TabPane tab="账户信息" key="3">
  142. <Account
  143. closeDetail={this.closeDetail}
  144. data={this.props.IntentionData}
  145. accountState={this.state.accountState}
  146. />
  147. </TabPane>
  148. <TabPane tab="客户跟进" key="4">
  149. <Visit
  150. categoryArr={this.props.categoryArr}
  151. closeDetail={this.closeDetail}
  152. data={this.props.IntentionData}
  153. visitState={this.state.visitState}
  154. />
  155. </TabPane>
  156. <TabPane tab="业务意向" key="5">
  157. <Business
  158. closeDetail={this.closeDetail}
  159. data={this.props.IntentionData}
  160. businessState={this.state.businessState}
  161. />
  162. </TabPane>
  163. </Tabs>
  164. </Modal>
  165. </div>
  166. )
  167. }
  168. })
  169. export default IntentionDetail;