intentionDetail.jsx 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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 LockBusiness from './detail/lockBusiness.jsx';
  12. import BasicPerson from './detail/basicPerson.jsx';//基本信息
  13. const IntentionDetail = React.createClass({
  14. getInitialState() {
  15. return {
  16. modalVisible: false,
  17. switchState: false,
  18. contactData: [],
  19. contactState: true,
  20. IntentionState: false,
  21. businessState: false,
  22. visitState: false,
  23. accountState: false,
  24. basicState: false
  25. }
  26. },
  27. detailsModal() {
  28. this.setState({
  29. basicState: false,
  30. modalVisible: false,
  31. callnub: 1,
  32. });
  33. this.props.closeDesc(false, true);
  34. },
  35. //详情tab切换数据处理
  36. callback(e) {
  37. if (e == '1') {
  38. this.setState({
  39. IntentionState: true,
  40. contactState: false,
  41. accountState: false,
  42. visitState: false,
  43. businessState: false,
  44. basicState: true
  45. })
  46. }
  47. if (e == '2') {
  48. this.setState({
  49. IntentionState: false,
  50. contactState: true,
  51. accountState: false,
  52. visitState: false,
  53. businessState: false,
  54. basicState: false
  55. })
  56. }
  57. // if(e == '3') {
  58. // this.setState({
  59. // IntentionState:false,
  60. // contactState:false,
  61. // accountState:true,
  62. // visitState:false,
  63. // businessState:false,
  64. // basicState:false
  65. // })
  66. // }
  67. if (e == '4') {
  68. this.setState({
  69. IntentionState: false,
  70. contactState: false,
  71. accountState: false,
  72. visitState: true,
  73. businessState: false,
  74. basicState: false
  75. })
  76. }
  77. if (e == '5') {
  78. this.setState({
  79. IntentionState: false,
  80. contactState: false,
  81. accountState: false,
  82. visitState: false,
  83. businessState: true,
  84. basicState: false
  85. })
  86. }
  87. this.setState({
  88. callnub: e,
  89. })
  90. },
  91. //取消函数
  92. closeDetail(e, s) {
  93. this.setState({
  94. basicState: false,
  95. //contactState:true,
  96. modalVisible: e,
  97. })
  98. // if(s){
  99. // this.props.closeDesc(false,true)
  100. // }
  101. },
  102. componentWillReceiveProps(nextProps) {
  103. if (nextProps.modalVisible && nextProps.IntentionData.id) {
  104. this.setState({
  105. modalVisible: true,
  106. callnub: this.props.defaultActiveKey ? String(this.props.defaultActiveKey) : (this.props.detailApi.indexOf('Organization')) > 0 ? "2" : '1',
  107. })
  108. };
  109. this.setState({
  110. basicState: nextProps.basicState,
  111. contactState: nextProps.contactState,
  112. })
  113. },
  114. render() {
  115. return (
  116. <div>
  117. {this.state.modalVisible ? <Modal
  118. className="customeDetails"
  119. title="签单客户详情"
  120. width="1300px"
  121. maskClosable={false}
  122. visible={this.state.modalVisible}
  123. onOk={this.detailsModal}
  124. onCancel={this.detailsModal}
  125. footer=""
  126. >
  127. <Tabs onChange={this.callback} activeKey={this.state.callnub}>
  128. {this.props.detailApi.indexOf("Organization") > 0 ? (
  129. ""
  130. ) : (
  131. <TabPane tab="基本信息" key="1">
  132. <BasicPerson
  133. detailApi={this.props.detailApi}
  134. closeDetail={this.closeDetail}
  135. data={this.props.IntentionData}
  136. IntentionState={this.state.IntentionState}
  137. basicState={this.state.basicState}
  138. />
  139. </TabPane>
  140. )}
  141. <TabPane tab="企业&联系人详情" key="2">
  142. <ContactPerson
  143. closeDetail={this.closeDetail}
  144. name={this.props.name}
  145. data={this.props.IntentionData}
  146. contactState={this.state.contactState}
  147. onCancel={this.detailsModal}
  148. />
  149. </TabPane>
  150. {/*<TabPane tab="账户信息" key="3">*/}
  151. {/* <Account*/}
  152. {/* closeDetail={this.closeDetail}*/}
  153. {/* data={this.props.IntentionData}*/}
  154. {/* accountState={this.state.accountState}*/}
  155. {/* />*/}
  156. {/*</TabPane>*/}
  157. <TabPane tab="客户跟进" key="4">
  158. <Visit
  159. categoryArr={this.props.categoryArr}
  160. loadData={this.props.loadData}
  161. closeDetail={this.closeDetail}
  162. data={this.props.IntentionData}
  163. visitState={this.state.visitState}
  164. />
  165. </TabPane>
  166. <TabPane tab="业务意向" key="5">
  167. <Business
  168. closeDesc={this.props.closeDesc}
  169. closeDetail={this.closeDetail}
  170. data={this.props.IntentionData}
  171. businessState={this.state.businessState}
  172. />
  173. </TabPane>
  174. <TabPane tab="锁定业务" key="6">
  175. {
  176. this.state.callnub === '6' ?
  177. <LockBusiness uid={this.props.IntentionData && this.props.IntentionData.uid} id={this.props.IntentionData && this.props.IntentionData.id} /> :
  178. <div />
  179. }
  180. </TabPane>
  181. {/*
  182. <TabPane tab="业务订单" key="6">
  183. </TabPane>
  184. <TabPane tab="技术需求" key="7">
  185. </TabPane>
  186. <TabPane tab="技术成果" key="8">
  187. </TabPane>
  188. <TabPane tab="技术专家" key="9">
  189. </TabPane>
  190. */}
  191. </Tabs>
  192. </Modal> : <div />}
  193. </div>
  194. );
  195. }
  196. })
  197. export default IntentionDetail;