index.jsx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import React, { Component } from 'react';
  2. import { Button, ItemBox, ConfirmModal, Loading, Message, Add } from '@commonComp';
  3. import DiagnosticList from '@containers/DiagnosticList.js';
  4. import { getPageCoordinate,setPosition } from '@utils/tools';
  5. import DiagResultSearch from '@containers/DiagResultSearch';
  6. import $ from 'jquery';
  7. class Diagnosis extends Component {
  8. constructor(props) {
  9. super(props);
  10. this.state = {
  11. diagType: 0,
  12. showSearch: props.show,
  13. pageTop: ''
  14. }
  15. this.showSearch = this.showSearch.bind(this);
  16. this.hideSearch = this.hideSearch.bind(this);
  17. this.handleshowSearch = this.handleshowSearch.bind(this);
  18. this.refreshScroller = this.refreshScroller.bind(this);
  19. }
  20. componentWillReceiveProps() {
  21. this.setState({
  22. showSearch: this.props.show
  23. })
  24. }
  25. showSearch() {
  26. const { showSearch } = this.props;
  27. showSearch && showSearch()
  28. }
  29. hideSearch() {
  30. const { hideSearch } = this.props;
  31. hideSearch && hideSearch()
  32. }
  33. handleshowSearch(e) {
  34. this.props.show ? this.hideSearch() : this.showSearch();
  35. this.setState({ pageTop:getPageCoordinate(e).boxTop });
  36. setPosition(e,"#searchOption",this.props.setHighter)
  37. }
  38. refreshScroller(){
  39. //更新滚动条状态,解决容器变大滚动条不更新bug
  40. return this.context.scrollArea;
  41. /*this.context.scrollArea.refresh();
  42. this.context.scrollArea.scrollBottom();*/
  43. }
  44. render() {
  45. return (<div id="diagnosisResult">
  46. <ItemBox id="diagnosis" title='诊断' boxHeight='auto' titleTop='22px' marginTop='9px' backgroundColor='#EAF7FD'>
  47. <DiagnosticList refreshScroller={this.refreshScroller}></DiagnosticList>
  48. <div style={{ marginLeft: '10px', position: 'relative' }}>
  49. <Add showText="添加诊断结果" handleClick={this.handleshowSearch} id="addDiag" height="50px" />
  50. <DiagResultSearch
  51. refreshScroller={this.refreshScroller} setHighter={this.props.setHighter} windowHeight={this.props.windowHeight} pageTop={this.state.pageTop} height={150}></DiagResultSearch>
  52. </div>
  53. </ItemBox>
  54. {/* <TreatDrug></TreatDrug> */}
  55. <Message></Message>
  56. </div>)
  57. }
  58. }
  59. Diagnosis.contextTypes = {
  60. scrollArea: React.PropTypes.object
  61. };
  62. export default Diagnosis;