index.jsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import React from "react";
  2. import style from "../index.less";
  3. import {getCalendarDate,getCurrentDate} from "@utils/tools";
  4. import TimeInterval from '../../TimeInterval';
  5. class Item extends React.Component {
  6. constructor(props) {
  7. super(props);
  8. this.state={
  9. startTime:getCurrentDate(false)+' 00:00:00',
  10. endTime:getCurrentDate(false)+' 23:59:59',
  11. code:'',
  12. name:'',
  13. sex:'',
  14. age:''
  15. }
  16. this.getStartTime = this.getStartTime.bind(this)
  17. this.getEndTime = this.getEndTime.bind(this)
  18. this.handleInput = this.handleInput.bind(this)
  19. }
  20. getStartTime(date){
  21. this.setState({startTime:date})
  22. }
  23. getEndTime(date){
  24. this.setState({endTime:date})
  25. }
  26. handleInput(e,val){
  27. switch(val){
  28. case 1:
  29. this.setState({
  30. code:e.target.value
  31. })
  32. break;
  33. case 2:
  34. this.setState({
  35. name:e.target.value
  36. })
  37. break;
  38. case 3:
  39. this.setState({
  40. sex:e.target.value
  41. })
  42. break;
  43. case 4:
  44. this.setState({
  45. age:e.target.value
  46. })
  47. break;
  48. }
  49. }
  50. render() {
  51. const {handleSearch,message} = this.props
  52. return <div className={style['items']}>
  53. <ul>
  54. <li className={`${style.code} ${style.pubLi} ${style.partLish}`}>
  55. <span>门诊号 : </span>
  56. <input type="text" value={this.state.code || message.recordId} readOnly
  57. onInput={(e) => {
  58. this.handleInput(e,1)
  59. }}
  60. onPropertyChange={(e) => {
  61. this.handleInput(e,1)
  62. }} />
  63. </li>
  64. <li className={`${style.name} ${style.pubLi} ${style.partLish}`}>
  65. <span>姓名 : </span>
  66. <input type="text" value={this.state.name || message.patientName} readOnly
  67. onInput={(e) => {
  68. this.handleInput(e,2)
  69. }}
  70. onPropertyChange={(e) => {
  71. this.handleInput(e,2)
  72. }} />
  73. </li>
  74. <li className={`${style.sex} ${style.pubLi} ${style.partLish}`}>
  75. <span>性别 : </span>
  76. <input type="text" value={this.state.sex || message.patientSex} readOnly
  77. onInput={(e) => {
  78. this.handleInput(e,3)
  79. }}
  80. onPropertyChange={(e) => {
  81. this.handleInput(e,3)
  82. }} />
  83. </li>
  84. <li className={`${style.age} ${style.pubLi} ${style.partLish}`}>
  85. <span>年龄 : </span>
  86. <input type="text" value={this.state.age||message.patientAge} readOnly
  87. onInput={(e) => {
  88. this.handleInput(e,4)
  89. }}
  90. onPropertyChange={(e) => {
  91. this.handleInput(e,4)
  92. }} />
  93. </li>
  94. <li className={`${style.time} ${style.pubLi} ${style.partLish}`}>
  95. <span>送检时间 : </span>
  96. <TimeInterval getStartTime={this.getStartTime} getEndTime={this.getEndTime}></TimeInterval>
  97. </li>
  98. </ul>
  99. <div className={style.search} onClick={()=>handleSearch(this.state)}>检索</div>
  100. </div>
  101. }
  102. }
  103. export default Item;