|
@@ -1,21 +1,108 @@
|
|
|
|
+import { data } from "jquery";
|
|
import React, { Component } from "react";
|
|
import React, { Component } from "react";
|
|
import style from "./index.less";
|
|
import style from "./index.less";
|
|
|
|
+import $ from "jquery";
|
|
|
|
+import waringw from '@common/images/waringw.png';
|
|
|
|
+import config from '@config/index';
|
|
|
|
|
|
class PatInfo extends Component {
|
|
class PatInfo extends Component {
|
|
constructor(props){
|
|
constructor(props){
|
|
super(props)
|
|
super(props)
|
|
|
|
+ this.state = {
|
|
|
|
+ show:false,
|
|
|
|
+ cover:true,
|
|
|
|
+ name:'',
|
|
|
|
+ sex:'',
|
|
|
|
+ age:'',
|
|
|
|
+ reg:false,
|
|
|
|
+ timer:null
|
|
|
|
+ }
|
|
this.handleName = this.handleName.bind(this)
|
|
this.handleName = this.handleName.bind(this)
|
|
|
|
+ this.handleSex = this.handleSex.bind(this)
|
|
|
|
+ this.handleAge = this.handleAge.bind(this)
|
|
|
|
+ this.checkValue = this.checkValue.bind(this)
|
|
|
|
+ this.watchData = this.watchData.bind(this)
|
|
}
|
|
}
|
|
componentWillMount() {
|
|
componentWillMount() {
|
|
const { getMessage } = this.props;
|
|
const { getMessage } = this.props;
|
|
getMessage && getMessage()
|
|
getMessage && getMessage()
|
|
}
|
|
}
|
|
- handleName(){
|
|
|
|
|
|
+ componentDidMount(){
|
|
|
|
+ $(document).click((event) => {
|
|
|
|
+ let searchWrap = document.getElementById("selectSex"); // 搜索按钮
|
|
|
|
+ if (searchWrap != event.target) { // Mark 1
|
|
|
|
+ this.setState({ show: false });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ handleName(e){
|
|
|
|
+ let value = e.target.value
|
|
|
|
+ const { setParams } = this.props;
|
|
|
|
+ setParams({patientName:value.trim()})
|
|
|
|
+ this.setState({name:value.trim()},()=>{this.watchData()})
|
|
|
|
+ }
|
|
|
|
+ checkValue(value){
|
|
|
|
+ if(value&&!/^\d+$/.test(value)){
|
|
|
|
+ this.setState({reg:true})
|
|
|
|
+ return false
|
|
|
|
+ }else{
|
|
|
|
+ if(value&&value>150||value&&value<1){
|
|
|
|
+ this.setState({reg:true})
|
|
|
|
+ return false
|
|
|
|
+ }else{
|
|
|
|
+ this.setState({reg:false})
|
|
|
|
+ return true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ handleAge(e){
|
|
|
|
+ let value = e.target.value
|
|
|
|
+ this.checkValue(value.trim())
|
|
|
|
+ const { setParams } = this.props;
|
|
|
|
+ setParams({patientAge:value.trim()})
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ this.setState({
|
|
|
|
+ age:value.trim()
|
|
|
|
+ },()=>{
|
|
|
|
+ this.watchData()
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ handleSex(value){
|
|
const { setParams } = this.props;
|
|
const { setParams } = this.props;
|
|
- setParams({name:'萨达实打实'})
|
|
|
|
|
|
+ setParams({sex:value,patientSex:value==1?'男':value==2?'女':''})
|
|
|
|
+ this.setState({
|
|
|
|
+ show:false,sex:value
|
|
|
|
+ },()=>{
|
|
|
|
+ this.watchData()
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ showToggle(){
|
|
|
|
+ const { show } = this.state;
|
|
|
|
+ this.setState({show:!show})
|
|
|
|
+ }
|
|
|
|
+ watchData(){
|
|
|
|
+ const {name,age,sex} = this.state
|
|
|
|
+ const {handlePush} = this.props
|
|
|
|
+ let allow = this.checkValue(age)
|
|
|
|
+ if(name&&sex&&age&&allow){
|
|
|
|
+ let stimer = this.state.timer
|
|
|
|
+ clearTimeout(stimer);
|
|
|
|
+ let timer = setTimeout(function(){
|
|
|
|
+ handlePush&&handlePush();
|
|
|
|
+ clearTimeout(stimer);
|
|
|
|
+ },config.delayPushTime);
|
|
|
|
+ this.setState({
|
|
|
|
+ timer
|
|
|
|
+ });
|
|
|
|
+ this.setState({cover:false})
|
|
|
|
+ }else{
|
|
|
|
+ this.setState({cover:true})
|
|
|
|
+ }
|
|
}
|
|
}
|
|
render(){
|
|
render(){
|
|
const {message} = this.props.patInfo;
|
|
const {message} = this.props.patInfo;
|
|
|
|
+ const {show,cover,reg} = this.state;
|
|
return <table className={style["table"]}>
|
|
return <table className={style["table"]}>
|
|
{/* <tr>
|
|
{/* <tr>
|
|
<td key='1' className={`${style.tdBorderB} ${style.tdBorderR}`} title={'卡号:' + (message.patientIdNo||'')}>卡号:{message.patientIdNo}</td>
|
|
<td key='1' className={`${style.tdBorderB} ${style.tdBorderR}`} title={'卡号:' + (message.patientIdNo||'')}>卡号:{message.patientIdNo}</td>
|
|
@@ -32,24 +119,26 @@ class PatInfo extends Component {
|
|
<tr>
|
|
<tr>
|
|
<td key='1' className={`${style.tdBorderB} ${style.tdBorderR}`}>
|
|
<td key='1' className={`${style.tdBorderB} ${style.tdBorderR}`}>
|
|
<span>姓名:</span>
|
|
<span>姓名:</span>
|
|
- <input type="text" className={style['name']} onChange={this.handleName} value={message.patientName}/>
|
|
|
|
|
|
+ <input type="text" placeholder="请输入" className={style['name']} onChange={(e)=>this.handleName(e)} value={message.patientName}/>
|
|
</td>
|
|
</td>
|
|
<td key='2' className={`${style.tdBorderB} ${style.tdBorderR}`}>
|
|
<td key='2' className={`${style.tdBorderB} ${style.tdBorderR}`}>
|
|
<span>性别:</span>
|
|
<span>性别:</span>
|
|
- <input type="text" className={style['sex']} onChange={this.handleName} value={message.patientSex} readOnly/>
|
|
|
|
- <ul className={style['sexSelect']}>
|
|
|
|
- <li>请选择</li>
|
|
|
|
- <li>男</li>
|
|
|
|
- <li>女</li>
|
|
|
|
|
|
+ <input id="selectSex" type="text" className={style['sex']} value={message.patientSex} placeholder="请选择" onClick={()=>this.showToggle()} readOnly/>
|
|
|
|
+ <ul className={style['sexSelect']} style={{display:show?'block':'none'}}>
|
|
|
|
+ <li onclick={()=>this.handleSex('')}>请选择</li>
|
|
|
|
+ <li onclick={()=>this.handleSex(1)}>男</li>
|
|
|
|
+ <li onclick={()=>this.handleSex(2)}>女</li>
|
|
</ul>
|
|
</ul>
|
|
</td>
|
|
</td>
|
|
</tr>
|
|
</tr>
|
|
<tr>
|
|
<tr>
|
|
<td key='3' colSpan="2" className={`${style.tdBorderB} ${style.tdBorderR}`}>
|
|
<td key='3' colSpan="2" className={`${style.tdBorderB} ${style.tdBorderR}`}>
|
|
<span>年龄:</span>
|
|
<span>年龄:</span>
|
|
- <input type="text" className={style['age']} value={message.patientAge}/>
|
|
|
|
|
|
+ <input type="text" className={style['age']} placeholder="请输入" onChange={(e)=>this.handleAge(e)} value={message.patientAge}/>
|
|
|
|
+ <img style={{display:reg?'inline-block':'none'}} className={style['warimg']} src={waringw} alt=""/><i style={{color:reg?'#FF545B':'#999999'}}>(请输入1-150以内的整数)</i>
|
|
</td>
|
|
</td>
|
|
</tr>
|
|
</tr>
|
|
|
|
+ <div className={style['coverDom']} style={{display:cover?'block':'none'}}></div>
|
|
</table>;
|
|
</table>;
|
|
}
|
|
}
|
|
}
|
|
}
|