|
@@ -1,5 +1,6 @@
|
|
import React, { Component } from "react";
|
|
import React, { Component } from "react";
|
|
import style from "./index.less";
|
|
import style from "./index.less";
|
|
|
|
+import Select from './Select/index'
|
|
import {
|
|
import {
|
|
timesYMDTime
|
|
timesYMDTime
|
|
} from '@utils/tools';
|
|
} from '@utils/tools';
|
|
@@ -69,6 +70,7 @@ class PatInfo extends Component {
|
|
]
|
|
]
|
|
}
|
|
}
|
|
this.handleChange = this.handleChange.bind(this)
|
|
this.handleChange = this.handleChange.bind(this)
|
|
|
|
+ this.handleSexChange = this.handleSexChange.bind(this)
|
|
}
|
|
}
|
|
componentWillMount() {
|
|
componentWillMount() {
|
|
const { getMessage, initPatInfoData } = this.props;
|
|
const { getMessage, initPatInfoData } = this.props;
|
|
@@ -82,7 +84,7 @@ class PatInfo extends Component {
|
|
// console.log(nextProps,'nextProps');
|
|
// console.log(nextProps,'nextProps');
|
|
const { patInfoData } = nextProps.patInfo
|
|
const { patInfoData } = nextProps.patInfo
|
|
this.setState({
|
|
this.setState({
|
|
- // patientInfo:patInfoData
|
|
|
|
|
|
+ patientInfo:patInfoData
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
@@ -113,6 +115,17 @@ class PatInfo extends Component {
|
|
initPatInfoData && initPatInfoData(newInfo)
|
|
initPatInfoData && initPatInfoData(newInfo)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ handleSexChange (item){
|
|
|
|
+ const { initPatInfoData } = this.props;
|
|
|
|
+ let { patientInfo } = this.state;
|
|
|
|
+ let newInfo = Object.assign([], patientInfo);
|
|
|
|
+ newInfo[3] = item
|
|
|
|
+ this.setState({
|
|
|
|
+ patientInfo: newInfo
|
|
|
|
+ })
|
|
|
|
+ initPatInfoData && initPatInfoData(newInfo)
|
|
|
|
+ }
|
|
|
|
+
|
|
render(){
|
|
render(){
|
|
const {message} = this.props.patInfo;
|
|
const {message} = this.props.patInfo;
|
|
return (
|
|
return (
|
|
@@ -122,11 +135,19 @@ class PatInfo extends Component {
|
|
return (
|
|
return (
|
|
<div className={style["infoItem"]} key={item.id}>
|
|
<div className={style["infoItem"]} key={item.id}>
|
|
<label for={item.label}>{item.title}:</label>
|
|
<label for={item.label}>{item.title}:</label>
|
|
- {item.id === 'patientSex' && (
|
|
|
|
|
|
+ {/* {item.id === 'patientSex' && (
|
|
<select id={item.id} value={item.value} onChange={this.handleChange}>
|
|
<select id={item.id} value={item.value} onChange={this.handleChange}>
|
|
<option value='1'>男</option>
|
|
<option value='1'>男</option>
|
|
<option value='2'>女</option>
|
|
<option value='2'>女</option>
|
|
</select>
|
|
</select>
|
|
|
|
+ )} */}
|
|
|
|
+ {item.id === 'patientSex' && (
|
|
|
|
+ <Select
|
|
|
|
+ default={this.state.patientInfo[3]}
|
|
|
|
+ label=""
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ onChange={(item) => this.handleSexChange(item)}
|
|
|
|
+ ></Select>
|
|
)}
|
|
)}
|
|
{item.id === 'patientAge' && (<input id={item.id} type="text" autocomplete="off" maxlength={11} value={item.value} onChange={this.handleChange} />)}
|
|
{item.id === 'patientAge' && (<input id={item.id} type="text" autocomplete="off" maxlength={11} value={item.value} onChange={this.handleChange} />)}
|
|
{/* {item.id === 'patientSex' && (<input id={item.id} type="text" autocomplete="off" value={item.value == 1 ? '男' : '女'} onChange={this.handleChange} />)} */}
|
|
{/* {item.id === 'patientSex' && (<input id={item.id} type="text" autocomplete="off" value={item.value == 1 ? '男' : '女'} onChange={this.handleChange} />)} */}
|