intentionDetail.jsx 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. import Outbound from '../../components/outbound';
  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. })
  32. this.props.closeDesc(false, true)
  33. },
  34. //详情tab切换数据处理
  35. callback(e) {
  36. if (e == '1') {
  37. this.setState({
  38. IntentionState: true,
  39. contactState: false,
  40. accountState: false,
  41. visitState: false,
  42. businessState: false,
  43. basicState: true
  44. })
  45. }
  46. if (e == '2') {
  47. this.setState({
  48. IntentionState: false,
  49. contactState: true,
  50. accountState: false,
  51. visitState: false,
  52. businessState: false,
  53. basicState: false
  54. })
  55. }
  56. // if(e == '3') {
  57. // this.setState({
  58. // IntentionState:false,
  59. // contactState:false,
  60. // accountState:true,
  61. // visitState:false,
  62. // businessState:false,
  63. // basicState:false
  64. // })
  65. // }
  66. if (e == '4') {
  67. this.setState({
  68. IntentionState: false,
  69. contactState: false,
  70. accountState: false,
  71. visitState: true,
  72. businessState: false,
  73. basicState: false
  74. })
  75. }
  76. if (e == '5') {
  77. this.setState({
  78. IntentionState: false,
  79. contactState: false,
  80. accountState: false,
  81. visitState: false,
  82. businessState: true,
  83. basicState: false
  84. })
  85. }
  86. this.setState({
  87. callnub: e,
  88. })
  89. },
  90. //取消函数
  91. closeDetail(e, s) {
  92. this.setState({
  93. basicState: false,
  94. modalVisible: e,
  95. })
  96. if (s) {
  97. this.props.closeDesc(false, true)
  98. }
  99. },
  100. componentWillReceiveProps(nextProps) {
  101. if (nextProps.modalVisible && nextProps.IntentionData.id) {
  102. this.setState({
  103. modalVisible: true,
  104. callnub: this.props.isCustomerAdmin ? '2' : (nextProps.isGuidanceLv ? (nextProps.tabsKey ? nextProps.tabsKey : "4") : (nextProps.tabsKey ? nextProps.tabsKey : (nextProps.detailApi.indexOf('Organization')) > 0 ? "2" : '1')),
  105. })
  106. };
  107. this.setState({
  108. basicState: nextProps.basicState,
  109. contactState: nextProps.contactState,
  110. })
  111. },
  112. render() {
  113. return (
  114. <div>
  115. {this.state.modalVisible ? <Modal
  116. className="customeDetails"
  117. title={<div
  118. style={{
  119. display: "flex",
  120. flexDirection: "row",
  121. justifyContent: "space-between",
  122. }}
  123. >
  124. <span>意向客户详情</span>
  125. <span style={{ marginRight: 100 }}>
  126. <Outbound
  127. type="private"
  128. uid={this.props.IntentionData.id}
  129. />
  130. </span>
  131. </div>}
  132. width='92%'
  133. visible={this.state.modalVisible}
  134. onOk={this.detailsModal}
  135. onCancel={this.detailsModal}
  136. footer=''
  137. >
  138. <Tabs onChange={this.callback} activeKey={this.state.callnub}>
  139. {this.props.isGuidanceLv || this.props.detailApi.indexOf('Organization') > 0 ? "" :
  140. <TabPane tab="基本信息" key="1">
  141. <BasicPerson
  142. detailApi={this.props.detailApi}
  143. closeDetail={this.closeDetail}
  144. data={this.props.IntentionData}
  145. IntentionState={this.state.IntentionState}
  146. basicState={this.state.basicState}
  147. />
  148. </TabPane>}
  149. {!this.props.isGuidanceLv || this.props.isCustomerAdmin ? <TabPane tab="企业&联系人详情" key="2">
  150. <ContactPerson
  151. isCustomerAdmin={this.props.isCustomerAdmin}
  152. closeDetail={this.closeDetail}
  153. name={this.props.name}
  154. data={this.props.IntentionData}
  155. contactState={this.state.contactState}
  156. onCancel={this.detailsModal}
  157. />
  158. </TabPane> : ""}
  159. {/* {!this.props.isGuidanceLv ? <TabPane tab="账户信息" key="3">*/}
  160. {/* <Account*/}
  161. {/* isGuidanceLv={this.props.isGuidanceLv} //用于判断是否为跟进管理页面*/}
  162. {/* closeDetail={this.closeDetail}*/}
  163. {/* data={this.props.IntentionData}*/}
  164. {/* accountState={this.state.accountState}*/}
  165. {/* />*/}
  166. {/*</TabPane>: ""}*/}
  167. <TabPane tab="客户跟进" key="4">
  168. <Visit
  169. isLimit={this.props.isLimit}
  170. isGuidanceLv={this.props.isGuidanceLv}
  171. isEditGuidanceLv={this.props.isEditGuidanceLv}
  172. categoryArr={this.props.categoryArr}
  173. closeDetail={this.closeDetail}
  174. data={this.props.IntentionData}
  175. visitState={this.state.visitState}
  176. />
  177. </TabPane>
  178. <TabPane tab="业务意向" key="5">
  179. <Business
  180. closeDetail={this.closeDetail}
  181. data={this.props.IntentionData}
  182. businessState={this.state.businessState}
  183. />
  184. </TabPane>
  185. </Tabs>
  186. </Modal> : <div />}
  187. </div>
  188. )
  189. }
  190. })
  191. export default IntentionDetail;